This commit is contained in:
188
source/bizobjects/AyaLib/GZTW.AyaNova.BLL/UserMemoIdList.cs
Normal file
188
source/bizobjects/AyaLib/GZTW.AyaNova.BLL/UserMemoIdList.cs
Normal file
@@ -0,0 +1,188 @@
|
||||
///////////////////////////////////////////////////////////
|
||||
// UserMemoIdList.cs
|
||||
// Implementation of Class UserMemoIdList
|
||||
// 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 UserMemoIds for internal migration processing
|
||||
///
|
||||
/// </summary>
|
||||
[Serializable]
|
||||
public class UserMemoIdList : ReadOnlyCollectionBase
|
||||
{
|
||||
#region Data structure
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
[Serializable]
|
||||
public struct UserMemoIdListInfo
|
||||
{
|
||||
|
||||
public Guid mID;
|
||||
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <param name="obj"></param>
|
||||
public bool Equals(UserMemoIdListInfo obj)
|
||||
{
|
||||
return this.mID.Equals(obj.mID);
|
||||
}
|
||||
|
||||
}//end UserMemoIdListInfo
|
||||
#endregion
|
||||
|
||||
#region Constructor
|
||||
|
||||
protected UserMemoIdList()
|
||||
{
|
||||
// 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 UserMemoIdListInfo this[int Item]
|
||||
{
|
||||
|
||||
get
|
||||
{
|
||||
return (UserMemoIdListInfo)List[Item];
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Returns UserMemoIdListInfo item that matches passed in itemid value
|
||||
/// </summary>
|
||||
/// <param name="ItemID"></param>
|
||||
public UserMemoIdListInfo this[Guid ItemID]
|
||||
{
|
||||
|
||||
get
|
||||
{
|
||||
foreach (UserMemoIdListInfo child in List)
|
||||
{
|
||||
if (child.mID == ItemID) return child;
|
||||
}
|
||||
throw new ArgumentException("UserMemoIdList: ID not found:\r\n" + ItemID.ToString());
|
||||
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region contains
|
||||
/// <summary>
|
||||
/// Check if item in collection
|
||||
/// </summary>
|
||||
/// <param name="obj"></param>
|
||||
public bool Contains(UserMemoIdListInfo obj)
|
||||
{
|
||||
foreach (UserMemoIdListInfo child in List)
|
||||
{
|
||||
if (child.Equals(obj)) return true;
|
||||
}
|
||||
return false;
|
||||
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region Static methods
|
||||
/// <summary>
|
||||
/// Get all for user
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
|
||||
public static UserMemoIdList GetList(Guid UserId)
|
||||
{
|
||||
return (UserMemoIdList)DataPortal.Fetch(new Criteria(UserId));
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
#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 AMEMO.AID FROM AMEMO WHERE ATOID=@ID",crit.ID
|
||||
//************************************************************
|
||||
)
|
||||
;
|
||||
|
||||
|
||||
while (dr.Read())
|
||||
{
|
||||
//*******************************************
|
||||
UserMemoIdListInfo info = new UserMemoIdListInfo();
|
||||
info.mID = dr.GetGuid("aID");
|
||||
|
||||
InnerList.Add(info);
|
||||
//*******************************************
|
||||
}
|
||||
}
|
||||
finally
|
||||
{
|
||||
if (dr != null) dr.Close();
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region criteria
|
||||
/// <summary>
|
||||
/// Criteria for identifying existing object
|
||||
/// </summary>
|
||||
[Serializable]
|
||||
private class Criteria
|
||||
{
|
||||
|
||||
|
||||
public Guid ID;
|
||||
public Criteria(Guid _ID)
|
||||
{
|
||||
ID = _ID;
|
||||
}
|
||||
|
||||
}
|
||||
#endregion
|
||||
|
||||
}//end UserMemoIdList
|
||||
|
||||
}//end namespace GZTW.AyaNova.BLL
|
||||
Reference in New Issue
Block a user