/////////////////////////////////////////////////////////// // 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 { /// /// Read only list of NotifyPopUps. /// Used to display popup notifications /// in AyaNova user interface /// /// [Serializable] public class NotifyPopUpList : ReadOnlyCollectionBase { #pragma warning disable 1591 #region Data structure /// /// Fields /// [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 /// /// Get item by index /// /// public NotifyPopUpListInfo this[int Item] { get { return (NotifyPopUpListInfo) List[Item]; } } #endregion #region Static methods /// /// Get all NotifyPopUp entries /// for current logged in user /// /// public static NotifyPopUpList GetList() { return (NotifyPopUpList) DataPortal.Fetch(new Criteria()); } /// /// Return an empty list /// used for initializing grid /// /// public static NotifyPopUpList GetEmptyList() { return new NotifyPopUpList(); } #endregion #region DAL DATA ACCESS /// /// 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 /// /// Criteria for identifying existing object /// [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