Files
2018-06-29 19:47:36 +00:00

200 lines
4.0 KiB
C#

///////////////////////////////////////////////////////////
// NotifyPopUpList.cs
// Implementation of Class NotifyPopUpList
// CSLA type: Read only collection
// Created on: 18-Oct-2005
// Object design: John
// Coded: 18-Oct-2005
///////////////////////////////////////////////////////////
using System;
using System.Data;
using GZTW.Data;
using CSLA.Data;
using CSLA;
using System.Threading;
using CSLA.Security;
namespace GZTW.AyaNova.BLL
{
/// <summary>
/// Read only list of NotifyPopUps.
/// Used to display popup notifications
/// in AyaNova user interface
///
/// </summary>
[Serializable]
public class NotifyPopUpList : ReadOnlyCollectionBase
{
#pragma warning disable 1591
#region Data structure
/// <summary>
/// Fields
/// </summary>
[Serializable]
public struct NotifyPopUpListInfo
{
//deliverydate, event, user, method, delivered, error
internal Guid mID;
internal string mMessage;
internal SmartDate mDeliveryDate;
internal GridNameValueCellItem mSource;
public Guid ID
{
get
{
return mID;
}
}
public object LT_NotifyDeliveryLog_Label_DeliveryDate
{
get
{
return mDeliveryDate.DBValue;
}
}
public string LT_Notify_Label_NotificationMessage
{
get
{
return mMessage;
}
}
public GridNameValueCellItem LT_Notify_Label_SourceOfEvent
{
get
{
return mSource;
}
}
}//end NotifyPopUpListInfo
#endregion
#region Constructor
protected NotifyPopUpList()
{
}
#endregion
#region Business properties and methods
/// <summary>
/// Get item by index
/// </summary>
/// <param name="Item"></param>
public NotifyPopUpListInfo this[int Item]
{
get
{
return (NotifyPopUpListInfo) List[Item];
}
}
#endregion
#region Static methods
/// <summary>
/// Get all NotifyPopUp entries
/// for current logged in user
/// </summary>
/// <returns></returns>
public static NotifyPopUpList GetList()
{
return (NotifyPopUpList) DataPortal.Fetch(new Criteria());
}
/// <summary>
/// Return an empty list
/// used for initializing grid
/// </summary>
/// <returns></returns>
public static NotifyPopUpList GetEmptyList()
{
return new NotifyPopUpList();
}
#endregion
#region DAL DATA ACCESS
///
/// <param name="Criteria"></param>
protected override void DataPortal_Fetch(object Criteria)
{
SafeDataReader dr = null;
try
{
dr=DBUtil.GetReaderFromSQLString(
//************************************************************
"SELECT * FROM aNotifyPopUp WHERE aToUserID=@ID ORDER BY aDeliveryDate",User.CurrentThreadUserID
//************************************************************
);
while(dr.Read())
{
//*******************************************
NotifyPopUpListInfo info=new NotifyPopUpListInfo();
info.mID=dr.GetGuid("aID");
info.mSource=new GridNameValueCellItem(dr.GetGuid("aRootObjectID"),((RootObjectTypes)dr.GetInt16("aRootObjectType")).ToString(),(RootObjectTypes)dr.GetInt16("aRootObjectType"));
info.mDeliveryDate=DBUtil.ToLocal(dr.GetSmartDate("aDeliveryDate"));
info.mMessage=dr.GetString("aMessage");
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 AdminMode;
public Criteria( /*bool _AdminMode*/)
{
//AdminMode=_AdminMode;
}
}
#endregion
#pragma warning restore 1591
}//end NotifyPopUpList
}//end namespace GZTW.AyaNova.BLL