86 lines
		
	
	
		
			2.3 KiB
		
	
	
	
		
			C#
		
	
	
	
	
	
			
		
		
	
	
			86 lines
		
	
	
		
			2.3 KiB
		
	
	
	
		
			C#
		
	
	
	
	
	
 | 
						|
// ========================================================================
 | 
						|
// 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>
 | 
						|
	///	RolePermissions Generated by MyGeneration using the CSLA Object Mapping template
 | 
						|
	/// </summary>
 | 
						|
	[Serializable()]
 | 
						|
	public partial class RolePermissions : BusinessListBase<RolePermissions,RolePermission>
 | 
						|
	{
 | 
						|
// No Columns to retrieve
 | 
						|
	#region Factory Methods
 | 
						|
 | 
						|
    internal static RolePermissions New()
 | 
						|
    {
 | 
						|
      return new RolePermissions();
 | 
						|
    }
 | 
						|
 | 
						|
    internal static RolePermissions Get(SafeDataReader dr)
 | 
						|
    {
 | 
						|
      return new RolePermissions(dr);
 | 
						|
    }
 | 
						|
 | 
						|
    private RolePermissions()
 | 
						|
    {
 | 
						|
      MarkAsChild();
 | 
						|
    }
 | 
						|
 | 
						|
    private RolePermissions(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(RolePermission.Get(dr));
 | 
						|
      this.RaiseListChangedEvents = true;
 | 
						|
    }
 | 
						|
 | 
						|
    internal void Update(Role role,SqlConnection cn)
 | 
						|
    {
 | 
						|
      this.RaiseListChangedEvents = false;
 | 
						|
      // update (thus deleting) any deleted child objects
 | 
						|
      foreach (RolePermission obj in DeletedList)
 | 
						|
        obj.DeleteSelf(role,cn);
 | 
						|
      // now that they are deleted, remove them from memory too
 | 
						|
      DeletedList.Clear();
 | 
						|
 | 
						|
      // add/update any current child objects
 | 
						|
      foreach (RolePermission obj in this)
 | 
						|
      {
 | 
						|
        if (obj.IsNew)
 | 
						|
          obj.Insert(role,cn);
 | 
						|
        else
 | 
						|
          obj.Update(role,cn);
 | 
						|
      }
 | 
						|
      this.RaiseListChangedEvents = true;
 | 
						|
    }
 | 
						|
 | 
						|
    #endregion
 | 
						|
 | 
						|
	} // Class
 | 
						|
} // Namespace
 |