194 lines
4.3 KiB
C#
194 lines
4.3 KiB
C#
///////////////////////////////////////////////////////////
|
|
// ClientNotificationList.cs
|
|
// Implementation of Class ClientNotificationList
|
|
// CSLA type: Read only collection
|
|
// Created on: 11-Dec-2008
|
|
// Object design: John
|
|
// Coded: 11-Dec-2008
|
|
///////////////////////////////////////////////////////////
|
|
|
|
using System;
|
|
using System.Data;
|
|
using GZTW.Data;
|
|
using CSLA.Data;
|
|
using CSLA;
|
|
|
|
namespace GZTW.AyaNova.BLL
|
|
{
|
|
/// <summary>
|
|
/// List of ClientNotifications for processing by GenProcessClientNotifications
|
|
///
|
|
/// </summary>
|
|
[Serializable]
|
|
internal class ClientNotificationList : ReadOnlyCollectionBase
|
|
{
|
|
#region Data structure
|
|
/// <summary>
|
|
///
|
|
/// </summary>
|
|
[Serializable]
|
|
public struct ClientNotificationListInfo
|
|
{
|
|
|
|
internal Guid mID;
|
|
|
|
|
|
/// <summary>
|
|
///
|
|
/// </summary>
|
|
/// <param name="obj"></param>
|
|
public bool Equals(ClientNotificationListInfo obj)
|
|
{
|
|
return this.mID.Equals(obj.mID);
|
|
}
|
|
|
|
}//end ClientNotificationListInfo
|
|
#endregion
|
|
|
|
#region Constructor
|
|
|
|
protected ClientNotificationList()
|
|
{
|
|
// AllowSort=false;
|
|
// AllowFind=true;
|
|
// AllowEdit=false;
|
|
// AllowNew=false;
|
|
// AllowRemove=false;
|
|
}
|
|
|
|
#endregion
|
|
|
|
#region Business properties and methods
|
|
|
|
/// <summary>
|
|
/// Get item by index
|
|
/// </summary>
|
|
/// <param name="Item"></param>
|
|
public ClientNotificationListInfo this[int Item]
|
|
{
|
|
|
|
get
|
|
{
|
|
return (ClientNotificationListInfo) List[Item];
|
|
}
|
|
}
|
|
|
|
|
|
/// <summary>
|
|
/// Returns ClientNotificationListInfo item that matches passed in itemid value
|
|
/// </summary>
|
|
/// <param name="ItemID"></param>
|
|
public ClientNotificationListInfo this[Guid ItemID]
|
|
{
|
|
|
|
get
|
|
{
|
|
foreach (ClientNotificationListInfo child in List)
|
|
{
|
|
if(child.mID==ItemID) return child;
|
|
}
|
|
throw new ArgumentException("ClientNotificationList: ID not found:\r\n"+ItemID.ToString());
|
|
|
|
}
|
|
}
|
|
#endregion
|
|
|
|
#region contains
|
|
/// <summary>
|
|
/// Check if item in collection
|
|
/// </summary>
|
|
/// <param name="obj"></param>
|
|
public bool Contains(ClientNotificationListInfo obj)
|
|
{
|
|
foreach (ClientNotificationListInfo child in List)
|
|
{
|
|
if(child.Equals(obj)) return true;
|
|
}
|
|
return false;
|
|
|
|
}
|
|
#endregion
|
|
|
|
#region Static methods
|
|
/// <summary>
|
|
/// Get all
|
|
/// </summary>
|
|
/// <returns></returns>
|
|
|
|
public static ClientNotificationList GetList()
|
|
{
|
|
return (ClientNotificationList) DataPortal.Fetch(new Criteria());
|
|
}
|
|
|
|
|
|
|
|
|
|
#endregion
|
|
|
|
#region DAL DATA ACCESS
|
|
///
|
|
/// <param name="Criteria"></param>
|
|
protected override void DataPortal_Fetch(object Criteria)
|
|
{
|
|
Criteria crit = (Criteria)Criteria;
|
|
SafeDataReader dr = null;
|
|
try
|
|
{
|
|
//case 1163
|
|
//SmartDate rightnow=new SmartDate(DateTime.Now);
|
|
DateTime dtNowUTC = DateTime.Now.ToUniversalTime();
|
|
|
|
dr=DBUtil.GetReaderFromSQLString(
|
|
//************************************************************
|
|
"SELECT AID, ADELIVERAFTER FROM ACLIENTNOTIFYEVENT ORDER BY ACREATED"
|
|
//************************************************************
|
|
)
|
|
;
|
|
|
|
|
|
while(dr.Read())
|
|
{
|
|
//*******************************************
|
|
ClientNotificationListInfo info=new ClientNotificationListInfo();
|
|
info.mID=dr.GetGuid("aID");
|
|
|
|
//case 1163 - this kind of stuff should go exclusively by utc no local involved at all
|
|
//if(DBUtil.ToLocal(dr.GetSmartDate("ADELIVERAFTER")).Date > rightnow.Date) continue;
|
|
if (dr.GetSmartDate("ADELIVERAFTER").Date > dtNowUTC) continue;
|
|
|
|
InnerList.Add(info);
|
|
//*******************************************
|
|
}
|
|
}
|
|
finally
|
|
{
|
|
if(dr!=null) dr.Close();
|
|
}
|
|
|
|
|
|
}
|
|
#endregion
|
|
|
|
#region criteria
|
|
/// <summary>
|
|
/// Criteria for identifying existing object
|
|
/// </summary>
|
|
[Serializable]
|
|
private class Criteria
|
|
{
|
|
|
|
|
|
// public bool Regional;
|
|
|
|
public Criteria(/*bool _Regional*/ )
|
|
{
|
|
//Regional = _Regional;
|
|
|
|
}
|
|
|
|
}
|
|
#endregion
|
|
|
|
}//end ClientNotificationList
|
|
|
|
}//end namespace GZTW.AyaNova.BLL |