2006-11-14 14:33:33 +00:00

845 lines
26 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;
using System.Configuration;
using System.IO;
namespace Volian.CSLA.Library
{
/// <summary>
/// Transition Generated by MyGeneration using the CSLA Object Mapping template
/// </summary>
[Serializable()]
public partial class Transition : BusinessBase<Transition>
{
#region Business Methods
private string _errorMessage = string.Empty;
public string ErrorMessage
{
get { return _errorMessage; }
}
private static int _nextTransitionId = -1;
public static int NextTransitionId
{
get { return _nextTransitionId--; }
}
private int _TransitionId;
[System.ComponentModel.DataObjectField(true, true)]
public int TransitionId
{
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
get
{
CanReadProperty(true);
return _TransitionId;
}
}
private int _FromId;
public int FromId
{
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
get
{
CanReadProperty(true);
return _FromId;
}
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
set
{
CanWriteProperty(true);
if (_FromId != value)
{
_FromId = value;
PropertyHasChanged();
}
}
}
private int _ToId;
/// <summary>
/// StructureID
/// </summary>
public int ToId
{
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
get
{
CanReadProperty(true);
return _ToId;
}
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
set
{
CanWriteProperty(true);
if (_ToId != value)
{
_ToId = value;
PropertyHasChanged();
}
}
}
private int _TranType;
public int TranType
{
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
get
{
CanReadProperty(true);
return _TranType;
}
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
set
{
CanWriteProperty(true);
if (_TranType != value)
{
_TranType = value;
PropertyHasChanged();
}
}
}
private int _SectID;
public int SectID
{
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
get
{
CanReadProperty(true);
return _SectID;
}
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
set
{
CanWriteProperty(true);
if (_SectID != value)
{
_SectID = value;
PropertyHasChanged();
}
}
}
private int _ProcID;
public int ProcID
{
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
get
{
CanReadProperty(true);
return _ProcID;
}
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
set
{
CanWriteProperty(true);
if (_ProcID != value)
{
_ProcID = value;
PropertyHasChanged();
}
}
}
private int _SetID;
public int SetID
{
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
get
{
CanReadProperty(true);
return _SetID;
}
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
set
{
CanWriteProperty(true);
if (_SetID != value)
{
_SetID = value;
PropertyHasChanged();
}
}
}
private int _PlantID;
public int PlantID
{
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
get
{
CanReadProperty(true);
return _PlantID;
}
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
set
{
CanWriteProperty(true);
if (_PlantID != value)
{
_PlantID = value;
PropertyHasChanged();
}
}
}
private DateTime _DTS = new DateTime();
public DateTime DTS
{
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
get
{
CanReadProperty(true);
return _DTS;
}
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
set
{
CanWriteProperty(true);
if (_DTS != value)
{
_DTS = value;
PropertyHasChanged();
}
}
}
private string _UserID = string.Empty;
public string UserID
{
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
get
{
CanReadProperty(true);
return _UserID;
}
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
set
{
CanWriteProperty(true);
if (value == null) value = string.Empty;
if (_UserID != value)
{
_UserID = value;
PropertyHasChanged();
}
}
}
private byte[] _LastChanged = new byte[8];//timestamp
// TODO: Replace base Transition.ToString function as necessary
/// <summary>
/// Overrides Base ToString
/// </summary>
/// <returns>A string representation of current Transition</returns>
//public override string ToString()
//{
// return base.ToString();
//}
// TODO: Check Transition.GetIdValue to assure that the ID returned is unique
/// <summary>
/// Overrides Base GetIdValue - Used internally by CSLA to determine equality
/// </summary>
/// <returns>A Unique ID for the current Transition</returns>
protected override object GetIdValue()
{
return _TransitionId;
}
#endregion
#region ValidationRules
protected override void AddBusinessRules()
{
ValidationRules.AddRule(
Csla.Validation.CommonRules.StringRequired, "UserID");
ValidationRules.AddRule(
Csla.Validation.CommonRules.StringMaxLength,
new Csla.Validation.CommonRules.MaxLengthRuleArgs("UserID", 100));
ext.AddValidationRules(ValidationRules);
// TODO: Add other validation rules
// ValidationRules.AddRule(StartDateGTEndDate, "Started");
}
// Sample data comparison validation rule
//private bool StartDateGTEndDate(object target, Csla.Validation.RuleArgs e)
//{
// if (_started > _ended)
// {
// e.Description = "Start date can't be after end date";
// return false;
// }
// else
// return true;
//}
#endregion
#region Authorization Rules
protected override void AddAuthorizationRules()
{
//TODO: Who can read/write which fields
//AuthorizationRules.AllowRead(TransitionId, "<Role(s)>");
//AuthorizationRules.AllowRead(FromId, "<Role(s)>");
//AuthorizationRules.AllowRead(ToId, "<Role(s)>");
//AuthorizationRules.AllowRead(TranType, "<Role(s)>");
//AuthorizationRules.AllowRead(SectID, "<Role(s)>");
//AuthorizationRules.AllowRead(ProcID, "<Role(s)>");
//AuthorizationRules.AllowRead(SetID, "<Role(s)>");
//AuthorizationRules.AllowRead(PlantID, "<Role(s)>");
//AuthorizationRules.AllowRead(DTS, "<Role(s)>");
//AuthorizationRules.AllowRead(UserID, "<Role(s)>");
//AuthorizationRules.AllowWrite(FromId, "<Role(s)>");
//AuthorizationRules.AllowWrite(ToId, "<Role(s)>");
//AuthorizationRules.AllowWrite(TranType, "<Role(s)>");
//AuthorizationRules.AllowWrite(SectID, "<Role(s)>");
//AuthorizationRules.AllowWrite(ProcID, "<Role(s)>");
//AuthorizationRules.AllowWrite(SetID, "<Role(s)>");
//AuthorizationRules.AllowWrite(PlantID, "<Role(s)>");
//AuthorizationRules.AllowWrite(DTS, "<Role(s)>");
//AuthorizationRules.AllowWrite(UserID, "<Role(s)>");
ext.AddAuthorizationRules(AuthorizationRules);
}
public static bool CanAddObject()
{
// TODO: Can Add Authorization
//return Csla.ApplicationContext.User.IsInRole("ProjectManager");
return true;
}
public static bool CanGetObject()
{
// TODO: CanGet Authorization
return true;
}
public static bool CanDeleteObject()
{
// TODO: CanDelete Authorization
//bool result = false;
//if (Csla.ApplicationContext.User.IsInRole("ProjectManager"))result = true;
//if (Csla.ApplicationContext.User.IsInRole("Administrator"))result = true;
//return result;
return true;
}
public static bool CanEditObject()
{
// TODO: CanEdit Authorization
//return Csla.ApplicationContext.User.IsInRole("ProjectManager");
return true;
}
#endregion
#region Factory Methods
public int CurrentEditLevel
{ get { return EditLevel; } }
private Transition()
{/* require use of factory methods */}
public static Transition New()
{
if (!CanAddObject())
throw new System.Security.SecurityException("User not authorized to add a Transition");
return DataPortal.Create<Transition>();
}
public static Transition New(int fromId, int toId, int tranType, int sectID, int procID, int setID, int plantID)
{
Transition tmp = Transition.New();
tmp.FromId = fromId;
tmp.ToId = toId;
tmp.TranType = tranType;
tmp.SectID = sectID;
tmp.ProcID = procID;
tmp.SetID = setID;
tmp.PlantID = plantID;
return tmp;
}
public static Transition MakeTransition(int fromId, int toId, int tranType, int sectID, int procID, int setID, int plantID)
{
Transition tmp = Transition.New(fromId, toId, tranType, sectID, procID, setID, plantID);
tmp.Save();
return tmp;
}
public static Transition MakeTransition(int fromId, int toId, int tranType, int sectID, int procID, int setID, int plantID, DateTime dts, string userID)
{
Transition tmp = Transition.New(fromId, toId, tranType, sectID, procID, setID, plantID);
if (dts >= new DateTime(1753, 1, 1) && dts <= new DateTime(9999, 12, 31)) tmp.DTS = dts;
if (userID != null && userID != string.Empty) tmp.UserID = userID;
tmp.Save();
return tmp;
}
public static Transition Get(int transitionId)
{
if (!CanGetObject())
throw new System.Security.SecurityException("User not authorized to view a Transition");
return DataPortal.Fetch<Transition>(new PKCriteria(transitionId));
}
public static Transition Get(SafeDataReader dr)
{
if (dr.Read()) return new Transition(dr);
return null;
}
private Transition(SafeDataReader dr)
{
_TransitionId = dr.GetInt32("TransitionId");
_FromId = dr.GetInt32("FromId");
_ToId = dr.GetInt32("ToId");
_TranType = dr.GetInt32("TranType");
_SectID = dr.GetInt32("SectID");
_ProcID = dr.GetInt32("ProcID");
_SetID = dr.GetInt32("SetID");
_PlantID = dr.GetInt32("PlantID");
_DTS = dr.GetDateTime("DTS");
_UserID = dr.GetString("UserID");
dr.GetBytes("LastChanged", 0, _LastChanged, 0, 8);
}
public static void Delete(int transitionId)
{
if (!CanDeleteObject())
throw new System.Security.SecurityException("User not authorized to remove a Transition");
DataPortal.Delete(new PKCriteria(transitionId));
}
public override Transition Save()
{
if (IsDeleted && !CanDeleteObject())
throw new System.Security.SecurityException("User not authorized to remove a Transition");
else if (IsNew && !CanAddObject())
throw new System.Security.SecurityException("User not authorized to add a Transition");
else if (!CanEditObject())
throw new System.Security.SecurityException("User not authorized to update a Transition");
return base.Save();
}
#endregion
#region Data Access Portal
[Serializable()]
private class PKCriteria
{
private int _TransitionId;
public int TransitionId
{ get { return _TransitionId; } }
public PKCriteria(int transitionId)
{
_TransitionId = transitionId;
}
}
// TODO: If Create needs to access DB - It should not be marked RunLocal
[RunLocal()]
private new void DataPortal_Create(object criteria)
{
_TransitionId = NextTransitionId;
// Database Defaults
_TranType = ext.DefaultTranType;
_SectID = ext.DefaultSectID;
_ProcID = ext.DefaultProcID;
_SetID = ext.DefaultSetID;
_PlantID = ext.DefaultPlantID;
_DTS = ext.DefaultDTS;
_UserID = ext.DefaultUserID;
// TODO: Add any defaults that are necessary
ValidationRules.CheckRules();
}
private void DataPortal_Fetch(PKCriteria criteria)
{
try
{
using (SqlConnection cn = Database.VEPROMS_SqlConnection)
{
using (SqlCommand cm = cn.CreateCommand())
{
cm.CommandType = CommandType.StoredProcedure;
cm.CommandText = "getTransition";
cm.Parameters.AddWithValue("@TransitionId", criteria.TransitionId);
using (SafeDataReader dr = new SafeDataReader(cm.ExecuteReader()))
{
dr.Read();
_TransitionId = dr.GetInt32("TransitionId");
_FromId = dr.GetInt32("FromId");
_ToId = dr.GetInt32("ToId");
_TranType = dr.GetInt32("TranType");
_SectID = dr.GetInt32("SectID");
_ProcID = dr.GetInt32("ProcID");
_SetID = dr.GetInt32("SetID");
_PlantID = dr.GetInt32("PlantID");
_DTS = dr.GetDateTime("DTS");
_UserID = dr.GetString("UserID");
dr.GetBytes("LastChanged", 0, _LastChanged, 0, 8);
}
}
}
}
catch (Exception ex)
{
Database.LogException("Transition.DataPortal_Fetch", ex);
_errorMessage = ex.Message;
throw new DbCslaException("Transition.DataPortal_Fetch", ex);
}
}
[Transactional(TransactionalTypes.TransactionScope)]
protected override void DataPortal_Insert()
{
try
{
using (SqlConnection cn = Database.VEPROMS_SqlConnection)
{
using (SqlCommand cm = cn.CreateCommand())
{
cm.CommandType = CommandType.StoredProcedure;
cm.CommandText = "addTransition";
// Input All Fields - Except Calculated Columns
cm.Parameters.AddWithValue("@FromId", _FromId);
cm.Parameters.AddWithValue("@ToId", _ToId);
cm.Parameters.AddWithValue("@TranType", _TranType);
cm.Parameters.AddWithValue("@SectID", _SectID);
cm.Parameters.AddWithValue("@ProcID", _ProcID);
cm.Parameters.AddWithValue("@SetID", _SetID);
cm.Parameters.AddWithValue("@PlantID", _PlantID);
cm.Parameters.AddWithValue("@DTS", _DTS);
cm.Parameters.AddWithValue("@UserID", _UserID);
// Output Calculated Columns
SqlParameter param_TransitionId = new SqlParameter("@newTransitionId", SqlDbType.Int);
param_TransitionId.Direction = ParameterDirection.Output;
cm.Parameters.Add(param_TransitionId);
SqlParameter param_LastChanged = new SqlParameter("@newLastChanged", SqlDbType.Timestamp);
param_LastChanged.Direction = ParameterDirection.Output;
cm.Parameters.Add(param_LastChanged);
// TODO: Define any additional output parameters
cm.ExecuteNonQuery();
// Save all values being returned from the Procedure
_TransitionId = (int)cm.Parameters["@newTransitionId"].Value;
_LastChanged = (byte[])cm.Parameters["@newLastChanged"].Value;
}
// update child objects
}
}
catch (Exception ex)
{
Database.LogException("Transition.DataPortal_Insert", ex);
_errorMessage = ex.Message;
throw new DbCslaException("Transition.DataPortal_Fetch", ex);
}
}
[Transactional(TransactionalTypes.TransactionScope)]
public static byte[] Add(SqlConnection cn, ref int transitionId, int fromId, int toId, int tranType, int sectID, int procID, int setID, int plantID, DateTime dts, string userID)
{
try
{
using (SqlCommand cm = cn.CreateCommand())
{
cm.CommandType = CommandType.StoredProcedure;
cm.CommandText = "addTransition";
// Input All Fields - Except Calculated Columns
cm.Parameters.AddWithValue("@FromId", fromId);
cm.Parameters.AddWithValue("@ToId", toId);
cm.Parameters.AddWithValue("@TranType", tranType);
cm.Parameters.AddWithValue("@SectID", sectID);
cm.Parameters.AddWithValue("@ProcID", procID);
cm.Parameters.AddWithValue("@SetID", setID);
cm.Parameters.AddWithValue("@PlantID", plantID);
cm.Parameters.AddWithValue("@DTS", dts);
cm.Parameters.AddWithValue("@UserID", userID);
// Output Calculated Columns
SqlParameter param_TransitionId = new SqlParameter("@newTransitionId", SqlDbType.Int);
param_TransitionId.Direction = ParameterDirection.Output;
cm.Parameters.Add(param_TransitionId);
SqlParameter param_LastChanged = new SqlParameter("@newLastChanged", SqlDbType.Timestamp);
param_LastChanged.Direction = ParameterDirection.Output;
cm.Parameters.Add(param_LastChanged);
// TODO: Define any additional output parameters
cm.ExecuteNonQuery();
// Save all values being returned from the Procedure
transitionId = (int)cm.Parameters["@newTransitionId"].Value;
return (byte[])cm.Parameters["@newLastChanged"].Value;
}
}
catch (Exception ex)
{
Database.LogException("Transition.Add", ex);
throw new DbCslaException("Transition.Add", ex);
}
}
[Transactional(TransactionalTypes.TransactionScope)]
protected override void DataPortal_Update()
{
if (IsDirty)// If this is dirty - open the connection
{
try
{
using (SqlConnection cn = Database.VEPROMS_SqlConnection)
{
if (base.IsDirty)
{
using (SqlCommand cm = cn.CreateCommand())
{
cm.CommandType = CommandType.StoredProcedure;
cm.CommandText = "updateTransition";
// All Fields including Calculated Fields
cm.Parameters.AddWithValue("@TransitionId", _TransitionId);
cm.Parameters.AddWithValue("@FromId", _FromId);
cm.Parameters.AddWithValue("@ToId", _ToId);
cm.Parameters.AddWithValue("@TranType", _TranType);
cm.Parameters.AddWithValue("@SectID", _SectID);
cm.Parameters.AddWithValue("@ProcID", _ProcID);
cm.Parameters.AddWithValue("@SetID", _SetID);
cm.Parameters.AddWithValue("@PlantID", _PlantID);
cm.Parameters.AddWithValue("@DTS", _DTS);
cm.Parameters.AddWithValue("@UserID", _UserID);
cm.Parameters.AddWithValue("@LastChanged", _LastChanged);
// Output Calculated Columns
SqlParameter param_LastChanged = new SqlParameter("@newLastChanged", SqlDbType.Timestamp);
param_LastChanged.Direction = ParameterDirection.Output;
cm.Parameters.Add(param_LastChanged);
// TODO: Define any additional output parameters
cm.ExecuteNonQuery();
// Save all values being returned from the Procedure
_LastChanged = (byte[])cm.Parameters["@newLastChanged"].Value;
}
}
// use the open connection to update child objects
}
}
catch (Exception ex)
{
Database.LogException("Transition.DataPortal_Update", ex);
_errorMessage = ex.Message;
if (!ex.Message.EndsWith("has been edited by another user."))throw ex;
}
}
}
[Transactional(TransactionalTypes.TransactionScope)]
public static byte[] Update(SqlConnection cn, ref int transitionId, int fromId, int toId, int tranType, int sectID, int procID, int setID, int plantID, DateTime dts, string userID, ref byte[] lastChanged)
{
try
{
using (SqlCommand cm = cn.CreateCommand())
{
cm.CommandType = CommandType.StoredProcedure;
cm.CommandText = "updateTransition";
// Input All Fields - Except Calculated Columns
cm.Parameters.AddWithValue("@TransitionId", transitionId);
cm.Parameters.AddWithValue("@FromId", fromId);
cm.Parameters.AddWithValue("@ToId", toId);
cm.Parameters.AddWithValue("@TranType", tranType);
cm.Parameters.AddWithValue("@SectID", sectID);
cm.Parameters.AddWithValue("@ProcID", procID);
cm.Parameters.AddWithValue("@SetID", setID);
cm.Parameters.AddWithValue("@PlantID", plantID);
cm.Parameters.AddWithValue("@DTS", dts);
cm.Parameters.AddWithValue("@UserID", userID);
cm.Parameters.AddWithValue("@LastChanged", lastChanged);
// Output Calculated Columns
SqlParameter param_LastChanged = new SqlParameter("@newLastChanged", SqlDbType.Timestamp);
param_LastChanged.Direction = ParameterDirection.Output;
cm.Parameters.Add(param_LastChanged);
// TODO: Define any additional output parameters
cm.ExecuteNonQuery();
// Save all values being returned from the Procedure
return (byte[])cm.Parameters["@newLastChanged"].Value;
}
}
catch (Exception ex)
{
Database.LogException("Transition.Update", ex);
throw new DbCslaException("Transition.Update", ex);
}
}
[Transactional(TransactionalTypes.TransactionScope)]
protected override void DataPortal_DeleteSelf()
{
DataPortal_Delete(new PKCriteria(_TransitionId));
}
[Transactional(TransactionalTypes.TransactionScope)]
private void DataPortal_Delete(PKCriteria criteria)
{
try
{
using (SqlConnection cn = Database.VEPROMS_SqlConnection)
{
using (SqlCommand cm = cn.CreateCommand())
{
cm.CommandType = CommandType.StoredProcedure;
cm.CommandText = "deleteTransition";
cm.Parameters.AddWithValue("@TransitionId", criteria.TransitionId);
cm.ExecuteNonQuery();
}
}
}
catch (Exception ex)
{
Database.LogException("Transition.DataPortal_Delete", ex);
_errorMessage = ex.Message;
throw new DbCslaException("Transition.DataPortal_Delete", ex);
}
}
[Transactional(TransactionalTypes.TransactionScope)]
public static void Remove(SqlConnection cn, int transitionId)
{
try
{
using (SqlCommand cm = cn.CreateCommand())
{
cm.CommandType = CommandType.StoredProcedure;
cm.CommandText = "deleteTransition";
// Input PK Fields
cm.Parameters.AddWithValue("@TransitionId", transitionId);
// TODO: Define any additional output parameters
cm.ExecuteNonQuery();
}
}
catch (Exception ex)
{
Database.LogException("Transition.Remove", ex);
throw new DbCslaException("Transition.Remove", ex);
}
}
#endregion
#region Exists
public static bool Exists(int transitionId)
{
ExistsCommand result;
result = DataPortal.Execute<ExistsCommand>
(new ExistsCommand(transitionId));
return result.Exists;
}
[Serializable()]
private class ExistsCommand : CommandBase
{
private int _TransitionId;
private bool _exists;
public bool Exists
{
get { return _exists; }
}
public ExistsCommand(int transitionId)
{
_TransitionId = transitionId;
}
protected override void DataPortal_Execute()
{
try
{
using (SqlConnection cn = Database.VEPROMS_SqlConnection)
{
cn.Open();
using (SqlCommand cm = cn.CreateCommand())
{
cm.CommandType = CommandType.StoredProcedure;
cm.CommandText = "existsTransition";
cm.Parameters.AddWithValue("@TransitionId", _TransitionId);
int count = (int)cm.ExecuteScalar();
_exists = (count > 0);
}
}
}
catch (Exception ex)
{
Database.LogException("Transition.DataPortal_Execute", ex);
throw new DbCslaException("Transition.DataPortal_Execute", ex);
}
}
}
#endregion
// Standard Default Code
#region extension
Extension ext = new Extension();
[Serializable()]
partial class Extension : extensionBase
{
}
[Serializable()]
class extensionBase
{
// Default Values
public virtual int DefaultTranType
{
get { return 0; }
}
public virtual int DefaultSectID
{
get { return 0; }
}
public virtual int DefaultProcID
{
get { return 0; }
}
public virtual int DefaultSetID
{
get { return 0; }
}
public virtual int DefaultPlantID
{
get { return 0; }
}
public virtual DateTime DefaultDTS
{
get { return DateTime.Now; }
}
public virtual string DefaultUserID
{
get { return Environment.UserName.ToUpper(); }
}
// Authorization Rules
public virtual void AddAuthorizationRules(Csla.Security.AuthorizationRules rules)
{
// Needs to be overriden to add new authorization rules
}
// Validation Rules
public virtual void AddValidationRules(Csla.Validation.ValidationRules rules)
{
// Needs to be overriden to add new validation rules
}
}
#endregion
} // Class
} // Namespace
//// The following is a sample Extension File. You can use it to create TransitionExt.cs
//using System;
//using System.Collections.Generic;
//using System.Text;
//using Csla;
//namespace Volian.CSLA.Library
//{
// public partial class Transition
// {
// partial class Extension : extensionBase
// {
// // TODO: Override automatic defaults
// public virtual int DefaultTranType
// {
// get { return 0; }
// }
// public virtual int DefaultSectID
// {
// get { return 0; }
// }
// public virtual int DefaultProcID
// {
// get { return 0; }
// }
// public virtual int DefaultSetID
// {
// get { return 0; }
// }
// public virtual int DefaultPlantID
// {
// get { return 0; }
// }
// public virtual DateTime DefaultDTS
// {
// get { return DateTime.Now; }
// }
// public virtual string DefaultUserID
// {
// get { return Environment.UserName.ToUpper(); }
// }
// public new void AddAuthorizationRules(Csla.Security.AuthorizationRules rules)
// {
// //rules.AllowRead(Dbid, "<Role(s)>");
// }
// public new void AddValidationRules(Csla.Validation.ValidationRules rules)
// {
// rules.AddRule(
// Csla.Validation.CommonRules.StringMaxLength,
// new Csla.Validation.CommonRules.MaxLengthRuleArgs("Name", 100));
// }
// }
// }
//}