diff --git a/PROMS/VEPROMS.CSLA.Library/Generated/RODbROFst.cs b/PROMS/VEPROMS.CSLA.Library/Generated/RODbROFst.cs
new file mode 100644
index 00000000..435d814a
--- /dev/null
+++ b/PROMS/VEPROMS.CSLA.Library/Generated/RODbROFst.cs
@@ -0,0 +1,440 @@
+// ========================================================================
+// Copyright 2007 - 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;
+using System.ComponentModel;
+using Csla.Validation;
+namespace VEPROMS.CSLA.Library
+{
+ ///
+ /// RODbROFst Generated by MyGeneration using the CSLA Object Mapping template
+ ///
+ [Serializable()]
+ [TypeConverter(typeof(RODbROFstConverter))]
+ public partial class RODbROFst : BusinessBase, IVEHasBrokenRules
+ {
+ #region Log4Net
+ private static readonly log4net.ILog _MyLog = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
+ #endregion
+ #region Business Methods
+ private string _ErrorMessage = string.Empty;
+ public string ErrorMessage
+ {
+ get { return _ErrorMessage; }
+ }
+ private int _ROFstID;
+ [System.ComponentModel.DataObjectField(true, true)]
+ public int ROFstID
+ {
+ [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
+ get
+ {
+ CanReadProperty("ROFstID", true);
+ if (_MyROFst != null) _ROFstID = _MyROFst.ROFstID;
+ return _ROFstID;
+ }
+ }
+ private ROFst _MyROFst;
+ [System.ComponentModel.DataObjectField(true, true)]
+ public ROFst MyROFst
+ {
+ [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
+ get
+ {
+ CanReadProperty("MyROFst", true);
+ if (_MyROFst == null && _ROFstID != 0) _MyROFst = ROFst.Get(_ROFstID);
+ return _MyROFst;
+ }
+ }
+ private byte[] _ROLookup;
+ public byte[] ROLookup
+ {
+ [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
+ get
+ {
+ CanReadProperty("ROLookup", true);
+ return _ROLookup;
+ }
+ [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
+ set
+ {
+ CanWriteProperty("ROLookup", true);
+ if (_ROLookup != value)
+ {
+ _ROLookup = value;
+ PropertyHasChanged();
+ }
+ }
+ }
+ private string _Config = string.Empty;
+ public string Config
+ {
+ [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
+ get
+ {
+ CanReadProperty("Config", true);
+ return _Config;
+ }
+ [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
+ set
+ {
+ CanWriteProperty("Config", true);
+ if (value == null) value = string.Empty;
+ if (_Config != value)
+ {
+ _Config = value;
+ PropertyHasChanged();
+ }
+ }
+ }
+ private DateTime _DTS = new DateTime();
+ public DateTime DTS
+ {
+ [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
+ get
+ {
+ CanReadProperty("DTS", true);
+ return _DTS;
+ }
+ [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
+ set
+ {
+ CanWriteProperty("DTS", 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("UserID", true);
+ return _UserID;
+ }
+ [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
+ set
+ {
+ CanWriteProperty("UserID", true);
+ if (value == null) value = string.Empty;
+ if (_UserID != value)
+ {
+ _UserID = value;
+ PropertyHasChanged();
+ }
+ }
+ }
+ private byte[] _LastChanged = new byte[8];//timestamp
+ // TODO: Check RODbROFst.GetIdValue to assure that the ID returned is unique
+ ///
+ /// Overrides Base GetIdValue - Used internally by CSLA to determine equality
+ ///
+ /// A Unique ID for the current RODbROFst
+ protected override object GetIdValue()
+ {
+ return _ROFstID;
+ }
+ // TODO: Replace base RODbROFst.ToString function as necessary
+ ///
+ /// Overrides Base ToString
+ ///
+ /// A string representation of current RODbROFst
+ //public override string ToString()
+ //{
+ // return base.ToString();
+ //}
+ #endregion
+ #region ValidationRules
+ [NonSerialized]
+ private bool _CheckingBrokenRules = false;
+ public IVEHasBrokenRules HasBrokenRules
+ {
+ get
+ {
+ if (_CheckingBrokenRules) return null;
+ if (BrokenRulesCollection.Count > 0) return this;
+ try
+ {
+ _CheckingBrokenRules = true;
+ IVEHasBrokenRules hasBrokenRules = null;
+ return hasBrokenRules;
+ }
+ finally
+ {
+ _CheckingBrokenRules = false;
+ }
+ }
+ }
+ public BrokenRulesCollection BrokenRules
+ {
+ get
+ {
+ IVEHasBrokenRules hasBrokenRules = HasBrokenRules;
+ if (this.Equals(hasBrokenRules)) return BrokenRulesCollection;
+ return (hasBrokenRules != null ? hasBrokenRules.BrokenRules : null);
+ }
+ }
+ protected override void AddBusinessRules()
+ {
+ ValidationRules.AddRule(
+ Csla.Validation.CommonRules.StringMaxLength,
+ new Csla.Validation.CommonRules.MaxLengthRuleArgs("Config", 1073741823));
+ ValidationRules.AddRule(
+ Csla.Validation.CommonRules.StringRequired, "UserID");
+ ValidationRules.AddRule(
+ Csla.Validation.CommonRules.StringMaxLength,
+ new Csla.Validation.CommonRules.MaxLengthRuleArgs("UserID", 100));
+ // TODO: Add other validation rules
+ }
+ // 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(ROFstID, "");
+ //AuthorizationRules.AllowRead(ROLookup, "");
+ //AuthorizationRules.AllowWrite(ROLookup, "");
+ //AuthorizationRules.AllowRead(Config, "");
+ //AuthorizationRules.AllowWrite(Config, "");
+ //AuthorizationRules.AllowRead(DTS, "");
+ //AuthorizationRules.AllowWrite(DTS, "");
+ //AuthorizationRules.AllowRead(UserID, "");
+ //AuthorizationRules.AllowWrite(UserID, "");
+ }
+ 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; } }
+ internal static RODbROFst New(byte[] rOLookup)
+ {
+ return new RODbROFst(rOLookup);
+ }
+ internal static RODbROFst Get(SafeDataReader dr)
+ {
+ return new RODbROFst(dr);
+ }
+ public RODbROFst()
+ {
+ MarkAsChild();
+ _ROFstID = ROFst.NextROFstID;
+ _DTS = _RODbROFstExtension.DefaultDTS;
+ _UserID = _RODbROFstExtension.DefaultUserID;
+ ValidationRules.CheckRules();
+ }
+ private RODbROFst(byte[] rOLookup)
+ {
+ MarkAsChild();
+ // TODO: Add any initialization & defaults
+ _DTS = _RODbROFstExtension.DefaultDTS;
+ _UserID = _RODbROFstExtension.DefaultUserID;
+ _ROLookup = rOLookup;
+ ValidationRules.CheckRules();
+ }
+ internal RODbROFst(SafeDataReader dr)
+ {
+ MarkAsChild();
+ Fetch(dr);
+ }
+ #endregion
+ #region Data Access Portal
+ private void Fetch(SafeDataReader dr)
+ {
+ if (_MyLog.IsDebugEnabled) _MyLog.DebugFormat("[{0}] RODbROFst.FetchDR", GetHashCode());
+ try
+ {
+ _ROFstID = dr.GetInt32("ROFstID");
+ _ROLookup = (byte[])dr.GetValue("ROLookup");
+ _Config = dr.GetString("Config");
+ _DTS = dr.GetDateTime("DTS");
+ _UserID = dr.GetString("UserID");
+ dr.GetBytes("LastChanged", 0, _LastChanged, 0, 8);
+ }
+ catch (Exception ex) // FKItem Fetch
+ {
+ if (_MyLog.IsErrorEnabled) _MyLog.Error("RODbROFst.FetchDR", ex);
+ throw new DbCslaException("RODbROFst.Fetch", ex);
+ }
+ MarkOld();
+ }
+ internal void Insert(RODb myRODb)
+ {
+ // if we're not dirty then don't update the database
+ if (!this.IsDirty) return;
+ SqlConnection cn = (SqlConnection)ApplicationContext.LocalContext["cn"];
+ _LastChanged = ROFst.Add(cn, ref _ROFstID, myRODb, _ROLookup, _Config, _DTS, _UserID);
+ MarkOld();
+ }
+ internal void Update(RODb myRODb)
+ {
+ // if we're not dirty then don't update the database
+ if (!this.IsDirty) return;
+ SqlConnection cn = (SqlConnection)ApplicationContext.LocalContext["cn"];
+ _LastChanged = ROFst.Update(cn, ref _ROFstID, myRODb, _ROLookup, _Config, _DTS, _UserID, ref _LastChanged);
+ MarkOld();
+ }
+ internal void DeleteSelf(RODb myRODb)
+ {
+ // if we're not dirty then don't update the database
+ if (!this.IsDirty) return;
+ // if we're new then don't update the database
+ if (this.IsNew) return;
+ SqlConnection cn = (SqlConnection)ApplicationContext.LocalContext["cn"];
+ ROFst.Remove(cn, _ROFstID);
+ MarkNew();
+ }
+ #endregion
+ // Standard Default Code
+ #region extension
+ RODbROFstExtension _RODbROFstExtension = new RODbROFstExtension();
+ [Serializable()]
+ partial class RODbROFstExtension : extensionBase
+ {
+ }
+ [Serializable()]
+ class extensionBase
+ {
+ // Default Values
+ 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
+ }
+ // Instance Authorization Rules
+ public virtual void AddInstanceAuthorizationRules(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
+ }
+ // InstanceValidation Rules
+ public virtual void AddInstanceValidationRules(Csla.Validation.ValidationRules rules)
+ {
+ // Needs to be overriden to add new validation rules
+ }
+ }
+ #endregion
+ } // Class
+ #region Converter
+ internal class RODbROFstConverter : ExpandableObjectConverter
+ {
+ public override object ConvertTo(ITypeDescriptorContext context, System.Globalization.CultureInfo culture, object value, Type destType)
+ {
+ if (destType == typeof(string) && value is RODbROFst)
+ {
+ // Return the ToString value
+ return ((RODbROFst)value).ToString();
+ }
+ return base.ConvertTo(context, culture, value, destType);
+ }
+ }
+ #endregion
+} // Namespace
+
+
+//// The following is a sample Extension File. You can use it to create RODbROFstExt.cs
+//using System;
+//using System.Collections.Generic;
+//using System.Text;
+//using Csla;
+
+//namespace VEPROMS.CSLA.Library
+//{
+// public partial class RODbROFst
+// {
+// partial class RODbROFstExtension : extensionBase
+// {
+// // TODO: Override automatic defaults
+// 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, "");
+// }
+// public new void AddInstanceAuthorizationRules(Csla.Security.AuthorizationRules rules)
+// {
+// //rules.AllowInstanceRead(Dbid, "");
+// }
+// public new void AddValidationRules(Csla.Validation.ValidationRules rules)
+// {
+// rules.AddRule(
+// Csla.Validation.CommonRules.StringMaxLength,
+// new Csla.Validation.CommonRules.MaxLengthRuleArgs("Name", 100));
+// }
+// public new void AddInstanceValidationRules(Csla.Validation.ValidationRules rules)
+// {
+// rules.AddInstanceRule(/* Instance Validation Rule */);
+// }
+// }
+// }
+//}
diff --git a/PROMS/VEPROMS.CSLA.Library/Generated/RODbROFsts.cs b/PROMS/VEPROMS.CSLA.Library/Generated/RODbROFsts.cs
new file mode 100644
index 00000000..b8123514
--- /dev/null
+++ b/PROMS/VEPROMS.CSLA.Library/Generated/RODbROFsts.cs
@@ -0,0 +1,304 @@
+// ========================================================================
+// Copyright 2007 - 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;
+using System.ComponentModel;
+using Csla.Validation;
+namespace VEPROMS.CSLA.Library
+{
+ ///
+ /// RODbROFsts Generated by MyGeneration using the CSLA Object Mapping template
+ ///
+ [Serializable()]
+ [TypeConverter(typeof(RODbROFstsConverter))]
+ public partial class RODbROFsts : BusinessListBase, ICustomTypeDescriptor, IVEHasBrokenRules
+ {
+ #region Log4Net
+ private static readonly log4net.ILog _MyLog = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
+ #endregion
+ #region Business Methods
+ private string _ErrorMessage = string.Empty;
+ public string ErrorMessage
+ {
+ get { return _ErrorMessage; }
+ }
+ // One To Many
+ public RODbROFst this[ROFst myROFst]
+ {
+ get
+ {
+ foreach (RODbROFst rOFst in this)
+ if (rOFst.ROFstID == myROFst.ROFstID)
+ return rOFst;
+ return null;
+ }
+ }
+ public new System.Collections.Generic.IList Items
+ {
+ get { return base.Items; }
+ }
+ public RODbROFst GetItem(ROFst myROFst)
+ {
+ foreach (RODbROFst rOFst in this)
+ if (rOFst.ROFstID == myROFst.ROFstID)
+ return rOFst;
+ return null;
+ }
+ public RODbROFst Add(byte[] rOLookup) // One to Many
+ {
+ RODbROFst rOFst = RODbROFst.New(rOLookup);
+ this.Add(rOFst);
+ return rOFst;
+ }
+ public void Remove(ROFst myROFst)
+ {
+ foreach (RODbROFst rOFst in this)
+ {
+ if (rOFst.ROFstID == myROFst.ROFstID)
+ {
+ Remove(rOFst);
+ break;
+ }
+ }
+ }
+ public bool Contains(ROFst myROFst)
+ {
+ foreach (RODbROFst rOFst in this)
+ if (rOFst.ROFstID == myROFst.ROFstID)
+ return true;
+ return false;
+ }
+ public bool ContainsDeleted(ROFst myROFst)
+ {
+ foreach (RODbROFst rOFst in DeletedList)
+ if (rOFst.ROFstID == myROFst.ROFstID)
+ return true;
+ return false;
+ }
+ public bool Contains(DateTime dts)
+ {
+ foreach (RODbROFst rOFst in this)
+ if (rOFst.DTS == dts)
+ return true;
+ return false;
+ }
+ public bool ContainsDeleted(DateTime dts)
+ {
+ foreach (RODbROFst rOFst in DeletedList)
+ if (rOFst.DTS == dts)
+ return true;
+ return false;
+ }
+ #endregion
+ #region ValidationRules
+ public IVEHasBrokenRules HasBrokenRules
+ {
+ get
+ {
+ IVEHasBrokenRules hasBrokenRules = null;
+ foreach (RODbROFst rODbROFst in this)
+ if ((hasBrokenRules = rODbROFst.HasBrokenRules) != null) return hasBrokenRules;
+ return hasBrokenRules;
+ }
+ }
+ public BrokenRulesCollection BrokenRules
+ {
+ get
+ {
+ IVEHasBrokenRules hasBrokenRules = HasBrokenRules;
+ return (hasBrokenRules != null ? hasBrokenRules.BrokenRules : null);
+ }
+ }
+ #endregion
+ #region Factory Methods
+ internal static RODbROFsts New()
+ {
+ return new RODbROFsts();
+ }
+ internal static RODbROFsts Get(SafeDataReader dr)
+ {
+ return new RODbROFsts(dr);
+ }
+ public static RODbROFsts GetByRODbID(int rODbID)
+ {
+ try
+ {
+ return DataPortal.Fetch(new RODbIDCriteria(rODbID));
+ }
+ catch (Exception ex)
+ {
+ throw new DbCslaException("Error on RODbROFsts.GetByRODbID", ex);
+ }
+ }
+ private RODbROFsts()
+ {
+ MarkAsChild();
+ }
+ internal RODbROFsts(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(RODbROFst.Get(dr));
+ this.RaiseListChangedEvents = true;
+ }
+ [Serializable()]
+ private class RODbIDCriteria
+ {
+ public RODbIDCriteria(int rODbID)
+ {
+ _RODbID = rODbID;
+ }
+ private int _RODbID;
+ public int RODbID
+ {
+ get { return _RODbID; }
+ set { _RODbID = value; }
+ }
+ }
+ private void DataPortal_Fetch(RODbIDCriteria criteria)
+ {
+ this.RaiseListChangedEvents = false;
+ if (_MyLog.IsDebugEnabled) _MyLog.DebugFormat("[{0}] RODbROFsts.DataPortal_FetchRODbID", GetHashCode());
+ try
+ {
+ using (SqlConnection cn = Database.VEPROMS_SqlConnection)
+ {
+ using (SqlCommand cm = cn.CreateCommand())
+ {
+ cm.CommandType = CommandType.StoredProcedure;
+ cm.CommandText = "getROFstsByRODbID";
+ cm.Parameters.AddWithValue("@RODbID", criteria.RODbID);
+ using (SafeDataReader dr = new SafeDataReader(cm.ExecuteReader()))
+ {
+ while (dr.Read()) this.Add(new RODbROFst(dr));
+ }
+ }
+ }
+ }
+ catch (Exception ex)
+ {
+ if (_MyLog.IsErrorEnabled) _MyLog.Error("RODbROFsts.DataPortal_FetchRODbID", ex);
+ throw new DbCslaException("RODbROFsts.DataPortal_Fetch", ex);
+ }
+ this.RaiseListChangedEvents = true;
+ }
+ internal void Update(RODb rODb)
+ {
+ this.RaiseListChangedEvents = false;
+ try
+ {
+ // update (thus deleting) any deleted child objects
+ foreach (RODbROFst obj in DeletedList)
+ obj.DeleteSelf(rODb);// Deletes related record
+ // now that they are deleted, remove them from memory too
+ DeletedList.Clear();
+ // add/update any current child objects
+ foreach (RODbROFst obj in this)
+ {
+ if (obj.IsNew)
+ obj.Insert(rODb);
+ else
+ obj.Update(rODb);
+ }
+ }
+ finally
+ {
+ this.RaiseListChangedEvents = true;
+ }
+ }
+ #endregion
+ #region ICustomTypeDescriptor impl
+ public String GetClassName()
+ { return TypeDescriptor.GetClassName(this, true); }
+ public AttributeCollection GetAttributes()
+ { return TypeDescriptor.GetAttributes(this, true); }
+ public String GetComponentName()
+ { return TypeDescriptor.GetComponentName(this, true); }
+ public TypeConverter GetConverter()
+ { return TypeDescriptor.GetConverter(this, true); }
+ public EventDescriptor GetDefaultEvent()
+ { return TypeDescriptor.GetDefaultEvent(this, true); }
+ public PropertyDescriptor GetDefaultProperty()
+ { return TypeDescriptor.GetDefaultProperty(this, true); }
+ public object GetEditor(Type editorBaseType)
+ { return TypeDescriptor.GetEditor(this, editorBaseType, true); }
+ public EventDescriptorCollection GetEvents(Attribute[] attributes)
+ { return TypeDescriptor.GetEvents(this, attributes, true); }
+ public EventDescriptorCollection GetEvents()
+ { return TypeDescriptor.GetEvents(this, true); }
+ public object GetPropertyOwner(PropertyDescriptor pd)
+ { return this; }
+ ///
+ /// Called to get the properties of this type. Returns properties with certain
+ /// attributes. this restriction is not implemented here.
+ ///
+ ///
+ ///
+ public PropertyDescriptorCollection GetProperties(Attribute[] attributes)
+ { return GetProperties(); }
+ ///
+ /// Called to get the properties of this type.
+ ///
+ ///
+ public PropertyDescriptorCollection GetProperties()
+ {
+ // Create a collection object to hold property descriptors
+ PropertyDescriptorCollection pds = new PropertyDescriptorCollection(null);
+ // Iterate the list
+ for (int i = 0; i < this.Items.Count; i++)
+ {
+ // Create a property descriptor for the item and add to the property descriptor collection
+ RODbROFstsPropertyDescriptor pd = new RODbROFstsPropertyDescriptor(this, i);
+ pds.Add(pd);
+ }
+ // return the property descriptor collection
+ return pds;
+ }
+ #endregion
+ } // Class
+ #region Property Descriptor
+ ///
+ /// Summary description for CollectionPropertyDescriptor.
+ ///
+ public partial class RODbROFstsPropertyDescriptor : vlnListPropertyDescriptor
+ {
+ private RODbROFst Item { get { return (RODbROFst)_Item; } }
+ public RODbROFstsPropertyDescriptor(RODbROFsts collection, int index) : base(collection, index) { ;}
+ }
+ #endregion
+ #region Converter
+ internal class RODbROFstsConverter : ExpandableObjectConverter
+ {
+ public override object ConvertTo(ITypeDescriptorContext context, System.Globalization.CultureInfo culture, object value, Type destType)
+ {
+ if (destType == typeof(string) && value is RODbROFsts)
+ {
+ // Return department and department role separated by comma.
+ return ((RODbROFsts)value).Items.Count.ToString() + " ROFsts";
+ }
+ return base.ConvertTo(context, culture, value, destType);
+ }
+ }
+ #endregion
+} // Namespace
diff --git a/PROMS/VEPROMS.CSLA.Library/Generated/RODbROImage.cs b/PROMS/VEPROMS.CSLA.Library/Generated/RODbROImage.cs
new file mode 100644
index 00000000..348bdc57
--- /dev/null
+++ b/PROMS/VEPROMS.CSLA.Library/Generated/RODbROImage.cs
@@ -0,0 +1,470 @@
+// ========================================================================
+// Copyright 2007 - 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;
+using System.ComponentModel;
+using Csla.Validation;
+namespace VEPROMS.CSLA.Library
+{
+ ///
+ /// RODbROImage Generated by MyGeneration using the CSLA Object Mapping template
+ ///
+ [Serializable()]
+ [TypeConverter(typeof(RODbROImageConverter))]
+ public partial class RODbROImage : BusinessBase, IVEHasBrokenRules
+ {
+ #region Log4Net
+ private static readonly log4net.ILog _MyLog = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
+ #endregion
+ #region Business Methods
+ private string _ErrorMessage = string.Empty;
+ public string ErrorMessage
+ {
+ get { return _ErrorMessage; }
+ }
+ private int _ImageID;
+ [System.ComponentModel.DataObjectField(true, true)]
+ public int ImageID
+ {
+ [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
+ get
+ {
+ CanReadProperty("ImageID", true);
+ if (_MyROImage != null) _ImageID = _MyROImage.ImageID;
+ return _ImageID;
+ }
+ }
+ private ROImage _MyROImage;
+ [System.ComponentModel.DataObjectField(true, true)]
+ public ROImage MyROImage
+ {
+ [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
+ get
+ {
+ CanReadProperty("MyROImage", true);
+ if (_MyROImage == null && _ImageID != 0) _MyROImage = ROImage.Get(_ImageID);
+ return _MyROImage;
+ }
+ }
+ private string _FileName = string.Empty;
+ public string FileName
+ {
+ [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
+ get
+ {
+ CanReadProperty("FileName", true);
+ return _FileName;
+ }
+ [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
+ set
+ {
+ CanWriteProperty("FileName", true);
+ if (value == null) value = string.Empty;
+ if (_FileName != value)
+ {
+ _FileName = value;
+ PropertyHasChanged();
+ }
+ }
+ }
+ private byte[] _Content;
+ public byte[] Content
+ {
+ [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
+ get
+ {
+ CanReadProperty("Content", true);
+ return _Content;
+ }
+ [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
+ set
+ {
+ CanWriteProperty("Content", true);
+ if (_Content != value)
+ {
+ _Content = value;
+ PropertyHasChanged();
+ }
+ }
+ }
+ private string _Config = string.Empty;
+ public string Config
+ {
+ [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
+ get
+ {
+ CanReadProperty("Config", true);
+ return _Config;
+ }
+ [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
+ set
+ {
+ CanWriteProperty("Config", true);
+ if (value == null) value = string.Empty;
+ if (_Config != value)
+ {
+ _Config = value;
+ PropertyHasChanged();
+ }
+ }
+ }
+ private DateTime _DTS = new DateTime();
+ public DateTime DTS
+ {
+ [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
+ get
+ {
+ CanReadProperty("DTS", true);
+ return _DTS;
+ }
+ [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
+ set
+ {
+ CanWriteProperty("DTS", 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("UserID", true);
+ return _UserID;
+ }
+ [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
+ set
+ {
+ CanWriteProperty("UserID", true);
+ if (value == null) value = string.Empty;
+ if (_UserID != value)
+ {
+ _UserID = value;
+ PropertyHasChanged();
+ }
+ }
+ }
+ private byte[] _LastChanged = new byte[8];//timestamp
+ // TODO: Check RODbROImage.GetIdValue to assure that the ID returned is unique
+ ///
+ /// Overrides Base GetIdValue - Used internally by CSLA to determine equality
+ ///
+ /// A Unique ID for the current RODbROImage
+ protected override object GetIdValue()
+ {
+ return _ImageID;
+ }
+ // TODO: Replace base RODbROImage.ToString function as necessary
+ ///
+ /// Overrides Base ToString
+ ///
+ /// A string representation of current RODbROImage
+ //public override string ToString()
+ //{
+ // return base.ToString();
+ //}
+ #endregion
+ #region ValidationRules
+ [NonSerialized]
+ private bool _CheckingBrokenRules = false;
+ public IVEHasBrokenRules HasBrokenRules
+ {
+ get
+ {
+ if (_CheckingBrokenRules) return null;
+ if (BrokenRulesCollection.Count > 0) return this;
+ try
+ {
+ _CheckingBrokenRules = true;
+ IVEHasBrokenRules hasBrokenRules = null;
+ return hasBrokenRules;
+ }
+ finally
+ {
+ _CheckingBrokenRules = false;
+ }
+ }
+ }
+ public BrokenRulesCollection BrokenRules
+ {
+ get
+ {
+ IVEHasBrokenRules hasBrokenRules = HasBrokenRules;
+ if (this.Equals(hasBrokenRules)) return BrokenRulesCollection;
+ return (hasBrokenRules != null ? hasBrokenRules.BrokenRules : null);
+ }
+ }
+ protected override void AddBusinessRules()
+ {
+ ValidationRules.AddRule(
+ Csla.Validation.CommonRules.StringRequired, "FileName");
+ ValidationRules.AddRule(
+ Csla.Validation.CommonRules.StringMaxLength,
+ new Csla.Validation.CommonRules.MaxLengthRuleArgs("FileName", 255));
+ ValidationRules.AddRule(
+ Csla.Validation.CommonRules.StringMaxLength,
+ new Csla.Validation.CommonRules.MaxLengthRuleArgs("Config", 1073741823));
+ ValidationRules.AddRule(
+ Csla.Validation.CommonRules.StringRequired, "UserID");
+ ValidationRules.AddRule(
+ Csla.Validation.CommonRules.StringMaxLength,
+ new Csla.Validation.CommonRules.MaxLengthRuleArgs("UserID", 100));
+ // TODO: Add other validation rules
+ }
+ // 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(ImageID, "");
+ //AuthorizationRules.AllowRead(FileName, "");
+ //AuthorizationRules.AllowWrite(FileName, "");
+ //AuthorizationRules.AllowRead(Content, "");
+ //AuthorizationRules.AllowWrite(Content, "");
+ //AuthorizationRules.AllowRead(Config, "");
+ //AuthorizationRules.AllowWrite(Config, "");
+ //AuthorizationRules.AllowRead(DTS, "");
+ //AuthorizationRules.AllowWrite(DTS, "");
+ //AuthorizationRules.AllowRead(UserID, "");
+ //AuthorizationRules.AllowWrite(UserID, "");
+ }
+ 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; } }
+ internal static RODbROImage New(string fileName, byte[] content)
+ {
+ return new RODbROImage(fileName, content);
+ }
+ internal static RODbROImage Get(SafeDataReader dr)
+ {
+ return new RODbROImage(dr);
+ }
+ public RODbROImage()
+ {
+ MarkAsChild();
+ _ImageID = ROImage.NextImageID;
+ _DTS = _RODbROImageExtension.DefaultDTS;
+ _UserID = _RODbROImageExtension.DefaultUserID;
+ ValidationRules.CheckRules();
+ }
+ private RODbROImage(string fileName, byte[] content)
+ {
+ MarkAsChild();
+ // TODO: Add any initialization & defaults
+ _DTS = _RODbROImageExtension.DefaultDTS;
+ _UserID = _RODbROImageExtension.DefaultUserID;
+ _FileName = fileName;
+ _Content = content;
+ ValidationRules.CheckRules();
+ }
+ internal RODbROImage(SafeDataReader dr)
+ {
+ MarkAsChild();
+ Fetch(dr);
+ }
+ #endregion
+ #region Data Access Portal
+ private void Fetch(SafeDataReader dr)
+ {
+ if (_MyLog.IsDebugEnabled) _MyLog.DebugFormat("[{0}] RODbROImage.FetchDR", GetHashCode());
+ try
+ {
+ _ImageID = dr.GetInt32("ImageID");
+ _FileName = dr.GetString("FileName");
+ _Content = (byte[])dr.GetValue("Content");
+ _Config = dr.GetString("Config");
+ _DTS = dr.GetDateTime("DTS");
+ _UserID = dr.GetString("UserID");
+ dr.GetBytes("LastChanged", 0, _LastChanged, 0, 8);
+ }
+ catch (Exception ex) // FKItem Fetch
+ {
+ if (_MyLog.IsErrorEnabled) _MyLog.Error("RODbROImage.FetchDR", ex);
+ throw new DbCslaException("RODbROImage.Fetch", ex);
+ }
+ MarkOld();
+ }
+ internal void Insert(RODb myRODb)
+ {
+ // if we're not dirty then don't update the database
+ if (!this.IsDirty) return;
+ SqlConnection cn = (SqlConnection)ApplicationContext.LocalContext["cn"];
+ _LastChanged = ROImage.Add(cn, ref _ImageID, myRODb, _FileName, _Content, _Config, _DTS, _UserID);
+ MarkOld();
+ }
+ internal void Update(RODb myRODb)
+ {
+ // if we're not dirty then don't update the database
+ if (!this.IsDirty) return;
+ SqlConnection cn = (SqlConnection)ApplicationContext.LocalContext["cn"];
+ _LastChanged = ROImage.Update(cn, ref _ImageID, myRODb, _FileName, _Content, _Config, _DTS, _UserID, ref _LastChanged);
+ MarkOld();
+ }
+ internal void DeleteSelf(RODb myRODb)
+ {
+ // if we're not dirty then don't update the database
+ if (!this.IsDirty) return;
+ // if we're new then don't update the database
+ if (this.IsNew) return;
+ SqlConnection cn = (SqlConnection)ApplicationContext.LocalContext["cn"];
+ ROImage.Remove(cn, _ImageID);
+ MarkNew();
+ }
+ #endregion
+ // Standard Default Code
+ #region extension
+ RODbROImageExtension _RODbROImageExtension = new RODbROImageExtension();
+ [Serializable()]
+ partial class RODbROImageExtension : extensionBase
+ {
+ }
+ [Serializable()]
+ class extensionBase
+ {
+ // Default Values
+ 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
+ }
+ // Instance Authorization Rules
+ public virtual void AddInstanceAuthorizationRules(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
+ }
+ // InstanceValidation Rules
+ public virtual void AddInstanceValidationRules(Csla.Validation.ValidationRules rules)
+ {
+ // Needs to be overriden to add new validation rules
+ }
+ }
+ #endregion
+ } // Class
+ #region Converter
+ internal class RODbROImageConverter : ExpandableObjectConverter
+ {
+ public override object ConvertTo(ITypeDescriptorContext context, System.Globalization.CultureInfo culture, object value, Type destType)
+ {
+ if (destType == typeof(string) && value is RODbROImage)
+ {
+ // Return the ToString value
+ return ((RODbROImage)value).ToString();
+ }
+ return base.ConvertTo(context, culture, value, destType);
+ }
+ }
+ #endregion
+} // Namespace
+
+
+//// The following is a sample Extension File. You can use it to create RODbROImageExt.cs
+//using System;
+//using System.Collections.Generic;
+//using System.Text;
+//using Csla;
+
+//namespace VEPROMS.CSLA.Library
+//{
+// public partial class RODbROImage
+// {
+// partial class RODbROImageExtension : extensionBase
+// {
+// // TODO: Override automatic defaults
+// 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, "");
+// }
+// public new void AddInstanceAuthorizationRules(Csla.Security.AuthorizationRules rules)
+// {
+// //rules.AllowInstanceRead(Dbid, "");
+// }
+// public new void AddValidationRules(Csla.Validation.ValidationRules rules)
+// {
+// rules.AddRule(
+// Csla.Validation.CommonRules.StringMaxLength,
+// new Csla.Validation.CommonRules.MaxLengthRuleArgs("Name", 100));
+// }
+// public new void AddInstanceValidationRules(Csla.Validation.ValidationRules rules)
+// {
+// rules.AddInstanceRule(/* Instance Validation Rule */);
+// }
+// }
+// }
+//}
diff --git a/PROMS/VEPROMS.CSLA.Library/Generated/RODbROImages.cs b/PROMS/VEPROMS.CSLA.Library/Generated/RODbROImages.cs
new file mode 100644
index 00000000..8b441259
--- /dev/null
+++ b/PROMS/VEPROMS.CSLA.Library/Generated/RODbROImages.cs
@@ -0,0 +1,304 @@
+// ========================================================================
+// Copyright 2007 - 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;
+using System.ComponentModel;
+using Csla.Validation;
+namespace VEPROMS.CSLA.Library
+{
+ ///
+ /// RODbROImages Generated by MyGeneration using the CSLA Object Mapping template
+ ///
+ [Serializable()]
+ [TypeConverter(typeof(RODbROImagesConverter))]
+ public partial class RODbROImages : BusinessListBase, ICustomTypeDescriptor, IVEHasBrokenRules
+ {
+ #region Log4Net
+ private static readonly log4net.ILog _MyLog = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
+ #endregion
+ #region Business Methods
+ private string _ErrorMessage = string.Empty;
+ public string ErrorMessage
+ {
+ get { return _ErrorMessage; }
+ }
+ // One To Many
+ public RODbROImage this[ROImage myROImage]
+ {
+ get
+ {
+ foreach (RODbROImage rOImage in this)
+ if (rOImage.ImageID == myROImage.ImageID)
+ return rOImage;
+ return null;
+ }
+ }
+ public new System.Collections.Generic.IList Items
+ {
+ get { return base.Items; }
+ }
+ public RODbROImage GetItem(ROImage myROImage)
+ {
+ foreach (RODbROImage rOImage in this)
+ if (rOImage.ImageID == myROImage.ImageID)
+ return rOImage;
+ return null;
+ }
+ public RODbROImage Add(string fileName, byte[] content) // One to Many
+ {
+ RODbROImage rOImage = RODbROImage.New(fileName, content);
+ this.Add(rOImage);
+ return rOImage;
+ }
+ public void Remove(ROImage myROImage)
+ {
+ foreach (RODbROImage rOImage in this)
+ {
+ if (rOImage.ImageID == myROImage.ImageID)
+ {
+ Remove(rOImage);
+ break;
+ }
+ }
+ }
+ public bool Contains(ROImage myROImage)
+ {
+ foreach (RODbROImage rOImage in this)
+ if (rOImage.ImageID == myROImage.ImageID)
+ return true;
+ return false;
+ }
+ public bool ContainsDeleted(ROImage myROImage)
+ {
+ foreach (RODbROImage rOImage in DeletedList)
+ if (rOImage.ImageID == myROImage.ImageID)
+ return true;
+ return false;
+ }
+ public bool Contains(string fileName, DateTime dts)
+ {
+ foreach (RODbROImage rOImage in this)
+ if (rOImage.FileName == fileName && rOImage.DTS == dts)
+ return true;
+ return false;
+ }
+ public bool ContainsDeleted(string fileName, DateTime dts)
+ {
+ foreach (RODbROImage rOImage in DeletedList)
+ if (rOImage.FileName == fileName && rOImage.DTS == dts)
+ return true;
+ return false;
+ }
+ #endregion
+ #region ValidationRules
+ public IVEHasBrokenRules HasBrokenRules
+ {
+ get
+ {
+ IVEHasBrokenRules hasBrokenRules = null;
+ foreach (RODbROImage rODbROImage in this)
+ if ((hasBrokenRules = rODbROImage.HasBrokenRules) != null) return hasBrokenRules;
+ return hasBrokenRules;
+ }
+ }
+ public BrokenRulesCollection BrokenRules
+ {
+ get
+ {
+ IVEHasBrokenRules hasBrokenRules = HasBrokenRules;
+ return (hasBrokenRules != null ? hasBrokenRules.BrokenRules : null);
+ }
+ }
+ #endregion
+ #region Factory Methods
+ internal static RODbROImages New()
+ {
+ return new RODbROImages();
+ }
+ internal static RODbROImages Get(SafeDataReader dr)
+ {
+ return new RODbROImages(dr);
+ }
+ public static RODbROImages GetByRODbID(int rODbID)
+ {
+ try
+ {
+ return DataPortal.Fetch(new RODbIDCriteria(rODbID));
+ }
+ catch (Exception ex)
+ {
+ throw new DbCslaException("Error on RODbROImages.GetByRODbID", ex);
+ }
+ }
+ private RODbROImages()
+ {
+ MarkAsChild();
+ }
+ internal RODbROImages(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(RODbROImage.Get(dr));
+ this.RaiseListChangedEvents = true;
+ }
+ [Serializable()]
+ private class RODbIDCriteria
+ {
+ public RODbIDCriteria(int rODbID)
+ {
+ _RODbID = rODbID;
+ }
+ private int _RODbID;
+ public int RODbID
+ {
+ get { return _RODbID; }
+ set { _RODbID = value; }
+ }
+ }
+ private void DataPortal_Fetch(RODbIDCriteria criteria)
+ {
+ this.RaiseListChangedEvents = false;
+ if (_MyLog.IsDebugEnabled) _MyLog.DebugFormat("[{0}] RODbROImages.DataPortal_FetchRODbID", GetHashCode());
+ try
+ {
+ using (SqlConnection cn = Database.VEPROMS_SqlConnection)
+ {
+ using (SqlCommand cm = cn.CreateCommand())
+ {
+ cm.CommandType = CommandType.StoredProcedure;
+ cm.CommandText = "getROImagesByRODbID";
+ cm.Parameters.AddWithValue("@RODbID", criteria.RODbID);
+ using (SafeDataReader dr = new SafeDataReader(cm.ExecuteReader()))
+ {
+ while (dr.Read()) this.Add(new RODbROImage(dr));
+ }
+ }
+ }
+ }
+ catch (Exception ex)
+ {
+ if (_MyLog.IsErrorEnabled) _MyLog.Error("RODbROImages.DataPortal_FetchRODbID", ex);
+ throw new DbCslaException("RODbROImages.DataPortal_Fetch", ex);
+ }
+ this.RaiseListChangedEvents = true;
+ }
+ internal void Update(RODb rODb)
+ {
+ this.RaiseListChangedEvents = false;
+ try
+ {
+ // update (thus deleting) any deleted child objects
+ foreach (RODbROImage obj in DeletedList)
+ obj.DeleteSelf(rODb);// Deletes related record
+ // now that they are deleted, remove them from memory too
+ DeletedList.Clear();
+ // add/update any current child objects
+ foreach (RODbROImage obj in this)
+ {
+ if (obj.IsNew)
+ obj.Insert(rODb);
+ else
+ obj.Update(rODb);
+ }
+ }
+ finally
+ {
+ this.RaiseListChangedEvents = true;
+ }
+ }
+ #endregion
+ #region ICustomTypeDescriptor impl
+ public String GetClassName()
+ { return TypeDescriptor.GetClassName(this, true); }
+ public AttributeCollection GetAttributes()
+ { return TypeDescriptor.GetAttributes(this, true); }
+ public String GetComponentName()
+ { return TypeDescriptor.GetComponentName(this, true); }
+ public TypeConverter GetConverter()
+ { return TypeDescriptor.GetConverter(this, true); }
+ public EventDescriptor GetDefaultEvent()
+ { return TypeDescriptor.GetDefaultEvent(this, true); }
+ public PropertyDescriptor GetDefaultProperty()
+ { return TypeDescriptor.GetDefaultProperty(this, true); }
+ public object GetEditor(Type editorBaseType)
+ { return TypeDescriptor.GetEditor(this, editorBaseType, true); }
+ public EventDescriptorCollection GetEvents(Attribute[] attributes)
+ { return TypeDescriptor.GetEvents(this, attributes, true); }
+ public EventDescriptorCollection GetEvents()
+ { return TypeDescriptor.GetEvents(this, true); }
+ public object GetPropertyOwner(PropertyDescriptor pd)
+ { return this; }
+ ///
+ /// Called to get the properties of this type. Returns properties with certain
+ /// attributes. this restriction is not implemented here.
+ ///
+ ///
+ ///
+ public PropertyDescriptorCollection GetProperties(Attribute[] attributes)
+ { return GetProperties(); }
+ ///
+ /// Called to get the properties of this type.
+ ///
+ ///
+ public PropertyDescriptorCollection GetProperties()
+ {
+ // Create a collection object to hold property descriptors
+ PropertyDescriptorCollection pds = new PropertyDescriptorCollection(null);
+ // Iterate the list
+ for (int i = 0; i < this.Items.Count; i++)
+ {
+ // Create a property descriptor for the item and add to the property descriptor collection
+ RODbROImagesPropertyDescriptor pd = new RODbROImagesPropertyDescriptor(this, i);
+ pds.Add(pd);
+ }
+ // return the property descriptor collection
+ return pds;
+ }
+ #endregion
+ } // Class
+ #region Property Descriptor
+ ///
+ /// Summary description for CollectionPropertyDescriptor.
+ ///
+ public partial class RODbROImagesPropertyDescriptor : vlnListPropertyDescriptor
+ {
+ private RODbROImage Item { get { return (RODbROImage)_Item; } }
+ public RODbROImagesPropertyDescriptor(RODbROImages collection, int index) : base(collection, index) { ;}
+ }
+ #endregion
+ #region Converter
+ internal class RODbROImagesConverter : ExpandableObjectConverter
+ {
+ public override object ConvertTo(ITypeDescriptorContext context, System.Globalization.CultureInfo culture, object value, Type destType)
+ {
+ if (destType == typeof(string) && value is RODbROImages)
+ {
+ // Return department and department role separated by comma.
+ return ((RODbROImages)value).Items.Count.ToString() + " ROImages";
+ }
+ return base.ConvertTo(context, culture, value, destType);
+ }
+ }
+ #endregion
+} // Namespace
diff --git a/PROMS/VEPROMS.CSLA.Library/Generated/RODbRoUsage.cs b/PROMS/VEPROMS.CSLA.Library/Generated/RODbRoUsage.cs
new file mode 100644
index 00000000..fb2627fe
--- /dev/null
+++ b/PROMS/VEPROMS.CSLA.Library/Generated/RODbRoUsage.cs
@@ -0,0 +1,590 @@
+// ========================================================================
+// Copyright 2007 - 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;
+using System.ComponentModel;
+using Csla.Validation;
+namespace VEPROMS.CSLA.Library
+{
+ ///
+ /// RODbRoUsage Generated by MyGeneration using the CSLA Object Mapping template
+ ///
+ [Serializable()]
+ [TypeConverter(typeof(RODbRoUsageConverter))]
+ public partial class RODbRoUsage : BusinessBase, IVEHasBrokenRules
+ {
+ #region Log4Net
+ private static readonly log4net.ILog _MyLog = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
+ #endregion
+ #region Business Methods
+ private string _ErrorMessage = string.Empty;
+ public string ErrorMessage
+ {
+ get { return _ErrorMessage; }
+ }
+ private int _ROUsageID;
+ [System.ComponentModel.DataObjectField(true, true)]
+ public int ROUsageID
+ {
+ [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
+ get
+ {
+ CanReadProperty("ROUsageID", true);
+ if (_MyRoUsage != null) _ROUsageID = _MyRoUsage.ROUsageID;
+ return _ROUsageID;
+ }
+ }
+ private RoUsage _MyRoUsage;
+ [System.ComponentModel.DataObjectField(true, true)]
+ public RoUsage MyRoUsage
+ {
+ [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
+ get
+ {
+ CanReadProperty("MyRoUsage", true);
+ if (_MyRoUsage == null && _ROUsageID != 0) _MyRoUsage = RoUsage.Get(_ROUsageID);
+ return _MyRoUsage;
+ }
+ }
+ private int _ContentID;
+ public int ContentID
+ {
+ [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
+ get
+ {
+ CanReadProperty("ContentID", true);
+ if (_MyContent != null) _ContentID = _MyContent.ContentID;
+ return _ContentID;
+ }
+ }
+ private Content _MyContent;
+ public Content MyContent
+ {
+ [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
+ get
+ {
+ CanReadProperty("MyContent", true);
+ if (_MyContent == null && _ContentID != 0) _MyContent = Content.Get(_ContentID);
+ return _MyContent;
+ }
+ [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
+ set
+ {
+ CanWriteProperty("MyContent", true);
+ if (_MyContent != value)
+ {
+ _MyContent = value;
+ PropertyHasChanged();
+ }
+ }
+ }
+ private string _ROID = string.Empty;
+ public string ROID
+ {
+ [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
+ get
+ {
+ CanReadProperty("ROID", true);
+ return _ROID;
+ }
+ [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
+ set
+ {
+ CanWriteProperty("ROID", true);
+ if (value == null) value = string.Empty;
+ if (_ROID != value)
+ {
+ _ROID = value;
+ PropertyHasChanged();
+ }
+ }
+ }
+ private string _Config = string.Empty;
+ public string Config
+ {
+ [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
+ get
+ {
+ CanReadProperty("Config", true);
+ return _Config;
+ }
+ [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
+ set
+ {
+ CanWriteProperty("Config", true);
+ if (value == null) value = string.Empty;
+ if (_Config != value)
+ {
+ _Config = value;
+ PropertyHasChanged();
+ }
+ }
+ }
+ private DateTime _DTS = new DateTime();
+ public DateTime DTS
+ {
+ [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
+ get
+ {
+ CanReadProperty("DTS", true);
+ return _DTS;
+ }
+ [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
+ set
+ {
+ CanWriteProperty("DTS", 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("UserID", true);
+ return _UserID;
+ }
+ [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
+ set
+ {
+ CanWriteProperty("UserID", true);
+ if (value == null) value = string.Empty;
+ if (_UserID != value)
+ {
+ _UserID = value;
+ PropertyHasChanged();
+ }
+ }
+ }
+ private byte[] _LastChanged = new byte[8];//timestamp
+ private string _Content_Number = string.Empty;
+ public string Content_Number
+ {
+ [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
+ get
+ {
+ CanReadProperty("Content_Number", true);
+ return _Content_Number;
+ }
+ }
+ private string _Content_Text = string.Empty;
+ public string Content_Text
+ {
+ [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
+ get
+ {
+ CanReadProperty("Content_Text", true);
+ return _Content_Text;
+ }
+ }
+ private int? _Content_Type;
+ ///
+ /// 0 - Procedure, 10000 - Section, 20000 Step
+ ///
+ public int? Content_Type
+ {
+ [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
+ get
+ {
+ CanReadProperty("Content_Type", true);
+ return _Content_Type;
+ }
+ }
+ private int? _Content_FormatID;
+ public int? Content_FormatID
+ {
+ [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
+ get
+ {
+ CanReadProperty("Content_FormatID", true);
+ return _Content_FormatID;
+ }
+ }
+ private string _Content_Config = string.Empty;
+ public string Content_Config
+ {
+ [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
+ get
+ {
+ CanReadProperty("Content_Config", true);
+ return _Content_Config;
+ }
+ }
+ private DateTime _Content_DTS = new DateTime();
+ public DateTime Content_DTS
+ {
+ [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
+ get
+ {
+ CanReadProperty("Content_DTS", true);
+ return _Content_DTS;
+ }
+ }
+ private string _Content_UserID = string.Empty;
+ public string Content_UserID
+ {
+ [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
+ get
+ {
+ CanReadProperty("Content_UserID", true);
+ return _Content_UserID;
+ }
+ }
+ // TODO: Check RODbRoUsage.GetIdValue to assure that the ID returned is unique
+ ///
+ /// Overrides Base GetIdValue - Used internally by CSLA to determine equality
+ ///
+ /// A Unique ID for the current RODbRoUsage
+ protected override object GetIdValue()
+ {
+ return _ROUsageID;
+ }
+ // TODO: Replace base RODbRoUsage.ToString function as necessary
+ ///
+ /// Overrides Base ToString
+ ///
+ /// A string representation of current RODbRoUsage
+ //public override string ToString()
+ //{
+ // return base.ToString();
+ //}
+ public override bool IsDirty
+ {
+ get { return base.IsDirty || (_MyContent == null ? false : _MyContent.IsDirty); }
+ }
+ public override bool IsValid
+ {
+ get { return (IsNew && !IsDirty ? true : base.IsValid) && (_MyContent == null ? true : _MyContent.IsValid); }
+ }
+ #endregion
+ #region ValidationRules
+ [NonSerialized]
+ private bool _CheckingBrokenRules = false;
+ public IVEHasBrokenRules HasBrokenRules
+ {
+ get
+ {
+ if (_CheckingBrokenRules) return null;
+ if (BrokenRulesCollection.Count > 0) return this;
+ try
+ {
+ _CheckingBrokenRules = true;
+ IVEHasBrokenRules hasBrokenRules = null;
+ if (_MyContent != null && (hasBrokenRules = _MyContent.HasBrokenRules) != null) return hasBrokenRules;
+ return hasBrokenRules;
+ }
+ finally
+ {
+ _CheckingBrokenRules = false;
+ }
+ }
+ }
+ public BrokenRulesCollection BrokenRules
+ {
+ get
+ {
+ IVEHasBrokenRules hasBrokenRules = HasBrokenRules;
+ if (this.Equals(hasBrokenRules)) return BrokenRulesCollection;
+ return (hasBrokenRules != null ? hasBrokenRules.BrokenRules : null);
+ }
+ }
+ protected override void AddBusinessRules()
+ {
+ ValidationRules.AddRule(MyContentRequired, "MyContent");
+ ValidationRules.AddRule(
+ Csla.Validation.CommonRules.StringRequired, "ROID");
+ ValidationRules.AddRule(
+ Csla.Validation.CommonRules.StringMaxLength,
+ new Csla.Validation.CommonRules.MaxLengthRuleArgs("ROID", 16));
+ ValidationRules.AddRule(
+ Csla.Validation.CommonRules.StringMaxLength,
+ new Csla.Validation.CommonRules.MaxLengthRuleArgs("Config", 1073741823));
+ ValidationRules.AddRule(
+ Csla.Validation.CommonRules.StringRequired, "UserID");
+ ValidationRules.AddRule(
+ Csla.Validation.CommonRules.StringMaxLength,
+ new Csla.Validation.CommonRules.MaxLengthRuleArgs("UserID", 100));
+ // TODO: Add other validation rules
+ }
+ private static bool MyContentRequired(RODbRoUsage target, Csla.Validation.RuleArgs e)
+ {
+ if (target._ContentID == 0 && target._MyContent == null) // Required field missing
+ {
+ e.Description = "Required";
+ return false;
+ }
+ return true;
+ }
+ // 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(ROUsageID, "");
+ //AuthorizationRules.AllowRead(ContentID, "");
+ //AuthorizationRules.AllowWrite(ContentID, "");
+ //AuthorizationRules.AllowRead(ROID, "");
+ //AuthorizationRules.AllowWrite(ROID, "");
+ //AuthorizationRules.AllowRead(Config, "");
+ //AuthorizationRules.AllowWrite(Config, "");
+ //AuthorizationRules.AllowRead(DTS, "");
+ //AuthorizationRules.AllowWrite(DTS, "");
+ //AuthorizationRules.AllowRead(UserID, "");
+ //AuthorizationRules.AllowWrite(UserID, "");
+ }
+ 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; } }
+ internal static RODbRoUsage New(string roid)
+ {
+ return new RODbRoUsage(roid);
+ }
+ internal static RODbRoUsage Get(SafeDataReader dr)
+ {
+ return new RODbRoUsage(dr);
+ }
+ public RODbRoUsage()
+ {
+ MarkAsChild();
+ _ROUsageID = RoUsage.NextROUsageID;
+ _ContentID = _RODbRoUsageExtension.DefaultContentID;
+ _DTS = _RODbRoUsageExtension.DefaultDTS;
+ _UserID = _RODbRoUsageExtension.DefaultUserID;
+ ValidationRules.CheckRules();
+ }
+ private RODbRoUsage(string roid)
+ {
+ MarkAsChild();
+ // TODO: Add any initialization & defaults
+ _ContentID = _RODbRoUsageExtension.DefaultContentID;
+ _DTS = _RODbRoUsageExtension.DefaultDTS;
+ _UserID = _RODbRoUsageExtension.DefaultUserID;
+ _ROID = roid;
+ ValidationRules.CheckRules();
+ }
+ internal RODbRoUsage(SafeDataReader dr)
+ {
+ MarkAsChild();
+ Fetch(dr);
+ }
+ #endregion
+ #region Data Access Portal
+ private void Fetch(SafeDataReader dr)
+ {
+ if (_MyLog.IsDebugEnabled) _MyLog.DebugFormat("[{0}] RODbRoUsage.FetchDR", GetHashCode());
+ try
+ {
+ _ROUsageID = dr.GetInt32("ROUsageID");
+ _ContentID = dr.GetInt32("ContentID");
+ _ROID = dr.GetString("ROID");
+ _Config = dr.GetString("Config");
+ _DTS = dr.GetDateTime("DTS");
+ _UserID = dr.GetString("UserID");
+ dr.GetBytes("LastChanged", 0, _LastChanged, 0, 8);
+ _Content_Number = dr.GetString("Content_Number");
+ _Content_Text = dr.GetString("Content_Text");
+ _Content_Type = (int?)dr.GetValue("Content_Type");
+ _Content_FormatID = (int?)dr.GetValue("Content_FormatID");
+ _Content_Config = dr.GetString("Content_Config");
+ _Content_DTS = dr.GetDateTime("Content_DTS");
+ _Content_UserID = dr.GetString("Content_UserID");
+ }
+ catch (Exception ex) // FKItem Fetch
+ {
+ if (_MyLog.IsErrorEnabled) _MyLog.Error("RODbRoUsage.FetchDR", ex);
+ throw new DbCslaException("RODbRoUsage.Fetch", ex);
+ }
+ MarkOld();
+ }
+ internal void Insert(RODb myRODb)
+ {
+ // if we're not dirty then don't update the database
+ if (!this.IsDirty) return;
+ SqlConnection cn = (SqlConnection)ApplicationContext.LocalContext["cn"];
+ _LastChanged = RoUsage.Add(cn, ref _ROUsageID, _MyContent, _ROID, _Config, _DTS, _UserID, myRODb);
+ MarkOld();
+ }
+ internal void Update(RODb myRODb)
+ {
+ // if we're not dirty then don't update the database
+ if (!this.IsDirty) return;
+ SqlConnection cn = (SqlConnection)ApplicationContext.LocalContext["cn"];
+ _LastChanged = RoUsage.Update(cn, ref _ROUsageID, _MyContent, _ROID, _Config, _DTS, _UserID, ref _LastChanged, myRODb);
+ MarkOld();
+ }
+ internal void DeleteSelf(RODb myRODb)
+ {
+ // if we're not dirty then don't update the database
+ if (!this.IsDirty) return;
+ // if we're new then don't update the database
+ if (this.IsNew) return;
+ SqlConnection cn = (SqlConnection)ApplicationContext.LocalContext["cn"];
+ RoUsage.Remove(cn, _ROUsageID);
+ MarkNew();
+ }
+ #endregion
+ // Standard Default Code
+ #region extension
+ RODbRoUsageExtension _RODbRoUsageExtension = new RODbRoUsageExtension();
+ [Serializable()]
+ partial class RODbRoUsageExtension : extensionBase
+ {
+ }
+ [Serializable()]
+ class extensionBase
+ {
+ // Default Values
+ public virtual int DefaultContentID
+ {
+ 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
+ }
+ // Instance Authorization Rules
+ public virtual void AddInstanceAuthorizationRules(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
+ }
+ // InstanceValidation Rules
+ public virtual void AddInstanceValidationRules(Csla.Validation.ValidationRules rules)
+ {
+ // Needs to be overriden to add new validation rules
+ }
+ }
+ #endregion
+ } // Class
+ #region Converter
+ internal class RODbRoUsageConverter : ExpandableObjectConverter
+ {
+ public override object ConvertTo(ITypeDescriptorContext context, System.Globalization.CultureInfo culture, object value, Type destType)
+ {
+ if (destType == typeof(string) && value is RODbRoUsage)
+ {
+ // Return the ToString value
+ return ((RODbRoUsage)value).ToString();
+ }
+ return base.ConvertTo(context, culture, value, destType);
+ }
+ }
+ #endregion
+} // Namespace
+
+
+//// The following is a sample Extension File. You can use it to create RODbRoUsageExt.cs
+//using System;
+//using System.Collections.Generic;
+//using System.Text;
+//using Csla;
+
+//namespace VEPROMS.CSLA.Library
+//{
+// public partial class RODbRoUsage
+// {
+// partial class RODbRoUsageExtension : extensionBase
+// {
+// // TODO: Override automatic defaults
+// public virtual int DefaultContentID
+// {
+// 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, "");
+// }
+// public new void AddInstanceAuthorizationRules(Csla.Security.AuthorizationRules rules)
+// {
+// //rules.AllowInstanceRead(Dbid, "");
+// }
+// public new void AddValidationRules(Csla.Validation.ValidationRules rules)
+// {
+// rules.AddRule(
+// Csla.Validation.CommonRules.StringMaxLength,
+// new Csla.Validation.CommonRules.MaxLengthRuleArgs("Name", 100));
+// }
+// public new void AddInstanceValidationRules(Csla.Validation.ValidationRules rules)
+// {
+// rules.AddInstanceRule(/* Instance Validation Rule */);
+// }
+// }
+// }
+//}
diff --git a/PROMS/VEPROMS.CSLA.Library/Generated/RODbRoUsages.cs b/PROMS/VEPROMS.CSLA.Library/Generated/RODbRoUsages.cs
new file mode 100644
index 00000000..4e5a4c3b
--- /dev/null
+++ b/PROMS/VEPROMS.CSLA.Library/Generated/RODbRoUsages.cs
@@ -0,0 +1,290 @@
+// ========================================================================
+// Copyright 2007 - 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;
+using System.ComponentModel;
+using Csla.Validation;
+namespace VEPROMS.CSLA.Library
+{
+ ///
+ /// RODbRoUsages Generated by MyGeneration using the CSLA Object Mapping template
+ ///
+ [Serializable()]
+ [TypeConverter(typeof(RODbRoUsagesConverter))]
+ public partial class RODbRoUsages : BusinessListBase, ICustomTypeDescriptor, IVEHasBrokenRules
+ {
+ #region Log4Net
+ private static readonly log4net.ILog _MyLog = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
+ #endregion
+ #region Business Methods
+ private string _ErrorMessage = string.Empty;
+ public string ErrorMessage
+ {
+ get { return _ErrorMessage; }
+ }
+ // One To Many
+ public RODbRoUsage this[RoUsage myRoUsage]
+ {
+ get
+ {
+ foreach (RODbRoUsage roUsage in this)
+ if (roUsage.ROUsageID == myRoUsage.ROUsageID)
+ return roUsage;
+ return null;
+ }
+ }
+ public new System.Collections.Generic.IList Items
+ {
+ get { return base.Items; }
+ }
+ public RODbRoUsage GetItem(RoUsage myRoUsage)
+ {
+ foreach (RODbRoUsage roUsage in this)
+ if (roUsage.ROUsageID == myRoUsage.ROUsageID)
+ return roUsage;
+ return null;
+ }
+ public RODbRoUsage Add(string roid) // One to Many
+ {
+ RODbRoUsage roUsage = RODbRoUsage.New(roid);
+ this.Add(roUsage);
+ return roUsage;
+ }
+ public void Remove(RoUsage myRoUsage)
+ {
+ foreach (RODbRoUsage roUsage in this)
+ {
+ if (roUsage.ROUsageID == myRoUsage.ROUsageID)
+ {
+ Remove(roUsage);
+ break;
+ }
+ }
+ }
+ public bool Contains(RoUsage myRoUsage)
+ {
+ foreach (RODbRoUsage roUsage in this)
+ if (roUsage.ROUsageID == myRoUsage.ROUsageID)
+ return true;
+ return false;
+ }
+ public bool ContainsDeleted(RoUsage myRoUsage)
+ {
+ foreach (RODbRoUsage roUsage in DeletedList)
+ if (roUsage.ROUsageID == myRoUsage.ROUsageID)
+ return true;
+ return false;
+ }
+ #endregion
+ #region ValidationRules
+ public IVEHasBrokenRules HasBrokenRules
+ {
+ get
+ {
+ IVEHasBrokenRules hasBrokenRules = null;
+ foreach (RODbRoUsage rODbRoUsage in this)
+ if ((hasBrokenRules = rODbRoUsage.HasBrokenRules) != null) return hasBrokenRules;
+ return hasBrokenRules;
+ }
+ }
+ public BrokenRulesCollection BrokenRules
+ {
+ get
+ {
+ IVEHasBrokenRules hasBrokenRules = HasBrokenRules;
+ return (hasBrokenRules != null ? hasBrokenRules.BrokenRules : null);
+ }
+ }
+ #endregion
+ #region Factory Methods
+ internal static RODbRoUsages New()
+ {
+ return new RODbRoUsages();
+ }
+ internal static RODbRoUsages Get(SafeDataReader dr)
+ {
+ return new RODbRoUsages(dr);
+ }
+ public static RODbRoUsages GetByRODbID(int rODbID)
+ {
+ try
+ {
+ return DataPortal.Fetch(new RODbIDCriteria(rODbID));
+ }
+ catch (Exception ex)
+ {
+ throw new DbCslaException("Error on RODbRoUsages.GetByRODbID", ex);
+ }
+ }
+ private RODbRoUsages()
+ {
+ MarkAsChild();
+ }
+ internal RODbRoUsages(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(RODbRoUsage.Get(dr));
+ this.RaiseListChangedEvents = true;
+ }
+ [Serializable()]
+ private class RODbIDCriteria
+ {
+ public RODbIDCriteria(int rODbID)
+ {
+ _RODbID = rODbID;
+ }
+ private int _RODbID;
+ public int RODbID
+ {
+ get { return _RODbID; }
+ set { _RODbID = value; }
+ }
+ }
+ private void DataPortal_Fetch(RODbIDCriteria criteria)
+ {
+ this.RaiseListChangedEvents = false;
+ if (_MyLog.IsDebugEnabled) _MyLog.DebugFormat("[{0}] RODbRoUsages.DataPortal_FetchRODbID", GetHashCode());
+ try
+ {
+ using (SqlConnection cn = Database.VEPROMS_SqlConnection)
+ {
+ using (SqlCommand cm = cn.CreateCommand())
+ {
+ cm.CommandType = CommandType.StoredProcedure;
+ cm.CommandText = "getRoUsagesByRODbID";
+ cm.Parameters.AddWithValue("@RODbID", criteria.RODbID);
+ using (SafeDataReader dr = new SafeDataReader(cm.ExecuteReader()))
+ {
+ while (dr.Read()) this.Add(new RODbRoUsage(dr));
+ }
+ }
+ }
+ }
+ catch (Exception ex)
+ {
+ if (_MyLog.IsErrorEnabled) _MyLog.Error("RODbRoUsages.DataPortal_FetchRODbID", ex);
+ throw new DbCslaException("RODbRoUsages.DataPortal_Fetch", ex);
+ }
+ this.RaiseListChangedEvents = true;
+ }
+ internal void Update(RODb rODb)
+ {
+ this.RaiseListChangedEvents = false;
+ try
+ {
+ // update (thus deleting) any deleted child objects
+ foreach (RODbRoUsage obj in DeletedList)
+ obj.DeleteSelf(rODb);// Deletes related record
+ // now that they are deleted, remove them from memory too
+ DeletedList.Clear();
+ // add/update any current child objects
+ foreach (RODbRoUsage obj in this)
+ {
+ if (obj.IsNew)
+ obj.Insert(rODb);
+ else
+ obj.Update(rODb);
+ }
+ }
+ finally
+ {
+ this.RaiseListChangedEvents = true;
+ }
+ }
+ #endregion
+ #region ICustomTypeDescriptor impl
+ public String GetClassName()
+ { return TypeDescriptor.GetClassName(this, true); }
+ public AttributeCollection GetAttributes()
+ { return TypeDescriptor.GetAttributes(this, true); }
+ public String GetComponentName()
+ { return TypeDescriptor.GetComponentName(this, true); }
+ public TypeConverter GetConverter()
+ { return TypeDescriptor.GetConverter(this, true); }
+ public EventDescriptor GetDefaultEvent()
+ { return TypeDescriptor.GetDefaultEvent(this, true); }
+ public PropertyDescriptor GetDefaultProperty()
+ { return TypeDescriptor.GetDefaultProperty(this, true); }
+ public object GetEditor(Type editorBaseType)
+ { return TypeDescriptor.GetEditor(this, editorBaseType, true); }
+ public EventDescriptorCollection GetEvents(Attribute[] attributes)
+ { return TypeDescriptor.GetEvents(this, attributes, true); }
+ public EventDescriptorCollection GetEvents()
+ { return TypeDescriptor.GetEvents(this, true); }
+ public object GetPropertyOwner(PropertyDescriptor pd)
+ { return this; }
+ ///
+ /// Called to get the properties of this type. Returns properties with certain
+ /// attributes. this restriction is not implemented here.
+ ///
+ ///
+ ///
+ public PropertyDescriptorCollection GetProperties(Attribute[] attributes)
+ { return GetProperties(); }
+ ///
+ /// Called to get the properties of this type.
+ ///
+ ///
+ public PropertyDescriptorCollection GetProperties()
+ {
+ // Create a collection object to hold property descriptors
+ PropertyDescriptorCollection pds = new PropertyDescriptorCollection(null);
+ // Iterate the list
+ for (int i = 0; i < this.Items.Count; i++)
+ {
+ // Create a property descriptor for the item and add to the property descriptor collection
+ RODbRoUsagesPropertyDescriptor pd = new RODbRoUsagesPropertyDescriptor(this, i);
+ pds.Add(pd);
+ }
+ // return the property descriptor collection
+ return pds;
+ }
+ #endregion
+ } // Class
+ #region Property Descriptor
+ ///
+ /// Summary description for CollectionPropertyDescriptor.
+ ///
+ public partial class RODbRoUsagesPropertyDescriptor : vlnListPropertyDescriptor
+ {
+ private RODbRoUsage Item { get { return (RODbRoUsage)_Item; } }
+ public RODbRoUsagesPropertyDescriptor(RODbRoUsages collection, int index) : base(collection, index) { ;}
+ }
+ #endregion
+ #region Converter
+ internal class RODbRoUsagesConverter : ExpandableObjectConverter
+ {
+ public override object ConvertTo(ITypeDescriptorContext context, System.Globalization.CultureInfo culture, object value, Type destType)
+ {
+ if (destType == typeof(string) && value is RODbRoUsages)
+ {
+ // Return department and department role separated by comma.
+ return ((RODbRoUsages)value).Items.Count.ToString() + " RoUsages";
+ }
+ return base.ConvertTo(context, culture, value, destType);
+ }
+ }
+ #endregion
+} // Namespace
diff --git a/PROMS/VEPROMS.CSLA.Library/Generated/ROFst.cs b/PROMS/VEPROMS.CSLA.Library/Generated/ROFst.cs
new file mode 100644
index 00000000..7d9b2075
--- /dev/null
+++ b/PROMS/VEPROMS.CSLA.Library/Generated/ROFst.cs
@@ -0,0 +1,1275 @@
+// ========================================================================
+// Copyright 2007 - 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;
+using System.ComponentModel;
+using System.Collections.Generic;
+using Csla.Validation;
+namespace VEPROMS.CSLA.Library
+{
+ ///
+ /// ROFst Generated by MyGeneration using the CSLA Object Mapping template
+ ///
+ [Serializable()]
+ [TypeConverter(typeof(ROFstConverter))]
+ public partial class ROFst : BusinessBase, IDisposable, IVEHasBrokenRules
+ {
+ #region Log4Net
+ private static readonly log4net.ILog _MyLog = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
+ #endregion
+ #region Refresh
+ private List _RefreshROFsts = new List();
+ private List _RefreshROFstAssociations = new List();
+ private List _RefreshROFstFigures = new List();
+ private void AddToRefreshList(List refreshROFsts, List refreshROFstAssociations, List refreshROFstFigures)
+ {
+ if (IsDirty)
+ refreshROFsts.Add(this);
+ if (_ROFstAssociations != null && _ROFstAssociations.IsDirty)
+ {
+ foreach (ROFstAssociation tmp in _ROFstAssociations)
+ {
+ if (tmp.IsDirty) refreshROFstAssociations.Add(tmp);
+ }
+ }
+ if (_ROFstFigures != null && _ROFstFigures.IsDirty)
+ {
+ foreach (ROFstFigure tmp in _ROFstFigures)
+ {
+ if (tmp.IsDirty) refreshROFstFigures.Add(tmp);
+ }
+ }
+ }
+ private void BuildRefreshList()
+ {
+ _RefreshROFsts = new List();
+ _RefreshROFstAssociations = new List();
+ _RefreshROFstFigures = new List();
+ AddToRefreshList(_RefreshROFsts, _RefreshROFstAssociations, _RefreshROFstFigures);
+ }
+ private void ProcessRefreshList()
+ {
+ foreach (ROFst tmp in _RefreshROFsts)
+ {
+ ROFstInfo.Refresh(tmp);
+ if (tmp._MyRODb != null) RODbInfo.Refresh(tmp._MyRODb);
+ }
+ foreach (ROFstAssociation tmp in _RefreshROFstAssociations)
+ {
+ AssociationInfo.Refresh(tmp);
+ }
+ foreach (ROFstFigure tmp in _RefreshROFstFigures)
+ {
+ FigureInfo.Refresh(tmp);
+ }
+ }
+ #endregion
+ #region Collection
+ private static List _CacheList = new List();
+ protected static void AddToCache(ROFst rOFst)
+ {
+ if (!_CacheList.Contains(rOFst)) _CacheList.Add(rOFst); // In AddToCache
+ }
+ protected static void RemoveFromCache(ROFst rOFst)
+ {
+ while (_CacheList.Contains(rOFst)) _CacheList.Remove(rOFst); // In RemoveFromCache
+ }
+ private static Dictionary> _CacheByPrimaryKey = new Dictionary>();
+ private static Dictionary> _CacheByRODbID_DTS = new Dictionary>();
+ private static void ConvertListToDictionary()
+ {
+ List remove = new List();
+ foreach (ROFst tmp in _CacheList)
+ {
+ if (!_CacheByPrimaryKey.ContainsKey(tmp.ROFstID.ToString()))
+ {
+ _CacheByPrimaryKey[tmp.ROFstID.ToString()] = new List(); // Add new list for PrimaryKey
+ _CacheByRODbID_DTS[tmp.RODbID.ToString() + "_" + tmp.DTS.ToString()] = new List(); // Add new list for RODbID_DTS
+ }
+ _CacheByPrimaryKey[tmp.ROFstID.ToString()].Add(tmp); // Add to Primary Key list
+ _CacheByRODbID_DTS[tmp.RODbID.ToString() + "_" + tmp.DTS.ToString()].Add(tmp); // Unique Index
+ remove.Add(tmp);
+ }
+ foreach (ROFst tmp in remove)
+ RemoveFromCache(tmp);
+ }
+ protected static ROFst GetCachedByPrimaryKey(int rOFstID)
+ {
+ ConvertListToDictionary();
+ string key = rOFstID.ToString();
+ if (_CacheByPrimaryKey.ContainsKey(key)) return _CacheByPrimaryKey[key][0];
+ return null;
+ }
+ protected static ROFst GetCachedByRODbID_DTS(int rODbID, DateTime dts)
+ {
+ ConvertListToDictionary();
+ string key = rODbID.ToString() + "_" + dts.ToString();
+ if (_CacheByRODbID_DTS.ContainsKey(key)) return _CacheByRODbID_DTS[key][0];
+ return null;
+ }
+ #endregion
+ #region Business Methods
+ private string _ErrorMessage = string.Empty;
+ public string ErrorMessage
+ {
+ get { return _ErrorMessage; }
+ }
+ private static int _nextROFstID = -1;
+ public static int NextROFstID
+ {
+ get { return _nextROFstID--; }
+ }
+ private int _ROFstID;
+ [System.ComponentModel.DataObjectField(true, true)]
+ public int ROFstID
+ {
+ [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
+ get
+ {
+ CanReadProperty("ROFstID", true);
+ return _ROFstID;
+ }
+ }
+ private int _RODbID;
+ public int RODbID
+ {
+ [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
+ get
+ {
+ CanReadProperty("RODbID", true);
+ if (_MyRODb != null) _RODbID = _MyRODb.RODbID;
+ return _RODbID;
+ }
+ }
+ private RODb _MyRODb;
+ public RODb MyRODb
+ {
+ [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
+ get
+ {
+ CanReadProperty("MyRODb", true);
+ if (_MyRODb == null && _RODbID != 0) _MyRODb = RODb.Get(_RODbID);
+ return _MyRODb;
+ }
+ [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
+ set
+ {
+ CanWriteProperty("MyRODb", true);
+ if (_MyRODb != value)
+ {
+ _MyRODb = value;
+ PropertyHasChanged();
+ }
+ }
+ }
+ private byte[] _ROLookup;
+ public byte[] ROLookup
+ {
+ [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
+ get
+ {
+ CanReadProperty("ROLookup", true);
+ return _ROLookup;
+ }
+ [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
+ set
+ {
+ CanWriteProperty("ROLookup", true);
+ if (_ROLookup != value)
+ {
+ _ROLookup = value;
+ PropertyHasChanged();
+ }
+ }
+ }
+ private string _Config = string.Empty;
+ public string Config
+ {
+ [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
+ get
+ {
+ CanReadProperty("Config", true);
+ return _Config;
+ }
+ [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
+ set
+ {
+ CanWriteProperty("Config", true);
+ if (value == null) value = string.Empty;
+ if (_Config != value)
+ {
+ _Config = value;
+ PropertyHasChanged();
+ }
+ }
+ }
+ private DateTime _DTS = new DateTime();
+ public DateTime DTS
+ {
+ [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
+ get
+ {
+ CanReadProperty("DTS", true);
+ return _DTS;
+ }
+ [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
+ set
+ {
+ CanWriteProperty("DTS", 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("UserID", true);
+ return _UserID;
+ }
+ [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
+ set
+ {
+ CanWriteProperty("UserID", true);
+ if (value == null) value = string.Empty;
+ if (_UserID != value)
+ {
+ _UserID = value;
+ PropertyHasChanged();
+ }
+ }
+ }
+ private byte[] _LastChanged = new byte[8];//timestamp
+ private int _ROFstAssociationCount = 0;
+ ///
+ /// Count of ROFstAssociations for this ROFst
+ ///
+ public int ROFstAssociationCount
+ {
+ [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
+ get
+ {
+ CanReadProperty("ROFstAssociationCount", true);
+ return _ROFstAssociationCount;
+ }
+ }
+ private ROFstAssociations _ROFstAssociations = null;
+ ///
+ /// Related Field
+ ///
+ [TypeConverter(typeof(ROFstAssociationsConverter))]
+ public ROFstAssociations ROFstAssociations
+ {
+ [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
+ get
+ {
+ CanReadProperty("ROFstAssociations", true);
+ if (_ROFstAssociationCount < 0 || (_ROFstAssociationCount > 0 && _ROFstAssociations == null))
+ _ROFstAssociations = ROFstAssociations.GetByROFstID(ROFstID);
+ if (_ROFstAssociationCount < 0 )
+ _ROFstAssociationCount = _ROFstAssociations == null ? 0 : _ROFstAssociations.Count;
+ if (_ROFstAssociations == null)
+ _ROFstAssociations = ROFstAssociations.New();
+ return _ROFstAssociations;
+ }
+ }
+ public void Reset_ROFstAssociations()
+ {
+ _ROFstAssociationCount = -1;
+ }
+ private int _ROFstFigureCount = 0;
+ ///
+ /// Count of ROFstFigures for this ROFst
+ ///
+ public int ROFstFigureCount
+ {
+ [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
+ get
+ {
+ CanReadProperty("ROFstFigureCount", true);
+ return _ROFstFigureCount;
+ }
+ }
+ private ROFstFigures _ROFstFigures = null;
+ ///
+ /// Related Field
+ ///
+ [TypeConverter(typeof(ROFstFiguresConverter))]
+ public ROFstFigures ROFstFigures
+ {
+ [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
+ get
+ {
+ CanReadProperty("ROFstFigures", true);
+ if (_ROFstFigureCount < 0 || (_ROFstFigureCount > 0 && _ROFstFigures == null))
+ _ROFstFigures = ROFstFigures.GetByROFstID(ROFstID);
+ if (_ROFstFigureCount < 0 )
+ _ROFstFigureCount = _ROFstFigures == null ? 0 : _ROFstFigures.Count;
+ if (_ROFstFigures == null)
+ _ROFstFigures = ROFstFigures.New();
+ return _ROFstFigures;
+ }
+ }
+ public void Reset_ROFstFigures()
+ {
+ _ROFstFigureCount = -1;
+ }
+ public override bool IsDirty
+ {
+ get { return base.IsDirty; } // || (_ROFstAssociations == null ? false : _ROFstAssociations.IsDirty) || (_ROFstFigures == null ? false : _ROFstFigures.IsDirty) || (_MyRODb == null ? false : _MyRODb.IsDirty); }
+ }
+ public override bool IsValid
+ {
+ get { return (IsNew && !IsDirty ? true : base.IsValid) && (_ROFstAssociations == null ? true : _ROFstAssociations.IsValid) && (_ROFstFigures == null ? true : _ROFstFigures.IsValid) && (_MyRODb == null ? true : _MyRODb.IsValid); }
+ }
+ // TODO: Replace base ROFst.ToString function as necessary
+ ///
+ /// Overrides Base ToString
+ ///
+ /// A string representation of current ROFst
+ //public override string ToString()
+ //{
+ // return base.ToString();
+ //}
+ // TODO: Check ROFst.GetIdValue to assure that the ID returned is unique
+ ///
+ /// Overrides Base GetIdValue - Used internally by CSLA to determine equality
+ ///
+ /// A Unique ID for the current ROFst
+ protected override object GetIdValue()
+ {
+ return _ROFstID;
+ }
+ #endregion
+ #region ValidationRules
+ [NonSerialized]
+ private bool _CheckingBrokenRules = false;
+ public IVEHasBrokenRules HasBrokenRules
+ {
+ get
+ {
+ if (_CheckingBrokenRules) return null;
+ if ((IsDirty || !IsNew) && BrokenRulesCollection.Count > 0) return this;
+ try
+ {
+ _CheckingBrokenRules = true;
+ IVEHasBrokenRules hasBrokenRules = null;
+ if (_ROFstAssociations != null && (hasBrokenRules = _ROFstAssociations.HasBrokenRules) != null) return hasBrokenRules;
+ if (_ROFstFigures != null && (hasBrokenRules = _ROFstFigures.HasBrokenRules) != null) return hasBrokenRules;
+ if (_MyRODb != null && (hasBrokenRules = _MyRODb.HasBrokenRules) != null) return hasBrokenRules;
+ return hasBrokenRules;
+ }
+ finally
+ {
+ _CheckingBrokenRules = false;
+ }
+ }
+ }
+ public BrokenRulesCollection BrokenRules
+ {
+ get
+ {
+ IVEHasBrokenRules hasBrokenRules = HasBrokenRules;
+ if (this.Equals(hasBrokenRules)) return BrokenRulesCollection;
+ return (hasBrokenRules != null ? hasBrokenRules.BrokenRules : null);
+ }
+ }
+ protected override void AddBusinessRules()
+ {
+ ValidationRules.AddRule(MyRODbRequired, "MyRODb");
+ ValidationRules.AddRule(
+ Csla.Validation.CommonRules.StringMaxLength,
+ new Csla.Validation.CommonRules.MaxLengthRuleArgs("Config", 1073741823));
+ ValidationRules.AddRule(
+ Csla.Validation.CommonRules.StringRequired, "UserID");
+ ValidationRules.AddRule(
+ Csla.Validation.CommonRules.StringMaxLength,
+ new Csla.Validation.CommonRules.MaxLengthRuleArgs("UserID", 100));
+ //ValidationRules.AddDependantProperty("x", "y");
+ _ROFstExtension.AddValidationRules(ValidationRules);
+ // TODO: Add other validation rules
+ }
+ protected override void AddInstanceBusinessRules()
+ {
+ _ROFstExtension.AddInstanceValidationRules(ValidationRules);
+ // TODO: Add other validation rules
+ }
+ private static bool MyRODbRequired(ROFst target, Csla.Validation.RuleArgs e)
+ {
+ if (target._RODbID == 0 && target._MyRODb == null) // Required field missing
+ {
+ e.Description = "Required";
+ return false;
+ }
+ return true;
+ }
+ // 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(ROFstID, "");
+ //AuthorizationRules.AllowRead(RODbID, "");
+ //AuthorizationRules.AllowRead(ROLookup, "");
+ //AuthorizationRules.AllowRead(Config, "");
+ //AuthorizationRules.AllowRead(DTS, "");
+ //AuthorizationRules.AllowRead(UserID, "");
+ //AuthorizationRules.AllowWrite(RODbID, "");
+ //AuthorizationRules.AllowWrite(ROLookup, "");
+ //AuthorizationRules.AllowWrite(Config, "");
+ //AuthorizationRules.AllowWrite(DTS, "");
+ //AuthorizationRules.AllowWrite(UserID, "");
+ _ROFstExtension.AddAuthorizationRules(AuthorizationRules);
+ }
+ protected override void AddInstanceAuthorizationRules()
+ {
+ //TODO: Who can read/write which fields
+ _ROFstExtension.AddInstanceAuthorizationRules(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;
+ }
+ ///
+ /// determines if related records (Foreign Keys) will keep this Item from being deleted
+ ///
+ public bool CanDelete
+ {
+ get
+ {
+ // Check to make sure that there are not any related records
+ int usedByCount = 0;
+ usedByCount += _ROFstAssociationCount;
+ usedByCount += _ROFstFigureCount;
+ return (usedByCount == 0);
+ }
+ }
+ 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 static int _ROFstUnique = 0;
+ protected static int ROFstUnique
+ { get { return ++_ROFstUnique; } }
+ private int _MyROFstUnique = ROFstUnique;
+ public int MyROFstUnique
+ { get { return _MyROFstUnique; } }
+ protected ROFst()
+ {/* require use of factory methods */
+ AddToCache(this);
+ }
+ public void Dispose()
+ {
+ RemoveFromDictionaries();
+ }
+ private void RemoveFromDictionaries()
+ {
+ RemoveFromCache(this);
+ if (_CacheByPrimaryKey.ContainsKey(ROFstID.ToString()))
+ {
+ List listROFst = _CacheByPrimaryKey[ROFstID.ToString()]; // Get the list of items
+ while (listROFst.Contains(this)) listROFst.Remove(this); // Remove the item from the list
+ if (listROFst.Count == 0) //If there are no items left in the list
+ _CacheByPrimaryKey.Remove(ROFstID.ToString()); // remove the list
+ }
+ string myKey;
+ myKey = null;
+ foreach (string key in _CacheByRODbID_DTS.Keys)
+ if (_CacheByRODbID_DTS[key].Contains(this))
+ myKey = key;
+ if (myKey != null)
+ {
+ List listROFst = _CacheByRODbID_DTS[myKey]; // Get the list of items
+ listROFst.Remove(this); // Remove the item from the list
+ if (listROFst.Count == 0) //If there are no items left in the list
+ _CacheByRODbID_DTS.Remove(myKey); // remove the list
+ }
+ }
+ public static ROFst New()
+ {
+ if (!CanAddObject())
+ throw new System.Security.SecurityException("User not authorized to add a ROFst");
+ try
+ {
+ return DataPortal.Create();
+ }
+ catch (Exception ex)
+ {
+ throw new DbCslaException("Error on ROFst.New", ex);
+ }
+ }
+ public static ROFst New(RODb myRODb, byte[] rOLookup)
+ {
+ ROFst tmp = ROFst.New();
+ tmp.MyRODb = myRODb;
+ tmp.ROLookup = rOLookup;
+ return tmp;
+ }
+ public static ROFst New(RODb myRODb, byte[] rOLookup, string config, DateTime dts, string userID)
+ {
+ ROFst tmp = ROFst.New();
+ tmp.MyRODb = myRODb;
+ tmp.ROLookup = rOLookup;
+ tmp.Config = config;
+ tmp.DTS = dts;
+ tmp.UserID = userID;
+ return tmp;
+ }
+ public static ROFst MakeROFst(RODb myRODb, byte[] rOLookup, string config, DateTime dts, string userID)
+ {
+ ROFst tmp = ROFst.New(myRODb, rOLookup, config, dts, userID);
+ if (tmp.IsSavable)
+ {
+ ROFst tmp2 = tmp;
+ tmp = tmp2.Save();
+ tmp2.Dispose();
+ }
+ else
+ {
+ Csla.Validation.BrokenRulesCollection brc = tmp.ValidationRules.GetBrokenRules();
+ tmp._ErrorMessage = "Failed Validation:";
+ foreach (Csla.Validation.BrokenRule br in brc)
+ {
+ tmp._ErrorMessage += "\r\n\tFailure: " + br.RuleName;
+ }
+ }
+ return tmp;
+ }
+ public static ROFst New(RODb myRODb, byte[] rOLookup, string config)
+ {
+ ROFst tmp = ROFst.New();
+ tmp.MyRODb = myRODb;
+ tmp.ROLookup = rOLookup;
+ tmp.Config = config;
+ return tmp;
+ }
+ public static ROFst MakeROFst(RODb myRODb, byte[] rOLookup, string config)
+ {
+ ROFst tmp = ROFst.New(myRODb, rOLookup, config);
+ if (tmp.IsSavable)
+ {
+ ROFst tmp2 = tmp;
+ tmp = tmp2.Save();
+ tmp2.Dispose();
+ }
+ else
+ {
+ Csla.Validation.BrokenRulesCollection brc = tmp.ValidationRules.GetBrokenRules();
+ tmp._ErrorMessage = "Failed Validation:";
+ foreach (Csla.Validation.BrokenRule br in brc)
+ {
+ tmp._ErrorMessage += "\r\n\tFailure: " + br.RuleName;
+ }
+ }
+ return tmp;
+ }
+ public static ROFst Get(int rOFstID)
+ {
+ if (!CanGetObject())
+ throw new System.Security.SecurityException("User not authorized to view a ROFst");
+ try
+ {
+ ROFst tmp = GetCachedByPrimaryKey(rOFstID);
+ if (tmp == null)
+ {
+ tmp = DataPortal.Fetch(new PKCriteria(rOFstID));
+ AddToCache(tmp);
+ }
+ if (tmp.ErrorMessage == "No Record Found")
+ {
+ tmp.Dispose(); // Clean-up ROFst
+ tmp = null;
+ }
+ return tmp;
+ }
+ catch (Exception ex)
+ {
+ throw new DbCslaException("Error on ROFst.Get", ex);
+ }
+ }
+ public static ROFst GetByRODbID_DTS(int rODbID, DateTime dts)
+ {
+ if (!CanGetObject())
+ throw new System.Security.SecurityException("User not authorized to view a ROFst");
+ try
+ {
+ ROFst tmp = GetCachedByRODbID_DTS(rODbID, dts);
+ if (tmp == null)
+ {
+ tmp = DataPortal.Fetch(new RODbID_DTSCriteria(rODbID, dts));
+ AddToCache(tmp);
+ }
+ if (tmp.ErrorMessage == "No Record Found")
+ {
+ tmp.Dispose(); // Clean-up ROFst
+ tmp = null;
+ }
+ return tmp;
+ }
+ catch (Exception ex)
+ {
+ throw new DbCslaException("Error on ROFst.GetByRODbID_DTS", ex);
+ }
+ }
+ public static ROFst Get(SafeDataReader dr)
+ {
+ if (dr.Read()) return new ROFst(dr);
+ return null;
+ }
+ internal ROFst(SafeDataReader dr)
+ {
+ ReadData(dr);
+ }
+ public static void Delete(int rOFstID)
+ {
+ if (!CanDeleteObject())
+ throw new System.Security.SecurityException("User not authorized to remove a ROFst");
+ try
+ {
+ DataPortal.Delete(new PKCriteria(rOFstID));
+ }
+ catch (Exception ex)
+ {
+ throw new DbCslaException("Error on ROFst.Delete", ex);
+ }
+ }
+ public override ROFst Save()
+ {
+ if (IsDeleted && !CanDeleteObject())
+ throw new System.Security.SecurityException("User not authorized to remove a ROFst");
+ else if (IsNew && !CanAddObject())
+ throw new System.Security.SecurityException("User not authorized to add a ROFst");
+ else if (!CanEditObject())
+ throw new System.Security.SecurityException("User not authorized to update a ROFst");
+ try
+ {
+ BuildRefreshList();
+ ROFst rOFst = base.Save();
+ RemoveFromDictionaries(); // if save is successful remove the previous Folder from the cache
+ AddToCache(rOFst);//Refresh the item in AllList
+ ProcessRefreshList();
+ return rOFst;
+ }
+ catch (Exception ex)
+ {
+ throw new DbCslaException("Error on CSLA Save", ex);
+ }
+ }
+ #endregion
+ #region Data Access Portal
+ [Serializable()]
+ protected class PKCriteria
+ {
+ private int _ROFstID;
+ public int ROFstID
+ { get { return _ROFstID; } }
+ public PKCriteria(int rOFstID)
+ {
+ _ROFstID = rOFstID;
+ }
+ }
+ [Serializable()]
+ private class RODbID_DTSCriteria
+ {
+ private int _RODbID;
+ public int RODbID
+ { get { return _RODbID; } }
+ private DateTime _DTS;
+ public DateTime DTS
+ { get { return _DTS; } }
+ public RODbID_DTSCriteria(int rODbID, DateTime dts)
+ {
+ _RODbID = rODbID;
+ _DTS = dts;
+ }
+ }
+ // TODO: If Create needs to access DB - It should not be marked RunLocal
+ [RunLocal()]
+ private new void DataPortal_Create()
+ {
+ _ROFstID = NextROFstID;
+ // Database Defaults
+ _DTS = _ROFstExtension.DefaultDTS;
+ _UserID = _ROFstExtension.DefaultUserID;
+ // TODO: Add any defaults that are necessary
+ ValidationRules.CheckRules();
+ }
+ private void ReadData(SafeDataReader dr)
+ {
+ if (_MyLog.IsDebugEnabled) _MyLog.DebugFormat("[{0}] ROFst.ReadData", GetHashCode());
+ try
+ {
+ _ROFstID = dr.GetInt32("ROFstID");
+ _RODbID = dr.GetInt32("RODbID");
+ _ROLookup = (byte[])dr.GetValue("ROLookup");
+ _Config = dr.GetString("Config");
+ _DTS = dr.GetDateTime("DTS");
+ _UserID = dr.GetString("UserID");
+ dr.GetBytes("LastChanged", 0, _LastChanged, 0, 8);
+ _ROFstAssociationCount = dr.GetInt32("AssociationCount");
+ _ROFstFigureCount = dr.GetInt32("FigureCount");
+ MarkOld();
+ }
+ catch (Exception ex)
+ {
+ if (_MyLog.IsErrorEnabled) _MyLog.Error("ROFst.ReadData", ex);
+ _ErrorMessage = ex.Message;
+ throw new DbCslaException("ROFst.ReadData", ex);
+ }
+ }
+ private void DataPortal_Fetch(PKCriteria criteria)
+ {
+ if (_MyLog.IsDebugEnabled) _MyLog.DebugFormat("[{0}] ROFst.DataPortal_Fetch", GetHashCode());
+ try
+ {
+ using (SqlConnection cn = Database.VEPROMS_SqlConnection)
+ {
+ ApplicationContext.LocalContext["cn"] = cn;
+ using (SqlCommand cm = cn.CreateCommand())
+ {
+ cm.CommandType = CommandType.StoredProcedure;
+ cm.CommandText = "getROFst";
+ cm.Parameters.AddWithValue("@ROFstID", criteria.ROFstID);
+ using (SafeDataReader dr = new SafeDataReader(cm.ExecuteReader()))
+ {
+ if (!dr.Read())
+ {
+ _ErrorMessage = "No Record Found";
+ return;
+ }
+ ReadData(dr);
+ // load child objects
+ dr.NextResult();
+ _ROFstAssociations = ROFstAssociations.Get(dr);
+ // load child objects
+ dr.NextResult();
+ _ROFstFigures = ROFstFigures.Get(dr);
+ }
+ }
+ // removing of item only needed for local data portal
+ if (ApplicationContext.ExecutionLocation == ApplicationContext.ExecutionLocations.Client)
+ ApplicationContext.LocalContext.Remove("cn");
+ }
+ }
+ catch (Exception ex)
+ {
+ if (_MyLog.IsErrorEnabled) _MyLog.Error("ROFst.DataPortal_Fetch", ex);
+ _ErrorMessage = ex.Message;
+ throw new DbCslaException("ROFst.DataPortal_Fetch", ex);
+ }
+ }
+ private void DataPortal_Fetch(RODbID_DTSCriteria criteria)
+ {
+ if (_MyLog.IsDebugEnabled) _MyLog.DebugFormat("[{0}] ROFst.DataPortal_Fetch", GetHashCode());
+ try
+ {
+ using (SqlConnection cn = Database.VEPROMS_SqlConnection)
+ {
+ ApplicationContext.LocalContext["cn"] = cn;
+ using (SqlCommand cm = cn.CreateCommand())
+ {
+ cm.CommandType = CommandType.StoredProcedure;
+ cm.CommandText = "getROFstByRODbID_DTS";
+ cm.Parameters.AddWithValue("@RODbID", criteria.RODbID);
+ if (criteria.DTS.Year >= 1753 && criteria.DTS.Year <= 9999) cm.Parameters.AddWithValue("@DTS", criteria.DTS);
+ using (SafeDataReader dr = new SafeDataReader(cm.ExecuteReader()))
+ {
+ if (!dr.Read())
+ {
+ _ErrorMessage = "No Record Found";
+ return;
+ }
+ ReadData(dr);
+ }
+ }
+ // removing of item only needed for local data portal
+ if (ApplicationContext.ExecutionLocation == ApplicationContext.ExecutionLocations.Client)
+ ApplicationContext.LocalContext.Remove("cn");
+ }
+ }
+ catch (Exception ex)
+ {
+ if (_MyLog.IsErrorEnabled) _MyLog.Error("ROFst.DataPortal_Fetch", ex);
+ _ErrorMessage = ex.Message;
+ throw new DbCslaException("ROFst.DataPortal_Fetch", ex);
+ }
+ }
+ [Transactional(TransactionalTypes.TransactionScope)]
+ protected override void DataPortal_Insert()
+ {
+ try
+ {
+ using (SqlConnection cn = Database.VEPROMS_SqlConnection)
+ {
+ ApplicationContext.LocalContext["cn"] = cn;
+ SQLInsert();
+ // removing of item only needed for local data portal
+ if (ApplicationContext.ExecutionLocation == ApplicationContext.ExecutionLocations.Client)
+ ApplicationContext.LocalContext.Remove("cn");
+ }
+ }
+ catch (Exception ex)
+ {
+ if (_MyLog.IsErrorEnabled) _MyLog.Error("ROFst.DataPortal_Insert", ex);
+ _ErrorMessage = ex.Message;
+ throw new DbCslaException("ROFst.DataPortal_Insert", ex);
+ }
+ finally
+ {
+ if (_MyLog.IsDebugEnabled) _MyLog.DebugFormat("[{0}] ROFst.DataPortal_Insert", GetHashCode());
+ }
+ }
+ [Transactional(TransactionalTypes.TransactionScope)]
+ internal void SQLInsert()
+ {
+ if (!this.IsDirty) return;
+ try
+ {
+ if (_MyRODb != null) _MyRODb.Update();
+ SqlConnection cn = (SqlConnection)ApplicationContext.LocalContext["cn"];
+ using (SqlCommand cm = cn.CreateCommand())
+ {
+ cm.CommandType = CommandType.StoredProcedure;
+ cm.CommandText = "addROFst";
+ // Input All Fields - Except Calculated Columns
+ cm.Parameters.AddWithValue("@RODbID", RODbID);
+ cm.Parameters.AddWithValue("@ROLookup", _ROLookup);
+ cm.Parameters.AddWithValue("@Config", _Config);
+ if (_DTS.Year >= 1753 && _DTS.Year <= 9999) cm.Parameters.AddWithValue("@DTS", _DTS);
+ cm.Parameters.AddWithValue("@UserID", _UserID);
+ // Output Calculated Columns
+ SqlParameter param_ROFstID = new SqlParameter("@newROFstID", SqlDbType.Int);
+ param_ROFstID.Direction = ParameterDirection.Output;
+ cm.Parameters.Add(param_ROFstID);
+ 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
+ _ROFstID = (int)cm.Parameters["@newROFstID"].Value;
+ _LastChanged = (byte[])cm.Parameters["@newLastChanged"].Value;
+ }
+ MarkOld();
+ // update child objects
+ if (_ROFstAssociations != null) _ROFstAssociations.Update(this);
+ if (_ROFstFigures != null) _ROFstFigures.Update(this);
+ if (_MyLog.IsDebugEnabled) _MyLog.DebugFormat("[{0}] ROFst.SQLInsert", GetHashCode());
+ }
+ catch (Exception ex)
+ {
+ if (_MyLog.IsErrorEnabled) _MyLog.Error("ROFst.SQLInsert", ex);
+ _ErrorMessage = ex.Message;
+ throw new DbCslaException("ROFst.SQLInsert", ex);
+ }
+ }
+ [Transactional(TransactionalTypes.TransactionScope)]
+ public static byte[] Add(SqlConnection cn, ref int rOFstID, RODb myRODb, byte[] rOLookup, string config, DateTime dts, string userID)
+ {
+ if (_MyLog.IsDebugEnabled) _MyLog.DebugFormat("[{0}] ROFst.Add", 0);
+ try
+ {
+ using (SqlCommand cm = cn.CreateCommand())
+ {
+ cm.CommandType = CommandType.StoredProcedure;
+ cm.CommandText = "addROFst";
+ // Input All Fields - Except Calculated Columns
+ cm.Parameters.AddWithValue("@RODbID", myRODb.RODbID);
+ cm.Parameters.AddWithValue("@ROLookup", rOLookup);
+ cm.Parameters.AddWithValue("@Config", config);
+ if (dts.Year >= 1753 && dts.Year <= 9999) cm.Parameters.AddWithValue("@DTS", dts);
+ cm.Parameters.AddWithValue("@UserID", userID);
+ // Output Calculated Columns
+ SqlParameter param_ROFstID = new SqlParameter("@newROFstID", SqlDbType.Int);
+ param_ROFstID.Direction = ParameterDirection.Output;
+ cm.Parameters.Add(param_ROFstID);
+ 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
+ rOFstID = (int)cm.Parameters["@newROFstID"].Value;
+ return (byte[])cm.Parameters["@newLastChanged"].Value;
+ }
+ }
+ catch (Exception ex)
+ {
+ if (_MyLog.IsErrorEnabled) _MyLog.Error("ROFst.Add", ex);
+ throw new DbCslaException("ROFst.Add", ex);
+ }
+ }
+ [Transactional(TransactionalTypes.TransactionScope)]
+ protected override void DataPortal_Update()
+ {
+ if (!IsDirty) return; // If not dirty - nothing to do
+ if (_MyLog.IsDebugEnabled) _MyLog.DebugFormat("[{0}] ROFst.DataPortal_Update", GetHashCode());
+ try
+ {
+ using (SqlConnection cn = Database.VEPROMS_SqlConnection)
+ {
+ ApplicationContext.LocalContext["cn"] = cn;
+ SQLUpdate();
+ // removing of item only needed for local data portal
+ if (ApplicationContext.ExecutionLocation == ApplicationContext.ExecutionLocations.Client)
+ ApplicationContext.LocalContext.Remove("cn");
+ }
+ }
+ catch (Exception ex)
+ {
+ if (_MyLog.IsErrorEnabled) _MyLog.Error("ROFst.DataPortal_Update", ex);
+ _ErrorMessage = ex.Message;
+ if (!ex.Message.EndsWith("has been edited by another user.")) throw ex;
+ }
+ }
+ [Transactional(TransactionalTypes.TransactionScope)]
+ internal void SQLUpdate()
+ {
+ if (!IsDirty) return; // If not dirty - nothing to do
+ if (_MyLog.IsDebugEnabled) _MyLog.DebugFormat("[{0}] ROFst.SQLUpdate", GetHashCode());
+ try
+ {
+ if (_MyRODb != null) _MyRODb.Update();
+ SqlConnection cn = (SqlConnection)ApplicationContext.LocalContext["cn"];
+ if (base.IsDirty)
+ {
+ using (SqlCommand cm = cn.CreateCommand())
+ {
+ cm.CommandType = CommandType.StoredProcedure;
+ cm.CommandText = "updateROFst";
+ // All Fields including Calculated Fields
+ cm.Parameters.AddWithValue("@ROFstID", _ROFstID);
+ cm.Parameters.AddWithValue("@RODbID", RODbID);
+ cm.Parameters.AddWithValue("@ROLookup", _ROLookup);
+ cm.Parameters.AddWithValue("@Config", _Config);
+ if (_DTS.Year >= 1753 && _DTS.Year <= 9999) 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;
+ }
+ }
+ MarkOld();
+ // use the open connection to update child objects
+ if (_ROFstAssociations != null) _ROFstAssociations.Update(this);
+ if (_ROFstFigures != null) _ROFstFigures.Update(this);
+ }
+ catch (Exception ex)
+ {
+ if (_MyLog.IsErrorEnabled) _MyLog.Error("ROFst.SQLUpdate", ex);
+ _ErrorMessage = ex.Message;
+ if (!ex.Message.EndsWith("has been edited by another user.")) throw ex;
+ }
+ }
+ internal void Update()
+ {
+ if (!this.IsDirty) return;
+ if (base.IsDirty)
+ {
+ SqlConnection cn = (SqlConnection)ApplicationContext.LocalContext["cn"];
+ if (IsNew)
+ _LastChanged = ROFst.Add(cn, ref _ROFstID, _MyRODb, _ROLookup, _Config, _DTS, _UserID);
+ else
+ _LastChanged = ROFst.Update(cn, ref _ROFstID, _MyRODb, _ROLookup, _Config, _DTS, _UserID, ref _LastChanged);
+ MarkOld();
+ }
+ if (_ROFstAssociations != null) _ROFstAssociations.Update(this);
+ if (_ROFstFigures != null) _ROFstFigures.Update(this);
+ }
+ [Transactional(TransactionalTypes.TransactionScope)]
+ public static byte[] Update(SqlConnection cn, ref int rOFstID, RODb myRODb, byte[] rOLookup, string config, DateTime dts, string userID, ref byte[] lastChanged)
+ {
+ if (_MyLog.IsDebugEnabled) _MyLog.DebugFormat("[{0}] ROFst.Update", 0);
+ try
+ {
+ using (SqlCommand cm = cn.CreateCommand())
+ {
+ cm.CommandType = CommandType.StoredProcedure;
+ cm.CommandText = "updateROFst";
+ // Input All Fields - Except Calculated Columns
+ cm.Parameters.AddWithValue("@ROFstID", rOFstID);
+ cm.Parameters.AddWithValue("@RODbID", myRODb.RODbID);
+ cm.Parameters.AddWithValue("@ROLookup", rOLookup);
+ cm.Parameters.AddWithValue("@Config", config);
+ if (dts.Year >= 1753 && dts.Year <= 9999) 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)
+ {
+ if (_MyLog.IsErrorEnabled) _MyLog.Error("ROFst.Update", ex);
+ throw new DbCslaException("ROFst.Update", ex);
+ }
+ }
+ [Transactional(TransactionalTypes.TransactionScope)]
+ protected override void DataPortal_DeleteSelf()
+ {
+ DataPortal_Delete(new PKCriteria(_ROFstID));
+ }
+ [Transactional(TransactionalTypes.TransactionScope)]
+ private void DataPortal_Delete(PKCriteria criteria)
+ {
+ if (_MyLog.IsDebugEnabled) _MyLog.DebugFormat("[{0}] ROFst.DataPortal_Delete", GetHashCode());
+ try
+ {
+ using (SqlConnection cn = Database.VEPROMS_SqlConnection)
+ {
+ using (SqlCommand cm = cn.CreateCommand())
+ {
+ cm.CommandType = CommandType.StoredProcedure;
+ cm.CommandText = "deleteROFst";
+ cm.Parameters.AddWithValue("@ROFstID", criteria.ROFstID);
+ cm.ExecuteNonQuery();
+ }
+ }
+ }
+ catch (Exception ex)
+ {
+ if (_MyLog.IsErrorEnabled) _MyLog.Error("ROFst.DataPortal_Delete", ex);
+ _ErrorMessage = ex.Message;
+ throw new DbCslaException("ROFst.DataPortal_Delete", ex);
+ }
+ }
+ [Transactional(TransactionalTypes.TransactionScope)]
+ public static void Remove(SqlConnection cn, int rOFstID)
+ {
+ if (_MyLog.IsDebugEnabled) _MyLog.DebugFormat("[{0}] ROFst.Remove", 0);
+ try
+ {
+ using (SqlCommand cm = cn.CreateCommand())
+ {
+ cm.CommandType = CommandType.StoredProcedure;
+ cm.CommandText = "deleteROFst";
+ // Input PK Fields
+ cm.Parameters.AddWithValue("@ROFstID", rOFstID);
+ // TODO: Define any additional output parameters
+ cm.ExecuteNonQuery();
+ }
+ }
+ catch (Exception ex)
+ {
+ if (_MyLog.IsErrorEnabled) _MyLog.Error("ROFst.Remove", ex);
+ throw new DbCslaException("ROFst.Remove", ex);
+ }
+ }
+ #endregion
+ #region Exists
+ public static bool Exists(int rOFstID)
+ {
+ ExistsCommand result;
+ try
+ {
+ result = DataPortal.Execute(new ExistsCommand(rOFstID));
+ return result.Exists;
+ }
+ catch (Exception ex)
+ {
+ throw new DbCslaException("Error on ROFst.Exists", ex);
+ }
+ }
+ [Serializable()]
+ private class ExistsCommand : CommandBase
+ {
+ private int _ROFstID;
+ private bool _exists;
+ public bool Exists
+ {
+ get { return _exists; }
+ }
+ public ExistsCommand(int rOFstID)
+ {
+ _ROFstID = rOFstID;
+ }
+ protected override void DataPortal_Execute()
+ {
+ if (_MyLog.IsDebugEnabled) _MyLog.DebugFormat("[{0}] ROFst.DataPortal_Execute", GetHashCode());
+ try
+ {
+ using (SqlConnection cn = Database.VEPROMS_SqlConnection)
+ {
+ cn.Open();
+ using (SqlCommand cm = cn.CreateCommand())
+ {
+ cm.CommandType = CommandType.StoredProcedure;
+ cm.CommandText = "existsROFst";
+ cm.Parameters.AddWithValue("@ROFstID", _ROFstID);
+ int count = (int)cm.ExecuteScalar();
+ _exists = (count > 0);
+ }
+ }
+ }
+ catch (Exception ex)
+ {
+ if (_MyLog.IsErrorEnabled) _MyLog.Error("ROFst.DataPortal_Execute", ex);
+ throw new DbCslaException("ROFst.DataPortal_Execute", ex);
+ }
+ }
+ }
+ #endregion
+ // Standard Default Code
+ #region extension
+ ROFstExtension _ROFstExtension = new ROFstExtension();
+ [Serializable()]
+ partial class ROFstExtension : extensionBase
+ {
+ }
+ [Serializable()]
+ class extensionBase
+ {
+ // Default Values
+ 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
+ }
+ // Instance Authorization Rules
+ public virtual void AddInstanceAuthorizationRules(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
+ }
+ // InstanceValidation Rules
+ public virtual void AddInstanceValidationRules(Csla.Validation.ValidationRules rules)
+ {
+ // Needs to be overriden to add new validation rules
+ }
+ }
+ #endregion
+ } // Class
+ #region Converter
+ internal class ROFstConverter : ExpandableObjectConverter
+ {
+ public override object ConvertTo(ITypeDescriptorContext context, System.Globalization.CultureInfo culture, object value, Type destType)
+ {
+ if (destType == typeof(string) && value is ROFst)
+ {
+ // Return the ToString value
+ return ((ROFst)value).ToString();
+ }
+ return base.ConvertTo(context, culture, value, destType);
+ }
+ }
+ #endregion
+} // Namespace
+
+
+//// The following is a sample Extension File. You can use it to create ROFstExt.cs
+//using System;
+//using System.Collections.Generic;
+//using System.Text;
+//using Csla;
+
+//namespace VEPROMS.CSLA.Library
+//{
+// public partial class ROFst
+// {
+// partial class ROFstExtension : extensionBase
+// {
+// // TODO: Override automatic defaults
+// 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, "");
+// }
+// public new void AddInstanceAuthorizationRules(Csla.Security.AuthorizationRules rules)
+// {
+// //rules.AllowInstanceRead(Dbid, "");
+// }
+// public new void AddValidationRules(Csla.Validation.ValidationRules rules)
+// {
+// rules.AddRule(
+// Csla.Validation.CommonRules.StringMaxLength,
+// new Csla.Validation.CommonRules.MaxLengthRuleArgs("Name", 100));
+// }
+// public new void AddInstanceValidationRules(Csla.Validation.ValidationRules rules)
+// {
+// rules.AddInstanceRule(/* Instance Validation Rule */);
+// }
+// }
+// }
+//}
diff --git a/PROMS/VEPROMS.CSLA.Library/Generated/ROFstAssociation.cs b/PROMS/VEPROMS.CSLA.Library/Generated/ROFstAssociation.cs
new file mode 100644
index 00000000..af4b61a5
--- /dev/null
+++ b/PROMS/VEPROMS.CSLA.Library/Generated/ROFstAssociation.cs
@@ -0,0 +1,573 @@
+// ========================================================================
+// Copyright 2007 - 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;
+using System.ComponentModel;
+using Csla.Validation;
+namespace VEPROMS.CSLA.Library
+{
+ ///
+ /// ROFstAssociation Generated by MyGeneration using the CSLA Object Mapping template
+ ///
+ [Serializable()]
+ [TypeConverter(typeof(ROFstAssociationConverter))]
+ public partial class ROFstAssociation : BusinessBase, IVEHasBrokenRules
+ {
+ #region Log4Net
+ private static readonly log4net.ILog _MyLog = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
+ #endregion
+ #region Business Methods
+ private string _ErrorMessage = string.Empty;
+ public string ErrorMessage
+ {
+ get { return _ErrorMessage; }
+ }
+ private int _AssociationID;
+ [System.ComponentModel.DataObjectField(true, true)]
+ public int AssociationID
+ {
+ [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
+ get
+ {
+ CanReadProperty("AssociationID", true);
+ if (_MyAssociation != null) _AssociationID = _MyAssociation.AssociationID;
+ return _AssociationID;
+ }
+ }
+ private Association _MyAssociation;
+ [System.ComponentModel.DataObjectField(true, true)]
+ public Association MyAssociation
+ {
+ [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
+ get
+ {
+ CanReadProperty("MyAssociation", true);
+ if (_MyAssociation == null && _AssociationID != 0) _MyAssociation = Association.Get(_AssociationID);
+ return _MyAssociation;
+ }
+ }
+ private int _VersionID;
+ public int VersionID
+ {
+ [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
+ get
+ {
+ CanReadProperty("VersionID", true);
+ if (_MyDocVersion != null) _VersionID = _MyDocVersion.VersionID;
+ return _VersionID;
+ }
+ }
+ private DocVersion _MyDocVersion;
+ public DocVersion MyDocVersion
+ {
+ [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
+ get
+ {
+ CanReadProperty("MyDocVersion", true);
+ if (_MyDocVersion == null && _VersionID != 0) _MyDocVersion = DocVersion.Get(_VersionID);
+ return _MyDocVersion;
+ }
+ [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
+ set
+ {
+ CanWriteProperty("MyDocVersion", true);
+ if (_MyDocVersion != value)
+ {
+ _MyDocVersion = value;
+ PropertyHasChanged();
+ }
+ }
+ }
+ private string _Config = string.Empty;
+ public string Config
+ {
+ [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
+ get
+ {
+ CanReadProperty("Config", true);
+ return _Config;
+ }
+ [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
+ set
+ {
+ CanWriteProperty("Config", true);
+ if (value == null) value = string.Empty;
+ if (_Config != value)
+ {
+ _Config = value;
+ PropertyHasChanged();
+ }
+ }
+ }
+ private DateTime _DTS = new DateTime();
+ public DateTime DTS
+ {
+ [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
+ get
+ {
+ CanReadProperty("DTS", true);
+ return _DTS;
+ }
+ [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
+ set
+ {
+ CanWriteProperty("DTS", 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("UserID", true);
+ return _UserID;
+ }
+ [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
+ set
+ {
+ CanWriteProperty("UserID", true);
+ if (value == null) value = string.Empty;
+ if (_UserID != value)
+ {
+ _UserID = value;
+ PropertyHasChanged();
+ }
+ }
+ }
+ private byte[] _LastChanged = new byte[8];//timestamp
+ private int _DocVersion_FolderID;
+ public int DocVersion_FolderID
+ {
+ [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
+ get
+ {
+ CanReadProperty("DocVersion_FolderID", true);
+ return _DocVersion_FolderID;
+ }
+ }
+ private int _DocVersion_VersionType;
+ ///
+ /// 0 Working Draft, 1 Temporary, 128 Revision, 129 Approved (Greater than 127 - non editable)
+ ///
+ public int DocVersion_VersionType
+ {
+ [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
+ get
+ {
+ CanReadProperty("DocVersion_VersionType", true);
+ return _DocVersion_VersionType;
+ }
+ }
+ private string _DocVersion_Name = string.Empty;
+ public string DocVersion_Name
+ {
+ [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
+ get
+ {
+ CanReadProperty("DocVersion_Name", true);
+ return _DocVersion_Name;
+ }
+ }
+ private string _DocVersion_Title = string.Empty;
+ public string DocVersion_Title
+ {
+ [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
+ get
+ {
+ CanReadProperty("DocVersion_Title", true);
+ return _DocVersion_Title;
+ }
+ }
+ private int? _DocVersion_ItemID;
+ public int? DocVersion_ItemID
+ {
+ [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
+ get
+ {
+ CanReadProperty("DocVersion_ItemID", true);
+ return _DocVersion_ItemID;
+ }
+ }
+ private int? _DocVersion_FormatID;
+ public int? DocVersion_FormatID
+ {
+ [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
+ get
+ {
+ CanReadProperty("DocVersion_FormatID", true);
+ return _DocVersion_FormatID;
+ }
+ }
+ private string _DocVersion_Config = string.Empty;
+ public string DocVersion_Config
+ {
+ [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
+ get
+ {
+ CanReadProperty("DocVersion_Config", true);
+ return _DocVersion_Config;
+ }
+ }
+ private DateTime _DocVersion_DTS = new DateTime();
+ public DateTime DocVersion_DTS
+ {
+ [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
+ get
+ {
+ CanReadProperty("DocVersion_DTS", true);
+ return _DocVersion_DTS;
+ }
+ }
+ private string _DocVersion_UserID = string.Empty;
+ public string DocVersion_UserID
+ {
+ [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
+ get
+ {
+ CanReadProperty("DocVersion_UserID", true);
+ return _DocVersion_UserID;
+ }
+ }
+ // TODO: Check ROFstAssociation.GetIdValue to assure that the ID returned is unique
+ ///
+ /// Overrides Base GetIdValue - Used internally by CSLA to determine equality
+ ///
+ /// A Unique ID for the current ROFstAssociation
+ protected override object GetIdValue()
+ {
+ return _AssociationID;
+ }
+ // TODO: Replace base ROFstAssociation.ToString function as necessary
+ ///
+ /// Overrides Base ToString
+ ///
+ /// A string representation of current ROFstAssociation
+ //public override string ToString()
+ //{
+ // return base.ToString();
+ //}
+ public override bool IsDirty
+ {
+ get { return base.IsDirty || (_MyDocVersion == null ? false : _MyDocVersion.IsDirty); }
+ }
+ public override bool IsValid
+ {
+ get { return true;} // (IsNew && !IsDirty ? true : base.IsValid) && (_MyDocVersion == null ? true : _MyDocVersion.IsValid); }
+ }
+ #endregion
+ #region ValidationRules
+ [NonSerialized]
+ private bool _CheckingBrokenRules = false;
+ public IVEHasBrokenRules HasBrokenRules
+ {
+ get
+ {
+ if (_CheckingBrokenRules) return null;
+ if (BrokenRulesCollection.Count > 0) return this;
+ try
+ {
+ _CheckingBrokenRules = true;
+ IVEHasBrokenRules hasBrokenRules = null;
+ if (_MyDocVersion != null && (hasBrokenRules = _MyDocVersion.HasBrokenRules) != null) return hasBrokenRules;
+ return hasBrokenRules;
+ }
+ finally
+ {
+ _CheckingBrokenRules = false;
+ }
+ }
+ }
+ public BrokenRulesCollection BrokenRules
+ {
+ get
+ {
+ IVEHasBrokenRules hasBrokenRules = HasBrokenRules;
+ if (this.Equals(hasBrokenRules)) return BrokenRulesCollection;
+ return (hasBrokenRules != null ? hasBrokenRules.BrokenRules : null);
+ }
+ }
+ protected override void AddBusinessRules()
+ {
+ ValidationRules.AddRule(MyDocVersionRequired, "MyDocVersion");
+ ValidationRules.AddRule(
+ Csla.Validation.CommonRules.StringMaxLength,
+ new Csla.Validation.CommonRules.MaxLengthRuleArgs("Config", 1073741823));
+ ValidationRules.AddRule(
+ Csla.Validation.CommonRules.StringRequired, "UserID");
+ ValidationRules.AddRule(
+ Csla.Validation.CommonRules.StringMaxLength,
+ new Csla.Validation.CommonRules.MaxLengthRuleArgs("UserID", 100));
+ // TODO: Add other validation rules
+ }
+ private static bool MyDocVersionRequired(ROFstAssociation target, Csla.Validation.RuleArgs e)
+ {
+ if (target._VersionID == 0 && target._MyDocVersion == null) // Required field missing
+ {
+ e.Description = "Required";
+ return false;
+ }
+ return true;
+ }
+ // 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(AssociationID, "");
+ //AuthorizationRules.AllowRead(VersionID, "");
+ //AuthorizationRules.AllowWrite(VersionID, "");
+ //AuthorizationRules.AllowRead(Config, "");
+ //AuthorizationRules.AllowWrite(Config, "");
+ //AuthorizationRules.AllowRead(DTS, "");
+ //AuthorizationRules.AllowWrite(DTS, "");
+ //AuthorizationRules.AllowRead(UserID, "");
+ //AuthorizationRules.AllowWrite(UserID, "");
+ }
+ 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; } }
+ internal static ROFstAssociation New(DocVersion myDocVersion)
+ {
+ return new ROFstAssociation(myDocVersion);
+ }
+ internal static ROFstAssociation Get(SafeDataReader dr)
+ {
+ return new ROFstAssociation(dr);
+ }
+ public ROFstAssociation()
+ {
+ MarkAsChild();
+ _AssociationID = Association.NextAssociationID;
+ _DTS = _ROFstAssociationExtension.DefaultDTS;
+ _UserID = _ROFstAssociationExtension.DefaultUserID;
+ ValidationRules.CheckRules();
+ }
+ private ROFstAssociation(DocVersion myDocVersion)
+ {
+ MarkAsChild();
+ // TODO: Add any initialization & defaults
+ _DTS = _ROFstAssociationExtension.DefaultDTS;
+ _UserID = _ROFstAssociationExtension.DefaultUserID;
+ _MyDocVersion = myDocVersion;
+ ValidationRules.CheckRules();
+ }
+ internal ROFstAssociation(SafeDataReader dr)
+ {
+ MarkAsChild();
+ Fetch(dr);
+ }
+ #endregion
+ #region Data Access Portal
+ private void Fetch(SafeDataReader dr)
+ {
+ if (_MyLog.IsDebugEnabled) _MyLog.DebugFormat("[{0}] ROFstAssociation.FetchDR", GetHashCode());
+ try
+ {
+ _AssociationID = dr.GetInt32("AssociationID");
+ _VersionID = dr.GetInt32("VersionID");
+ _Config = dr.GetString("Config");
+ _DTS = dr.GetDateTime("DTS");
+ _UserID = dr.GetString("UserID");
+ dr.GetBytes("LastChanged", 0, _LastChanged, 0, 8);
+ _DocVersion_FolderID = dr.GetInt32("DocVersion_FolderID");
+ _DocVersion_VersionType = dr.GetInt32("DocVersion_VersionType");
+ _DocVersion_Name = dr.GetString("DocVersion_Name");
+ _DocVersion_Title = dr.GetString("DocVersion_Title");
+ _DocVersion_ItemID = (int?)dr.GetValue("DocVersion_ItemID");
+ _DocVersion_FormatID = (int?)dr.GetValue("DocVersion_FormatID");
+ _DocVersion_Config = dr.GetString("DocVersion_Config");
+ _DocVersion_DTS = dr.GetDateTime("DocVersion_DTS");
+ _DocVersion_UserID = dr.GetString("DocVersion_UserID");
+ }
+ catch (Exception ex) // FKItem Fetch
+ {
+ if (_MyLog.IsErrorEnabled) _MyLog.Error("ROFstAssociation.FetchDR", ex);
+ throw new DbCslaException("ROFstAssociation.Fetch", ex);
+ }
+ MarkOld();
+ }
+ internal void Insert(ROFst myROFst)
+ {
+ // if we're not dirty then don't update the database
+ if (!this.IsDirty) return;
+ SqlConnection cn = (SqlConnection)ApplicationContext.LocalContext["cn"];
+ _LastChanged = Association.Add(cn, ref _AssociationID, _MyDocVersion, myROFst, _Config, _DTS, _UserID);
+ MarkOld();
+ }
+ internal void Update(ROFst myROFst)
+ {
+ // if we're not dirty then don't update the database
+ if (!this.IsDirty) return;
+ SqlConnection cn = (SqlConnection)ApplicationContext.LocalContext["cn"];
+ _LastChanged = Association.Update(cn, ref _AssociationID, _MyDocVersion, myROFst, _Config, _DTS, _UserID, ref _LastChanged);
+ MarkOld();
+ }
+ internal void DeleteSelf(ROFst myROFst)
+ {
+ // if we're not dirty then don't update the database
+ if (!this.IsDirty) return;
+ // if we're new then don't update the database
+ if (this.IsNew) return;
+ SqlConnection cn = (SqlConnection)ApplicationContext.LocalContext["cn"];
+ Association.Remove(cn, _AssociationID);
+ MarkNew();
+ }
+ #endregion
+ // Standard Default Code
+ #region extension
+ ROFstAssociationExtension _ROFstAssociationExtension = new ROFstAssociationExtension();
+ [Serializable()]
+ partial class ROFstAssociationExtension : extensionBase
+ {
+ }
+ [Serializable()]
+ class extensionBase
+ {
+ // Default Values
+ 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
+ }
+ // Instance Authorization Rules
+ public virtual void AddInstanceAuthorizationRules(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
+ }
+ // InstanceValidation Rules
+ public virtual void AddInstanceValidationRules(Csla.Validation.ValidationRules rules)
+ {
+ // Needs to be overriden to add new validation rules
+ }
+ }
+ #endregion
+ } // Class
+ #region Converter
+ internal class ROFstAssociationConverter : ExpandableObjectConverter
+ {
+ public override object ConvertTo(ITypeDescriptorContext context, System.Globalization.CultureInfo culture, object value, Type destType)
+ {
+ if (destType == typeof(string) && value is ROFstAssociation)
+ {
+ // Return the ToString value
+ return ((ROFstAssociation)value).ToString();
+ }
+ return base.ConvertTo(context, culture, value, destType);
+ }
+ }
+ #endregion
+} // Namespace
+
+
+//// The following is a sample Extension File. You can use it to create ROFstAssociationExt.cs
+//using System;
+//using System.Collections.Generic;
+//using System.Text;
+//using Csla;
+
+//namespace VEPROMS.CSLA.Library
+//{
+// public partial class ROFstAssociation
+// {
+// partial class ROFstAssociationExtension : extensionBase
+// {
+// // TODO: Override automatic defaults
+// 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, "");
+// }
+// public new void AddInstanceAuthorizationRules(Csla.Security.AuthorizationRules rules)
+// {
+// //rules.AllowInstanceRead(Dbid, "");
+// }
+// public new void AddValidationRules(Csla.Validation.ValidationRules rules)
+// {
+// rules.AddRule(
+// Csla.Validation.CommonRules.StringMaxLength,
+// new Csla.Validation.CommonRules.MaxLengthRuleArgs("Name", 100));
+// }
+// public new void AddInstanceValidationRules(Csla.Validation.ValidationRules rules)
+// {
+// rules.AddInstanceRule(/* Instance Validation Rule */);
+// }
+// }
+// }
+//}
diff --git a/PROMS/VEPROMS.CSLA.Library/Generated/ROFstAssociations.cs b/PROMS/VEPROMS.CSLA.Library/Generated/ROFstAssociations.cs
new file mode 100644
index 00000000..099b0032
--- /dev/null
+++ b/PROMS/VEPROMS.CSLA.Library/Generated/ROFstAssociations.cs
@@ -0,0 +1,309 @@
+// ========================================================================
+// Copyright 2007 - 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;
+using System.ComponentModel;
+using Csla.Validation;
+namespace VEPROMS.CSLA.Library
+{
+ ///
+ /// ROFstAssociations Generated by MyGeneration using the CSLA Object Mapping template
+ ///
+ [Serializable()]
+ [TypeConverter(typeof(ROFstAssociationsConverter))]
+ public partial class ROFstAssociations : BusinessListBase, ICustomTypeDescriptor, IVEHasBrokenRules
+ {
+ #region Log4Net
+ private static readonly log4net.ILog _MyLog = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
+ #endregion
+ #region Business Methods
+ private string _ErrorMessage = string.Empty;
+ public string ErrorMessage
+ {
+ get { return _ErrorMessage; }
+ }
+ // One To Many
+ public ROFstAssociation this[Association myAssociation]
+ {
+ get
+ {
+ foreach (ROFstAssociation association in this)
+ if (association.AssociationID == myAssociation.AssociationID)
+ return association;
+ return null;
+ }
+ }
+ public new System.Collections.Generic.IList Items
+ {
+ get { return base.Items; }
+ }
+ public ROFstAssociation GetItem(Association myAssociation)
+ {
+ foreach (ROFstAssociation association in this)
+ if (association.AssociationID == myAssociation.AssociationID)
+ return association;
+ return null;
+ }
+ public ROFstAssociation Add(DocVersion myDocVersion) // One to Many with unique fields
+ {
+ if (!Contains(myDocVersion))
+ {
+ ROFstAssociation association = ROFstAssociation.New(myDocVersion);
+ this.Add(association);
+ return association;
+ }
+ else
+ throw new InvalidOperationException("association already exists");
+ }
+ public void Remove(Association myAssociation)
+ {
+ foreach (ROFstAssociation association in this)
+ {
+ if (association.AssociationID == myAssociation.AssociationID)
+ {
+ Remove(association);
+ break;
+ }
+ }
+ }
+ public bool Contains(Association myAssociation)
+ {
+ foreach (ROFstAssociation association in this)
+ if (association.AssociationID == myAssociation.AssociationID)
+ return true;
+ return false;
+ }
+ public bool ContainsDeleted(Association myAssociation)
+ {
+ foreach (ROFstAssociation association in DeletedList)
+ if (association.AssociationID == myAssociation.AssociationID)
+ return true;
+ return false;
+ }
+ public bool Contains(DocVersion myDocVersion)
+ {
+ foreach (ROFstAssociation association in this)
+ if (association.VersionID == myDocVersion.VersionID)
+ return true;
+ return false;
+ }
+ public bool ContainsDeleted(DocVersion myDocVersion)
+ {
+ foreach (ROFstAssociation association in DeletedList)
+ if (association.VersionID == myDocVersion.VersionID)
+ return true;
+ return false;
+ }
+ #endregion
+ #region ValidationRules
+ public IVEHasBrokenRules HasBrokenRules
+ {
+ get
+ {
+ IVEHasBrokenRules hasBrokenRules = null;
+ foreach (ROFstAssociation rOFstAssociation in this)
+ if ((hasBrokenRules = rOFstAssociation.HasBrokenRules) != null) return hasBrokenRules;
+ return hasBrokenRules;
+ }
+ }
+ public BrokenRulesCollection BrokenRules
+ {
+ get
+ {
+ IVEHasBrokenRules hasBrokenRules = HasBrokenRules;
+ return (hasBrokenRules != null ? hasBrokenRules.BrokenRules : null);
+ }
+ }
+ #endregion
+ #region Factory Methods
+ internal static ROFstAssociations New()
+ {
+ return new ROFstAssociations();
+ }
+ internal static ROFstAssociations Get(SafeDataReader dr)
+ {
+ return new ROFstAssociations(dr);
+ }
+ public static ROFstAssociations GetByROFstID(int rOFstID)
+ {
+ try
+ {
+ return DataPortal.Fetch(new ROFstIDCriteria(rOFstID));
+ }
+ catch (Exception ex)
+ {
+ throw new DbCslaException("Error on ROFstAssociations.GetByROFstID", ex);
+ }
+ }
+ private ROFstAssociations()
+ {
+ MarkAsChild();
+ }
+ internal ROFstAssociations(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(ROFstAssociation.Get(dr));
+ this.RaiseListChangedEvents = true;
+ }
+ [Serializable()]
+ private class ROFstIDCriteria
+ {
+ public ROFstIDCriteria(int rOFstID)
+ {
+ _ROFstID = rOFstID;
+ }
+ private int _ROFstID;
+ public int ROFstID
+ {
+ get { return _ROFstID; }
+ set { _ROFstID = value; }
+ }
+ }
+ private void DataPortal_Fetch(ROFstIDCriteria criteria)
+ {
+ this.RaiseListChangedEvents = false;
+ if (_MyLog.IsDebugEnabled) _MyLog.DebugFormat("[{0}] ROFstAssociations.DataPortal_FetchROFstID", GetHashCode());
+ try
+ {
+ using (SqlConnection cn = Database.VEPROMS_SqlConnection)
+ {
+ using (SqlCommand cm = cn.CreateCommand())
+ {
+ cm.CommandType = CommandType.StoredProcedure;
+ cm.CommandText = "getAssociationsByROFstID";
+ cm.Parameters.AddWithValue("@ROFstID", criteria.ROFstID);
+ using (SafeDataReader dr = new SafeDataReader(cm.ExecuteReader()))
+ {
+ while (dr.Read()) this.Add(new ROFstAssociation(dr));
+ }
+ }
+ }
+ }
+ catch (Exception ex)
+ {
+ if (_MyLog.IsErrorEnabled) _MyLog.Error("ROFstAssociations.DataPortal_FetchROFstID", ex);
+ throw new DbCslaException("ROFstAssociations.DataPortal_Fetch", ex);
+ }
+ this.RaiseListChangedEvents = true;
+ }
+ internal void Update(ROFst rOFst)
+ {
+ this.RaiseListChangedEvents = false;
+ try
+ {
+ // update (thus deleting) any deleted child objects
+ foreach (ROFstAssociation obj in DeletedList)
+ obj.DeleteSelf(rOFst);// Deletes related record
+ // now that they are deleted, remove them from memory too
+ DeletedList.Clear();
+ // add/update any current child objects
+ foreach (ROFstAssociation obj in this)
+ {
+ if (obj.IsNew)
+ obj.Insert(rOFst);
+ else
+ obj.Update(rOFst);
+ }
+ }
+ finally
+ {
+ this.RaiseListChangedEvents = true;
+ }
+ }
+ #endregion
+ #region ICustomTypeDescriptor impl
+ public String GetClassName()
+ { return TypeDescriptor.GetClassName(this, true); }
+ public AttributeCollection GetAttributes()
+ { return TypeDescriptor.GetAttributes(this, true); }
+ public String GetComponentName()
+ { return TypeDescriptor.GetComponentName(this, true); }
+ public TypeConverter GetConverter()
+ { return TypeDescriptor.GetConverter(this, true); }
+ public EventDescriptor GetDefaultEvent()
+ { return TypeDescriptor.GetDefaultEvent(this, true); }
+ public PropertyDescriptor GetDefaultProperty()
+ { return TypeDescriptor.GetDefaultProperty(this, true); }
+ public object GetEditor(Type editorBaseType)
+ { return TypeDescriptor.GetEditor(this, editorBaseType, true); }
+ public EventDescriptorCollection GetEvents(Attribute[] attributes)
+ { return TypeDescriptor.GetEvents(this, attributes, true); }
+ public EventDescriptorCollection GetEvents()
+ { return TypeDescriptor.GetEvents(this, true); }
+ public object GetPropertyOwner(PropertyDescriptor pd)
+ { return this; }
+ ///
+ /// Called to get the properties of this type. Returns properties with certain
+ /// attributes. this restriction is not implemented here.
+ ///
+ ///
+ ///
+ public PropertyDescriptorCollection GetProperties(Attribute[] attributes)
+ { return GetProperties(); }
+ ///
+ /// Called to get the properties of this type.
+ ///
+ ///
+ public PropertyDescriptorCollection GetProperties()
+ {
+ // Create a collection object to hold property descriptors
+ PropertyDescriptorCollection pds = new PropertyDescriptorCollection(null);
+ // Iterate the list
+ for (int i = 0; i < this.Items.Count; i++)
+ {
+ // Create a property descriptor for the item and add to the property descriptor collection
+ ROFstAssociationsPropertyDescriptor pd = new ROFstAssociationsPropertyDescriptor(this, i);
+ pds.Add(pd);
+ }
+ // return the property descriptor collection
+ return pds;
+ }
+ #endregion
+ } // Class
+ #region Property Descriptor
+ ///
+ /// Summary description for CollectionPropertyDescriptor.
+ ///
+ public partial class ROFstAssociationsPropertyDescriptor : vlnListPropertyDescriptor
+ {
+ private ROFstAssociation Item { get { return (ROFstAssociation)_Item; } }
+ public ROFstAssociationsPropertyDescriptor(ROFstAssociations collection, int index) : base(collection, index) { ;}
+ }
+ #endregion
+ #region Converter
+ internal class ROFstAssociationsConverter : ExpandableObjectConverter
+ {
+ public override object ConvertTo(ITypeDescriptorContext context, System.Globalization.CultureInfo culture, object value, Type destType)
+ {
+ if (destType == typeof(string) && value is ROFstAssociations)
+ {
+ // Return department and department role separated by comma.
+ return ((ROFstAssociations)value).Items.Count.ToString() + " Associations";
+ }
+ return base.ConvertTo(context, culture, value, destType);
+ }
+ }
+ #endregion
+} // Namespace
diff --git a/PROMS/VEPROMS.CSLA.Library/Generated/ROFstFigure.cs b/PROMS/VEPROMS.CSLA.Library/Generated/ROFstFigure.cs
new file mode 100644
index 00000000..0216e86b
--- /dev/null
+++ b/PROMS/VEPROMS.CSLA.Library/Generated/ROFstFigure.cs
@@ -0,0 +1,537 @@
+// ========================================================================
+// Copyright 2007 - 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;
+using System.ComponentModel;
+using Csla.Validation;
+namespace VEPROMS.CSLA.Library
+{
+ ///
+ /// ROFstFigure Generated by MyGeneration using the CSLA Object Mapping template
+ ///
+ [Serializable()]
+ [TypeConverter(typeof(ROFstFigureConverter))]
+ public partial class ROFstFigure : BusinessBase, IVEHasBrokenRules
+ {
+ #region Log4Net
+ private static readonly log4net.ILog _MyLog = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
+ #endregion
+ #region Business Methods
+ private string _ErrorMessage = string.Empty;
+ public string ErrorMessage
+ {
+ get { return _ErrorMessage; }
+ }
+ private int _FigureID;
+ [System.ComponentModel.DataObjectField(true, true)]
+ public int FigureID
+ {
+ [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
+ get
+ {
+ CanReadProperty("FigureID", true);
+ if (_MyFigure != null) _FigureID = _MyFigure.FigureID;
+ return _FigureID;
+ }
+ }
+ private Figure _MyFigure;
+ [System.ComponentModel.DataObjectField(true, true)]
+ public Figure MyFigure
+ {
+ [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
+ get
+ {
+ CanReadProperty("MyFigure", true);
+ if (_MyFigure == null && _FigureID != 0) _MyFigure = Figure.Get(_FigureID);
+ return _MyFigure;
+ }
+ }
+ private int _ImageID;
+ public int ImageID
+ {
+ [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
+ get
+ {
+ CanReadProperty("ImageID", true);
+ if (_MyROImage != null) _ImageID = _MyROImage.ImageID;
+ return _ImageID;
+ }
+ }
+ private ROImage _MyROImage;
+ public ROImage MyROImage
+ {
+ [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
+ get
+ {
+ CanReadProperty("MyROImage", true);
+ if (_MyROImage == null && _ImageID != 0) _MyROImage = ROImage.Get(_ImageID);
+ return _MyROImage;
+ }
+ [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
+ set
+ {
+ CanWriteProperty("MyROImage", true);
+ if (_MyROImage != value)
+ {
+ _MyROImage = value;
+ PropertyHasChanged();
+ }
+ }
+ }
+ private string _Config = string.Empty;
+ public string Config
+ {
+ [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
+ get
+ {
+ CanReadProperty("Config", true);
+ return _Config;
+ }
+ [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
+ set
+ {
+ CanWriteProperty("Config", true);
+ if (value == null) value = string.Empty;
+ if (_Config != value)
+ {
+ _Config = value;
+ PropertyHasChanged();
+ }
+ }
+ }
+ private DateTime _DTS = new DateTime();
+ public DateTime DTS
+ {
+ [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
+ get
+ {
+ CanReadProperty("DTS", true);
+ return _DTS;
+ }
+ [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
+ set
+ {
+ CanWriteProperty("DTS", 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("UserID", true);
+ return _UserID;
+ }
+ [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
+ set
+ {
+ CanWriteProperty("UserID", true);
+ if (value == null) value = string.Empty;
+ if (_UserID != value)
+ {
+ _UserID = value;
+ PropertyHasChanged();
+ }
+ }
+ }
+ private byte[] _LastChanged = new byte[8];//timestamp
+ private int _ROImage_RODbID;
+ public int ROImage_RODbID
+ {
+ [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
+ get
+ {
+ CanReadProperty("ROImage_RODbID", true);
+ return _ROImage_RODbID;
+ }
+ }
+ private string _ROImage_FileName = string.Empty;
+ public string ROImage_FileName
+ {
+ [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
+ get
+ {
+ CanReadProperty("ROImage_FileName", true);
+ return _ROImage_FileName;
+ }
+ }
+ private byte[] _ROImage_Content;
+ public byte[] ROImage_Content
+ {
+ [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
+ get
+ {
+ CanReadProperty("ROImage_Content", true);
+ return _ROImage_Content;
+ }
+ }
+ private string _ROImage_Config = string.Empty;
+ public string ROImage_Config
+ {
+ [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
+ get
+ {
+ CanReadProperty("ROImage_Config", true);
+ return _ROImage_Config;
+ }
+ }
+ private DateTime _ROImage_DTS = new DateTime();
+ public DateTime ROImage_DTS
+ {
+ [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
+ get
+ {
+ CanReadProperty("ROImage_DTS", true);
+ return _ROImage_DTS;
+ }
+ }
+ private string _ROImage_UserID = string.Empty;
+ public string ROImage_UserID
+ {
+ [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
+ get
+ {
+ CanReadProperty("ROImage_UserID", true);
+ return _ROImage_UserID;
+ }
+ }
+ // TODO: Check ROFstFigure.GetIdValue to assure that the ID returned is unique
+ ///
+ /// Overrides Base GetIdValue - Used internally by CSLA to determine equality
+ ///
+ /// A Unique ID for the current ROFstFigure
+ protected override object GetIdValue()
+ {
+ return _FigureID;
+ }
+ // TODO: Replace base ROFstFigure.ToString function as necessary
+ ///
+ /// Overrides Base ToString
+ ///
+ /// A string representation of current ROFstFigure
+ //public override string ToString()
+ //{
+ // return base.ToString();
+ //}
+ public override bool IsDirty
+ {
+ get { return base.IsDirty || (_MyROImage == null ? false : _MyROImage.IsDirty); }
+ }
+ public override bool IsValid
+ {
+ get { return (IsNew && !IsDirty ? true : base.IsValid) && (_MyROImage == null ? true : _MyROImage.IsValid); }
+ }
+ #endregion
+ #region ValidationRules
+ [NonSerialized]
+ private bool _CheckingBrokenRules = false;
+ public IVEHasBrokenRules HasBrokenRules
+ {
+ get
+ {
+ if (_CheckingBrokenRules) return null;
+ if (BrokenRulesCollection.Count > 0) return this;
+ try
+ {
+ _CheckingBrokenRules = true;
+ IVEHasBrokenRules hasBrokenRules = null;
+ if (_MyROImage != null && (hasBrokenRules = _MyROImage.HasBrokenRules) != null) return hasBrokenRules;
+ return hasBrokenRules;
+ }
+ finally
+ {
+ _CheckingBrokenRules = false;
+ }
+ }
+ }
+ public BrokenRulesCollection BrokenRules
+ {
+ get
+ {
+ IVEHasBrokenRules hasBrokenRules = HasBrokenRules;
+ if (this.Equals(hasBrokenRules)) return BrokenRulesCollection;
+ return (hasBrokenRules != null ? hasBrokenRules.BrokenRules : null);
+ }
+ }
+ protected override void AddBusinessRules()
+ {
+ ValidationRules.AddRule(MyROImageRequired, "MyROImage");
+ ValidationRules.AddRule(
+ Csla.Validation.CommonRules.StringMaxLength,
+ new Csla.Validation.CommonRules.MaxLengthRuleArgs("Config", 1073741823));
+ ValidationRules.AddRule(
+ Csla.Validation.CommonRules.StringRequired, "UserID");
+ ValidationRules.AddRule(
+ Csla.Validation.CommonRules.StringMaxLength,
+ new Csla.Validation.CommonRules.MaxLengthRuleArgs("UserID", 100));
+ // TODO: Add other validation rules
+ }
+ private static bool MyROImageRequired(ROFstFigure target, Csla.Validation.RuleArgs e)
+ {
+ if (target._ImageID == 0 && target._MyROImage == null) // Required field missing
+ {
+ e.Description = "Required";
+ return false;
+ }
+ return true;
+ }
+ // 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(FigureID, "");
+ //AuthorizationRules.AllowRead(ImageID, "");
+ //AuthorizationRules.AllowWrite(ImageID, "");
+ //AuthorizationRules.AllowRead(Config, "");
+ //AuthorizationRules.AllowWrite(Config, "");
+ //AuthorizationRules.AllowRead(DTS, "");
+ //AuthorizationRules.AllowWrite(DTS, "");
+ //AuthorizationRules.AllowRead(UserID, "");
+ //AuthorizationRules.AllowWrite(UserID, "");
+ }
+ 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; } }
+ internal static ROFstFigure New(ROImage myROImage)
+ {
+ return new ROFstFigure(myROImage);
+ }
+ internal static ROFstFigure Get(SafeDataReader dr)
+ {
+ return new ROFstFigure(dr);
+ }
+ public ROFstFigure()
+ {
+ MarkAsChild();
+ _FigureID = Figure.NextFigureID;
+ _DTS = _ROFstFigureExtension.DefaultDTS;
+ _UserID = _ROFstFigureExtension.DefaultUserID;
+ ValidationRules.CheckRules();
+ }
+ private ROFstFigure(ROImage myROImage)
+ {
+ MarkAsChild();
+ // TODO: Add any initialization & defaults
+ _DTS = _ROFstFigureExtension.DefaultDTS;
+ _UserID = _ROFstFigureExtension.DefaultUserID;
+ _MyROImage = myROImage;
+ ValidationRules.CheckRules();
+ }
+ internal ROFstFigure(SafeDataReader dr)
+ {
+ MarkAsChild();
+ Fetch(dr);
+ }
+ #endregion
+ #region Data Access Portal
+ private void Fetch(SafeDataReader dr)
+ {
+ if (_MyLog.IsDebugEnabled) _MyLog.DebugFormat("[{0}] ROFstFigure.FetchDR", GetHashCode());
+ try
+ {
+ _FigureID = dr.GetInt32("FigureID");
+ _ImageID = dr.GetInt32("ImageID");
+ _Config = dr.GetString("Config");
+ _DTS = dr.GetDateTime("DTS");
+ _UserID = dr.GetString("UserID");
+ dr.GetBytes("LastChanged", 0, _LastChanged, 0, 8);
+ _ROImage_RODbID = dr.GetInt32("ROImage_RODbID");
+ _ROImage_FileName = dr.GetString("ROImage_FileName");
+ _ROImage_Content = (byte[])dr.GetValue("ROImage_Content");
+ _ROImage_Config = dr.GetString("ROImage_Config");
+ _ROImage_DTS = dr.GetDateTime("ROImage_DTS");
+ _ROImage_UserID = dr.GetString("ROImage_UserID");
+ }
+ catch (Exception ex) // FKItem Fetch
+ {
+ if (_MyLog.IsErrorEnabled) _MyLog.Error("ROFstFigure.FetchDR", ex);
+ throw new DbCslaException("ROFstFigure.Fetch", ex);
+ }
+ MarkOld();
+ }
+ internal void Insert(ROFst myROFst)
+ {
+ // if we're not dirty then don't update the database
+ if (!this.IsDirty) return;
+ SqlConnection cn = (SqlConnection)ApplicationContext.LocalContext["cn"];
+ _LastChanged = Figure.Add(cn, ref _FigureID, myROFst, _MyROImage, _Config, _DTS, _UserID);
+ MarkOld();
+ }
+ internal void Update(ROFst myROFst)
+ {
+ // if we're not dirty then don't update the database
+ if (!this.IsDirty) return;
+ SqlConnection cn = (SqlConnection)ApplicationContext.LocalContext["cn"];
+ _LastChanged = Figure.Update(cn, ref _FigureID, myROFst, _MyROImage, _Config, _DTS, _UserID, ref _LastChanged);
+ MarkOld();
+ }
+ internal void DeleteSelf(ROFst myROFst)
+ {
+ // if we're not dirty then don't update the database
+ if (!this.IsDirty) return;
+ // if we're new then don't update the database
+ if (this.IsNew) return;
+ SqlConnection cn = (SqlConnection)ApplicationContext.LocalContext["cn"];
+ Figure.Remove(cn, _FigureID);
+ MarkNew();
+ }
+ #endregion
+ // Standard Default Code
+ #region extension
+ ROFstFigureExtension _ROFstFigureExtension = new ROFstFigureExtension();
+ [Serializable()]
+ partial class ROFstFigureExtension : extensionBase
+ {
+ }
+ [Serializable()]
+ class extensionBase
+ {
+ // Default Values
+ 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
+ }
+ // Instance Authorization Rules
+ public virtual void AddInstanceAuthorizationRules(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
+ }
+ // InstanceValidation Rules
+ public virtual void AddInstanceValidationRules(Csla.Validation.ValidationRules rules)
+ {
+ // Needs to be overriden to add new validation rules
+ }
+ }
+ #endregion
+ } // Class
+ #region Converter
+ internal class ROFstFigureConverter : ExpandableObjectConverter
+ {
+ public override object ConvertTo(ITypeDescriptorContext context, System.Globalization.CultureInfo culture, object value, Type destType)
+ {
+ if (destType == typeof(string) && value is ROFstFigure)
+ {
+ // Return the ToString value
+ return ((ROFstFigure)value).ToString();
+ }
+ return base.ConvertTo(context, culture, value, destType);
+ }
+ }
+ #endregion
+} // Namespace
+
+
+//// The following is a sample Extension File. You can use it to create ROFstFigureExt.cs
+//using System;
+//using System.Collections.Generic;
+//using System.Text;
+//using Csla;
+
+//namespace VEPROMS.CSLA.Library
+//{
+// public partial class ROFstFigure
+// {
+// partial class ROFstFigureExtension : extensionBase
+// {
+// // TODO: Override automatic defaults
+// 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, "");
+// }
+// public new void AddInstanceAuthorizationRules(Csla.Security.AuthorizationRules rules)
+// {
+// //rules.AllowInstanceRead(Dbid, "");
+// }
+// public new void AddValidationRules(Csla.Validation.ValidationRules rules)
+// {
+// rules.AddRule(
+// Csla.Validation.CommonRules.StringMaxLength,
+// new Csla.Validation.CommonRules.MaxLengthRuleArgs("Name", 100));
+// }
+// public new void AddInstanceValidationRules(Csla.Validation.ValidationRules rules)
+// {
+// rules.AddInstanceRule(/* Instance Validation Rule */);
+// }
+// }
+// }
+//}
diff --git a/PROMS/VEPROMS.CSLA.Library/Generated/ROFstFigures.cs b/PROMS/VEPROMS.CSLA.Library/Generated/ROFstFigures.cs
new file mode 100644
index 00000000..f8b685db
--- /dev/null
+++ b/PROMS/VEPROMS.CSLA.Library/Generated/ROFstFigures.cs
@@ -0,0 +1,309 @@
+// ========================================================================
+// Copyright 2007 - 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;
+using System.ComponentModel;
+using Csla.Validation;
+namespace VEPROMS.CSLA.Library
+{
+ ///
+ /// ROFstFigures Generated by MyGeneration using the CSLA Object Mapping template
+ ///
+ [Serializable()]
+ [TypeConverter(typeof(ROFstFiguresConverter))]
+ public partial class ROFstFigures : BusinessListBase, ICustomTypeDescriptor, IVEHasBrokenRules
+ {
+ #region Log4Net
+ private static readonly log4net.ILog _MyLog = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
+ #endregion
+ #region Business Methods
+ private string _ErrorMessage = string.Empty;
+ public string ErrorMessage
+ {
+ get { return _ErrorMessage; }
+ }
+ // One To Many
+ public ROFstFigure this[Figure myFigure]
+ {
+ get
+ {
+ foreach (ROFstFigure figure in this)
+ if (figure.FigureID == myFigure.FigureID)
+ return figure;
+ return null;
+ }
+ }
+ public new System.Collections.Generic.IList Items
+ {
+ get { return base.Items; }
+ }
+ public ROFstFigure GetItem(Figure myFigure)
+ {
+ foreach (ROFstFigure figure in this)
+ if (figure.FigureID == myFigure.FigureID)
+ return figure;
+ return null;
+ }
+ public ROFstFigure Add(ROImage myROImage) // One to Many with unique fields
+ {
+ if (!Contains(myROImage))
+ {
+ ROFstFigure figure = ROFstFigure.New(myROImage);
+ this.Add(figure);
+ return figure;
+ }
+ else
+ throw new InvalidOperationException("figure already exists");
+ }
+ public void Remove(Figure myFigure)
+ {
+ foreach (ROFstFigure figure in this)
+ {
+ if (figure.FigureID == myFigure.FigureID)
+ {
+ Remove(figure);
+ break;
+ }
+ }
+ }
+ public bool Contains(Figure myFigure)
+ {
+ foreach (ROFstFigure figure in this)
+ if (figure.FigureID == myFigure.FigureID)
+ return true;
+ return false;
+ }
+ public bool ContainsDeleted(Figure myFigure)
+ {
+ foreach (ROFstFigure figure in DeletedList)
+ if (figure.FigureID == myFigure.FigureID)
+ return true;
+ return false;
+ }
+ public bool Contains(ROImage myROImage)
+ {
+ foreach (ROFstFigure figure in this)
+ if (figure.ImageID == myROImage.ImageID)
+ return true;
+ return false;
+ }
+ public bool ContainsDeleted(ROImage myROImage)
+ {
+ foreach (ROFstFigure figure in DeletedList)
+ if (figure.ImageID == myROImage.ImageID)
+ return true;
+ return false;
+ }
+ #endregion
+ #region ValidationRules
+ public IVEHasBrokenRules HasBrokenRules
+ {
+ get
+ {
+ IVEHasBrokenRules hasBrokenRules = null;
+ foreach (ROFstFigure rOFstFigure in this)
+ if ((hasBrokenRules = rOFstFigure.HasBrokenRules) != null) return hasBrokenRules;
+ return hasBrokenRules;
+ }
+ }
+ public BrokenRulesCollection BrokenRules
+ {
+ get
+ {
+ IVEHasBrokenRules hasBrokenRules = HasBrokenRules;
+ return (hasBrokenRules != null ? hasBrokenRules.BrokenRules : null);
+ }
+ }
+ #endregion
+ #region Factory Methods
+ internal static ROFstFigures New()
+ {
+ return new ROFstFigures();
+ }
+ internal static ROFstFigures Get(SafeDataReader dr)
+ {
+ return new ROFstFigures(dr);
+ }
+ public static ROFstFigures GetByROFstID(int rOFstID)
+ {
+ try
+ {
+ return DataPortal.Fetch(new ROFstIDCriteria(rOFstID));
+ }
+ catch (Exception ex)
+ {
+ throw new DbCslaException("Error on ROFstFigures.GetByROFstID", ex);
+ }
+ }
+ private ROFstFigures()
+ {
+ MarkAsChild();
+ }
+ internal ROFstFigures(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(ROFstFigure.Get(dr));
+ this.RaiseListChangedEvents = true;
+ }
+ [Serializable()]
+ private class ROFstIDCriteria
+ {
+ public ROFstIDCriteria(int rOFstID)
+ {
+ _ROFstID = rOFstID;
+ }
+ private int _ROFstID;
+ public int ROFstID
+ {
+ get { return _ROFstID; }
+ set { _ROFstID = value; }
+ }
+ }
+ private void DataPortal_Fetch(ROFstIDCriteria criteria)
+ {
+ this.RaiseListChangedEvents = false;
+ if (_MyLog.IsDebugEnabled) _MyLog.DebugFormat("[{0}] ROFstFigures.DataPortal_FetchROFstID", GetHashCode());
+ try
+ {
+ using (SqlConnection cn = Database.VEPROMS_SqlConnection)
+ {
+ using (SqlCommand cm = cn.CreateCommand())
+ {
+ cm.CommandType = CommandType.StoredProcedure;
+ cm.CommandText = "getFiguresByROFstID";
+ cm.Parameters.AddWithValue("@ROFstID", criteria.ROFstID);
+ using (SafeDataReader dr = new SafeDataReader(cm.ExecuteReader()))
+ {
+ while (dr.Read()) this.Add(new ROFstFigure(dr));
+ }
+ }
+ }
+ }
+ catch (Exception ex)
+ {
+ if (_MyLog.IsErrorEnabled) _MyLog.Error("ROFstFigures.DataPortal_FetchROFstID", ex);
+ throw new DbCslaException("ROFstFigures.DataPortal_Fetch", ex);
+ }
+ this.RaiseListChangedEvents = true;
+ }
+ internal void Update(ROFst rOFst)
+ {
+ this.RaiseListChangedEvents = false;
+ try
+ {
+ // update (thus deleting) any deleted child objects
+ foreach (ROFstFigure obj in DeletedList)
+ obj.DeleteSelf(rOFst);// Deletes related record
+ // now that they are deleted, remove them from memory too
+ DeletedList.Clear();
+ // add/update any current child objects
+ foreach (ROFstFigure obj in this)
+ {
+ if (obj.IsNew)
+ obj.Insert(rOFst);
+ else
+ obj.Update(rOFst);
+ }
+ }
+ finally
+ {
+ this.RaiseListChangedEvents = true;
+ }
+ }
+ #endregion
+ #region ICustomTypeDescriptor impl
+ public String GetClassName()
+ { return TypeDescriptor.GetClassName(this, true); }
+ public AttributeCollection GetAttributes()
+ { return TypeDescriptor.GetAttributes(this, true); }
+ public String GetComponentName()
+ { return TypeDescriptor.GetComponentName(this, true); }
+ public TypeConverter GetConverter()
+ { return TypeDescriptor.GetConverter(this, true); }
+ public EventDescriptor GetDefaultEvent()
+ { return TypeDescriptor.GetDefaultEvent(this, true); }
+ public PropertyDescriptor GetDefaultProperty()
+ { return TypeDescriptor.GetDefaultProperty(this, true); }
+ public object GetEditor(Type editorBaseType)
+ { return TypeDescriptor.GetEditor(this, editorBaseType, true); }
+ public EventDescriptorCollection GetEvents(Attribute[] attributes)
+ { return TypeDescriptor.GetEvents(this, attributes, true); }
+ public EventDescriptorCollection GetEvents()
+ { return TypeDescriptor.GetEvents(this, true); }
+ public object GetPropertyOwner(PropertyDescriptor pd)
+ { return this; }
+ ///
+ /// Called to get the properties of this type. Returns properties with certain
+ /// attributes. this restriction is not implemented here.
+ ///
+ ///
+ ///
+ public PropertyDescriptorCollection GetProperties(Attribute[] attributes)
+ { return GetProperties(); }
+ ///
+ /// Called to get the properties of this type.
+ ///
+ ///
+ public PropertyDescriptorCollection GetProperties()
+ {
+ // Create a collection object to hold property descriptors
+ PropertyDescriptorCollection pds = new PropertyDescriptorCollection(null);
+ // Iterate the list
+ for (int i = 0; i < this.Items.Count; i++)
+ {
+ // Create a property descriptor for the item and add to the property descriptor collection
+ ROFstFiguresPropertyDescriptor pd = new ROFstFiguresPropertyDescriptor(this, i);
+ pds.Add(pd);
+ }
+ // return the property descriptor collection
+ return pds;
+ }
+ #endregion
+ } // Class
+ #region Property Descriptor
+ ///
+ /// Summary description for CollectionPropertyDescriptor.
+ ///
+ public partial class ROFstFiguresPropertyDescriptor : vlnListPropertyDescriptor
+ {
+ private ROFstFigure Item { get { return (ROFstFigure)_Item; } }
+ public ROFstFiguresPropertyDescriptor(ROFstFigures collection, int index) : base(collection, index) { ;}
+ }
+ #endregion
+ #region Converter
+ internal class ROFstFiguresConverter : ExpandableObjectConverter
+ {
+ public override object ConvertTo(ITypeDescriptorContext context, System.Globalization.CultureInfo culture, object value, Type destType)
+ {
+ if (destType == typeof(string) && value is ROFstFigures)
+ {
+ // Return department and department role separated by comma.
+ return ((ROFstFigures)value).Items.Count.ToString() + " Figures";
+ }
+ return base.ConvertTo(context, culture, value, destType);
+ }
+ }
+ #endregion
+} // Namespace
diff --git a/PROMS/VEPROMS.CSLA.Library/Generated/ROFstInfo.cs b/PROMS/VEPROMS.CSLA.Library/Generated/ROFstInfo.cs
new file mode 100644
index 00000000..3e9d2b59
--- /dev/null
+++ b/PROMS/VEPROMS.CSLA.Library/Generated/ROFstInfo.cs
@@ -0,0 +1,464 @@
+// ========================================================================
+// Copyright 2007 - 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;
+using System.ComponentModel;
+using System.Collections.Generic;
+namespace VEPROMS.CSLA.Library
+{
+ public delegate void ROFstInfoEvent(object sender);
+ ///
+ /// ROFstInfo Generated by MyGeneration using the CSLA Object Mapping template
+ ///
+ [Serializable()]
+ [TypeConverter(typeof(ROFstInfoConverter))]
+ public partial class ROFstInfo : ReadOnlyBase, IDisposable
+ {
+ public event ROFstInfoEvent Changed;
+ private void OnChange()
+ {
+ if (Changed != null) Changed(this);
+ }
+ #region Log4Net
+ private static readonly log4net.ILog _MyLog = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
+ #endregion
+ #region Collection
+ private static List _CacheList = new List();
+ protected static void AddToCache(ROFstInfo rOFstInfo)
+ {
+ if (!_CacheList.Contains(rOFstInfo)) _CacheList.Add(rOFstInfo); // In AddToCache
+ }
+ protected static void RemoveFromCache(ROFstInfo rOFstInfo)
+ {
+ while (_CacheList.Contains(rOFstInfo)) _CacheList.Remove(rOFstInfo); // In RemoveFromCache
+ }
+ private static Dictionary> _CacheByPrimaryKey = new Dictionary>();
+ private static void ConvertListToDictionary()
+ {
+ List remove = new List();
+ foreach (ROFstInfo tmp in _CacheList)
+ {
+ if (!_CacheByPrimaryKey.ContainsKey(tmp.ROFstID.ToString()))
+ {
+ _CacheByPrimaryKey[tmp.ROFstID.ToString()] = new List(); // Add new list for PrimaryKey
+ }
+ _CacheByPrimaryKey[tmp.ROFstID.ToString()].Add(tmp); // Add to Primary Key list
+ remove.Add(tmp);
+ }
+ foreach (ROFstInfo tmp in remove)
+ RemoveFromCache(tmp);
+ }
+ internal static void AddList(ROFstInfoList lst)
+ {
+ foreach (ROFstInfo item in lst) AddToCache(item);
+ }
+ protected static ROFstInfo GetCachedByPrimaryKey(int rOFstID)
+ {
+ ConvertListToDictionary();
+ string key = rOFstID.ToString();
+ if (_CacheByPrimaryKey.ContainsKey(key)) return _CacheByPrimaryKey[key][0];
+ return null;
+ }
+ #endregion
+ #region Business Methods
+ private string _ErrorMessage = string.Empty;
+ public string ErrorMessage
+ {
+ get { return _ErrorMessage; }
+ }
+ protected ROFst _Editable;
+ private IVEHasBrokenRules HasBrokenRules
+ {
+ get
+ {
+ IVEHasBrokenRules hasBrokenRules = null;
+ if (_Editable != null)
+ hasBrokenRules = _Editable.HasBrokenRules;
+ return hasBrokenRules;
+ }
+ }
+ private int _ROFstID;
+ [System.ComponentModel.DataObjectField(true, true)]
+ public int ROFstID
+ {
+ [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
+ get
+ {
+ CanReadProperty("ROFstID", true);
+ return _ROFstID;
+ }
+ }
+ private int _RODbID;
+ public int RODbID
+ {
+ [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
+ get
+ {
+ CanReadProperty("RODbID", true);
+ if (_MyRODb != null) _RODbID = _MyRODb.RODbID;
+ return _RODbID;
+ }
+ }
+ private RODbInfo _MyRODb;
+ public RODbInfo MyRODb
+ {
+ [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
+ get
+ {
+ CanReadProperty("MyRODb", true);
+ if (_MyRODb == null && _RODbID != 0) _MyRODb = RODbInfo.Get(_RODbID);
+ return _MyRODb;
+ }
+ }
+ private byte[] _ROLookup;
+ public byte[] ROLookup
+ {
+ [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
+ get
+ {
+ CanReadProperty("ROLookup", true);
+ return _ROLookup;
+ }
+ }
+ private string _Config = string.Empty;
+ public string Config
+ {
+ [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
+ get
+ {
+ CanReadProperty("Config", true);
+ return _Config;
+ }
+ }
+ private DateTime _DTS = new DateTime();
+ public DateTime DTS
+ {
+ [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
+ get
+ {
+ CanReadProperty("DTS", true);
+ return _DTS;
+ }
+ }
+ private string _UserID = string.Empty;
+ public string UserID
+ {
+ [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
+ get
+ {
+ CanReadProperty("UserID", true);
+ return _UserID;
+ }
+ }
+ private int _ROFstAssociationCount = 0;
+ ///
+ /// Count of ROFstAssociations for this ROFst
+ ///
+ public int ROFstAssociationCount
+ {
+ [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
+ get
+ {
+ CanReadProperty("ROFstAssociationCount", true);
+ return _ROFstAssociationCount;
+ }
+ }
+ private AssociationInfoList _ROFstAssociations = null;
+ [TypeConverter(typeof(AssociationInfoListConverter))]
+ public AssociationInfoList ROFstAssociations
+ {
+ [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
+ get
+ {
+ CanReadProperty("ROFstAssociations", true);
+ if (_ROFstAssociationCount < 0 || (_ROFstAssociationCount > 0 && _ROFstAssociations == null))
+ _ROFstAssociations = AssociationInfoList.GetByROFstID(_ROFstID);
+ if (_ROFstAssociationCount < 0)
+ _ROFstAssociationCount = _ROFstAssociations.Count;
+ return _ROFstAssociations;
+ }
+ }
+ public void RefreshROFstAssociations()
+ {
+ ConvertListToDictionary();
+ if (_CacheByPrimaryKey.ContainsKey(_ROFstID.ToString()))
+ foreach (ROFstInfo tmp in _CacheByPrimaryKey[_ROFstID.ToString()])
+ tmp._ROFstAssociationCount = -1; // This will cause the data to be requeried
+ }
+ private int _ROFstFigureCount = 0;
+ ///
+ /// Count of ROFstFigures for this ROFst
+ ///
+ public int ROFstFigureCount
+ {
+ [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
+ get
+ {
+ CanReadProperty("ROFstFigureCount", true);
+ return _ROFstFigureCount;
+ }
+ }
+ private FigureInfoList _ROFstFigures = null;
+ [TypeConverter(typeof(FigureInfoListConverter))]
+ public FigureInfoList ROFstFigures
+ {
+ [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
+ get
+ {
+ CanReadProperty("ROFstFigures", true);
+ if (_ROFstFigureCount < 0 || (_ROFstFigureCount > 0 && _ROFstFigures == null))
+ _ROFstFigures = FigureInfoList.GetByROFstID(_ROFstID);
+ if (_ROFstFigureCount < 0)
+ _ROFstFigureCount = _ROFstFigures.Count;
+ return _ROFstFigures;
+ }
+ }
+ public void RefreshROFstFigures()
+ {
+ ConvertListToDictionary();
+ if (_CacheByPrimaryKey.ContainsKey(_ROFstID.ToString()))
+ foreach (ROFstInfo tmp in _CacheByPrimaryKey[_ROFstID.ToString()])
+ tmp._ROFstFigureCount = -1; // This will cause the data to be requeried
+ }
+ // TODO: Replace base ROFstInfo.ToString function as necessary
+ ///
+ /// Overrides Base ToString
+ ///
+ /// A string representation of current ROFstInfo
+ //public override string ToString()
+ //{
+ // return base.ToString();
+ //}
+ // TODO: Check ROFstInfo.GetIdValue to assure that the ID returned is unique
+ ///
+ /// Overrides Base GetIdValue - Used internally by CSLA to determine equality
+ ///
+ /// A Unique ID for the current ROFstInfo
+ protected override object GetIdValue()
+ {
+ return _ROFstID;
+ }
+ #endregion
+ #region Factory Methods
+ private static int _ROFstInfoUnique = 0;
+ private static int ROFstInfoUnique
+ { get { return ++_ROFstInfoUnique; } }
+ private int _MyROFstInfoUnique = ROFstInfoUnique;
+ public int MyROFstInfoUnique
+ { get { return _MyROFstInfoUnique; } }
+ protected ROFstInfo()
+ {/* require use of factory methods */
+ AddToCache(this);
+ }
+ public void Dispose()
+ {
+ RemoveFromCache(this);
+ if (!_CacheByPrimaryKey.ContainsKey(ROFstID.ToString())) return;
+ List listROFstInfo = _CacheByPrimaryKey[ROFstID.ToString()]; // Get the list of items
+ while (listROFstInfo.Contains(this)) listROFstInfo.Remove(this); // Remove the item from the list
+ if (listROFstInfo.Count == 0) // If there are no items left in the list
+ _CacheByPrimaryKey.Remove(ROFstID.ToString()); // remove the list
+ }
+ public virtual ROFst Get()
+ {
+ return _Editable = ROFst.Get(_ROFstID);
+ }
+ public static void Refresh(ROFst tmp)
+ {
+ string key = tmp.ROFstID.ToString();
+ ConvertListToDictionary();
+ if (_CacheByPrimaryKey.ContainsKey(key))
+ foreach (ROFstInfo tmpInfo in _CacheByPrimaryKey[key])
+ tmpInfo.RefreshFields(tmp);
+ }
+ protected virtual void RefreshFields(ROFst tmp)
+ {
+ if (_RODbID != tmp.RODbID)
+ {
+ if (MyRODb != null) MyRODb.RefreshRODbROFsts(); // Update List for old value
+ _RODbID = tmp.RODbID; // Update the value
+ }
+ _MyRODb = null; // Reset list so that the next line gets a new list
+ if (MyRODb != null) MyRODb.RefreshRODbROFsts(); // Update List for new value
+ _ROLookup = tmp.ROLookup;
+ _Config = tmp.Config;
+ _DTS = tmp.DTS;
+ _UserID = tmp.UserID;
+ _ROFstInfoExtension.Refresh(this);
+ if(_MyRODb != null)
+ {
+ _MyRODb.Dispose();// Dispose related value
+ _MyRODb = null;// Reset related value
+ }
+ OnChange();// raise an event
+ }
+ public static void Refresh(RODbROFst tmp)
+ {
+ string key = tmp.ROFstID.ToString();
+ ConvertListToDictionary();
+ if (_CacheByPrimaryKey.ContainsKey(key))
+ foreach (ROFstInfo tmpInfo in _CacheByPrimaryKey[key])
+ tmpInfo.RefreshFields(tmp);
+ }
+ protected virtual void RefreshFields(RODbROFst tmp)
+ {
+ _ROLookup = tmp.ROLookup;
+ _Config = tmp.Config;
+ _DTS = tmp.DTS;
+ _UserID = tmp.UserID;
+ _ROFstInfoExtension.Refresh(this);
+ if(_MyRODb != null)
+ {
+ _MyRODb.Dispose();// Dispose related value
+ _MyRODb = null;// Reset related value
+ }
+ OnChange();// raise an event
+ }
+ public static ROFstInfo Get(int rOFstID)
+ {
+ //if (!CanGetObject())
+ // throw new System.Security.SecurityException("User not authorized to view a ROFst");
+ try
+ {
+ ROFstInfo tmp = GetCachedByPrimaryKey(rOFstID);
+ if (tmp == null)
+ {
+ tmp = DataPortal.Fetch(new PKCriteria(rOFstID));
+ AddToCache(tmp);
+ }
+ if (tmp.ErrorMessage == "No Record Found")
+ {
+ tmp.Dispose(); // Clean-up ROFstInfo
+ tmp = null;
+ }
+ return tmp;
+ }
+ catch (Exception ex)
+ {
+ throw new DbCslaException("Error on ROFstInfo.Get", ex);
+ }
+ }
+ #endregion
+ #region Data Access Portal
+ internal ROFstInfo(SafeDataReader dr)
+ {
+ if (_MyLog.IsDebugEnabled) _MyLog.DebugFormat("[{0}] ROFstInfo.Constructor", GetHashCode());
+ try
+ {
+ ReadData(dr);
+ }
+ catch (Exception ex)
+ {
+ if (_MyLog.IsErrorEnabled) _MyLog.Error("ROFstInfo.Constructor", ex);
+ throw new DbCslaException("ROFstInfo.Constructor", ex);
+ }
+ }
+ [Serializable()]
+ protected class PKCriteria
+ {
+ private int _ROFstID;
+ public int ROFstID
+ { get { return _ROFstID; } }
+ public PKCriteria(int rOFstID)
+ {
+ _ROFstID = rOFstID;
+ }
+ }
+ private void ReadData(SafeDataReader dr)
+ {
+ if (_MyLog.IsDebugEnabled) _MyLog.DebugFormat("[{0}] ROFstInfo.ReadData", GetHashCode());
+ try
+ {
+ _ROFstID = dr.GetInt32("ROFstID");
+ _RODbID = dr.GetInt32("RODbID");
+ _ROLookup = (byte[])dr.GetValue("ROLookup");
+ _Config = dr.GetString("Config");
+ _DTS = dr.GetDateTime("DTS");
+ _UserID = dr.GetString("UserID");
+ _ROFstAssociationCount = dr.GetInt32("AssociationCount");
+ _ROFstFigureCount = dr.GetInt32("FigureCount");
+ }
+ catch (Exception ex)
+ {
+ if (_MyLog.IsErrorEnabled) _MyLog.Error("ROFstInfo.ReadData", ex);
+ _ErrorMessage = ex.Message;
+ throw new DbCslaException("ROFstInfo.ReadData", ex);
+ }
+ }
+ private void DataPortal_Fetch(PKCriteria criteria)
+ {
+ if (_MyLog.IsDebugEnabled) _MyLog.DebugFormat("[{0}] ROFstInfo.DataPortal_Fetch", GetHashCode());
+ try
+ {
+ using (SqlConnection cn = Database.VEPROMS_SqlConnection)
+ {
+ ApplicationContext.LocalContext["cn"] = cn;
+ using (SqlCommand cm = cn.CreateCommand())
+ {
+ cm.CommandType = CommandType.StoredProcedure;
+ cm.CommandText = "getROFst";
+ cm.Parameters.AddWithValue("@ROFstID", criteria.ROFstID);
+ using (SafeDataReader dr = new SafeDataReader(cm.ExecuteReader()))
+ {
+ if (!dr.Read())
+ {
+ _ErrorMessage = "No Record Found";
+ return;
+ }
+ ReadData(dr);
+ }
+ }
+ // removing of item only needed for local data portal
+ if (ApplicationContext.ExecutionLocation == ApplicationContext.ExecutionLocations.Client)
+ ApplicationContext.LocalContext.Remove("cn");
+ }
+ }
+ catch (Exception ex)
+ {
+ if (_MyLog.IsErrorEnabled) _MyLog.Error("ROFstInfo.DataPortal_Fetch", ex);
+ _ErrorMessage = ex.Message;
+ throw new DbCslaException("ROFstInfo.DataPortal_Fetch", ex);
+ }
+ }
+ #endregion
+ // Standard Refresh
+ #region extension
+ ROFstInfoExtension _ROFstInfoExtension = new ROFstInfoExtension();
+ [Serializable()]
+ partial class ROFstInfoExtension : extensionBase { }
+ [Serializable()]
+ class extensionBase
+ {
+ // Default Refresh
+ public virtual void Refresh(ROFstInfo tmp) { }
+ }
+ #endregion
+ } // Class
+ #region Converter
+ internal class ROFstInfoConverter : ExpandableObjectConverter
+ {
+ public override object ConvertTo(ITypeDescriptorContext context, System.Globalization.CultureInfo culture, object value, Type destType)
+ {
+ if (destType == typeof(string) && value is ROFstInfo)
+ {
+ // Return the ToString value
+ return ((ROFstInfo)value).ToString();
+ }
+ return base.ConvertTo(context, culture, value, destType);
+ }
+ }
+ #endregion
+} // Namespace
diff --git a/PROMS/VEPROMS.CSLA.Library/Generated/ROFstInfoList.cs b/PROMS/VEPROMS.CSLA.Library/Generated/ROFstInfoList.cs
new file mode 100644
index 00000000..ec83317e
--- /dev/null
+++ b/PROMS/VEPROMS.CSLA.Library/Generated/ROFstInfoList.cs
@@ -0,0 +1,262 @@
+// ========================================================================
+// Copyright 2007 - 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;
+using System.ComponentModel;
+using System.Collections.Generic;
+namespace VEPROMS.CSLA.Library
+{
+ ///
+ /// ROFstInfoList Generated by MyGeneration using the CSLA Object Mapping template
+ ///
+ [Serializable()]
+ [TypeConverter(typeof(ROFstInfoListConverter))]
+ public partial class ROFstInfoList : ReadOnlyListBase, ICustomTypeDescriptor, IDisposable
+ {
+ #region Log4Net
+ private static readonly log4net.ILog _MyLog = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
+ #endregion
+ #region Business Methods
+ internal new IList Items
+ { get { return base.Items; } }
+ public void AddEvents()
+ {
+ foreach (ROFstInfo tmp in this)
+ {
+ tmp.Changed += new ROFstInfoEvent(tmp_Changed);
+ }
+ }
+ void tmp_Changed(object sender)
+ {
+ for (int i = 0; i < Count; i++)
+ {
+ if (base[i] == sender)
+ this.OnListChanged(new ListChangedEventArgs(ListChangedType.ItemChanged, i));
+ }
+ }
+ public void Dispose()
+ {
+ foreach (ROFstInfo tmp in this)
+ {
+ tmp.Changed -= new ROFstInfoEvent(tmp_Changed);
+ }
+ }
+ #endregion
+ #region Factory Methods
+ public static ROFstInfoList _ROFstInfoList = null;
+ ///
+ /// Return a list of all ROFstInfo.
+ ///
+ public static ROFstInfoList Get()
+ {
+ try
+ {
+ if (_ROFstInfoList != null)
+ return _ROFstInfoList;
+ ROFstInfoList tmp = DataPortal.Fetch();
+ ROFstInfo.AddList(tmp);
+ tmp.AddEvents();
+ _ROFstInfoList = tmp;
+ return tmp;
+ }
+ catch (Exception ex)
+ {
+ throw new DbCslaException("Error on ROFstInfoList.Get", ex);
+ }
+ }
+ ///
+ /// Reset the list of all ROFstInfo.
+ ///
+ public static void Reset()
+ {
+ _ROFstInfoList = null;
+ }
+ // TODO: Add alternative gets -
+ //public static ROFstInfoList Get()
+ //{
+ // try
+ // {
+ // return DataPortal.Fetch(new FilteredCriteria());
+ // }
+ // catch (Exception ex)
+ // {
+ // throw new DbCslaException("Error on ROFstInfoList.Get", ex);
+ // }
+ //}
+ public static ROFstInfoList GetByRODbID(int rODbID)
+ {
+ try
+ {
+ ROFstInfoList tmp = DataPortal.Fetch(new RODbIDCriteria(rODbID));
+ ROFstInfo.AddList(tmp);
+ tmp.AddEvents();
+ return tmp;
+ }
+ catch (Exception ex)
+ {
+ throw new DbCslaException("Error on ROFstInfoList.GetByRODbID", ex);
+ }
+ }
+ private ROFstInfoList()
+ { /* require use of factory methods */ }
+ #endregion
+ #region Data Access Portal
+ private void DataPortal_Fetch()
+ {
+ this.RaiseListChangedEvents = false;
+ if (_MyLog.IsDebugEnabled) _MyLog.DebugFormat("[{0}] ROFstInfoList.DataPortal_Fetch", GetHashCode());
+ try
+ {
+ using (SqlConnection cn = Database.VEPROMS_SqlConnection)
+ {
+ using (SqlCommand cm = cn.CreateCommand())
+ {
+ cm.CommandType = CommandType.StoredProcedure;
+ cm.CommandText = "getROFsts";
+ using (SafeDataReader dr = new SafeDataReader(cm.ExecuteReader()))
+ {
+ IsReadOnly = false;
+ while (dr.Read()) this.Add(new ROFstInfo(dr));
+ IsReadOnly = true;
+ }
+ }
+ }
+ }
+ catch (Exception ex)
+ {
+ if (_MyLog.IsErrorEnabled) _MyLog.Error("ROFstInfoList.DataPortal_Fetch", ex);
+ throw new DbCslaException("ROFstInfoList.DataPortal_Fetch", ex);
+ }
+ this.RaiseListChangedEvents = true;
+ }
+ [Serializable()]
+ private class RODbIDCriteria
+ {
+ public RODbIDCriteria(int rODbID)
+ {
+ _RODbID = rODbID;
+ }
+ private int _RODbID;
+ public int RODbID
+ {
+ get { return _RODbID; }
+ set { _RODbID = value; }
+ }
+ }
+ private void DataPortal_Fetch(RODbIDCriteria criteria)
+ {
+ this.RaiseListChangedEvents = false;
+ if (_MyLog.IsDebugEnabled) _MyLog.DebugFormat("[{0}] ROFstInfoList.DataPortal_FetchRODbID", GetHashCode());
+ try
+ {
+ using (SqlConnection cn = Database.VEPROMS_SqlConnection)
+ {
+ using (SqlCommand cm = cn.CreateCommand())
+ {
+ cm.CommandType = CommandType.StoredProcedure;
+ cm.CommandText = "getROFstsByRODbID";
+ cm.Parameters.AddWithValue("@RODbID", criteria.RODbID);
+ using (SafeDataReader dr = new SafeDataReader(cm.ExecuteReader()))
+ {
+ IsReadOnly = false;
+ while (dr.Read()) this.Add(new ROFstInfo(dr));
+ IsReadOnly = true;
+ }
+ }
+ }
+ }
+ catch (Exception ex)
+ {
+ if (_MyLog.IsErrorEnabled) _MyLog.Error("ROFstInfoList.DataPortal_FetchRODbID", ex);
+ throw new DbCslaException("ROFstInfoList.DataPortal_Fetch", ex);
+ }
+ this.RaiseListChangedEvents = true;
+ }
+ #endregion
+ #region ICustomTypeDescriptor impl
+ public String GetClassName()
+ { return TypeDescriptor.GetClassName(this, true); }
+ public AttributeCollection GetAttributes()
+ { return TypeDescriptor.GetAttributes(this, true); }
+ public String GetComponentName()
+ { return TypeDescriptor.GetComponentName(this, true); }
+ public TypeConverter GetConverter()
+ { return TypeDescriptor.GetConverter(this, true); }
+ public EventDescriptor GetDefaultEvent()
+ { return TypeDescriptor.GetDefaultEvent(this, true); }
+ public PropertyDescriptor GetDefaultProperty()
+ { return TypeDescriptor.GetDefaultProperty(this, true); }
+ public object GetEditor(Type editorBaseType)
+ { return TypeDescriptor.GetEditor(this, editorBaseType, true); }
+ public EventDescriptorCollection GetEvents(Attribute[] attributes)
+ { return TypeDescriptor.GetEvents(this, attributes, true); }
+ public EventDescriptorCollection GetEvents()
+ { return TypeDescriptor.GetEvents(this, true); }
+ public object GetPropertyOwner(PropertyDescriptor pd)
+ { return this; }
+ ///
+ /// Called to get the properties of this type. Returns properties with certain
+ /// attributes. this restriction is not implemented here.
+ ///
+ ///
+ ///
+ public PropertyDescriptorCollection GetProperties(Attribute[] attributes)
+ { return GetProperties(); }
+ ///
+ /// Called to get the properties of this type.
+ ///
+ ///
+ public PropertyDescriptorCollection GetProperties()
+ {
+ // Create a collection object to hold property descriptors
+ PropertyDescriptorCollection pds = new PropertyDescriptorCollection(null);
+ // Iterate the list
+ for (int i = 0; i < this.Items.Count; i++)
+ {
+ // Create a property descriptor for the item and add to the property descriptor collection
+ ROFstInfoListPropertyDescriptor pd = new ROFstInfoListPropertyDescriptor(this, i);
+ pds.Add(pd);
+ }
+ // return the property descriptor collection
+ return pds;
+ }
+ #endregion
+ } // Class
+ #region Property Descriptor
+ ///
+ /// Summary description for CollectionPropertyDescriptor.
+ ///
+ public partial class ROFstInfoListPropertyDescriptor : vlnListPropertyDescriptor
+ {
+ private ROFstInfo Item { get { return (ROFstInfo)_Item; } }
+ public ROFstInfoListPropertyDescriptor(ROFstInfoList collection, int index) : base(collection, index) { ;}
+ }
+ #endregion
+ #region Converter
+ internal class ROFstInfoListConverter : ExpandableObjectConverter
+ {
+ public override object ConvertTo(ITypeDescriptorContext context, System.Globalization.CultureInfo culture, object value, Type destType)
+ {
+ if (destType == typeof(string) && value is ROFstInfoList)
+ {
+ // Return department and department role separated by comma.
+ return ((ROFstInfoList)value).Items.Count.ToString() + " ROFsts";
+ }
+ return base.ConvertTo(context, culture, value, destType);
+ }
+ }
+ #endregion
+} // Namespace
diff --git a/PROMS/VEPROMS.CSLA.Library/Generated/ROImage.cs b/PROMS/VEPROMS.CSLA.Library/Generated/ROImage.cs
new file mode 100644
index 00000000..3237f22f
--- /dev/null
+++ b/PROMS/VEPROMS.CSLA.Library/Generated/ROImage.cs
@@ -0,0 +1,1257 @@
+// ========================================================================
+// Copyright 2007 - 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;
+using System.ComponentModel;
+using System.Collections.Generic;
+using Csla.Validation;
+namespace VEPROMS.CSLA.Library
+{
+ ///
+ /// ROImage Generated by MyGeneration using the CSLA Object Mapping template
+ ///
+ [Serializable()]
+ [TypeConverter(typeof(ROImageConverter))]
+ public partial class ROImage : BusinessBase, IDisposable, IVEHasBrokenRules
+ {
+ #region Log4Net
+ private static readonly log4net.ILog _MyLog = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
+ #endregion
+ #region Refresh
+ private List _RefreshROImages = new List();
+ private List _RefreshROImageFigures = new List();
+ private void AddToRefreshList(List refreshROImages, List refreshROImageFigures)
+ {
+ if (IsDirty)
+ refreshROImages.Add(this);
+ if (_ROImageFigures != null && _ROImageFigures.IsDirty)
+ {
+ foreach (ROImageFigure tmp in _ROImageFigures)
+ {
+ if (tmp.IsDirty) refreshROImageFigures.Add(tmp);
+ }
+ }
+ }
+ private void BuildRefreshList()
+ {
+ _RefreshROImages = new List();
+ _RefreshROImageFigures = new List();
+ AddToRefreshList(_RefreshROImages, _RefreshROImageFigures);
+ }
+ private void ProcessRefreshList()
+ {
+ foreach (ROImage tmp in _RefreshROImages)
+ {
+ ROImageInfo.Refresh(tmp);
+ if (tmp._MyRODb != null) RODbInfo.Refresh(tmp._MyRODb);
+ }
+ foreach (ROImageFigure tmp in _RefreshROImageFigures)
+ {
+ FigureInfo.Refresh(tmp);
+ }
+ }
+ #endregion
+ #region Collection
+ private static List _CacheList = new List();
+ protected static void AddToCache(ROImage rOImage)
+ {
+ if (!_CacheList.Contains(rOImage)) _CacheList.Add(rOImage); // In AddToCache
+ }
+ protected static void RemoveFromCache(ROImage rOImage)
+ {
+ while (_CacheList.Contains(rOImage)) _CacheList.Remove(rOImage); // In RemoveFromCache
+ }
+ private static Dictionary> _CacheByPrimaryKey = new Dictionary>();
+ private static Dictionary> _CacheByRODbID_FileName_DTS = new Dictionary>();
+ private static void ConvertListToDictionary()
+ {
+ List remove = new List();
+ foreach (ROImage tmp in _CacheList)
+ {
+ if (!_CacheByPrimaryKey.ContainsKey(tmp.ImageID.ToString()))
+ {
+ _CacheByPrimaryKey[tmp.ImageID.ToString()] = new List(); // Add new list for PrimaryKey
+ _CacheByRODbID_FileName_DTS[tmp.RODbID.ToString() + "_" + tmp.FileName.ToString() + "_" + tmp.DTS.ToString()] = new List(); // Add new list for RODbID_FileName_DTS
+ }
+ _CacheByPrimaryKey[tmp.ImageID.ToString()].Add(tmp); // Add to Primary Key list
+ _CacheByRODbID_FileName_DTS[tmp.RODbID.ToString() + "_" + tmp.FileName.ToString() + "_" + tmp.DTS.ToString()].Add(tmp); // Unique Index
+ remove.Add(tmp);
+ }
+ foreach (ROImage tmp in remove)
+ RemoveFromCache(tmp);
+ }
+ protected static ROImage GetCachedByPrimaryKey(int imageID)
+ {
+ ConvertListToDictionary();
+ string key = imageID.ToString();
+ if (_CacheByPrimaryKey.ContainsKey(key)) return _CacheByPrimaryKey[key][0];
+ return null;
+ }
+ protected static ROImage GetCachedByRODbID_FileName_DTS(int rODbID, string fileName, DateTime dts)
+ {
+ ConvertListToDictionary();
+ string key = rODbID.ToString() + "_" + fileName.ToString() + "_" + dts.ToString();
+ if (_CacheByRODbID_FileName_DTS.ContainsKey(key)) return _CacheByRODbID_FileName_DTS[key][0];
+ return null;
+ }
+ #endregion
+ #region Business Methods
+ private string _ErrorMessage = string.Empty;
+ public string ErrorMessage
+ {
+ get { return _ErrorMessage; }
+ }
+ private static int _nextImageID = -1;
+ public static int NextImageID
+ {
+ get { return _nextImageID--; }
+ }
+ private int _ImageID;
+ [System.ComponentModel.DataObjectField(true, true)]
+ public int ImageID
+ {
+ [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
+ get
+ {
+ CanReadProperty("ImageID", true);
+ return _ImageID;
+ }
+ }
+ private int _RODbID;
+ public int RODbID
+ {
+ [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
+ get
+ {
+ CanReadProperty("RODbID", true);
+ if (_MyRODb != null) _RODbID = _MyRODb.RODbID;
+ return _RODbID;
+ }
+ }
+ private RODb _MyRODb;
+ public RODb MyRODb
+ {
+ [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
+ get
+ {
+ CanReadProperty("MyRODb", true);
+ if (_MyRODb == null && _RODbID != 0) _MyRODb = RODb.Get(_RODbID);
+ return _MyRODb;
+ }
+ [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
+ set
+ {
+ CanWriteProperty("MyRODb", true);
+ if (_MyRODb != value)
+ {
+ _MyRODb = value;
+ PropertyHasChanged();
+ }
+ }
+ }
+ private string _FileName = string.Empty;
+ public string FileName
+ {
+ [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
+ get
+ {
+ CanReadProperty("FileName", true);
+ return _FileName;
+ }
+ [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
+ set
+ {
+ CanWriteProperty("FileName", true);
+ if (value == null) value = string.Empty;
+ if (_FileName != value)
+ {
+ _FileName = value;
+ PropertyHasChanged();
+ }
+ }
+ }
+ private byte[] _Content;
+ public byte[] Content
+ {
+ [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
+ get
+ {
+ CanReadProperty("Content", true);
+ return _Content;
+ }
+ [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
+ set
+ {
+ CanWriteProperty("Content", true);
+ if (_Content != value)
+ {
+ _Content = value;
+ PropertyHasChanged();
+ }
+ }
+ }
+ private string _Config = string.Empty;
+ public string Config
+ {
+ [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
+ get
+ {
+ CanReadProperty("Config", true);
+ return _Config;
+ }
+ [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
+ set
+ {
+ CanWriteProperty("Config", true);
+ if (value == null) value = string.Empty;
+ if (_Config != value)
+ {
+ _Config = value;
+ PropertyHasChanged();
+ }
+ }
+ }
+ private DateTime _DTS = new DateTime();
+ public DateTime DTS
+ {
+ [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
+ get
+ {
+ CanReadProperty("DTS", true);
+ return _DTS;
+ }
+ [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
+ set
+ {
+ CanWriteProperty("DTS", 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("UserID", true);
+ return _UserID;
+ }
+ [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
+ set
+ {
+ CanWriteProperty("UserID", true);
+ if (value == null) value = string.Empty;
+ if (_UserID != value)
+ {
+ _UserID = value;
+ PropertyHasChanged();
+ }
+ }
+ }
+ private byte[] _LastChanged = new byte[8];//timestamp
+ private int _ROImageFigureCount = 0;
+ ///
+ /// Count of ROImageFigures for this ROImage
+ ///
+ public int ROImageFigureCount
+ {
+ [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
+ get
+ {
+ CanReadProperty("ROImageFigureCount", true);
+ return _ROImageFigureCount;
+ }
+ }
+ private ROImageFigures _ROImageFigures = null;
+ ///
+ /// Related Field
+ ///
+ [TypeConverter(typeof(ROImageFiguresConverter))]
+ public ROImageFigures ROImageFigures
+ {
+ [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
+ get
+ {
+ CanReadProperty("ROImageFigures", true);
+ if (_ROImageFigureCount < 0 || (_ROImageFigureCount > 0 && _ROImageFigures == null))
+ _ROImageFigures = ROImageFigures.GetByImageID(ImageID);
+ if (_ROImageFigureCount < 0 )
+ _ROImageFigureCount = _ROImageFigures == null ? 0 : _ROImageFigures.Count;
+ if (_ROImageFigures == null)
+ _ROImageFigures = ROImageFigures.New();
+ return _ROImageFigures;
+ }
+ }
+ public void Reset_ROImageFigures()
+ {
+ _ROImageFigureCount = -1;
+ }
+ public override bool IsDirty
+ {
+ get { return base.IsDirty || (_ROImageFigures == null ? false : _ROImageFigures.IsDirty) || (_MyRODb == null ? false : _MyRODb.IsDirty); }
+ }
+ public override bool IsValid
+ {
+ get { return (IsNew && !IsDirty ? true : base.IsValid) && (_ROImageFigures == null ? true : _ROImageFigures.IsValid) && (_MyRODb == null ? true : _MyRODb.IsValid); }
+ }
+ // TODO: Replace base ROImage.ToString function as necessary
+ ///
+ /// Overrides Base ToString
+ ///
+ /// A string representation of current ROImage
+ //public override string ToString()
+ //{
+ // return base.ToString();
+ //}
+ // TODO: Check ROImage.GetIdValue to assure that the ID returned is unique
+ ///
+ /// Overrides Base GetIdValue - Used internally by CSLA to determine equality
+ ///
+ /// A Unique ID for the current ROImage
+ protected override object GetIdValue()
+ {
+ return _ImageID;
+ }
+ #endregion
+ #region ValidationRules
+ [NonSerialized]
+ private bool _CheckingBrokenRules = false;
+ public IVEHasBrokenRules HasBrokenRules
+ {
+ get
+ {
+ if (_CheckingBrokenRules) return null;
+ if ((IsDirty || !IsNew) && BrokenRulesCollection.Count > 0) return this;
+ try
+ {
+ _CheckingBrokenRules = true;
+ IVEHasBrokenRules hasBrokenRules = null;
+ if (_ROImageFigures != null && (hasBrokenRules = _ROImageFigures.HasBrokenRules) != null) return hasBrokenRules;
+ if (_MyRODb != null && (hasBrokenRules = _MyRODb.HasBrokenRules) != null) return hasBrokenRules;
+ return hasBrokenRules;
+ }
+ finally
+ {
+ _CheckingBrokenRules = false;
+ }
+ }
+ }
+ public BrokenRulesCollection BrokenRules
+ {
+ get
+ {
+ IVEHasBrokenRules hasBrokenRules = HasBrokenRules;
+ if (this.Equals(hasBrokenRules)) return BrokenRulesCollection;
+ return (hasBrokenRules != null ? hasBrokenRules.BrokenRules : null);
+ }
+ }
+ protected override void AddBusinessRules()
+ {
+ ValidationRules.AddRule(MyRODbRequired, "MyRODb");
+ ValidationRules.AddRule(
+ Csla.Validation.CommonRules.StringRequired, "FileName");
+ ValidationRules.AddRule(
+ Csla.Validation.CommonRules.StringMaxLength,
+ new Csla.Validation.CommonRules.MaxLengthRuleArgs("FileName", 255));
+ ValidationRules.AddRule(
+ Csla.Validation.CommonRules.StringMaxLength,
+ new Csla.Validation.CommonRules.MaxLengthRuleArgs("Config", 1073741823));
+ ValidationRules.AddRule(
+ Csla.Validation.CommonRules.StringRequired, "UserID");
+ ValidationRules.AddRule(
+ Csla.Validation.CommonRules.StringMaxLength,
+ new Csla.Validation.CommonRules.MaxLengthRuleArgs("UserID", 100));
+ //ValidationRules.AddDependantProperty("x", "y");
+ _ROImageExtension.AddValidationRules(ValidationRules);
+ // TODO: Add other validation rules
+ }
+ protected override void AddInstanceBusinessRules()
+ {
+ _ROImageExtension.AddInstanceValidationRules(ValidationRules);
+ // TODO: Add other validation rules
+ }
+ private static bool MyRODbRequired(ROImage target, Csla.Validation.RuleArgs e)
+ {
+ if (target._RODbID == 0 && target._MyRODb == null) // Required field missing
+ {
+ e.Description = "Required";
+ return false;
+ }
+ return true;
+ }
+ // 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(ImageID, "");
+ //AuthorizationRules.AllowRead(RODbID, "");
+ //AuthorizationRules.AllowRead(FileName, "");
+ //AuthorizationRules.AllowRead(Content, "");
+ //AuthorizationRules.AllowRead(Config, "");
+ //AuthorizationRules.AllowRead(DTS, "");
+ //AuthorizationRules.AllowRead(UserID, "");
+ //AuthorizationRules.AllowWrite(RODbID, "");
+ //AuthorizationRules.AllowWrite(FileName, "");
+ //AuthorizationRules.AllowWrite(Content, "");
+ //AuthorizationRules.AllowWrite(Config, "");
+ //AuthorizationRules.AllowWrite(DTS, "");
+ //AuthorizationRules.AllowWrite(UserID, "");
+ _ROImageExtension.AddAuthorizationRules(AuthorizationRules);
+ }
+ protected override void AddInstanceAuthorizationRules()
+ {
+ //TODO: Who can read/write which fields
+ _ROImageExtension.AddInstanceAuthorizationRules(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;
+ }
+ ///
+ /// determines if related records (Foreign Keys) will keep this Item from being deleted
+ ///
+ public bool CanDelete
+ {
+ get
+ {
+ // Check to make sure that there are not any related records
+ int usedByCount = 0;
+ usedByCount += _ROImageFigureCount;
+ return (usedByCount == 0);
+ }
+ }
+ 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 static int _ROImageUnique = 0;
+ protected static int ROImageUnique
+ { get { return ++_ROImageUnique; } }
+ private int _MyROImageUnique = ROImageUnique;
+ public int MyROImageUnique
+ { get { return _MyROImageUnique; } }
+ protected ROImage()
+ {/* require use of factory methods */
+ AddToCache(this);
+ }
+ public void Dispose()
+ {
+ RemoveFromDictionaries();
+ }
+ private void RemoveFromDictionaries()
+ {
+ RemoveFromCache(this);
+ if (_CacheByPrimaryKey.ContainsKey(ImageID.ToString()))
+ {
+ List listROImage = _CacheByPrimaryKey[ImageID.ToString()]; // Get the list of items
+ while (listROImage.Contains(this)) listROImage.Remove(this); // Remove the item from the list
+ if (listROImage.Count == 0) //If there are no items left in the list
+ _CacheByPrimaryKey.Remove(ImageID.ToString()); // remove the list
+ }
+ string myKey;
+ myKey = null;
+ foreach (string key in _CacheByRODbID_FileName_DTS.Keys)
+ if (_CacheByRODbID_FileName_DTS[key].Contains(this))
+ myKey = key;
+ if (myKey != null)
+ {
+ List listROImage = _CacheByRODbID_FileName_DTS[myKey]; // Get the list of items
+ listROImage.Remove(this); // Remove the item from the list
+ if (listROImage.Count == 0) //If there are no items left in the list
+ _CacheByRODbID_FileName_DTS.Remove(myKey); // remove the list
+ }
+ }
+ public static ROImage New()
+ {
+ if (!CanAddObject())
+ throw new System.Security.SecurityException("User not authorized to add a ROImage");
+ try
+ {
+ return DataPortal.Create();
+ }
+ catch (Exception ex)
+ {
+ throw new DbCslaException("Error on ROImage.New", ex);
+ }
+ }
+ public static ROImage New(RODb myRODb, string fileName, byte[] content)
+ {
+ ROImage tmp = ROImage.New();
+ tmp.MyRODb = myRODb;
+ tmp.FileName = fileName;
+ tmp.Content = content;
+ return tmp;
+ }
+ public static ROImage New(RODb myRODb, string fileName, byte[] content, string config, DateTime dts, string userID)
+ {
+ ROImage tmp = ROImage.New();
+ tmp.MyRODb = myRODb;
+ tmp.FileName = fileName;
+ tmp.Content = content;
+ tmp.Config = config;
+ tmp.DTS = dts;
+ tmp.UserID = userID;
+ return tmp;
+ }
+ public static ROImage MakeROImage(RODb myRODb, string fileName, byte[] content, string config, DateTime dts, string userID)
+ {
+ ROImage tmp = ROImage.New(myRODb, fileName, content, config, dts, userID);
+ if (tmp.IsSavable)
+ {
+ ROImage tmp2 = tmp;
+ tmp = tmp2.Save();
+ tmp2.Dispose();
+ }
+ else
+ {
+ Csla.Validation.BrokenRulesCollection brc = tmp.ValidationRules.GetBrokenRules();
+ tmp._ErrorMessage = "Failed Validation:";
+ foreach (Csla.Validation.BrokenRule br in brc)
+ {
+ tmp._ErrorMessage += "\r\n\tFailure: " + br.RuleName;
+ }
+ }
+ return tmp;
+ }
+ public static ROImage New(RODb myRODb, string fileName, byte[] content, string config)
+ {
+ ROImage tmp = ROImage.New();
+ tmp.MyRODb = myRODb;
+ tmp.FileName = fileName;
+ tmp.Content = content;
+ tmp.Config = config;
+ return tmp;
+ }
+ public static ROImage MakeROImage(RODb myRODb, string fileName, byte[] content, string config)
+ {
+ ROImage tmp = ROImage.New(myRODb, fileName, content, config);
+ if (tmp.IsSavable)
+ {
+ ROImage tmp2 = tmp;
+ tmp = tmp2.Save();
+ tmp2.Dispose();
+ }
+ else
+ {
+ Csla.Validation.BrokenRulesCollection brc = tmp.ValidationRules.GetBrokenRules();
+ tmp._ErrorMessage = "Failed Validation:";
+ foreach (Csla.Validation.BrokenRule br in brc)
+ {
+ tmp._ErrorMessage += "\r\n\tFailure: " + br.RuleName;
+ }
+ }
+ return tmp;
+ }
+ public static ROImage Get(int imageID)
+ {
+ if (!CanGetObject())
+ throw new System.Security.SecurityException("User not authorized to view a ROImage");
+ try
+ {
+ ROImage tmp = GetCachedByPrimaryKey(imageID);
+ if (tmp == null)
+ {
+ tmp = DataPortal.Fetch(new PKCriteria(imageID));
+ AddToCache(tmp);
+ }
+ if (tmp.ErrorMessage == "No Record Found")
+ {
+ tmp.Dispose(); // Clean-up ROImage
+ tmp = null;
+ }
+ return tmp;
+ }
+ catch (Exception ex)
+ {
+ throw new DbCslaException("Error on ROImage.Get", ex);
+ }
+ }
+ public static ROImage GetByRODbID_FileName_DTS(int rODbID, string fileName, DateTime dts)
+ {
+ if (!CanGetObject())
+ throw new System.Security.SecurityException("User not authorized to view a ROImage");
+ try
+ {
+ ROImage tmp = GetCachedByRODbID_FileName_DTS(rODbID, fileName, dts);
+ if (tmp == null)
+ {
+ tmp = DataPortal.Fetch(new RODbID_FileName_DTSCriteria(rODbID, fileName, dts));
+ AddToCache(tmp);
+ }
+ if (tmp.ErrorMessage == "No Record Found")
+ {
+ tmp.Dispose(); // Clean-up ROImage
+ tmp = null;
+ }
+ return tmp;
+ }
+ catch (Exception ex)
+ {
+ throw new DbCslaException("Error on ROImage.GetByRODbID_FileName_DTS", ex);
+ }
+ }
+ public static ROImage Get(SafeDataReader dr)
+ {
+ if (dr.Read()) return new ROImage(dr);
+ return null;
+ }
+ internal ROImage(SafeDataReader dr)
+ {
+ ReadData(dr);
+ }
+ public static void Delete(int imageID)
+ {
+ if (!CanDeleteObject())
+ throw new System.Security.SecurityException("User not authorized to remove a ROImage");
+ try
+ {
+ DataPortal.Delete(new PKCriteria(imageID));
+ }
+ catch (Exception ex)
+ {
+ throw new DbCslaException("Error on ROImage.Delete", ex);
+ }
+ }
+ public override ROImage Save()
+ {
+ if (IsDeleted && !CanDeleteObject())
+ throw new System.Security.SecurityException("User not authorized to remove a ROImage");
+ else if (IsNew && !CanAddObject())
+ throw new System.Security.SecurityException("User not authorized to add a ROImage");
+ else if (!CanEditObject())
+ throw new System.Security.SecurityException("User not authorized to update a ROImage");
+ try
+ {
+ BuildRefreshList();
+ ROImage rOImage = base.Save();
+ RemoveFromDictionaries(); // if save is successful remove the previous Folder from the cache
+ AddToCache(rOImage);//Refresh the item in AllList
+ ProcessRefreshList();
+ return rOImage;
+ }
+ catch (Exception ex)
+ {
+ throw new DbCslaException("Error on CSLA Save", ex);
+ }
+ }
+ #endregion
+ #region Data Access Portal
+ [Serializable()]
+ protected class PKCriteria
+ {
+ private int _ImageID;
+ public int ImageID
+ { get { return _ImageID; } }
+ public PKCriteria(int imageID)
+ {
+ _ImageID = imageID;
+ }
+ }
+ [Serializable()]
+ private class RODbID_FileName_DTSCriteria
+ {
+ private int _RODbID;
+ public int RODbID
+ { get { return _RODbID; } }
+ private string _FileName;
+ public string FileName
+ { get { return _FileName; } }
+ private DateTime _DTS;
+ public DateTime DTS
+ { get { return _DTS; } }
+ public RODbID_FileName_DTSCriteria(int rODbID, string fileName, DateTime dts)
+ {
+ _RODbID = rODbID;
+ _FileName = fileName;
+ _DTS = dts;
+ }
+ }
+ // TODO: If Create needs to access DB - It should not be marked RunLocal
+ [RunLocal()]
+ private new void DataPortal_Create()
+ {
+ _ImageID = NextImageID;
+ // Database Defaults
+ _DTS = _ROImageExtension.DefaultDTS;
+ _UserID = _ROImageExtension.DefaultUserID;
+ // TODO: Add any defaults that are necessary
+ ValidationRules.CheckRules();
+ }
+ private void ReadData(SafeDataReader dr)
+ {
+ if (_MyLog.IsDebugEnabled) _MyLog.DebugFormat("[{0}] ROImage.ReadData", GetHashCode());
+ try
+ {
+ _ImageID = dr.GetInt32("ImageID");
+ _RODbID = dr.GetInt32("RODbID");
+ _FileName = dr.GetString("FileName");
+ _Content = (byte[])dr.GetValue("Content");
+ _Config = dr.GetString("Config");
+ _DTS = dr.GetDateTime("DTS");
+ _UserID = dr.GetString("UserID");
+ dr.GetBytes("LastChanged", 0, _LastChanged, 0, 8);
+ _ROImageFigureCount = dr.GetInt32("FigureCount");
+ MarkOld();
+ }
+ catch (Exception ex)
+ {
+ if (_MyLog.IsErrorEnabled) _MyLog.Error("ROImage.ReadData", ex);
+ _ErrorMessage = ex.Message;
+ throw new DbCslaException("ROImage.ReadData", ex);
+ }
+ }
+ private void DataPortal_Fetch(PKCriteria criteria)
+ {
+ if (_MyLog.IsDebugEnabled) _MyLog.DebugFormat("[{0}] ROImage.DataPortal_Fetch", GetHashCode());
+ try
+ {
+ using (SqlConnection cn = Database.VEPROMS_SqlConnection)
+ {
+ ApplicationContext.LocalContext["cn"] = cn;
+ using (SqlCommand cm = cn.CreateCommand())
+ {
+ cm.CommandType = CommandType.StoredProcedure;
+ cm.CommandText = "getROImage";
+ cm.Parameters.AddWithValue("@ImageID", criteria.ImageID);
+ using (SafeDataReader dr = new SafeDataReader(cm.ExecuteReader()))
+ {
+ if (!dr.Read())
+ {
+ _ErrorMessage = "No Record Found";
+ return;
+ }
+ ReadData(dr);
+ // load child objects
+ dr.NextResult();
+ _ROImageFigures = ROImageFigures.Get(dr);
+ }
+ }
+ // removing of item only needed for local data portal
+ if (ApplicationContext.ExecutionLocation == ApplicationContext.ExecutionLocations.Client)
+ ApplicationContext.LocalContext.Remove("cn");
+ }
+ }
+ catch (Exception ex)
+ {
+ if (_MyLog.IsErrorEnabled) _MyLog.Error("ROImage.DataPortal_Fetch", ex);
+ _ErrorMessage = ex.Message;
+ throw new DbCslaException("ROImage.DataPortal_Fetch", ex);
+ }
+ }
+ private void DataPortal_Fetch(RODbID_FileName_DTSCriteria criteria)
+ {
+ if (_MyLog.IsDebugEnabled) _MyLog.DebugFormat("[{0}] ROImage.DataPortal_Fetch", GetHashCode());
+ try
+ {
+ using (SqlConnection cn = Database.VEPROMS_SqlConnection)
+ {
+ ApplicationContext.LocalContext["cn"] = cn;
+ using (SqlCommand cm = cn.CreateCommand())
+ {
+ cm.CommandType = CommandType.StoredProcedure;
+ cm.CommandText = "getROImageByRODbID_FileName_DTS";
+ cm.Parameters.AddWithValue("@RODbID", criteria.RODbID);
+ cm.Parameters.AddWithValue("@FileName", criteria.FileName);
+ if (criteria.DTS.Year >= 1753 && criteria.DTS.Year <= 9999) cm.Parameters.AddWithValue("@DTS", criteria.DTS);
+ using (SafeDataReader dr = new SafeDataReader(cm.ExecuteReader()))
+ {
+ if (!dr.Read())
+ {
+ _ErrorMessage = "No Record Found";
+ return;
+ }
+ ReadData(dr);
+ }
+ }
+ // removing of item only needed for local data portal
+ if (ApplicationContext.ExecutionLocation == ApplicationContext.ExecutionLocations.Client)
+ ApplicationContext.LocalContext.Remove("cn");
+ }
+ }
+ catch (Exception ex)
+ {
+ if (_MyLog.IsErrorEnabled) _MyLog.Error("ROImage.DataPortal_Fetch", ex);
+ _ErrorMessage = ex.Message;
+ throw new DbCslaException("ROImage.DataPortal_Fetch", ex);
+ }
+ }
+ [Transactional(TransactionalTypes.TransactionScope)]
+ protected override void DataPortal_Insert()
+ {
+ try
+ {
+ using (SqlConnection cn = Database.VEPROMS_SqlConnection)
+ {
+ ApplicationContext.LocalContext["cn"] = cn;
+ SQLInsert();
+ // removing of item only needed for local data portal
+ if (ApplicationContext.ExecutionLocation == ApplicationContext.ExecutionLocations.Client)
+ ApplicationContext.LocalContext.Remove("cn");
+ }
+ }
+ catch (Exception ex)
+ {
+ if (_MyLog.IsErrorEnabled) _MyLog.Error("ROImage.DataPortal_Insert", ex);
+ _ErrorMessage = ex.Message;
+ throw new DbCslaException("ROImage.DataPortal_Insert", ex);
+ }
+ finally
+ {
+ if (_MyLog.IsDebugEnabled) _MyLog.DebugFormat("[{0}] ROImage.DataPortal_Insert", GetHashCode());
+ }
+ }
+ [Transactional(TransactionalTypes.TransactionScope)]
+ internal void SQLInsert()
+ {
+ if (!this.IsDirty) return;
+ try
+ {
+ if (_MyRODb != null) _MyRODb.Update();
+ SqlConnection cn = (SqlConnection)ApplicationContext.LocalContext["cn"];
+ using (SqlCommand cm = cn.CreateCommand())
+ {
+ cm.CommandType = CommandType.StoredProcedure;
+ cm.CommandText = "addROImage";
+ // Input All Fields - Except Calculated Columns
+ cm.Parameters.AddWithValue("@RODbID", RODbID);
+ cm.Parameters.AddWithValue("@FileName", _FileName);
+ cm.Parameters.AddWithValue("@Content", _Content);
+ cm.Parameters.AddWithValue("@Config", _Config);
+ if (_DTS.Year >= 1753 && _DTS.Year <= 9999) cm.Parameters.AddWithValue("@DTS", _DTS);
+ cm.Parameters.AddWithValue("@UserID", _UserID);
+ // Output Calculated Columns
+ SqlParameter param_ImageID = new SqlParameter("@newImageID", SqlDbType.Int);
+ param_ImageID.Direction = ParameterDirection.Output;
+ cm.Parameters.Add(param_ImageID);
+ 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
+ _ImageID = (int)cm.Parameters["@newImageID"].Value;
+ _LastChanged = (byte[])cm.Parameters["@newLastChanged"].Value;
+ }
+ MarkOld();
+ // update child objects
+ if (_ROImageFigures != null) _ROImageFigures.Update(this);
+ if (_MyLog.IsDebugEnabled) _MyLog.DebugFormat("[{0}] ROImage.SQLInsert", GetHashCode());
+ }
+ catch (Exception ex)
+ {
+ if (_MyLog.IsErrorEnabled) _MyLog.Error("ROImage.SQLInsert", ex);
+ _ErrorMessage = ex.Message;
+ throw new DbCslaException("ROImage.SQLInsert", ex);
+ }
+ }
+ [Transactional(TransactionalTypes.TransactionScope)]
+ public static byte[] Add(SqlConnection cn, ref int imageID, RODb myRODb, string fileName, byte[] content, string config, DateTime dts, string userID)
+ {
+ if (_MyLog.IsDebugEnabled) _MyLog.DebugFormat("[{0}] ROImage.Add", 0);
+ try
+ {
+ using (SqlCommand cm = cn.CreateCommand())
+ {
+ cm.CommandType = CommandType.StoredProcedure;
+ cm.CommandText = "addROImage";
+ // Input All Fields - Except Calculated Columns
+ cm.Parameters.AddWithValue("@RODbID", myRODb.RODbID);
+ cm.Parameters.AddWithValue("@FileName", fileName);
+ cm.Parameters.AddWithValue("@Content", content);
+ cm.Parameters.AddWithValue("@Config", config);
+ if (dts.Year >= 1753 && dts.Year <= 9999) cm.Parameters.AddWithValue("@DTS", dts);
+ cm.Parameters.AddWithValue("@UserID", userID);
+ // Output Calculated Columns
+ SqlParameter param_ImageID = new SqlParameter("@newImageID", SqlDbType.Int);
+ param_ImageID.Direction = ParameterDirection.Output;
+ cm.Parameters.Add(param_ImageID);
+ 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
+ imageID = (int)cm.Parameters["@newImageID"].Value;
+ return (byte[])cm.Parameters["@newLastChanged"].Value;
+ }
+ }
+ catch (Exception ex)
+ {
+ if (_MyLog.IsErrorEnabled) _MyLog.Error("ROImage.Add", ex);
+ throw new DbCslaException("ROImage.Add", ex);
+ }
+ }
+ [Transactional(TransactionalTypes.TransactionScope)]
+ protected override void DataPortal_Update()
+ {
+ if (!IsDirty) return; // If not dirty - nothing to do
+ if (_MyLog.IsDebugEnabled) _MyLog.DebugFormat("[{0}] ROImage.DataPortal_Update", GetHashCode());
+ try
+ {
+ using (SqlConnection cn = Database.VEPROMS_SqlConnection)
+ {
+ ApplicationContext.LocalContext["cn"] = cn;
+ SQLUpdate();
+ // removing of item only needed for local data portal
+ if (ApplicationContext.ExecutionLocation == ApplicationContext.ExecutionLocations.Client)
+ ApplicationContext.LocalContext.Remove("cn");
+ }
+ }
+ catch (Exception ex)
+ {
+ if (_MyLog.IsErrorEnabled) _MyLog.Error("ROImage.DataPortal_Update", ex);
+ _ErrorMessage = ex.Message;
+ if (!ex.Message.EndsWith("has been edited by another user.")) throw ex;
+ }
+ }
+ [Transactional(TransactionalTypes.TransactionScope)]
+ internal void SQLUpdate()
+ {
+ if (!IsDirty) return; // If not dirty - nothing to do
+ if (_MyLog.IsDebugEnabled) _MyLog.DebugFormat("[{0}] ROImage.SQLUpdate", GetHashCode());
+ try
+ {
+ if (_MyRODb != null) _MyRODb.Update();
+ SqlConnection cn = (SqlConnection)ApplicationContext.LocalContext["cn"];
+ if (base.IsDirty)
+ {
+ using (SqlCommand cm = cn.CreateCommand())
+ {
+ cm.CommandType = CommandType.StoredProcedure;
+ cm.CommandText = "updateROImage";
+ // All Fields including Calculated Fields
+ cm.Parameters.AddWithValue("@ImageID", _ImageID);
+ cm.Parameters.AddWithValue("@RODbID", RODbID);
+ cm.Parameters.AddWithValue("@FileName", _FileName);
+ cm.Parameters.AddWithValue("@Content", _Content);
+ cm.Parameters.AddWithValue("@Config", _Config);
+ if (_DTS.Year >= 1753 && _DTS.Year <= 9999) 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;
+ }
+ }
+ MarkOld();
+ // use the open connection to update child objects
+ if (_ROImageFigures != null) _ROImageFigures.Update(this);
+ }
+ catch (Exception ex)
+ {
+ if (_MyLog.IsErrorEnabled) _MyLog.Error("ROImage.SQLUpdate", ex);
+ _ErrorMessage = ex.Message;
+ if (!ex.Message.EndsWith("has been edited by another user.")) throw ex;
+ }
+ }
+ internal void Update()
+ {
+ if (!this.IsDirty) return;
+ if (base.IsDirty)
+ {
+ SqlConnection cn = (SqlConnection)ApplicationContext.LocalContext["cn"];
+ if (IsNew)
+ _LastChanged = ROImage.Add(cn, ref _ImageID, _MyRODb, _FileName, _Content, _Config, _DTS, _UserID);
+ else
+ _LastChanged = ROImage.Update(cn, ref _ImageID, _MyRODb, _FileName, _Content, _Config, _DTS, _UserID, ref _LastChanged);
+ MarkOld();
+ }
+ if (_ROImageFigures != null) _ROImageFigures.Update(this);
+ }
+ [Transactional(TransactionalTypes.TransactionScope)]
+ public static byte[] Update(SqlConnection cn, ref int imageID, RODb myRODb, string fileName, byte[] content, string config, DateTime dts, string userID, ref byte[] lastChanged)
+ {
+ if (_MyLog.IsDebugEnabled) _MyLog.DebugFormat("[{0}] ROImage.Update", 0);
+ try
+ {
+ using (SqlCommand cm = cn.CreateCommand())
+ {
+ cm.CommandType = CommandType.StoredProcedure;
+ cm.CommandText = "updateROImage";
+ // Input All Fields - Except Calculated Columns
+ cm.Parameters.AddWithValue("@ImageID", imageID);
+ cm.Parameters.AddWithValue("@RODbID", myRODb.RODbID);
+ cm.Parameters.AddWithValue("@FileName", fileName);
+ cm.Parameters.AddWithValue("@Content", content);
+ cm.Parameters.AddWithValue("@Config", config);
+ if (dts.Year >= 1753 && dts.Year <= 9999) 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)
+ {
+ if (_MyLog.IsErrorEnabled) _MyLog.Error("ROImage.Update", ex);
+ throw new DbCslaException("ROImage.Update", ex);
+ }
+ }
+ [Transactional(TransactionalTypes.TransactionScope)]
+ protected override void DataPortal_DeleteSelf()
+ {
+ DataPortal_Delete(new PKCriteria(_ImageID));
+ }
+ [Transactional(TransactionalTypes.TransactionScope)]
+ private void DataPortal_Delete(PKCriteria criteria)
+ {
+ if (_MyLog.IsDebugEnabled) _MyLog.DebugFormat("[{0}] ROImage.DataPortal_Delete", GetHashCode());
+ try
+ {
+ using (SqlConnection cn = Database.VEPROMS_SqlConnection)
+ {
+ using (SqlCommand cm = cn.CreateCommand())
+ {
+ cm.CommandType = CommandType.StoredProcedure;
+ cm.CommandText = "deleteROImage";
+ cm.Parameters.AddWithValue("@ImageID", criteria.ImageID);
+ cm.ExecuteNonQuery();
+ }
+ }
+ }
+ catch (Exception ex)
+ {
+ if (_MyLog.IsErrorEnabled) _MyLog.Error("ROImage.DataPortal_Delete", ex);
+ _ErrorMessage = ex.Message;
+ throw new DbCslaException("ROImage.DataPortal_Delete", ex);
+ }
+ }
+ [Transactional(TransactionalTypes.TransactionScope)]
+ public static void Remove(SqlConnection cn, int imageID)
+ {
+ if (_MyLog.IsDebugEnabled) _MyLog.DebugFormat("[{0}] ROImage.Remove", 0);
+ try
+ {
+ using (SqlCommand cm = cn.CreateCommand())
+ {
+ cm.CommandType = CommandType.StoredProcedure;
+ cm.CommandText = "deleteROImage";
+ // Input PK Fields
+ cm.Parameters.AddWithValue("@ImageID", imageID);
+ // TODO: Define any additional output parameters
+ cm.ExecuteNonQuery();
+ }
+ }
+ catch (Exception ex)
+ {
+ if (_MyLog.IsErrorEnabled) _MyLog.Error("ROImage.Remove", ex);
+ throw new DbCslaException("ROImage.Remove", ex);
+ }
+ }
+ #endregion
+ #region Exists
+ public static bool Exists(int imageID)
+ {
+ ExistsCommand result;
+ try
+ {
+ result = DataPortal.Execute(new ExistsCommand(imageID));
+ return result.Exists;
+ }
+ catch (Exception ex)
+ {
+ throw new DbCslaException("Error on ROImage.Exists", ex);
+ }
+ }
+ [Serializable()]
+ private class ExistsCommand : CommandBase
+ {
+ private int _ImageID;
+ private bool _exists;
+ public bool Exists
+ {
+ get { return _exists; }
+ }
+ public ExistsCommand(int imageID)
+ {
+ _ImageID = imageID;
+ }
+ protected override void DataPortal_Execute()
+ {
+ if (_MyLog.IsDebugEnabled) _MyLog.DebugFormat("[{0}] ROImage.DataPortal_Execute", GetHashCode());
+ try
+ {
+ using (SqlConnection cn = Database.VEPROMS_SqlConnection)
+ {
+ cn.Open();
+ using (SqlCommand cm = cn.CreateCommand())
+ {
+ cm.CommandType = CommandType.StoredProcedure;
+ cm.CommandText = "existsROImage";
+ cm.Parameters.AddWithValue("@ImageID", _ImageID);
+ int count = (int)cm.ExecuteScalar();
+ _exists = (count > 0);
+ }
+ }
+ }
+ catch (Exception ex)
+ {
+ if (_MyLog.IsErrorEnabled) _MyLog.Error("ROImage.DataPortal_Execute", ex);
+ throw new DbCslaException("ROImage.DataPortal_Execute", ex);
+ }
+ }
+ }
+ #endregion
+ // Standard Default Code
+ #region extension
+ ROImageExtension _ROImageExtension = new ROImageExtension();
+ [Serializable()]
+ partial class ROImageExtension : extensionBase
+ {
+ }
+ [Serializable()]
+ class extensionBase
+ {
+ // Default Values
+ 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
+ }
+ // Instance Authorization Rules
+ public virtual void AddInstanceAuthorizationRules(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
+ }
+ // InstanceValidation Rules
+ public virtual void AddInstanceValidationRules(Csla.Validation.ValidationRules rules)
+ {
+ // Needs to be overriden to add new validation rules
+ }
+ }
+ #endregion
+ } // Class
+ #region Converter
+ internal class ROImageConverter : ExpandableObjectConverter
+ {
+ public override object ConvertTo(ITypeDescriptorContext context, System.Globalization.CultureInfo culture, object value, Type destType)
+ {
+ if (destType == typeof(string) && value is ROImage)
+ {
+ // Return the ToString value
+ return ((ROImage)value).ToString();
+ }
+ return base.ConvertTo(context, culture, value, destType);
+ }
+ }
+ #endregion
+} // Namespace
+
+
+//// The following is a sample Extension File. You can use it to create ROImageExt.cs
+//using System;
+//using System.Collections.Generic;
+//using System.Text;
+//using Csla;
+
+//namespace VEPROMS.CSLA.Library
+//{
+// public partial class ROImage
+// {
+// partial class ROImageExtension : extensionBase
+// {
+// // TODO: Override automatic defaults
+// 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, "");
+// }
+// public new void AddInstanceAuthorizationRules(Csla.Security.AuthorizationRules rules)
+// {
+// //rules.AllowInstanceRead(Dbid, "");
+// }
+// public new void AddValidationRules(Csla.Validation.ValidationRules rules)
+// {
+// rules.AddRule(
+// Csla.Validation.CommonRules.StringMaxLength,
+// new Csla.Validation.CommonRules.MaxLengthRuleArgs("Name", 100));
+// }
+// public new void AddInstanceValidationRules(Csla.Validation.ValidationRules rules)
+// {
+// rules.AddInstanceRule(/* Instance Validation Rule */);
+// }
+// }
+// }
+//}
diff --git a/PROMS/VEPROMS.CSLA.Library/Generated/ROImageFigure.cs b/PROMS/VEPROMS.CSLA.Library/Generated/ROImageFigure.cs
new file mode 100644
index 00000000..8053ecc5
--- /dev/null
+++ b/PROMS/VEPROMS.CSLA.Library/Generated/ROImageFigure.cs
@@ -0,0 +1,526 @@
+// ========================================================================
+// Copyright 2007 - 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;
+using System.ComponentModel;
+using Csla.Validation;
+namespace VEPROMS.CSLA.Library
+{
+ ///
+ /// ROImageFigure Generated by MyGeneration using the CSLA Object Mapping template
+ ///
+ [Serializable()]
+ [TypeConverter(typeof(ROImageFigureConverter))]
+ public partial class ROImageFigure : BusinessBase, IVEHasBrokenRules
+ {
+ #region Log4Net
+ private static readonly log4net.ILog _MyLog = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
+ #endregion
+ #region Business Methods
+ private string _ErrorMessage = string.Empty;
+ public string ErrorMessage
+ {
+ get { return _ErrorMessage; }
+ }
+ private int _FigureID;
+ [System.ComponentModel.DataObjectField(true, true)]
+ public int FigureID
+ {
+ [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
+ get
+ {
+ CanReadProperty("FigureID", true);
+ if (_MyFigure != null) _FigureID = _MyFigure.FigureID;
+ return _FigureID;
+ }
+ }
+ private Figure _MyFigure;
+ [System.ComponentModel.DataObjectField(true, true)]
+ public Figure MyFigure
+ {
+ [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
+ get
+ {
+ CanReadProperty("MyFigure", true);
+ if (_MyFigure == null && _FigureID != 0) _MyFigure = Figure.Get(_FigureID);
+ return _MyFigure;
+ }
+ }
+ private int _ROFstID;
+ public int ROFstID
+ {
+ [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
+ get
+ {
+ CanReadProperty("ROFstID", true);
+ if (_MyROFst != null) _ROFstID = _MyROFst.ROFstID;
+ return _ROFstID;
+ }
+ }
+ private ROFst _MyROFst;
+ public ROFst MyROFst
+ {
+ [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
+ get
+ {
+ CanReadProperty("MyROFst", true);
+ if (_MyROFst == null && _ROFstID != 0) _MyROFst = ROFst.Get(_ROFstID);
+ return _MyROFst;
+ }
+ [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
+ set
+ {
+ CanWriteProperty("MyROFst", true);
+ if (_MyROFst != value)
+ {
+ _MyROFst = value;
+ PropertyHasChanged();
+ }
+ }
+ }
+ private string _Config = string.Empty;
+ public string Config
+ {
+ [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
+ get
+ {
+ CanReadProperty("Config", true);
+ return _Config;
+ }
+ [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
+ set
+ {
+ CanWriteProperty("Config", true);
+ if (value == null) value = string.Empty;
+ if (_Config != value)
+ {
+ _Config = value;
+ PropertyHasChanged();
+ }
+ }
+ }
+ private DateTime _DTS = new DateTime();
+ public DateTime DTS
+ {
+ [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
+ get
+ {
+ CanReadProperty("DTS", true);
+ return _DTS;
+ }
+ [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
+ set
+ {
+ CanWriteProperty("DTS", 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("UserID", true);
+ return _UserID;
+ }
+ [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
+ set
+ {
+ CanWriteProperty("UserID", true);
+ if (value == null) value = string.Empty;
+ if (_UserID != value)
+ {
+ _UserID = value;
+ PropertyHasChanged();
+ }
+ }
+ }
+ private byte[] _LastChanged = new byte[8];//timestamp
+ private int _ROFst_RODbID;
+ public int ROFst_RODbID
+ {
+ [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
+ get
+ {
+ CanReadProperty("ROFst_RODbID", true);
+ return _ROFst_RODbID;
+ }
+ }
+ private byte[] _ROFst_ROLookup;
+ public byte[] ROFst_ROLookup
+ {
+ [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
+ get
+ {
+ CanReadProperty("ROFst_ROLookup", true);
+ return _ROFst_ROLookup;
+ }
+ }
+ private string _ROFst_Config = string.Empty;
+ public string ROFst_Config
+ {
+ [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
+ get
+ {
+ CanReadProperty("ROFst_Config", true);
+ return _ROFst_Config;
+ }
+ }
+ private DateTime _ROFst_DTS = new DateTime();
+ public DateTime ROFst_DTS
+ {
+ [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
+ get
+ {
+ CanReadProperty("ROFst_DTS", true);
+ return _ROFst_DTS;
+ }
+ }
+ private string _ROFst_UserID = string.Empty;
+ public string ROFst_UserID
+ {
+ [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
+ get
+ {
+ CanReadProperty("ROFst_UserID", true);
+ return _ROFst_UserID;
+ }
+ }
+ // TODO: Check ROImageFigure.GetIdValue to assure that the ID returned is unique
+ ///
+ /// Overrides Base GetIdValue - Used internally by CSLA to determine equality
+ ///
+ /// A Unique ID for the current ROImageFigure
+ protected override object GetIdValue()
+ {
+ return _FigureID;
+ }
+ // TODO: Replace base ROImageFigure.ToString function as necessary
+ ///
+ /// Overrides Base ToString
+ ///
+ /// A string representation of current ROImageFigure
+ //public override string ToString()
+ //{
+ // return base.ToString();
+ //}
+ public override bool IsDirty
+ {
+ get { return base.IsDirty || (_MyROFst == null ? false : _MyROFst.IsDirty); }
+ }
+ public override bool IsValid
+ {
+ get { return (IsNew && !IsDirty ? true : base.IsValid) && (_MyROFst == null ? true : _MyROFst.IsValid); }
+ }
+ #endregion
+ #region ValidationRules
+ [NonSerialized]
+ private bool _CheckingBrokenRules = false;
+ public IVEHasBrokenRules HasBrokenRules
+ {
+ get
+ {
+ if (_CheckingBrokenRules) return null;
+ if (BrokenRulesCollection.Count > 0) return this;
+ try
+ {
+ _CheckingBrokenRules = true;
+ IVEHasBrokenRules hasBrokenRules = null;
+ if (_MyROFst != null && (hasBrokenRules = _MyROFst.HasBrokenRules) != null) return hasBrokenRules;
+ return hasBrokenRules;
+ }
+ finally
+ {
+ _CheckingBrokenRules = false;
+ }
+ }
+ }
+ public BrokenRulesCollection BrokenRules
+ {
+ get
+ {
+ IVEHasBrokenRules hasBrokenRules = HasBrokenRules;
+ if (this.Equals(hasBrokenRules)) return BrokenRulesCollection;
+ return (hasBrokenRules != null ? hasBrokenRules.BrokenRules : null);
+ }
+ }
+ protected override void AddBusinessRules()
+ {
+ ValidationRules.AddRule(MyROFstRequired, "MyROFst");
+ ValidationRules.AddRule(
+ Csla.Validation.CommonRules.StringMaxLength,
+ new Csla.Validation.CommonRules.MaxLengthRuleArgs("Config", 1073741823));
+ ValidationRules.AddRule(
+ Csla.Validation.CommonRules.StringRequired, "UserID");
+ ValidationRules.AddRule(
+ Csla.Validation.CommonRules.StringMaxLength,
+ new Csla.Validation.CommonRules.MaxLengthRuleArgs("UserID", 100));
+ // TODO: Add other validation rules
+ }
+ private static bool MyROFstRequired(ROImageFigure target, Csla.Validation.RuleArgs e)
+ {
+ if (target._ROFstID == 0 && target._MyROFst == null) // Required field missing
+ {
+ e.Description = "Required";
+ return false;
+ }
+ return true;
+ }
+ // 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(FigureID, "");
+ //AuthorizationRules.AllowRead(ROFstID, "");
+ //AuthorizationRules.AllowWrite(ROFstID, "");
+ //AuthorizationRules.AllowRead(Config, "");
+ //AuthorizationRules.AllowWrite(Config, "");
+ //AuthorizationRules.AllowRead(DTS, "");
+ //AuthorizationRules.AllowWrite(DTS, "");
+ //AuthorizationRules.AllowRead(UserID, "");
+ //AuthorizationRules.AllowWrite(UserID, "");
+ }
+ 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; } }
+ internal static ROImageFigure New(ROFst myROFst)
+ {
+ return new ROImageFigure(myROFst);
+ }
+ internal static ROImageFigure Get(SafeDataReader dr)
+ {
+ return new ROImageFigure(dr);
+ }
+ public ROImageFigure()
+ {
+ MarkAsChild();
+ _FigureID = Figure.NextFigureID;
+ _DTS = _ROImageFigureExtension.DefaultDTS;
+ _UserID = _ROImageFigureExtension.DefaultUserID;
+ ValidationRules.CheckRules();
+ }
+ private ROImageFigure(ROFst myROFst)
+ {
+ MarkAsChild();
+ // TODO: Add any initialization & defaults
+ _DTS = _ROImageFigureExtension.DefaultDTS;
+ _UserID = _ROImageFigureExtension.DefaultUserID;
+ _MyROFst = myROFst;
+ ValidationRules.CheckRules();
+ }
+ internal ROImageFigure(SafeDataReader dr)
+ {
+ MarkAsChild();
+ Fetch(dr);
+ }
+ #endregion
+ #region Data Access Portal
+ private void Fetch(SafeDataReader dr)
+ {
+ if (_MyLog.IsDebugEnabled) _MyLog.DebugFormat("[{0}] ROImageFigure.FetchDR", GetHashCode());
+ try
+ {
+ _FigureID = dr.GetInt32("FigureID");
+ _ROFstID = dr.GetInt32("ROFstID");
+ _Config = dr.GetString("Config");
+ _DTS = dr.GetDateTime("DTS");
+ _UserID = dr.GetString("UserID");
+ dr.GetBytes("LastChanged", 0, _LastChanged, 0, 8);
+ _ROFst_RODbID = dr.GetInt32("ROFst_RODbID");
+ _ROFst_ROLookup = (byte[])dr.GetValue("ROFst_ROLookup");
+ _ROFst_Config = dr.GetString("ROFst_Config");
+ _ROFst_DTS = dr.GetDateTime("ROFst_DTS");
+ _ROFst_UserID = dr.GetString("ROFst_UserID");
+ }
+ catch (Exception ex) // FKItem Fetch
+ {
+ if (_MyLog.IsErrorEnabled) _MyLog.Error("ROImageFigure.FetchDR", ex);
+ throw new DbCslaException("ROImageFigure.Fetch", ex);
+ }
+ MarkOld();
+ }
+ internal void Insert(ROImage myROImage)
+ {
+ // if we're not dirty then don't update the database
+ if (!this.IsDirty) return;
+ SqlConnection cn = (SqlConnection)ApplicationContext.LocalContext["cn"];
+ _LastChanged = Figure.Add(cn, ref _FigureID, _MyROFst, myROImage, _Config, _DTS, _UserID);
+ MarkOld();
+ }
+ internal void Update(ROImage myROImage)
+ {
+ // if we're not dirty then don't update the database
+ if (!this.IsDirty) return;
+ SqlConnection cn = (SqlConnection)ApplicationContext.LocalContext["cn"];
+ _LastChanged = Figure.Update(cn, ref _FigureID, _MyROFst, myROImage, _Config, _DTS, _UserID, ref _LastChanged);
+ MarkOld();
+ }
+ internal void DeleteSelf(ROImage myROImage)
+ {
+ // if we're not dirty then don't update the database
+ if (!this.IsDirty) return;
+ // if we're new then don't update the database
+ if (this.IsNew) return;
+ SqlConnection cn = (SqlConnection)ApplicationContext.LocalContext["cn"];
+ Figure.Remove(cn, _FigureID);
+ MarkNew();
+ }
+ #endregion
+ // Standard Default Code
+ #region extension
+ ROImageFigureExtension _ROImageFigureExtension = new ROImageFigureExtension();
+ [Serializable()]
+ partial class ROImageFigureExtension : extensionBase
+ {
+ }
+ [Serializable()]
+ class extensionBase
+ {
+ // Default Values
+ 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
+ }
+ // Instance Authorization Rules
+ public virtual void AddInstanceAuthorizationRules(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
+ }
+ // InstanceValidation Rules
+ public virtual void AddInstanceValidationRules(Csla.Validation.ValidationRules rules)
+ {
+ // Needs to be overriden to add new validation rules
+ }
+ }
+ #endregion
+ } // Class
+ #region Converter
+ internal class ROImageFigureConverter : ExpandableObjectConverter
+ {
+ public override object ConvertTo(ITypeDescriptorContext context, System.Globalization.CultureInfo culture, object value, Type destType)
+ {
+ if (destType == typeof(string) && value is ROImageFigure)
+ {
+ // Return the ToString value
+ return ((ROImageFigure)value).ToString();
+ }
+ return base.ConvertTo(context, culture, value, destType);
+ }
+ }
+ #endregion
+} // Namespace
+
+
+//// The following is a sample Extension File. You can use it to create ROImageFigureExt.cs
+//using System;
+//using System.Collections.Generic;
+//using System.Text;
+//using Csla;
+
+//namespace VEPROMS.CSLA.Library
+//{
+// public partial class ROImageFigure
+// {
+// partial class ROImageFigureExtension : extensionBase
+// {
+// // TODO: Override automatic defaults
+// 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, "");
+// }
+// public new void AddInstanceAuthorizationRules(Csla.Security.AuthorizationRules rules)
+// {
+// //rules.AllowInstanceRead(Dbid, "");
+// }
+// public new void AddValidationRules(Csla.Validation.ValidationRules rules)
+// {
+// rules.AddRule(
+// Csla.Validation.CommonRules.StringMaxLength,
+// new Csla.Validation.CommonRules.MaxLengthRuleArgs("Name", 100));
+// }
+// public new void AddInstanceValidationRules(Csla.Validation.ValidationRules rules)
+// {
+// rules.AddInstanceRule(/* Instance Validation Rule */);
+// }
+// }
+// }
+//}
diff --git a/PROMS/VEPROMS.CSLA.Library/Generated/ROImageFigures.cs b/PROMS/VEPROMS.CSLA.Library/Generated/ROImageFigures.cs
new file mode 100644
index 00000000..25a80944
--- /dev/null
+++ b/PROMS/VEPROMS.CSLA.Library/Generated/ROImageFigures.cs
@@ -0,0 +1,309 @@
+// ========================================================================
+// Copyright 2007 - 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;
+using System.ComponentModel;
+using Csla.Validation;
+namespace VEPROMS.CSLA.Library
+{
+ ///
+ /// ROImageFigures Generated by MyGeneration using the CSLA Object Mapping template
+ ///
+ [Serializable()]
+ [TypeConverter(typeof(ROImageFiguresConverter))]
+ public partial class ROImageFigures : BusinessListBase, ICustomTypeDescriptor, IVEHasBrokenRules
+ {
+ #region Log4Net
+ private static readonly log4net.ILog _MyLog = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
+ #endregion
+ #region Business Methods
+ private string _ErrorMessage = string.Empty;
+ public string ErrorMessage
+ {
+ get { return _ErrorMessage; }
+ }
+ // One To Many
+ public ROImageFigure this[Figure myFigure]
+ {
+ get
+ {
+ foreach (ROImageFigure figure in this)
+ if (figure.FigureID == myFigure.FigureID)
+ return figure;
+ return null;
+ }
+ }
+ public new System.Collections.Generic.IList Items
+ {
+ get { return base.Items; }
+ }
+ public ROImageFigure GetItem(Figure myFigure)
+ {
+ foreach (ROImageFigure figure in this)
+ if (figure.FigureID == myFigure.FigureID)
+ return figure;
+ return null;
+ }
+ public ROImageFigure Add(ROFst myROFst) // One to Many with unique fields
+ {
+ if (!Contains(myROFst))
+ {
+ ROImageFigure figure = ROImageFigure.New(myROFst);
+ this.Add(figure);
+ return figure;
+ }
+ else
+ throw new InvalidOperationException("figure already exists");
+ }
+ public void Remove(Figure myFigure)
+ {
+ foreach (ROImageFigure figure in this)
+ {
+ if (figure.FigureID == myFigure.FigureID)
+ {
+ Remove(figure);
+ break;
+ }
+ }
+ }
+ public bool Contains(Figure myFigure)
+ {
+ foreach (ROImageFigure figure in this)
+ if (figure.FigureID == myFigure.FigureID)
+ return true;
+ return false;
+ }
+ public bool ContainsDeleted(Figure myFigure)
+ {
+ foreach (ROImageFigure figure in DeletedList)
+ if (figure.FigureID == myFigure.FigureID)
+ return true;
+ return false;
+ }
+ public bool Contains(ROFst myROFst)
+ {
+ foreach (ROImageFigure figure in this)
+ if (figure.ROFstID == myROFst.ROFstID)
+ return true;
+ return false;
+ }
+ public bool ContainsDeleted(ROFst myROFst)
+ {
+ foreach (ROImageFigure figure in DeletedList)
+ if (figure.ROFstID == myROFst.ROFstID)
+ return true;
+ return false;
+ }
+ #endregion
+ #region ValidationRules
+ public IVEHasBrokenRules HasBrokenRules
+ {
+ get
+ {
+ IVEHasBrokenRules hasBrokenRules = null;
+ foreach (ROImageFigure rOImageFigure in this)
+ if ((hasBrokenRules = rOImageFigure.HasBrokenRules) != null) return hasBrokenRules;
+ return hasBrokenRules;
+ }
+ }
+ public BrokenRulesCollection BrokenRules
+ {
+ get
+ {
+ IVEHasBrokenRules hasBrokenRules = HasBrokenRules;
+ return (hasBrokenRules != null ? hasBrokenRules.BrokenRules : null);
+ }
+ }
+ #endregion
+ #region Factory Methods
+ internal static ROImageFigures New()
+ {
+ return new ROImageFigures();
+ }
+ internal static ROImageFigures Get(SafeDataReader dr)
+ {
+ return new ROImageFigures(dr);
+ }
+ public static ROImageFigures GetByImageID(int imageID)
+ {
+ try
+ {
+ return DataPortal.Fetch(new ImageIDCriteria(imageID));
+ }
+ catch (Exception ex)
+ {
+ throw new DbCslaException("Error on ROImageFigures.GetByImageID", ex);
+ }
+ }
+ private ROImageFigures()
+ {
+ MarkAsChild();
+ }
+ internal ROImageFigures(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(ROImageFigure.Get(dr));
+ this.RaiseListChangedEvents = true;
+ }
+ [Serializable()]
+ private class ImageIDCriteria
+ {
+ public ImageIDCriteria(int imageID)
+ {
+ _ImageID = imageID;
+ }
+ private int _ImageID;
+ public int ImageID
+ {
+ get { return _ImageID; }
+ set { _ImageID = value; }
+ }
+ }
+ private void DataPortal_Fetch(ImageIDCriteria criteria)
+ {
+ this.RaiseListChangedEvents = false;
+ if (_MyLog.IsDebugEnabled) _MyLog.DebugFormat("[{0}] ROImageFigures.DataPortal_FetchImageID", GetHashCode());
+ try
+ {
+ using (SqlConnection cn = Database.VEPROMS_SqlConnection)
+ {
+ using (SqlCommand cm = cn.CreateCommand())
+ {
+ cm.CommandType = CommandType.StoredProcedure;
+ cm.CommandText = "getFiguresByImageID";
+ cm.Parameters.AddWithValue("@ImageID", criteria.ImageID);
+ using (SafeDataReader dr = new SafeDataReader(cm.ExecuteReader()))
+ {
+ while (dr.Read()) this.Add(new ROImageFigure(dr));
+ }
+ }
+ }
+ }
+ catch (Exception ex)
+ {
+ if (_MyLog.IsErrorEnabled) _MyLog.Error("ROImageFigures.DataPortal_FetchImageID", ex);
+ throw new DbCslaException("ROImageFigures.DataPortal_Fetch", ex);
+ }
+ this.RaiseListChangedEvents = true;
+ }
+ internal void Update(ROImage rOImage)
+ {
+ this.RaiseListChangedEvents = false;
+ try
+ {
+ // update (thus deleting) any deleted child objects
+ foreach (ROImageFigure obj in DeletedList)
+ obj.DeleteSelf(rOImage);// Deletes related record
+ // now that they are deleted, remove them from memory too
+ DeletedList.Clear();
+ // add/update any current child objects
+ foreach (ROImageFigure obj in this)
+ {
+ if (obj.IsNew)
+ obj.Insert(rOImage);
+ else
+ obj.Update(rOImage);
+ }
+ }
+ finally
+ {
+ this.RaiseListChangedEvents = true;
+ }
+ }
+ #endregion
+ #region ICustomTypeDescriptor impl
+ public String GetClassName()
+ { return TypeDescriptor.GetClassName(this, true); }
+ public AttributeCollection GetAttributes()
+ { return TypeDescriptor.GetAttributes(this, true); }
+ public String GetComponentName()
+ { return TypeDescriptor.GetComponentName(this, true); }
+ public TypeConverter GetConverter()
+ { return TypeDescriptor.GetConverter(this, true); }
+ public EventDescriptor GetDefaultEvent()
+ { return TypeDescriptor.GetDefaultEvent(this, true); }
+ public PropertyDescriptor GetDefaultProperty()
+ { return TypeDescriptor.GetDefaultProperty(this, true); }
+ public object GetEditor(Type editorBaseType)
+ { return TypeDescriptor.GetEditor(this, editorBaseType, true); }
+ public EventDescriptorCollection GetEvents(Attribute[] attributes)
+ { return TypeDescriptor.GetEvents(this, attributes, true); }
+ public EventDescriptorCollection GetEvents()
+ { return TypeDescriptor.GetEvents(this, true); }
+ public object GetPropertyOwner(PropertyDescriptor pd)
+ { return this; }
+ ///
+ /// Called to get the properties of this type. Returns properties with certain
+ /// attributes. this restriction is not implemented here.
+ ///
+ ///
+ ///
+ public PropertyDescriptorCollection GetProperties(Attribute[] attributes)
+ { return GetProperties(); }
+ ///
+ /// Called to get the properties of this type.
+ ///
+ ///
+ public PropertyDescriptorCollection GetProperties()
+ {
+ // Create a collection object to hold property descriptors
+ PropertyDescriptorCollection pds = new PropertyDescriptorCollection(null);
+ // Iterate the list
+ for (int i = 0; i < this.Items.Count; i++)
+ {
+ // Create a property descriptor for the item and add to the property descriptor collection
+ ROImageFiguresPropertyDescriptor pd = new ROImageFiguresPropertyDescriptor(this, i);
+ pds.Add(pd);
+ }
+ // return the property descriptor collection
+ return pds;
+ }
+ #endregion
+ } // Class
+ #region Property Descriptor
+ ///
+ /// Summary description for CollectionPropertyDescriptor.
+ ///
+ public partial class ROImageFiguresPropertyDescriptor : vlnListPropertyDescriptor
+ {
+ private ROImageFigure Item { get { return (ROImageFigure)_Item; } }
+ public ROImageFiguresPropertyDescriptor(ROImageFigures collection, int index) : base(collection, index) { ;}
+ }
+ #endregion
+ #region Converter
+ internal class ROImageFiguresConverter : ExpandableObjectConverter
+ {
+ public override object ConvertTo(ITypeDescriptorContext context, System.Globalization.CultureInfo culture, object value, Type destType)
+ {
+ if (destType == typeof(string) && value is ROImageFigures)
+ {
+ // Return department and department role separated by comma.
+ return ((ROImageFigures)value).Items.Count.ToString() + " Figures";
+ }
+ return base.ConvertTo(context, culture, value, destType);
+ }
+ }
+ #endregion
+} // Namespace
diff --git a/PROMS/VEPROMS.CSLA.Library/Generated/ROImageInfo.cs b/PROMS/VEPROMS.CSLA.Library/Generated/ROImageInfo.cs
new file mode 100644
index 00000000..78bf3a7b
--- /dev/null
+++ b/PROMS/VEPROMS.CSLA.Library/Generated/ROImageInfo.cs
@@ -0,0 +1,441 @@
+// ========================================================================
+// Copyright 2007 - 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;
+using System.ComponentModel;
+using System.Collections.Generic;
+namespace VEPROMS.CSLA.Library
+{
+ public delegate void ROImageInfoEvent(object sender);
+ ///
+ /// ROImageInfo Generated by MyGeneration using the CSLA Object Mapping template
+ ///
+ [Serializable()]
+ [TypeConverter(typeof(ROImageInfoConverter))]
+ public partial class ROImageInfo : ReadOnlyBase, IDisposable
+ {
+ public event ROImageInfoEvent Changed;
+ private void OnChange()
+ {
+ if (Changed != null) Changed(this);
+ }
+ #region Log4Net
+ private static readonly log4net.ILog _MyLog = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
+ #endregion
+ #region Collection
+ private static List _CacheList = new List();
+ protected static void AddToCache(ROImageInfo rOImageInfo)
+ {
+ if (!_CacheList.Contains(rOImageInfo)) _CacheList.Add(rOImageInfo); // In AddToCache
+ }
+ protected static void RemoveFromCache(ROImageInfo rOImageInfo)
+ {
+ while (_CacheList.Contains(rOImageInfo)) _CacheList.Remove(rOImageInfo); // In RemoveFromCache
+ }
+ private static Dictionary> _CacheByPrimaryKey = new Dictionary>();
+ private static void ConvertListToDictionary()
+ {
+ List remove = new List();
+ foreach (ROImageInfo tmp in _CacheList)
+ {
+ if (!_CacheByPrimaryKey.ContainsKey(tmp.ImageID.ToString()))
+ {
+ _CacheByPrimaryKey[tmp.ImageID.ToString()] = new List(); // Add new list for PrimaryKey
+ }
+ _CacheByPrimaryKey[tmp.ImageID.ToString()].Add(tmp); // Add to Primary Key list
+ remove.Add(tmp);
+ }
+ foreach (ROImageInfo tmp in remove)
+ RemoveFromCache(tmp);
+ }
+ internal static void AddList(ROImageInfoList lst)
+ {
+ foreach (ROImageInfo item in lst) AddToCache(item);
+ }
+ protected static ROImageInfo GetCachedByPrimaryKey(int imageID)
+ {
+ ConvertListToDictionary();
+ string key = imageID.ToString();
+ if (_CacheByPrimaryKey.ContainsKey(key)) return _CacheByPrimaryKey[key][0];
+ return null;
+ }
+ #endregion
+ #region Business Methods
+ private string _ErrorMessage = string.Empty;
+ public string ErrorMessage
+ {
+ get { return _ErrorMessage; }
+ }
+ protected ROImage _Editable;
+ private IVEHasBrokenRules HasBrokenRules
+ {
+ get
+ {
+ IVEHasBrokenRules hasBrokenRules = null;
+ if (_Editable != null)
+ hasBrokenRules = _Editable.HasBrokenRules;
+ return hasBrokenRules;
+ }
+ }
+ private int _ImageID;
+ [System.ComponentModel.DataObjectField(true, true)]
+ public int ImageID
+ {
+ [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
+ get
+ {
+ CanReadProperty("ImageID", true);
+ return _ImageID;
+ }
+ }
+ private int _RODbID;
+ public int RODbID
+ {
+ [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
+ get
+ {
+ CanReadProperty("RODbID", true);
+ if (_MyRODb != null) _RODbID = _MyRODb.RODbID;
+ return _RODbID;
+ }
+ }
+ private RODbInfo _MyRODb;
+ public RODbInfo MyRODb
+ {
+ [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
+ get
+ {
+ CanReadProperty("MyRODb", true);
+ if (_MyRODb == null && _RODbID != 0) _MyRODb = RODbInfo.Get(_RODbID);
+ return _MyRODb;
+ }
+ }
+ private string _FileName = string.Empty;
+ public string FileName
+ {
+ [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
+ get
+ {
+ CanReadProperty("FileName", true);
+ return _FileName;
+ }
+ }
+ private byte[] _Content;
+ public byte[] Content
+ {
+ [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
+ get
+ {
+ CanReadProperty("Content", true);
+ return _Content;
+ }
+ }
+ private string _Config = string.Empty;
+ public string Config
+ {
+ [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
+ get
+ {
+ CanReadProperty("Config", true);
+ return _Config;
+ }
+ }
+ private DateTime _DTS = new DateTime();
+ public DateTime DTS
+ {
+ [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
+ get
+ {
+ CanReadProperty("DTS", true);
+ return _DTS;
+ }
+ }
+ private string _UserID = string.Empty;
+ public string UserID
+ {
+ [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
+ get
+ {
+ CanReadProperty("UserID", true);
+ return _UserID;
+ }
+ }
+ private int _ROImageFigureCount = 0;
+ ///
+ /// Count of ROImageFigures for this ROImage
+ ///
+ public int ROImageFigureCount
+ {
+ [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
+ get
+ {
+ CanReadProperty("ROImageFigureCount", true);
+ return _ROImageFigureCount;
+ }
+ }
+ private FigureInfoList _ROImageFigures = null;
+ [TypeConverter(typeof(FigureInfoListConverter))]
+ public FigureInfoList ROImageFigures
+ {
+ [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
+ get
+ {
+ CanReadProperty("ROImageFigures", true);
+ if (_ROImageFigureCount < 0 || (_ROImageFigureCount > 0 && _ROImageFigures == null))
+ _ROImageFigures = FigureInfoList.GetByImageID(_ImageID);
+ if (_ROImageFigureCount < 0)
+ _ROImageFigureCount = _ROImageFigures.Count;
+ return _ROImageFigures;
+ }
+ }
+ public void RefreshROImageFigures()
+ {
+ ConvertListToDictionary();
+ if (_CacheByPrimaryKey.ContainsKey(_ImageID.ToString()))
+ foreach (ROImageInfo tmp in _CacheByPrimaryKey[_ImageID.ToString()])
+ tmp._ROImageFigureCount = -1; // This will cause the data to be requeried
+ }
+ // TODO: Replace base ROImageInfo.ToString function as necessary
+ ///
+ /// Overrides Base ToString
+ ///
+ /// A string representation of current ROImageInfo
+ //public override string ToString()
+ //{
+ // return base.ToString();
+ //}
+ // TODO: Check ROImageInfo.GetIdValue to assure that the ID returned is unique
+ ///
+ /// Overrides Base GetIdValue - Used internally by CSLA to determine equality
+ ///
+ /// A Unique ID for the current ROImageInfo
+ protected override object GetIdValue()
+ {
+ return _ImageID;
+ }
+ #endregion
+ #region Factory Methods
+ private static int _ROImageInfoUnique = 0;
+ private static int ROImageInfoUnique
+ { get { return ++_ROImageInfoUnique; } }
+ private int _MyROImageInfoUnique = ROImageInfoUnique;
+ public int MyROImageInfoUnique
+ { get { return _MyROImageInfoUnique; } }
+ protected ROImageInfo()
+ {/* require use of factory methods */
+ AddToCache(this);
+ }
+ public void Dispose()
+ {
+ RemoveFromCache(this);
+ if (!_CacheByPrimaryKey.ContainsKey(ImageID.ToString())) return;
+ List listROImageInfo = _CacheByPrimaryKey[ImageID.ToString()]; // Get the list of items
+ while (listROImageInfo.Contains(this)) listROImageInfo.Remove(this); // Remove the item from the list
+ if (listROImageInfo.Count == 0) // If there are no items left in the list
+ _CacheByPrimaryKey.Remove(ImageID.ToString()); // remove the list
+ }
+ public virtual ROImage Get()
+ {
+ return _Editable = ROImage.Get(_ImageID);
+ }
+ public static void Refresh(ROImage tmp)
+ {
+ string key = tmp.ImageID.ToString();
+ ConvertListToDictionary();
+ if (_CacheByPrimaryKey.ContainsKey(key))
+ foreach (ROImageInfo tmpInfo in _CacheByPrimaryKey[key])
+ tmpInfo.RefreshFields(tmp);
+ }
+ protected virtual void RefreshFields(ROImage tmp)
+ {
+ if (_RODbID != tmp.RODbID)
+ {
+ if (MyRODb != null) MyRODb.RefreshRODbROImages(); // Update List for old value
+ _RODbID = tmp.RODbID; // Update the value
+ }
+ _MyRODb = null; // Reset list so that the next line gets a new list
+ if (MyRODb != null) MyRODb.RefreshRODbROImages(); // Update List for new value
+ _FileName = tmp.FileName;
+ _Content = tmp.Content;
+ _Config = tmp.Config;
+ _DTS = tmp.DTS;
+ _UserID = tmp.UserID;
+ _ROImageInfoExtension.Refresh(this);
+ if(_MyRODb != null)
+ {
+ _MyRODb.Dispose();// Dispose related value
+ _MyRODb = null;// Reset related value
+ }
+ OnChange();// raise an event
+ }
+ public static void Refresh(RODbROImage tmp)
+ {
+ string key = tmp.ImageID.ToString();
+ ConvertListToDictionary();
+ if (_CacheByPrimaryKey.ContainsKey(key))
+ foreach (ROImageInfo tmpInfo in _CacheByPrimaryKey[key])
+ tmpInfo.RefreshFields(tmp);
+ }
+ protected virtual void RefreshFields(RODbROImage tmp)
+ {
+ _FileName = tmp.FileName;
+ _Content = tmp.Content;
+ _Config = tmp.Config;
+ _DTS = tmp.DTS;
+ _UserID = tmp.UserID;
+ _ROImageInfoExtension.Refresh(this);
+ if(_MyRODb != null)
+ {
+ _MyRODb.Dispose();// Dispose related value
+ _MyRODb = null;// Reset related value
+ }
+ OnChange();// raise an event
+ }
+ public static ROImageInfo Get(int imageID)
+ {
+ //if (!CanGetObject())
+ // throw new System.Security.SecurityException("User not authorized to view a ROImage");
+ try
+ {
+ ROImageInfo tmp = GetCachedByPrimaryKey(imageID);
+ if (tmp == null)
+ {
+ tmp = DataPortal.Fetch(new PKCriteria(imageID));
+ AddToCache(tmp);
+ }
+ if (tmp.ErrorMessage == "No Record Found")
+ {
+ tmp.Dispose(); // Clean-up ROImageInfo
+ tmp = null;
+ }
+ return tmp;
+ }
+ catch (Exception ex)
+ {
+ throw new DbCslaException("Error on ROImageInfo.Get", ex);
+ }
+ }
+ #endregion
+ #region Data Access Portal
+ internal ROImageInfo(SafeDataReader dr)
+ {
+ if (_MyLog.IsDebugEnabled) _MyLog.DebugFormat("[{0}] ROImageInfo.Constructor", GetHashCode());
+ try
+ {
+ ReadData(dr);
+ }
+ catch (Exception ex)
+ {
+ if (_MyLog.IsErrorEnabled) _MyLog.Error("ROImageInfo.Constructor", ex);
+ throw new DbCslaException("ROImageInfo.Constructor", ex);
+ }
+ }
+ [Serializable()]
+ protected class PKCriteria
+ {
+ private int _ImageID;
+ public int ImageID
+ { get { return _ImageID; } }
+ public PKCriteria(int imageID)
+ {
+ _ImageID = imageID;
+ }
+ }
+ private void ReadData(SafeDataReader dr)
+ {
+ if (_MyLog.IsDebugEnabled) _MyLog.DebugFormat("[{0}] ROImageInfo.ReadData", GetHashCode());
+ try
+ {
+ _ImageID = dr.GetInt32("ImageID");
+ _RODbID = dr.GetInt32("RODbID");
+ _FileName = dr.GetString("FileName");
+ _Content = (byte[])dr.GetValue("Content");
+ _Config = dr.GetString("Config");
+ _DTS = dr.GetDateTime("DTS");
+ _UserID = dr.GetString("UserID");
+ _ROImageFigureCount = dr.GetInt32("FigureCount");
+ }
+ catch (Exception ex)
+ {
+ if (_MyLog.IsErrorEnabled) _MyLog.Error("ROImageInfo.ReadData", ex);
+ _ErrorMessage = ex.Message;
+ throw new DbCslaException("ROImageInfo.ReadData", ex);
+ }
+ }
+ private void DataPortal_Fetch(PKCriteria criteria)
+ {
+ if (_MyLog.IsDebugEnabled) _MyLog.DebugFormat("[{0}] ROImageInfo.DataPortal_Fetch", GetHashCode());
+ try
+ {
+ using (SqlConnection cn = Database.VEPROMS_SqlConnection)
+ {
+ ApplicationContext.LocalContext["cn"] = cn;
+ using (SqlCommand cm = cn.CreateCommand())
+ {
+ cm.CommandType = CommandType.StoredProcedure;
+ cm.CommandText = "getROImage";
+ cm.Parameters.AddWithValue("@ImageID", criteria.ImageID);
+ using (SafeDataReader dr = new SafeDataReader(cm.ExecuteReader()))
+ {
+ if (!dr.Read())
+ {
+ _ErrorMessage = "No Record Found";
+ return;
+ }
+ ReadData(dr);
+ }
+ }
+ // removing of item only needed for local data portal
+ if (ApplicationContext.ExecutionLocation == ApplicationContext.ExecutionLocations.Client)
+ ApplicationContext.LocalContext.Remove("cn");
+ }
+ }
+ catch (Exception ex)
+ {
+ if (_MyLog.IsErrorEnabled) _MyLog.Error("ROImageInfo.DataPortal_Fetch", ex);
+ _ErrorMessage = ex.Message;
+ throw new DbCslaException("ROImageInfo.DataPortal_Fetch", ex);
+ }
+ }
+ #endregion
+ // Standard Refresh
+ #region extension
+ ROImageInfoExtension _ROImageInfoExtension = new ROImageInfoExtension();
+ [Serializable()]
+ partial class ROImageInfoExtension : extensionBase { }
+ [Serializable()]
+ class extensionBase
+ {
+ // Default Refresh
+ public virtual void Refresh(ROImageInfo tmp) { }
+ }
+ #endregion
+ } // Class
+ #region Converter
+ internal class ROImageInfoConverter : ExpandableObjectConverter
+ {
+ public override object ConvertTo(ITypeDescriptorContext context, System.Globalization.CultureInfo culture, object value, Type destType)
+ {
+ if (destType == typeof(string) && value is ROImageInfo)
+ {
+ // Return the ToString value
+ return ((ROImageInfo)value).ToString();
+ }
+ return base.ConvertTo(context, culture, value, destType);
+ }
+ }
+ #endregion
+} // Namespace
diff --git a/PROMS/VEPROMS.CSLA.Library/Generated/ROImageInfoList.cs b/PROMS/VEPROMS.CSLA.Library/Generated/ROImageInfoList.cs
new file mode 100644
index 00000000..6116d745
--- /dev/null
+++ b/PROMS/VEPROMS.CSLA.Library/Generated/ROImageInfoList.cs
@@ -0,0 +1,262 @@
+// ========================================================================
+// Copyright 2007 - 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;
+using System.ComponentModel;
+using System.Collections.Generic;
+namespace VEPROMS.CSLA.Library
+{
+ ///
+ /// ROImageInfoList Generated by MyGeneration using the CSLA Object Mapping template
+ ///
+ [Serializable()]
+ [TypeConverter(typeof(ROImageInfoListConverter))]
+ public partial class ROImageInfoList : ReadOnlyListBase, ICustomTypeDescriptor, IDisposable
+ {
+ #region Log4Net
+ private static readonly log4net.ILog _MyLog = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
+ #endregion
+ #region Business Methods
+ internal new IList Items
+ { get { return base.Items; } }
+ public void AddEvents()
+ {
+ foreach (ROImageInfo tmp in this)
+ {
+ tmp.Changed += new ROImageInfoEvent(tmp_Changed);
+ }
+ }
+ void tmp_Changed(object sender)
+ {
+ for (int i = 0; i < Count; i++)
+ {
+ if (base[i] == sender)
+ this.OnListChanged(new ListChangedEventArgs(ListChangedType.ItemChanged, i));
+ }
+ }
+ public void Dispose()
+ {
+ foreach (ROImageInfo tmp in this)
+ {
+ tmp.Changed -= new ROImageInfoEvent(tmp_Changed);
+ }
+ }
+ #endregion
+ #region Factory Methods
+ public static ROImageInfoList _ROImageInfoList = null;
+ ///
+ /// Return a list of all ROImageInfo.
+ ///
+ public static ROImageInfoList Get()
+ {
+ try
+ {
+ if (_ROImageInfoList != null)
+ return _ROImageInfoList;
+ ROImageInfoList tmp = DataPortal.Fetch();
+ ROImageInfo.AddList(tmp);
+ tmp.AddEvents();
+ _ROImageInfoList = tmp;
+ return tmp;
+ }
+ catch (Exception ex)
+ {
+ throw new DbCslaException("Error on ROImageInfoList.Get", ex);
+ }
+ }
+ ///
+ /// Reset the list of all ROImageInfo.
+ ///
+ public static void Reset()
+ {
+ _ROImageInfoList = null;
+ }
+ // TODO: Add alternative gets -
+ //public static ROImageInfoList Get()
+ //{
+ // try
+ // {
+ // return DataPortal.Fetch(new FilteredCriteria());
+ // }
+ // catch (Exception ex)
+ // {
+ // throw new DbCslaException("Error on ROImageInfoList.Get", ex);
+ // }
+ //}
+ public static ROImageInfoList GetByRODbID(int rODbID)
+ {
+ try
+ {
+ ROImageInfoList tmp = DataPortal.Fetch(new RODbIDCriteria(rODbID));
+ ROImageInfo.AddList(tmp);
+ tmp.AddEvents();
+ return tmp;
+ }
+ catch (Exception ex)
+ {
+ throw new DbCslaException("Error on ROImageInfoList.GetByRODbID", ex);
+ }
+ }
+ private ROImageInfoList()
+ { /* require use of factory methods */ }
+ #endregion
+ #region Data Access Portal
+ private void DataPortal_Fetch()
+ {
+ this.RaiseListChangedEvents = false;
+ if (_MyLog.IsDebugEnabled) _MyLog.DebugFormat("[{0}] ROImageInfoList.DataPortal_Fetch", GetHashCode());
+ try
+ {
+ using (SqlConnection cn = Database.VEPROMS_SqlConnection)
+ {
+ using (SqlCommand cm = cn.CreateCommand())
+ {
+ cm.CommandType = CommandType.StoredProcedure;
+ cm.CommandText = "getROImages";
+ using (SafeDataReader dr = new SafeDataReader(cm.ExecuteReader()))
+ {
+ IsReadOnly = false;
+ while (dr.Read()) this.Add(new ROImageInfo(dr));
+ IsReadOnly = true;
+ }
+ }
+ }
+ }
+ catch (Exception ex)
+ {
+ if (_MyLog.IsErrorEnabled) _MyLog.Error("ROImageInfoList.DataPortal_Fetch", ex);
+ throw new DbCslaException("ROImageInfoList.DataPortal_Fetch", ex);
+ }
+ this.RaiseListChangedEvents = true;
+ }
+ [Serializable()]
+ private class RODbIDCriteria
+ {
+ public RODbIDCriteria(int rODbID)
+ {
+ _RODbID = rODbID;
+ }
+ private int _RODbID;
+ public int RODbID
+ {
+ get { return _RODbID; }
+ set { _RODbID = value; }
+ }
+ }
+ private void DataPortal_Fetch(RODbIDCriteria criteria)
+ {
+ this.RaiseListChangedEvents = false;
+ if (_MyLog.IsDebugEnabled) _MyLog.DebugFormat("[{0}] ROImageInfoList.DataPortal_FetchRODbID", GetHashCode());
+ try
+ {
+ using (SqlConnection cn = Database.VEPROMS_SqlConnection)
+ {
+ using (SqlCommand cm = cn.CreateCommand())
+ {
+ cm.CommandType = CommandType.StoredProcedure;
+ cm.CommandText = "getROImagesByRODbID";
+ cm.Parameters.AddWithValue("@RODbID", criteria.RODbID);
+ using (SafeDataReader dr = new SafeDataReader(cm.ExecuteReader()))
+ {
+ IsReadOnly = false;
+ while (dr.Read()) this.Add(new ROImageInfo(dr));
+ IsReadOnly = true;
+ }
+ }
+ }
+ }
+ catch (Exception ex)
+ {
+ if (_MyLog.IsErrorEnabled) _MyLog.Error("ROImageInfoList.DataPortal_FetchRODbID", ex);
+ throw new DbCslaException("ROImageInfoList.DataPortal_Fetch", ex);
+ }
+ this.RaiseListChangedEvents = true;
+ }
+ #endregion
+ #region ICustomTypeDescriptor impl
+ public String GetClassName()
+ { return TypeDescriptor.GetClassName(this, true); }
+ public AttributeCollection GetAttributes()
+ { return TypeDescriptor.GetAttributes(this, true); }
+ public String GetComponentName()
+ { return TypeDescriptor.GetComponentName(this, true); }
+ public TypeConverter GetConverter()
+ { return TypeDescriptor.GetConverter(this, true); }
+ public EventDescriptor GetDefaultEvent()
+ { return TypeDescriptor.GetDefaultEvent(this, true); }
+ public PropertyDescriptor GetDefaultProperty()
+ { return TypeDescriptor.GetDefaultProperty(this, true); }
+ public object GetEditor(Type editorBaseType)
+ { return TypeDescriptor.GetEditor(this, editorBaseType, true); }
+ public EventDescriptorCollection GetEvents(Attribute[] attributes)
+ { return TypeDescriptor.GetEvents(this, attributes, true); }
+ public EventDescriptorCollection GetEvents()
+ { return TypeDescriptor.GetEvents(this, true); }
+ public object GetPropertyOwner(PropertyDescriptor pd)
+ { return this; }
+ ///
+ /// Called to get the properties of this type. Returns properties with certain
+ /// attributes. this restriction is not implemented here.
+ ///
+ ///
+ ///
+ public PropertyDescriptorCollection GetProperties(Attribute[] attributes)
+ { return GetProperties(); }
+ ///
+ /// Called to get the properties of this type.
+ ///
+ ///
+ public PropertyDescriptorCollection GetProperties()
+ {
+ // Create a collection object to hold property descriptors
+ PropertyDescriptorCollection pds = new PropertyDescriptorCollection(null);
+ // Iterate the list
+ for (int i = 0; i < this.Items.Count; i++)
+ {
+ // Create a property descriptor for the item and add to the property descriptor collection
+ ROImageInfoListPropertyDescriptor pd = new ROImageInfoListPropertyDescriptor(this, i);
+ pds.Add(pd);
+ }
+ // return the property descriptor collection
+ return pds;
+ }
+ #endregion
+ } // Class
+ #region Property Descriptor
+ ///
+ /// Summary description for CollectionPropertyDescriptor.
+ ///
+ public partial class ROImageInfoListPropertyDescriptor : vlnListPropertyDescriptor
+ {
+ private ROImageInfo Item { get { return (ROImageInfo)_Item; } }
+ public ROImageInfoListPropertyDescriptor(ROImageInfoList collection, int index) : base(collection, index) { ;}
+ }
+ #endregion
+ #region Converter
+ internal class ROImageInfoListConverter : ExpandableObjectConverter
+ {
+ public override object ConvertTo(ITypeDescriptorContext context, System.Globalization.CultureInfo culture, object value, Type destType)
+ {
+ if (destType == typeof(string) && value is ROImageInfoList)
+ {
+ // Return department and department role separated by comma.
+ return ((ROImageInfoList)value).Items.Count.ToString() + " ROImages";
+ }
+ return base.ConvertTo(context, culture, value, destType);
+ }
+ }
+ #endregion
+} // Namespace
diff --git a/PROMS/VEPROMS.CSLA.Library/Generated/RoUsage.cs b/PROMS/VEPROMS.CSLA.Library/Generated/RoUsage.cs
index d0f7739c..61f9ec90 100644
--- a/PROMS/VEPROMS.CSLA.Library/Generated/RoUsage.cs
+++ b/PROMS/VEPROMS.CSLA.Library/Generated/RoUsage.cs
@@ -48,6 +48,7 @@ namespace VEPROMS.CSLA.Library
{
RoUsageInfo.Refresh(tmp);
if (tmp._MyContent != null) ContentInfo.Refresh(tmp._MyContent);
+ if (tmp._MyRODb != null) RODbInfo.Refresh(tmp._MyRODb);
}
}
#endregion
@@ -223,13 +224,45 @@ namespace VEPROMS.CSLA.Library
}
}
private byte[] _LastChanged = new byte[8];//timestamp
+ private int _RODbID;
+ public int RODbID
+ {
+ [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
+ get
+ {
+ CanReadProperty("RODbID", true);
+ if (_MyRODb != null) _RODbID = _MyRODb.RODbID;
+ return _RODbID;
+ }
+ }
+ private RODb _MyRODb;
+ public RODb MyRODb
+ {
+ [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
+ get
+ {
+ CanReadProperty("MyRODb", true);
+ if (_MyRODb == null && _RODbID != 0) _MyRODb = RODb.Get(_RODbID);
+ return _MyRODb;
+ }
+ [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
+ set
+ {
+ CanWriteProperty("MyRODb", true);
+ if (_MyRODb != value)
+ {
+ _MyRODb = value;
+ PropertyHasChanged();
+ }
+ }
+ }
public override bool IsDirty
{
- get { return base.IsDirty || (_MyContent == null ? false : _MyContent.IsDirty); }
+ get { return base.IsDirty || (_MyContent == null ? false : _MyContent.IsDirty) || (_MyRODb == null ? false : _MyRODb.IsDirty); }
}
public override bool IsValid
{
- get { return (IsNew && !IsDirty ? true : base.IsValid) && (_MyContent == null ? true : _MyContent.IsValid); }
+ get { return (IsNew && !IsDirty ? true : base.IsValid) && (_MyContent == null ? true : _MyContent.IsValid) && (_MyRODb == null ? true : _MyRODb.IsValid); }
}
// TODO: Replace base RoUsage.ToString function as necessary
///
@@ -264,6 +297,7 @@ namespace VEPROMS.CSLA.Library
_CheckingBrokenRules = true;
IVEHasBrokenRules hasBrokenRules = null;
if (_MyContent != null && (hasBrokenRules = _MyContent.HasBrokenRules) != null) return hasBrokenRules;
+ if (_MyRODb != null && (hasBrokenRules = _MyRODb.HasBrokenRules) != null) return hasBrokenRules;
return hasBrokenRules;
}
finally
@@ -297,6 +331,7 @@ namespace VEPROMS.CSLA.Library
ValidationRules.AddRule(
Csla.Validation.CommonRules.StringMaxLength,
new Csla.Validation.CommonRules.MaxLengthRuleArgs("UserID", 100));
+ ValidationRules.AddRule(MyRODbRequired, "MyRODb");
//ValidationRules.AddDependantProperty("x", "y");
_RoUsageExtension.AddValidationRules(ValidationRules);
// TODO: Add other validation rules
@@ -315,6 +350,15 @@ namespace VEPROMS.CSLA.Library
}
return true;
}
+ private static bool MyRODbRequired(RoUsage target, Csla.Validation.RuleArgs e)
+ {
+ if (target._RODbID == 0 && target._MyRODb == null) // Required field missing
+ {
+ e.Description = "Required";
+ return false;
+ }
+ return true;
+ }
// Sample data comparison validation rule
//private bool StartDateGTEndDate(object target, Csla.Validation.RuleArgs e)
//{
@@ -337,11 +381,13 @@ namespace VEPROMS.CSLA.Library
//AuthorizationRules.AllowRead(Config, "");
//AuthorizationRules.AllowRead(DTS, "");
//AuthorizationRules.AllowRead(UserID, "");
+ //AuthorizationRules.AllowRead(RODbID, "");
//AuthorizationRules.AllowWrite(ContentID, "");
//AuthorizationRules.AllowWrite(ROID, "");
//AuthorizationRules.AllowWrite(Config, "");
//AuthorizationRules.AllowWrite(DTS, "");
//AuthorizationRules.AllowWrite(UserID, "");
+ //AuthorizationRules.AllowWrite(RODbID, "");
_RoUsageExtension.AddAuthorizationRules(AuthorizationRules);
}
protected override void AddInstanceAuthorizationRules()
@@ -417,13 +463,14 @@ namespace VEPROMS.CSLA.Library
throw new DbCslaException("Error on RoUsage.New", ex);
}
}
- public static RoUsage New(string roid)
+ public static RoUsage New(string roid, RODb myRODb)
{
RoUsage tmp = RoUsage.New();
tmp.ROID = roid;
+ tmp.MyRODb = myRODb;
return tmp;
}
- public static RoUsage New(Content myContent, string roid, string config, DateTime dts, string userID)
+ public static RoUsage New(Content myContent, string roid, string config, DateTime dts, string userID, RODb myRODb)
{
RoUsage tmp = RoUsage.New();
tmp.MyContent = myContent;
@@ -431,11 +478,12 @@ namespace VEPROMS.CSLA.Library
tmp.Config = config;
tmp.DTS = dts;
tmp.UserID = userID;
+ tmp.MyRODb = myRODb;
return tmp;
}
- public static RoUsage MakeRoUsage(Content myContent, string roid, string config, DateTime dts, string userID)
+ public static RoUsage MakeRoUsage(Content myContent, string roid, string config, DateTime dts, string userID, RODb myRODb)
{
- RoUsage tmp = RoUsage.New(myContent, roid, config, dts, userID);
+ RoUsage tmp = RoUsage.New(myContent, roid, config, dts, userID, myRODb);
if (tmp.IsSavable)
{
RoUsage tmp2 = tmp;
@@ -453,17 +501,18 @@ namespace VEPROMS.CSLA.Library
}
return tmp;
}
- public static RoUsage New(Content myContent, string roid, string config)
+ public static RoUsage New(Content myContent, string roid, string config, RODb myRODb)
{
RoUsage tmp = RoUsage.New();
tmp.MyContent = myContent;
tmp.ROID = roid;
tmp.Config = config;
+ tmp.MyRODb = myRODb;
return tmp;
}
- public static RoUsage MakeRoUsage(Content myContent, string roid, string config)
+ public static RoUsage MakeRoUsage(Content myContent, string roid, string config, RODb myRODb)
{
- RoUsage tmp = RoUsage.New(myContent, roid, config);
+ RoUsage tmp = RoUsage.New(myContent, roid, config, myRODb);
if (tmp.IsSavable)
{
RoUsage tmp2 = tmp;
@@ -586,6 +635,7 @@ namespace VEPROMS.CSLA.Library
_DTS = dr.GetDateTime("DTS");
_UserID = dr.GetString("UserID");
dr.GetBytes("LastChanged", 0, _LastChanged, 0, 8);
+ _RODbID = dr.GetInt32("RODbID");
MarkOld();
}
catch (Exception ex)
@@ -662,6 +712,7 @@ namespace VEPROMS.CSLA.Library
try
{
if (_MyContent != null) _MyContent.Update();
+ if (_MyRODb != null) _MyRODb.Update();
SqlConnection cn = (SqlConnection)ApplicationContext.LocalContext["cn"];
using (SqlCommand cm = cn.CreateCommand())
{
@@ -673,6 +724,7 @@ namespace VEPROMS.CSLA.Library
cm.Parameters.AddWithValue("@Config", _Config);
if (_DTS.Year >= 1753 && _DTS.Year <= 9999) cm.Parameters.AddWithValue("@DTS", _DTS);
cm.Parameters.AddWithValue("@UserID", _UserID);
+ cm.Parameters.AddWithValue("@RODbID", RODbID);
// Output Calculated Columns
SqlParameter param_ROUsageID = new SqlParameter("@newROUsageID", SqlDbType.Int);
param_ROUsageID.Direction = ParameterDirection.Output;
@@ -698,7 +750,7 @@ namespace VEPROMS.CSLA.Library
}
}
[Transactional(TransactionalTypes.TransactionScope)]
- public static byte[] Add(SqlConnection cn, ref int rOUsageID, Content myContent, string roid, string config, DateTime dts, string userID)
+ public static byte[] Add(SqlConnection cn, ref int rOUsageID, Content myContent, string roid, string config, DateTime dts, string userID, RODb myRODb)
{
if (_MyLog.IsDebugEnabled) _MyLog.DebugFormat("[{0}] RoUsage.Add", 0);
try
@@ -713,6 +765,7 @@ namespace VEPROMS.CSLA.Library
cm.Parameters.AddWithValue("@Config", config);
if (dts.Year >= 1753 && dts.Year <= 9999) cm.Parameters.AddWithValue("@DTS", dts);
cm.Parameters.AddWithValue("@UserID", userID);
+ cm.Parameters.AddWithValue("@RODbID", myRODb.RODbID);
// Output Calculated Columns
SqlParameter param_ROUsageID = new SqlParameter("@newROUsageID", SqlDbType.Int);
param_ROUsageID.Direction = ParameterDirection.Output;
@@ -764,6 +817,7 @@ namespace VEPROMS.CSLA.Library
try
{
if (_MyContent != null) _MyContent.Update();
+ if (_MyRODb != null) _MyRODb.Update();
SqlConnection cn = (SqlConnection)ApplicationContext.LocalContext["cn"];
if (base.IsDirty)
{
@@ -779,6 +833,7 @@ namespace VEPROMS.CSLA.Library
if (_DTS.Year >= 1753 && _DTS.Year <= 9999) cm.Parameters.AddWithValue("@DTS", _DTS);
cm.Parameters.AddWithValue("@UserID", _UserID);
cm.Parameters.AddWithValue("@LastChanged", _LastChanged);
+ cm.Parameters.AddWithValue("@RODbID", RODbID);
// Output Calculated Columns
SqlParameter param_LastChanged = new SqlParameter("@newLastChanged", SqlDbType.Timestamp);
param_LastChanged.Direction = ParameterDirection.Output;
@@ -806,14 +861,14 @@ namespace VEPROMS.CSLA.Library
{
SqlConnection cn = (SqlConnection)ApplicationContext.LocalContext["cn"];
if (IsNew)
- _LastChanged = RoUsage.Add(cn, ref _ROUsageID, _MyContent, _ROID, _Config, _DTS, _UserID);
+ _LastChanged = RoUsage.Add(cn, ref _ROUsageID, _MyContent, _ROID, _Config, _DTS, _UserID, _MyRODb);
else
- _LastChanged = RoUsage.Update(cn, ref _ROUsageID, _MyContent, _ROID, _Config, _DTS, _UserID, ref _LastChanged);
+ _LastChanged = RoUsage.Update(cn, ref _ROUsageID, _MyContent, _ROID, _Config, _DTS, _UserID, ref _LastChanged, _MyRODb);
MarkOld();
}
}
[Transactional(TransactionalTypes.TransactionScope)]
- public static byte[] Update(SqlConnection cn, ref int rOUsageID, Content myContent, string roid, string config, DateTime dts, string userID, ref byte[] lastChanged)
+ public static byte[] Update(SqlConnection cn, ref int rOUsageID, Content myContent, string roid, string config, DateTime dts, string userID, ref byte[] lastChanged, RODb myRODb)
{
if (_MyLog.IsDebugEnabled) _MyLog.DebugFormat("[{0}] RoUsage.Update", 0);
try
@@ -830,6 +885,7 @@ namespace VEPROMS.CSLA.Library
if (dts.Year >= 1753 && dts.Year <= 9999) cm.Parameters.AddWithValue("@DTS", dts);
cm.Parameters.AddWithValue("@UserID", userID);
cm.Parameters.AddWithValue("@LastChanged", lastChanged);
+ cm.Parameters.AddWithValue("@RODbID", myRODb.RODbID);
// Output Calculated Columns
SqlParameter param_LastChanged = new SqlParameter("@newLastChanged", SqlDbType.Timestamp);
param_LastChanged.Direction = ParameterDirection.Output;
diff --git a/PROMS/VEPROMS.CSLA.Library/Generated/RoUsageInfo.cs b/PROMS/VEPROMS.CSLA.Library/Generated/RoUsageInfo.cs
index 188b72bd..4690708e 100644
--- a/PROMS/VEPROMS.CSLA.Library/Generated/RoUsageInfo.cs
+++ b/PROMS/VEPROMS.CSLA.Library/Generated/RoUsageInfo.cs
@@ -163,6 +163,28 @@ namespace VEPROMS.CSLA.Library
return _UserID;
}
}
+ private int _RODbID;
+ public int RODbID
+ {
+ [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
+ get
+ {
+ CanReadProperty("RODbID", true);
+ if (_MyRODb != null) _RODbID = _MyRODb.RODbID;
+ return _RODbID;
+ }
+ }
+ private RODbInfo _MyRODb;
+ public RODbInfo MyRODb
+ {
+ [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
+ get
+ {
+ CanReadProperty("MyRODb", true);
+ if (_MyRODb == null && _RODbID != 0) _MyRODb = RODbInfo.Get(_RODbID);
+ return _MyRODb;
+ }
+ }
// TODO: Replace base RoUsageInfo.ToString function as necessary
///
/// Overrides Base ToString
@@ -227,12 +249,24 @@ namespace VEPROMS.CSLA.Library
_Config = tmp.Config;
_DTS = tmp.DTS;
_UserID = tmp.UserID;
+ if (_RODbID != tmp.RODbID)
+ {
+ if (MyRODb != null) MyRODb.RefreshRODbRoUsages(); // Update List for old value
+ _RODbID = tmp.RODbID; // Update the value
+ }
+ _MyRODb = null; // Reset list so that the next line gets a new list
+ if (MyRODb != null) MyRODb.RefreshRODbRoUsages(); // Update List for new value
_RoUsageInfoExtension.Refresh(this);
if(_MyContent != null)
{
_MyContent.Dispose();// Dispose related value
_MyContent = null;// Reset related value
}
+ if(_MyRODb != null)
+ {
+ _MyRODb.Dispose();// Dispose related value
+ _MyRODb = null;// Reset related value
+ }
OnChange();// raise an event
}
public static void Refresh(ContentRoUsage tmp)
@@ -249,12 +283,58 @@ namespace VEPROMS.CSLA.Library
_Config = tmp.Config;
_DTS = tmp.DTS;
_UserID = tmp.UserID;
+ if (_RODbID != tmp.RODbID)
+ {
+ if (MyRODb != null) MyRODb.RefreshRODbRoUsages(); // Update List for old value
+ _RODbID = tmp.RODbID; // Update the value
+ }
+ _MyRODb = null; // Reset list so that the next line gets a new list
+ if (MyRODb != null) MyRODb.RefreshRODbRoUsages(); // Update List for new value
_RoUsageInfoExtension.Refresh(this);
if(_MyContent != null)
{
_MyContent.Dispose();// Dispose related value
_MyContent = null;// Reset related value
}
+ if(_MyRODb != null)
+ {
+ _MyRODb.Dispose();// Dispose related value
+ _MyRODb = null;// Reset related value
+ }
+ OnChange();// raise an event
+ }
+ public static void Refresh(RODbRoUsage tmp)
+ {
+ string key = tmp.ROUsageID.ToString();
+ ConvertListToDictionary();
+ if (_CacheByPrimaryKey.ContainsKey(key))
+ foreach (RoUsageInfo tmpInfo in _CacheByPrimaryKey[key])
+ tmpInfo.RefreshFields(tmp);
+ }
+ protected virtual void RefreshFields(RODbRoUsage tmp)
+ {
+ if (_ContentID != tmp.ContentID)
+ {
+ if (MyContent != null) MyContent.RefreshContentRoUsages(); // Update List for old value
+ _ContentID = tmp.ContentID; // Update the value
+ }
+ _MyContent = null; // Reset list so that the next line gets a new list
+ if (MyContent != null) MyContent.RefreshContentRoUsages(); // Update List for new value
+ _ROID = tmp.ROID;
+ _Config = tmp.Config;
+ _DTS = tmp.DTS;
+ _UserID = tmp.UserID;
+ _RoUsageInfoExtension.Refresh(this);
+ if(_MyContent != null)
+ {
+ _MyContent.Dispose();// Dispose related value
+ _MyContent = null;// Reset related value
+ }
+ if(_MyRODb != null)
+ {
+ _MyRODb.Dispose();// Dispose related value
+ _MyRODb = null;// Reset related value
+ }
OnChange();// raise an event
}
public static RoUsageInfo Get(int rOUsageID)
@@ -318,6 +398,7 @@ namespace VEPROMS.CSLA.Library
_Config = dr.GetString("Config");
_DTS = dr.GetDateTime("DTS");
_UserID = dr.GetString("UserID");
+ _RODbID = dr.GetInt32("RODbID");
}
catch (Exception ex)
{
diff --git a/PROMS/VEPROMS.CSLA.Library/Generated/RoUsageInfoList.cs b/PROMS/VEPROMS.CSLA.Library/Generated/RoUsageInfoList.cs
index 7136abd1..a829ce6c 100644
--- a/PROMS/VEPROMS.CSLA.Library/Generated/RoUsageInfoList.cs
+++ b/PROMS/VEPROMS.CSLA.Library/Generated/RoUsageInfoList.cs
@@ -58,7 +58,7 @@ namespace VEPROMS.CSLA.Library
#region Factory Methods
public static RoUsageInfoList _RoUsageInfoList = null;
///
- /// Return a list of all projects.
+ /// Return a list of all RoUsageInfo.
///
public static RoUsageInfoList Get()
{
@@ -77,6 +77,13 @@ namespace VEPROMS.CSLA.Library
throw new DbCslaException("Error on RoUsageInfoList.Get", ex);
}
}
+ ///
+ /// Reset the list of all RoUsageInfo.
+ ///
+ public static void Reset()
+ {
+ _RoUsageInfoList = null;
+ }
// TODO: Add alternative gets -
//public static RoUsageInfoList Get()
//{
@@ -103,6 +110,20 @@ namespace VEPROMS.CSLA.Library
throw new DbCslaException("Error on RoUsageInfoList.GetByContentID", ex);
}
}
+ public static RoUsageInfoList GetByRODbID(int rODbID)
+ {
+ try
+ {
+ RoUsageInfoList tmp = DataPortal.Fetch(new RODbIDCriteria(rODbID));
+ RoUsageInfo.AddList(tmp);
+ tmp.AddEvents();
+ return tmp;
+ }
+ catch (Exception ex)
+ {
+ throw new DbCslaException("Error on RoUsageInfoList.GetByRODbID", ex);
+ }
+ }
private RoUsageInfoList()
{ /* require use of factory methods */ }
#endregion
@@ -178,6 +199,49 @@ namespace VEPROMS.CSLA.Library
}
this.RaiseListChangedEvents = true;
}
+ [Serializable()]
+ private class RODbIDCriteria
+ {
+ public RODbIDCriteria(int rODbID)
+ {
+ _RODbID = rODbID;
+ }
+ private int _RODbID;
+ public int RODbID
+ {
+ get { return _RODbID; }
+ set { _RODbID = value; }
+ }
+ }
+ private void DataPortal_Fetch(RODbIDCriteria criteria)
+ {
+ this.RaiseListChangedEvents = false;
+ if (_MyLog.IsDebugEnabled) _MyLog.DebugFormat("[{0}] RoUsageInfoList.DataPortal_FetchRODbID", GetHashCode());
+ try
+ {
+ using (SqlConnection cn = Database.VEPROMS_SqlConnection)
+ {
+ using (SqlCommand cm = cn.CreateCommand())
+ {
+ cm.CommandType = CommandType.StoredProcedure;
+ cm.CommandText = "getRoUsagesByRODbID";
+ cm.Parameters.AddWithValue("@RODbID", criteria.RODbID);
+ using (SafeDataReader dr = new SafeDataReader(cm.ExecuteReader()))
+ {
+ IsReadOnly = false;
+ while (dr.Read()) this.Add(new RoUsageInfo(dr));
+ IsReadOnly = true;
+ }
+ }
+ }
+ }
+ catch (Exception ex)
+ {
+ if (_MyLog.IsErrorEnabled) _MyLog.Error("RoUsageInfoList.DataPortal_FetchRODbID", ex);
+ throw new DbCslaException("RoUsageInfoList.DataPortal_Fetch", ex);
+ }
+ this.RaiseListChangedEvents = true;
+ }
#endregion
#region ICustomTypeDescriptor impl
public String GetClassName()