253 lines
6.0 KiB
C#
253 lines
6.0 KiB
C#
///////////////////////////////////////////////////////////
|
|
// ScheduleableUserGroupUsers.cs
|
|
// Implementation of Class ScheduleableUserGroupUsers
|
|
// CSLA type: Editable child collection
|
|
// Created on: 07-Jun-2004 8:41:37 AM
|
|
// Object design: Joyce
|
|
// Coded: John 29-July-2004
|
|
///////////////////////////////////////////////////////////
|
|
|
|
using System;
|
|
using System.Data;
|
|
using CSLA.Data;
|
|
using CSLA;
|
|
|
|
namespace GZTW.AyaNova.BLL
|
|
{
|
|
/// <summary>
|
|
/// Editable child collection of <see cref="ScheduleableUserGroupUser"/> objects
|
|
/// </summary>
|
|
[Serializable]
|
|
public class ScheduleableUserGroupUsers : BusinessCollectionBase
|
|
{
|
|
|
|
#region Constructor
|
|
|
|
//Private constructor prevents direction instantiation
|
|
private ScheduleableUserGroupUsers()
|
|
{
|
|
//Child
|
|
MarkAsChild();
|
|
AllowSort=false;
|
|
AllowFind=true;
|
|
AllowEdit=true;
|
|
AllowNew=true;
|
|
AllowRemove=true;
|
|
|
|
}
|
|
|
|
#endregion
|
|
|
|
#region Business properties and methods
|
|
/// <summary>
|
|
/// Retrieve ScheduleableUserGroupUser by index
|
|
/// </summary>
|
|
/// <param name="Item">Index</param>
|
|
public ScheduleableUserGroupUser this[int Item]
|
|
{
|
|
get
|
|
{
|
|
return (ScheduleableUserGroupUser) List[Item];
|
|
|
|
}
|
|
}
|
|
|
|
/// <summary>
|
|
/// Retrieve ScheduleableUserGroupUser by string containing Guid value
|
|
/// </summary>
|
|
public ScheduleableUserGroupUser this[string ScheduleableUserGroupUserID]
|
|
{
|
|
get
|
|
{
|
|
System.Guid sid = new System.Guid(ScheduleableUserGroupUserID);
|
|
foreach (ScheduleableUserGroupUser child in List)
|
|
{
|
|
if(child.ID==sid)
|
|
return child;
|
|
}
|
|
return null;
|
|
}
|
|
}
|
|
|
|
/// <summary>
|
|
/// Remove ScheduleableUserGroupUser by passing it in
|
|
/// </summary>
|
|
/// <param name="obj"></param>
|
|
public void Remove(ScheduleableUserGroupUser obj)
|
|
{
|
|
List.Remove(obj);
|
|
}
|
|
|
|
/// <summary>
|
|
/// Remove ScheduleableUserGroupUser by string of id value
|
|
/// </summary>
|
|
/// <param name="ScheduleableUserGroupUserID"></param>
|
|
public void Remove(string ScheduleableUserGroupUserID)
|
|
{
|
|
System.Guid sid = new System.Guid(ScheduleableUserGroupUserID);
|
|
foreach (ScheduleableUserGroupUser child in List)
|
|
{
|
|
if(child.ID==sid)
|
|
List.Remove(child);
|
|
}
|
|
}
|
|
|
|
/// <summary>
|
|
/// Remove by Guid value of ID
|
|
/// </summary>
|
|
/// <param name="ScheduleableUserGroupUserID"></param>
|
|
public void Remove(Guid ScheduleableUserGroupUserID)
|
|
{//case 1269
|
|
ScheduleableUserGroupUser uDelete = null;
|
|
foreach (ScheduleableUserGroupUser child in List)
|
|
{
|
|
if(child.ID==ScheduleableUserGroupUserID)
|
|
{
|
|
uDelete = child;
|
|
break;
|
|
}
|
|
}
|
|
|
|
if(uDelete!=null)
|
|
List.Remove(uDelete);
|
|
|
|
}
|
|
|
|
/// <summary>
|
|
/// Add a new ScheduleableUserGroupUser to the collection
|
|
/// </summary>
|
|
/// <param name="obj"></param>
|
|
public ScheduleableUserGroupUser Add(ScheduleableUserGroup obj)
|
|
{
|
|
ScheduleableUserGroupUser child=ScheduleableUserGroupUser.NewItem(obj);
|
|
List.Add(child);
|
|
return child;
|
|
}
|
|
|
|
#endregion
|
|
|
|
#region Contains
|
|
|
|
/// <summary>
|
|
/// Check if item in collection
|
|
/// </summary>
|
|
/// <param name="obj"></param>
|
|
public bool Contains(ScheduleableUserGroupUser obj)
|
|
{
|
|
foreach (ScheduleableUserGroupUser 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="ScheduleableUserGroupUserID"></param>
|
|
public bool Contains(string ScheduleableUserGroupUserID)
|
|
{
|
|
System.Guid sid = new System.Guid(ScheduleableUserGroupUserID);
|
|
foreach (ScheduleableUserGroupUser 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(ScheduleableUserGroupUser obj)
|
|
{
|
|
foreach (ScheduleableUserGroupUser 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="ScheduleableUserGroupUserID"></param>
|
|
public bool ContainsDeleted(string ScheduleableUserGroupUserID)
|
|
{
|
|
System.Guid sid = new System.Guid(ScheduleableUserGroupUserID);
|
|
foreach (ScheduleableUserGroupUser child in deletedList)
|
|
{
|
|
if(child.ID==sid) return true;
|
|
}
|
|
return false;
|
|
|
|
}
|
|
#endregion
|
|
|
|
#region Static methods
|
|
/// <summary>
|
|
/// NewItems
|
|
/// </summary>
|
|
/// <returns></returns>
|
|
internal static ScheduleableUserGroupUsers NewItems()
|
|
{
|
|
return new ScheduleableUserGroupUsers();
|
|
}
|
|
|
|
/// <summary>
|
|
/// GetItems
|
|
/// </summary>
|
|
/// <param name="dr"></param>
|
|
/// <returns></returns>
|
|
internal static ScheduleableUserGroupUsers GetItems(SafeDataReader dr)
|
|
{
|
|
ScheduleableUserGroupUsers col = new ScheduleableUserGroupUsers();
|
|
col.Fetch(dr);
|
|
return col;
|
|
}
|
|
#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(ScheduleableUserGroupUser.GetItem(dr));
|
|
}
|
|
}
|
|
|
|
/// <summary>
|
|
/// Update children
|
|
/// </summary>
|
|
/// <param name="obj"></param>
|
|
/// <param name="tr"></param>
|
|
internal void Update(ScheduleableUserGroup obj,IDbTransaction tr)
|
|
{
|
|
//update (thus deleting) any deleted child objects
|
|
foreach (ScheduleableUserGroupUser child in deletedList)
|
|
{
|
|
child.Update(obj,tr);
|
|
}
|
|
|
|
//Now that they are deleted remove them from memory
|
|
deletedList.Clear();
|
|
|
|
foreach (ScheduleableUserGroupUser child in List)
|
|
{
|
|
child.Update(obj,tr);
|
|
|
|
}
|
|
}
|
|
#endregion
|
|
|
|
}//end Tasks
|
|
|
|
}//end namespace GZTW.AyaNova.BLL |