Commit for development environment setup
This commit is contained in:
145
PROMS/VEPROMS_Security/Volian.Object.Library/GroupAssignments.cs
Normal file
145
PROMS/VEPROMS_Security/Volian.Object.Library/GroupAssignments.cs
Normal file
@@ -0,0 +1,145 @@
|
||||
|
||||
// ========================================================================
|
||||
// Copyright 2006 - Volian Enterprises, Inc. All rights reserved.
|
||||
// Volian Enterprises - Proprietary Information - DO NOT COPY OR DISTRIBUTE
|
||||
// ------------------------------------------------------------------------
|
||||
// $Workfile: $ $Revision: $
|
||||
// $Author: $ $Date: $
|
||||
//
|
||||
// $History: $
|
||||
// ========================================================================
|
||||
|
||||
using System;
|
||||
using System.Data;
|
||||
using System.Data.SqlClient;
|
||||
using Csla;
|
||||
using Csla.Data;
|
||||
|
||||
namespace Volian.Object.Library
|
||||
{
|
||||
/// <summary>
|
||||
/// GroupAssignments Generated by MyGeneration using the CSLA Object Mapping template
|
||||
/// </summary>
|
||||
[Serializable()]
|
||||
public partial class GroupAssignments : BusinessListBase<GroupAssignments,GroupAssignment>
|
||||
{
|
||||
#region Business Methods
|
||||
|
||||
public GroupAssignment this[int folderid, int rid]
|
||||
{
|
||||
get
|
||||
{
|
||||
foreach (GroupAssignment assignment in this)
|
||||
if (assignment.Folderid == folderid && assignment.Rid == rid)
|
||||
return assignment;
|
||||
return null;
|
||||
}
|
||||
}
|
||||
public GroupAssignment GetItem(int folderid, int rid)
|
||||
{
|
||||
foreach (GroupAssignment assignment in this)
|
||||
if (assignment.Folderid == folderid && assignment.Rid == rid)
|
||||
return assignment;
|
||||
return null;
|
||||
}
|
||||
|
||||
public void Add(int rid, int folderid)
|
||||
{
|
||||
if (!Contains(folderid, rid))
|
||||
{
|
||||
GroupAssignment assignment =
|
||||
GroupAssignment.New(rid, folderid);
|
||||
this.Add(assignment);
|
||||
}
|
||||
else
|
||||
throw new InvalidOperationException("assignment already exists");
|
||||
}
|
||||
|
||||
public void Remove(int folderid, int rid)
|
||||
{
|
||||
foreach (GroupAssignment assignment in this)
|
||||
{
|
||||
if (assignment.Folderid == folderid && assignment.Rid == rid)
|
||||
{
|
||||
Remove(assignment);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public bool Contains(int folderid, int rid)
|
||||
{
|
||||
foreach (GroupAssignment assignment in this)
|
||||
if (assignment.Folderid == folderid && assignment.Rid == rid)
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
public bool ContainsDeleted(int folderid, int rid)
|
||||
{
|
||||
foreach (GroupAssignment assignment in DeletedList)
|
||||
if (assignment.Folderid == folderid && assignment.Rid == rid)
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
#endregion
|
||||
#region Factory Methods
|
||||
|
||||
internal static GroupAssignments New()
|
||||
{
|
||||
return new GroupAssignments();
|
||||
}
|
||||
|
||||
internal static GroupAssignments Get(SafeDataReader dr)
|
||||
{
|
||||
return new GroupAssignments(dr);
|
||||
}
|
||||
|
||||
private GroupAssignments()
|
||||
{
|
||||
MarkAsChild();
|
||||
}
|
||||
|
||||
private GroupAssignments(SafeDataReader dr)
|
||||
{
|
||||
MarkAsChild();
|
||||
Fetch(dr);
|
||||
}
|
||||
|
||||
#endregion
|
||||
#region Data Access Portal
|
||||
|
||||
// called to load data from the database
|
||||
private void Fetch(SafeDataReader dr)
|
||||
{
|
||||
this.RaiseListChangedEvents = false;
|
||||
while (dr.Read())
|
||||
this.Add(GroupAssignment.Get(dr));
|
||||
this.RaiseListChangedEvents = true;
|
||||
}
|
||||
|
||||
internal void Update(Group group,SqlConnection cn)
|
||||
{
|
||||
this.RaiseListChangedEvents = false;
|
||||
// update (thus deleting) any deleted child objects
|
||||
foreach (GroupAssignment obj in DeletedList)
|
||||
obj.DeleteSelf(group,cn);
|
||||
// now that they are deleted, remove them from memory too
|
||||
DeletedList.Clear();
|
||||
|
||||
// add/update any current child objects
|
||||
foreach (GroupAssignment obj in this)
|
||||
{
|
||||
if (obj.IsNew)
|
||||
obj.Insert(group,cn);
|
||||
else
|
||||
obj.Update(group,cn);
|
||||
}
|
||||
this.RaiseListChangedEvents = true;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
} // Class
|
||||
} // Namespace
|
Reference in New Issue
Block a user