66 lines
1.1 KiB
C#
66 lines
1.1 KiB
C#
using System;
|
|
using System.Data.SqlClient;
|
|
using Csla;
|
|
|
|
[Serializable()]
|
|
public class DynamicRootList :
|
|
EditableRootListBase<EditableRoot>
|
|
{
|
|
|
|
#region Authorization Rules
|
|
|
|
public static bool CanGetObject()
|
|
{
|
|
// TODO: customize to check user role
|
|
return ApplicationContext.User.IsInRole("");
|
|
}
|
|
|
|
public static bool CanEditObject()
|
|
{
|
|
// TODO: customize to check user role
|
|
return ApplicationContext.User.IsInRole("");
|
|
}
|
|
|
|
#endregion
|
|
|
|
#region Factory Methods
|
|
|
|
public static DynamicRootList NewDynamicRootList()
|
|
{
|
|
return new DynamicRootList();
|
|
}
|
|
|
|
public static DynamicRootList GetDynamicRootList()
|
|
{
|
|
return DataPortal.Fetch<DynamicRootList>();
|
|
}
|
|
|
|
private DynamicRootList()
|
|
{
|
|
// require use of factory methods
|
|
}
|
|
|
|
#endregion
|
|
|
|
#region Data Access
|
|
|
|
private void DataPortal_Fetch()
|
|
{
|
|
|
|
// TODO: load values
|
|
RaiseListChangedEvents = false;
|
|
using (SqlDataReader dr = null)
|
|
{
|
|
while (dr.Read())
|
|
{
|
|
Add(EditableRoot.GetEditableRoot(dr));
|
|
}
|
|
}
|
|
RaiseListChangedEvents = true;
|
|
|
|
}
|
|
|
|
#endregion
|
|
|
|
}
|