This commit is contained in:
@@ -0,0 +1,265 @@
|
||||
///////////////////////////////////////////////////////////
|
||||
// RegionWoStatusNotifyItems.cs
|
||||
// Implementation of Class RegionWoStatusNotifyItems
|
||||
// CSLA type: Editable child collection
|
||||
// Created on: 21-Dec-2010
|
||||
// Object design: John
|
||||
// Coded: John 21-Dec-2010
|
||||
///////////////////////////////////////////////////////////
|
||||
|
||||
using System;
|
||||
using CSLA.Data;
|
||||
using CSLA;
|
||||
using System.Data;
|
||||
|
||||
namespace GZTW.AyaNova.BLL
|
||||
{
|
||||
/// <summary>
|
||||
/// Editable child collection of <see cref="RegionWoStatusNotifyItem"/> objects assigned to <see cref="Region"/>
|
||||
/// </summary>
|
||||
[Serializable]
|
||||
public class RegionWoStatusNotifyItems : BusinessCollectionBase {
|
||||
|
||||
#region Constructor
|
||||
|
||||
//Private constructor prevents direction instantiation
|
||||
private RegionWoStatusNotifyItems()
|
||||
{
|
||||
//Child
|
||||
MarkAsChild();
|
||||
AllowSort=false;
|
||||
AllowFind=true;
|
||||
AllowEdit=true;
|
||||
AllowNew=true;
|
||||
AllowRemove=true;
|
||||
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Business properties and methods
|
||||
/// <summary>
|
||||
/// Retrieve RegionWoStatusNotifyItem by index
|
||||
/// </summary>
|
||||
/// <param name="Item">Index</param>
|
||||
public RegionWoStatusNotifyItem this[int Item]
|
||||
{
|
||||
get
|
||||
{
|
||||
return (RegionWoStatusNotifyItem) List[Item];
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Retrieve RegionWoStatusNotifyItem by string containing Guid value
|
||||
/// </summary>
|
||||
public RegionWoStatusNotifyItem this[string sID]
|
||||
{
|
||||
get
|
||||
{
|
||||
System.Guid sid = new System.Guid(sID);
|
||||
foreach (RegionWoStatusNotifyItem child in List)
|
||||
{
|
||||
if(child.ID==sid)
|
||||
return child;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Remove RegionWoStatusNotifyItem by passing it in
|
||||
/// </summary>
|
||||
/// <param name="obj"></param>
|
||||
public void Remove(RegionWoStatusNotifyItem obj)
|
||||
{
|
||||
List.Remove(obj);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Remove RegionWoStatusNotifyItem by string of id value
|
||||
/// </summary>
|
||||
/// <param name="sID"></param>
|
||||
public void Remove(string sID)
|
||||
{
|
||||
System.Guid sid = new System.Guid(sID);
|
||||
foreach (RegionWoStatusNotifyItem child in List)
|
||||
{
|
||||
if(child.ID==sid)
|
||||
List.Remove(child);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Remove by Guid value of ID
|
||||
/// </summary>
|
||||
/// <param name="ID"></param>
|
||||
public void Remove(Guid ID)
|
||||
{
|
||||
foreach (RegionWoStatusNotifyItem child in List)
|
||||
{
|
||||
if(child.ID==ID)
|
||||
List.Remove(child);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Add a new RegionWoStatusNotifyItem to the collection
|
||||
/// </summary>
|
||||
/// <param name="obj"></param>
|
||||
public RegionWoStatusNotifyItem Add(Region obj)
|
||||
{
|
||||
|
||||
RegionWoStatusNotifyItem child=RegionWoStatusNotifyItem.NewItem(obj);
|
||||
List.Add(child);
|
||||
return child;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Contains
|
||||
|
||||
/// <summary>
|
||||
/// Check if item in collection
|
||||
/// </summary>
|
||||
/// <param name="obj"></param>
|
||||
public bool Contains(RegionWoStatusNotifyItem obj)
|
||||
{
|
||||
foreach (RegionWoStatusNotifyItem child in List)
|
||||
{
|
||||
if(child.Equals(obj)) return true;
|
||||
}
|
||||
return false;
|
||||
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Check if item in collection by string of ID value
|
||||
/// </summary>
|
||||
/// <param name="sID"></param>
|
||||
public bool Contains(string sID)
|
||||
{
|
||||
System.Guid sid = new System.Guid(sID);
|
||||
foreach (RegionWoStatusNotifyItem child in List)
|
||||
{
|
||||
if(child.ID==sid) return true;
|
||||
}
|
||||
return false;
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Check if item in deleted collection
|
||||
/// </summary>
|
||||
/// <param name="obj"></param>
|
||||
public bool ContainsDeleted(RegionWoStatusNotifyItem obj)
|
||||
{
|
||||
foreach (RegionWoStatusNotifyItem child in deletedList)
|
||||
{
|
||||
if(child.Equals(obj)) return true;
|
||||
}
|
||||
return false;
|
||||
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Check if item in deleted collection by string of ID value
|
||||
/// </summary>
|
||||
/// <param name="sID"></param>
|
||||
public bool ContainsDeleted(string sID)
|
||||
{
|
||||
System.Guid sid = new System.Guid(sID);
|
||||
foreach (RegionWoStatusNotifyItem child in deletedList)
|
||||
{
|
||||
if(child.ID==sid) return true;
|
||||
}
|
||||
return false;
|
||||
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region Static methods
|
||||
/// <summary>
|
||||
/// NewItems
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
internal static RegionWoStatusNotifyItems NewItems()
|
||||
{
|
||||
return new RegionWoStatusNotifyItems();
|
||||
}
|
||||
|
||||
////case 1186
|
||||
//internal static RegionWoStatusNotifyItems GetItems(SafeDataReader dr)
|
||||
//{
|
||||
// return GetItems(dr, false);
|
||||
//}
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <param name="dr"></param>
|
||||
/// <returns></returns>
|
||||
internal static RegionWoStatusNotifyItems GetItems(SafeDataReader dr)
|
||||
{
|
||||
//if (AyaBizUtils.Right("Object.Region") > (int)SecurityLevelTypes.ReadOnly)
|
||||
//{
|
||||
RegionWoStatusNotifyItems col = new RegionWoStatusNotifyItems();
|
||||
col.Fetch(dr);
|
||||
return col;
|
||||
//}
|
||||
//else
|
||||
// throw new System.Security.SecurityException(
|
||||
// string.Format(
|
||||
// LocalizedTextTable.GetLocalizedTextDirect("Error.Security.NotAuthorizedToRetrieve"),
|
||||
// LocalizedTextTable.GetLocalizedTextDirect("O.Region")));
|
||||
|
||||
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region DAL DATA ACCESS
|
||||
|
||||
/// <summary>
|
||||
/// Fetch children
|
||||
/// </summary>
|
||||
/// <param name="dr">Populated data reader</param>
|
||||
private void Fetch(SafeDataReader dr)
|
||||
{
|
||||
while(dr.Read())
|
||||
{
|
||||
List.Add(RegionWoStatusNotifyItem.GetItem(dr));
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Update children
|
||||
/// </summary>
|
||||
/// <param name="tr"></param>
|
||||
internal void Update(IDbTransaction tr)
|
||||
{
|
||||
//update (thus deleting) any deleted child objects
|
||||
foreach (RegionWoStatusNotifyItem child in deletedList)
|
||||
{
|
||||
child.Update(tr);
|
||||
}
|
||||
|
||||
//Now that they are deleted remove them from memory
|
||||
deletedList.Clear();
|
||||
|
||||
foreach (RegionWoStatusNotifyItem child in List)
|
||||
{
|
||||
child.Update(tr);
|
||||
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
|
||||
|
||||
}//end RegionWoStatusNotifyItems
|
||||
|
||||
}//end namespace GZTW.AyaNova.BLL
|
||||
Reference in New Issue
Block a user