101 lines
2.3 KiB
C#
101 lines
2.3 KiB
C#
///////////////////////////////////////////////////////////
|
|
// Bool.cs
|
|
// Implementation of Class ScheduleableUserCountFetcher
|
|
// CSLA type: Read-only object
|
|
// Created on: 10-Jan-2006
|
|
// Object design: John
|
|
// Coded: John 10-Jan-2006
|
|
///////////////////////////////////////////////////////////
|
|
|
|
using System;
|
|
using System.Data;
|
|
using CSLA.Data;
|
|
using GZTW.Data;
|
|
using CSLA;
|
|
using System.Threading;
|
|
using CSLA.Security;
|
|
using System.ComponentModel;
|
|
|
|
|
|
|
|
namespace GZTW.AyaNova.BLL
|
|
{
|
|
|
|
[Serializable,EditorBrowsable(EditorBrowsableState.Never)]
|
|
internal class ScheduleableUserCountFetcher : ReadOnlyBase
|
|
{
|
|
|
|
#region Attributes
|
|
private long mCount;
|
|
|
|
#endregion
|
|
|
|
#region Constructor
|
|
|
|
/// <summary>
|
|
/// Private constructor to prevent direct instantiation
|
|
/// </summary>
|
|
private ScheduleableUserCountFetcher()
|
|
{
|
|
|
|
}
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
#region Static methods
|
|
|
|
|
|
|
|
public static long GetItem()
|
|
{
|
|
|
|
return ((ScheduleableUserCountFetcher)DataPortal.Fetch(new Criteria( ))).mCount;
|
|
|
|
}
|
|
|
|
|
|
#endregion
|
|
|
|
#region DAL DATA ACCESS
|
|
///
|
|
/// <param Bool="Criteria"></param>
|
|
protected override void DataPortal_Fetch(object Criteria)
|
|
{
|
|
//THIS is actually the very first DB call after login because it's triggered by
|
|
//form1 get user object immediately after login to get the settings for the user which
|
|
//in turn triggers the User constructor to get the default language from the cached Global object in AyaBizUtils but it's not cached yet
|
|
//so it in turn fetchs global object which in turn triggers this code here before it attempts to fetch the global object.
|
|
//So when we see ExecuteScalar error immediately after login it's this bit of code being called
|
|
mCount=System.Convert.ToInt64(DBUtil.GetScalarFromSQLString(
|
|
"SELECT COUNT(*) AS aquant FROM AUSER WHERE " +
|
|
"(AUSER.AACTIVE = 1) AND (AUSER.AUSERTYPE = 2)"
|
|
));
|
|
}
|
|
|
|
|
|
|
|
#endregion
|
|
|
|
#region criteria
|
|
/// <summary>
|
|
/// Criteria for identifying existing object
|
|
/// </summary>
|
|
[Serializable]
|
|
private class Criteria
|
|
{
|
|
|
|
|
|
|
|
public Criteria()
|
|
{
|
|
|
|
}
|
|
|
|
}
|
|
#endregion
|
|
|
|
}//end Bool
|
|
|
|
}//end Boolspace GZTW.AyaNova.BLL |