This commit is contained in:
Jsj
2008-05-16 18:07:47 +00:00
parent 9d0b3cd543
commit cda0291dbd
116 changed files with 4257 additions and 3382 deletions

View File

@@ -42,14 +42,14 @@ namespace VEPROMS.CSLA.Library
{
foreach (FolderAssignment tmp in _FolderAssignments)
{
if(tmp.IsDirty)refreshFolderAssignments.Add(tmp);
if (tmp.IsDirty) refreshFolderAssignments.Add(tmp);
}
}
if (_FolderDocVersions != null && _FolderDocVersions.IsDirty)
{
foreach (FolderDocVersion tmp in _FolderDocVersions)
{
if(tmp.IsDirty)refreshFolderDocVersions.Add(tmp);
if (tmp.IsDirty) refreshFolderDocVersions.Add(tmp);
}
}
if (_ChildFolders != null && _ChildFolders.IsDirty)
@@ -72,8 +72,8 @@ namespace VEPROMS.CSLA.Library
foreach (Folder tmp in _RefreshFolders)
{
FolderInfo.Refresh(tmp);
if(tmp._MyConnection != null) ConnectionInfo.Refresh(tmp._MyConnection);
if(tmp._MyFormat != null) FormatInfo.Refresh(tmp._MyFormat);
if (tmp._MyConnection != null) ConnectionInfo.Refresh(tmp._MyConnection);
if (tmp._MyFormat != null) FormatInfo.Refresh(tmp._MyFormat);
}
foreach (FolderAssignment tmp in _RefreshFolderAssignments)
{
@@ -87,15 +87,20 @@ namespace VEPROMS.CSLA.Library
#endregion
#region Collection
protected static List<Folder> _AllList = new List<Folder>();
private static Dictionary<string, Folder> _AllByPrimaryKey = new Dictionary<string, Folder>();
private static Dictionary<string, Folder> _AllByParentID_Name = new Dictionary<string, Folder>();
private static Dictionary<string, List<Folder>> _AllByPrimaryKey = new Dictionary<string, List<Folder>>();
private static Dictionary<string, List<Folder>> _AllByParentID_Name = new Dictionary<string, List<Folder>>();
private static void ConvertListToDictionary()
{
List<Folder> remove = new List<Folder>();
foreach (Folder tmp in _AllList)
{
_AllByPrimaryKey[tmp.FolderID.ToString()]=tmp; // Primary Key
_AllByParentID_Name[tmp.ParentID.ToString() + "_" + tmp.Name.ToString()] = tmp; // Unique Index
if (!_AllByPrimaryKey.ContainsKey(tmp.FolderID.ToString()))
{
_AllByPrimaryKey[tmp.FolderID.ToString()] = new List<Folder>(); // Add new list for PrimaryKey
_AllByParentID_Name[tmp.ParentID.ToString() + "_" + tmp.Name.ToString()] = new List<Folder>(); // Add new list for ParentID_Name
}
_AllByPrimaryKey[tmp.FolderID.ToString()].Add(tmp); // Add to Primary Key list
_AllByParentID_Name[tmp.ParentID.ToString() + "_" + tmp.Name.ToString()].Add(tmp); // Unique Index
remove.Add(tmp);
}
foreach (Folder tmp in remove)
@@ -105,14 +110,14 @@ namespace VEPROMS.CSLA.Library
{
ConvertListToDictionary();
string key = folderID.ToString();
if (_AllByPrimaryKey.ContainsKey(key)) return _AllByPrimaryKey[key];
if (_AllByPrimaryKey.ContainsKey(key)) return _AllByPrimaryKey[key][0];
return null;
}
public static Folder GetExistingByParentID_Name(int parentID, string name)
{
ConvertListToDictionary();
string key = parentID.ToString() + "_" + name.ToString();
if (_AllByParentID_Name.ContainsKey(key)) return _AllByParentID_Name[key];
if (_AllByParentID_Name.ContainsKey(key)) return _AllByParentID_Name[key][0];
return null;
}
#endregion
@@ -134,7 +139,7 @@ namespace VEPROMS.CSLA.Library
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
get
{
CanReadProperty("FolderID",true);
CanReadProperty("FolderID", true);
return _FolderID;
}
}
@@ -144,7 +149,7 @@ namespace VEPROMS.CSLA.Library
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
get
{
CanReadProperty("ParentID",true);
CanReadProperty("ParentID", true);
if (_MyParent != null) _ParentID = _MyParent.FolderID;
return _ParentID;
}
@@ -155,14 +160,14 @@ namespace VEPROMS.CSLA.Library
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
get
{
CanReadProperty("MyParent",true);
CanReadProperty("MyParent", true);
if (_MyParent == null && _ParentID != _FolderID) _MyParent = Folder.Get(_ParentID);
return _MyParent;
}
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
set
{
CanWriteProperty("MyParent",true);
CanWriteProperty("MyParent", true);
if (_MyParent != value)
{
_MyParent = value;
@@ -176,7 +181,7 @@ namespace VEPROMS.CSLA.Library
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
get
{
CanReadProperty("DBID",true);
CanReadProperty("DBID", true);
if (_MyConnection != null) _DBID = _MyConnection.DBID;
return _DBID;
}
@@ -187,14 +192,14 @@ namespace VEPROMS.CSLA.Library
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
get
{
CanReadProperty("MyConnection",true);
CanReadProperty("MyConnection", true);
if (_MyConnection == null && _DBID != 0) _MyConnection = Connection.Get(_DBID);
return _MyConnection;
}
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
set
{
CanWriteProperty("MyConnection",true);
CanWriteProperty("MyConnection", true);
if (_MyConnection != value)
{
_MyConnection = value;
@@ -208,13 +213,13 @@ namespace VEPROMS.CSLA.Library
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
get
{
CanReadProperty("Name",true);
CanReadProperty("Name", true);
return _Name;
}
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
set
{
CanWriteProperty("Name",true);
CanWriteProperty("Name", true);
if (value == null) value = string.Empty;
if (_Name != value)
{
@@ -229,13 +234,13 @@ namespace VEPROMS.CSLA.Library
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
get
{
CanReadProperty("Title",true);
CanReadProperty("Title", true);
return _Title;
}
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
set
{
CanWriteProperty("Title",true);
CanWriteProperty("Title", true);
if (value == null) value = string.Empty;
if (_Title != value)
{
@@ -250,13 +255,13 @@ namespace VEPROMS.CSLA.Library
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
get
{
CanReadProperty("ShortName",true);
CanReadProperty("ShortName", true);
return _ShortName;
}
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
set
{
CanWriteProperty("ShortName",true);
CanWriteProperty("ShortName", true);
if (value == null) value = string.Empty;
if (_ShortName != value)
{
@@ -271,7 +276,7 @@ namespace VEPROMS.CSLA.Library
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
get
{
CanReadProperty("FormatID",true);
CanReadProperty("FormatID", true);
if (_MyFormat != null) _FormatID = _MyFormat.FormatID;
return _FormatID;
}
@@ -282,18 +287,18 @@ namespace VEPROMS.CSLA.Library
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
get
{
CanReadProperty("MyFormat",true);
CanReadProperty("MyFormat", true);
if (_MyFormat == null && _FormatID != null) _MyFormat = Format.Get((int)_FormatID);
return _MyFormat;
}
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
set
{
CanWriteProperty("MyFormat",true);
CanWriteProperty("MyFormat", true);
if (_MyFormat != value)
{
_MyFormat = value;
_FormatID = (value == null ? null : (int?) value.FormatID);
_FormatID = (value == null ? null : (int?)value.FormatID);
PropertyHasChanged();
}
}
@@ -304,13 +309,13 @@ namespace VEPROMS.CSLA.Library
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
get
{
CanReadProperty("Config",true);
CanReadProperty("Config", true);
return _Config;
}
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
set
{
CanWriteProperty("Config",true);
CanWriteProperty("Config", true);
if (value == null) value = string.Empty;
if (_Config != value)
{
@@ -325,13 +330,13 @@ namespace VEPROMS.CSLA.Library
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
get
{
CanReadProperty("DTS",true);
CanReadProperty("DTS", true);
return _DTS;
}
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
set
{
CanWriteProperty("DTS",true);
CanWriteProperty("DTS", true);
if (_DTS != value)
{
_DTS = value;
@@ -345,13 +350,13 @@ namespace VEPROMS.CSLA.Library
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
get
{
CanReadProperty("UsrID",true);
CanReadProperty("UsrID", true);
return _UsrID;
}
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
set
{
CanWriteProperty("UsrID",true);
CanWriteProperty("UsrID", true);
if (value == null) value = string.Empty;
if (_UsrID != value)
{
@@ -370,7 +375,7 @@ namespace VEPROMS.CSLA.Library
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
get
{
CanReadProperty("FolderAssignmentCount",true);
CanReadProperty("FolderAssignmentCount", true);
return _FolderAssignmentCount;
}
}
@@ -384,10 +389,10 @@ namespace VEPROMS.CSLA.Library
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
get
{
CanReadProperty("FolderAssignments",true);
if(_FolderAssignmentCount > 0 && _FolderAssignments == null)
CanReadProperty("FolderAssignments", true);
if (_FolderAssignmentCount > 0 && _FolderAssignments == null)
_FolderAssignments = FolderAssignments.GetByFolderID(FolderID);
else if(_FolderAssignments == null)
else if (_FolderAssignments == null)
_FolderAssignments = FolderAssignments.New();
return _FolderAssignments;
}
@@ -401,7 +406,7 @@ namespace VEPROMS.CSLA.Library
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
get
{
CanReadProperty("FolderDocVersionCount",true);
CanReadProperty("FolderDocVersionCount", true);
return _FolderDocVersionCount;
}
}
@@ -415,10 +420,10 @@ namespace VEPROMS.CSLA.Library
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
get
{
CanReadProperty("FolderDocVersions",true);
if(_FolderDocVersionCount > 0 && _FolderDocVersions == null)
CanReadProperty("FolderDocVersions", true);
if (_FolderDocVersionCount > 0 && _FolderDocVersions == null)
_FolderDocVersions = FolderDocVersions.GetByFolderID(FolderID);
else if(_FolderDocVersions == null)
else if (_FolderDocVersions == null)
_FolderDocVersions = FolderDocVersions.New();
return _FolderDocVersions;
}
@@ -432,7 +437,7 @@ namespace VEPROMS.CSLA.Library
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
get
{
CanReadProperty("ChildFolderCount",true);
CanReadProperty("ChildFolderCount", true);
return _ChildFolderCount;
}
}
@@ -446,21 +451,21 @@ namespace VEPROMS.CSLA.Library
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
get
{
CanReadProperty("ChildFolders",true);
if(_ChildFolderCount > 0 && _ChildFolders == null)
CanReadProperty("ChildFolders", true);
if (_ChildFolderCount > 0 && _ChildFolders == null)
_ChildFolders = ChildFolders.GetByParentID(FolderID);
else if(_ChildFolders == null)
else if (_ChildFolders == null)
_ChildFolders = ChildFolders.New();
return _ChildFolders;
}
}
public override bool IsDirty
{
get { return base.IsDirty || (_FolderAssignments == null? false : _FolderAssignments.IsDirty) || (_FolderDocVersions == null? false : _FolderDocVersions.IsDirty) || (_ChildFolders == null? false : _ChildFolders.IsDirty) || (_MyConnection == null? false : _MyConnection.IsDirty) || (_MyFormat == null? false : _MyFormat.IsDirty); }
get { return base.IsDirty || (_FolderAssignments == null ? false : _FolderAssignments.IsDirty) || (_FolderDocVersions == null ? false : _FolderDocVersions.IsDirty) || (_ChildFolders == null ? false : _ChildFolders.IsDirty) || (_MyConnection == null ? false : _MyConnection.IsDirty) || (_MyFormat == null ? false : _MyFormat.IsDirty); }
}
public override bool IsValid
{
get { return (IsNew && !IsDirty ? true : base.IsValid) && (_FolderAssignments == null? true : _FolderAssignments.IsValid) && (_FolderDocVersions == null? true : _FolderDocVersions.IsValid) && (_ChildFolders == null? true : _ChildFolders.IsValid) && (_MyConnection == null? true : _MyConnection.IsValid) && (_MyFormat == null? true : _MyFormat.IsValid); }
get { return (IsNew && !IsDirty ? true : base.IsValid) && (_FolderAssignments == null ? true : _FolderAssignments.IsValid) && (_FolderDocVersions == null ? true : _FolderDocVersions.IsValid) && (_ChildFolders == null ? true : _ChildFolders.IsValid) && (_MyConnection == null ? true : _MyConnection.IsValid) && (_MyFormat == null ? true : _MyFormat.IsValid); }
}
// TODO: Replace base Folder.ToString function as necessary
/// <summary>
@@ -483,26 +488,27 @@ namespace VEPROMS.CSLA.Library
#endregion
#region ValidationRules
[NonSerialized]
private bool _CheckingBrokenRules=false;
private bool _CheckingBrokenRules = false;
public IVEHasBrokenRules HasBrokenRules
{
get {
if(_CheckingBrokenRules)return null;
get
{
if (_CheckingBrokenRules) return null;
if ((IsDirty || !IsNew) && BrokenRulesCollection.Count > 0) return this;
try
{
_CheckingBrokenRules=true;
_CheckingBrokenRules = true;
IVEHasBrokenRules hasBrokenRules = null;
if (_FolderAssignments != null && (hasBrokenRules = _FolderAssignments.HasBrokenRules) != null) return hasBrokenRules;
if (_FolderDocVersions != null && (hasBrokenRules = _FolderDocVersions.HasBrokenRules) != null) return hasBrokenRules;
if (_ChildFolders != null && (hasBrokenRules = _ChildFolders.HasBrokenRules) != null) return hasBrokenRules;
if (_MyConnection != null && (hasBrokenRules = _MyConnection.HasBrokenRules) != null) return hasBrokenRules;
if (_MyFormat != null && (hasBrokenRules = _MyFormat.HasBrokenRules) != null) return hasBrokenRules;
if (_FolderAssignments != null && (hasBrokenRules = _FolderAssignments.HasBrokenRules) != null) return hasBrokenRules;
if (_FolderDocVersions != null && (hasBrokenRules = _FolderDocVersions.HasBrokenRules) != null) return hasBrokenRules;
if (_ChildFolders != null && (hasBrokenRules = _ChildFolders.HasBrokenRules) != null) return hasBrokenRules;
if (_MyConnection != null && (hasBrokenRules = _MyConnection.HasBrokenRules) != null) return hasBrokenRules;
if (_MyFormat != null && (hasBrokenRules = _MyFormat.HasBrokenRules) != null) return hasBrokenRules;
return hasBrokenRules;
}
finally
{
_CheckingBrokenRules=false;
_CheckingBrokenRules = false;
}
}
}
@@ -644,15 +650,29 @@ namespace VEPROMS.CSLA.Library
#region Factory Methods
public int CurrentEditLevel
{ get { return EditLevel; } }
private static int _FolderUnique = 0;
private int _MyFolderUnique;
public int MyFolderUnique
{
get { return _MyFolderUnique; }
}
protected Folder()
{/* require use of factory methods */
_MyFolderUnique = ++_FolderUnique;
_AllList.Add(this);
}
public void Dispose()
{
_AllList.Remove(this);
_AllByPrimaryKey.Remove(FolderID.ToString());
_AllByParentID_Name.Remove(ParentID.ToString() + "_" + Name.ToString());
if (!_AllByPrimaryKey.ContainsKey(FolderID.ToString())) return;
List<Folder> listFolder = _AllByPrimaryKey[FolderID.ToString()]; // Get the list of items
listFolder.Remove(this); // Remove the item from the list
if (listFolder.Count == 0) //If there are no items left in the list
_AllByPrimaryKey.Remove(FolderID.ToString()); // remove the list
listFolder = _AllByParentID_Name[FolderID.ToString()]; // Get the list of items
listFolder.Remove(this); // Remove the item from the list
if (listFolder.Count == 0) //If there are no items left in the list
_AllByParentID_Name.Remove(FolderID.ToString()); // remove the list
}
public static Folder New()
{
@@ -743,7 +763,7 @@ namespace VEPROMS.CSLA.Library
if (tmp == null)
{
tmp = DataPortal.Fetch<Folder>(new PKCriteria(folderID));
_AllList.Add(tmp);
if (!_AllList.Contains(tmp)) _AllList.Add(tmp);
}
if (tmp.ErrorMessage == "No Record Found") tmp = null;
return tmp;
@@ -762,8 +782,8 @@ namespace VEPROMS.CSLA.Library
Folder tmp = GetExistingByParentID_Name(parentID, name);
if (tmp == null)
{
tmp=DataPortal.Fetch<Folder>(new ParentID_NameCriteria(parentID, name));
_AllList.Add(tmp);
tmp = DataPortal.Fetch<Folder>(new ParentID_NameCriteria(parentID, name));
if (!_AllList.Contains(tmp)) _AllList.Add(tmp);
}
if (tmp.ErrorMessage == "No Record Found") tmp = null;
return tmp;
@@ -869,7 +889,7 @@ namespace VEPROMS.CSLA.Library
}
private void ReadData(SafeDataReader dr)
{
if(_MyLog.IsDebugEnabled)_MyLog.DebugFormat("[{0}] Folder.ReadData", GetHashCode());
if (_MyLog.IsDebugEnabled) _MyLog.DebugFormat("[{0}] Folder.ReadData", GetHashCode());
try
{
_FolderID = dr.GetInt32("FolderID");
@@ -890,14 +910,14 @@ namespace VEPROMS.CSLA.Library
}
catch (Exception ex)
{
if(_MyLog.IsErrorEnabled)_MyLog.Error("Folder.ReadData", ex);
if (_MyLog.IsErrorEnabled) _MyLog.Error("Folder.ReadData", ex);
_ErrorMessage = ex.Message;
throw new DbCslaException("Folder.ReadData", ex);
}
}
private void DataPortal_Fetch(PKCriteria criteria)
{
if(_MyLog.IsDebugEnabled)_MyLog.DebugFormat("[{0}] Folder.DataPortal_Fetch", GetHashCode());
if (_MyLog.IsDebugEnabled) _MyLog.DebugFormat("[{0}] Folder.DataPortal_Fetch", GetHashCode());
try
{
using (SqlConnection cn = Database.VEPROMS_SqlConnection)
@@ -931,14 +951,14 @@ namespace VEPROMS.CSLA.Library
}
catch (Exception ex)
{
if(_MyLog.IsErrorEnabled)_MyLog.Error("Folder.DataPortal_Fetch", ex);
if (_MyLog.IsErrorEnabled) _MyLog.Error("Folder.DataPortal_Fetch", ex);
_ErrorMessage = ex.Message;
throw new DbCslaException("Folder.DataPortal_Fetch", ex);
}
}
private void DataPortal_Fetch(ParentID_NameCriteria criteria)
{
if(_MyLog.IsDebugEnabled)_MyLog.DebugFormat("[{0}] Folder.DataPortal_Fetch", GetHashCode());
if (_MyLog.IsDebugEnabled) _MyLog.DebugFormat("[{0}] Folder.DataPortal_Fetch", GetHashCode());
try
{
using (SqlConnection cn = Database.VEPROMS_SqlConnection)
@@ -967,7 +987,7 @@ namespace VEPROMS.CSLA.Library
}
catch (Exception ex)
{
if(_MyLog.IsErrorEnabled)_MyLog.Error("Folder.DataPortal_Fetch", ex);
if (_MyLog.IsErrorEnabled) _MyLog.Error("Folder.DataPortal_Fetch", ex);
_ErrorMessage = ex.Message;
throw new DbCslaException("Folder.DataPortal_Fetch", ex);
}
@@ -988,13 +1008,13 @@ namespace VEPROMS.CSLA.Library
}
catch (Exception ex)
{
if(_MyLog.IsErrorEnabled)_MyLog.Error("Folder.DataPortal_Insert", ex);
if (_MyLog.IsErrorEnabled) _MyLog.Error("Folder.DataPortal_Insert", ex);
_ErrorMessage = ex.Message;
throw new DbCslaException("Folder.DataPortal_Insert", ex);
}
finally
{
if(_MyLog.IsDebugEnabled)_MyLog.DebugFormat("[{0}] Folder.DataPortal_Insert", GetHashCode());
if (_MyLog.IsDebugEnabled) _MyLog.DebugFormat("[{0}] Folder.DataPortal_Insert", GetHashCode());
}
}
[Transactional(TransactionalTypes.TransactionScope)]
@@ -1003,8 +1023,8 @@ namespace VEPROMS.CSLA.Library
if (!this.IsDirty) return;
try
{
if(_MyConnection != null) _MyConnection.Update();
if(_MyFormat != null) _MyFormat.Update();
if (_MyConnection != null) _MyConnection.Update();
if (_MyFormat != null) _MyFormat.Update();
SqlConnection cn = (SqlConnection)ApplicationContext.LocalContext["cn"];
using (SqlCommand cm = cn.CreateCommand())
{
@@ -1038,11 +1058,11 @@ namespace VEPROMS.CSLA.Library
if (_FolderAssignments != null) _FolderAssignments.Update(this);
if (_FolderDocVersions != null) _FolderDocVersions.Update(this);
if (_ChildFolders != null) _ChildFolders.Update(this);
if(_MyLog.IsDebugEnabled)_MyLog.DebugFormat("[{0}] Folder.SQLInsert", GetHashCode());
if (_MyLog.IsDebugEnabled) _MyLog.DebugFormat("[{0}] Folder.SQLInsert", GetHashCode());
}
catch (Exception ex)
{
if(_MyLog.IsErrorEnabled)_MyLog.Error("Folder.SQLInsert", ex);
if (_MyLog.IsErrorEnabled) _MyLog.Error("Folder.SQLInsert", ex);
_ErrorMessage = ex.Message;
throw new DbCslaException("Folder.SQLInsert", ex);
}
@@ -1050,7 +1070,7 @@ namespace VEPROMS.CSLA.Library
[Transactional(TransactionalTypes.TransactionScope)]
public static byte[] Add(SqlConnection cn, ref int folderID, Folder myParent, Connection myConnection, string name, string title, string shortName, Format myFormat, string config, DateTime dts, string usrID)
{
if(_MyLog.IsDebugEnabled)_MyLog.DebugFormat("[{0}] Folder.Add", 0);
if (_MyLog.IsDebugEnabled) _MyLog.DebugFormat("[{0}] Folder.Add", 0);
try
{
using (SqlCommand cm = cn.CreateCommand())
@@ -1063,7 +1083,7 @@ namespace VEPROMS.CSLA.Library
cm.Parameters.AddWithValue("@Name", name);
cm.Parameters.AddWithValue("@Title", title);
cm.Parameters.AddWithValue("@ShortName", shortName);
if(myFormat != null)cm.Parameters.AddWithValue("@FormatID", myFormat.FormatID);
if (myFormat != null) cm.Parameters.AddWithValue("@FormatID", myFormat.FormatID);
cm.Parameters.AddWithValue("@Config", config);
if (dts.Year >= 1753 && dts.Year <= 9999) cm.Parameters.AddWithValue("@DTS", dts);
cm.Parameters.AddWithValue("@UsrID", usrID);
@@ -1083,7 +1103,7 @@ namespace VEPROMS.CSLA.Library
}
catch (Exception ex)
{
if(_MyLog.IsErrorEnabled)_MyLog.Error("Folder.Add", ex);
if (_MyLog.IsErrorEnabled) _MyLog.Error("Folder.Add", ex);
throw new DbCslaException("Folder.Add", ex);
}
}
@@ -1091,7 +1111,7 @@ namespace VEPROMS.CSLA.Library
protected override void DataPortal_Update()
{
if (!IsDirty) return; // If not dirty - nothing to do
if(_MyLog.IsDebugEnabled)_MyLog.DebugFormat("[{0}] Folder.DataPortal_Update", GetHashCode());
if (_MyLog.IsDebugEnabled) _MyLog.DebugFormat("[{0}] Folder.DataPortal_Update", GetHashCode());
try
{
using (SqlConnection cn = Database.VEPROMS_SqlConnection)
@@ -1105,7 +1125,7 @@ namespace VEPROMS.CSLA.Library
}
catch (Exception ex)
{
if(_MyLog.IsErrorEnabled)_MyLog.Error("Folder.DataPortal_Update", ex);
if (_MyLog.IsErrorEnabled) _MyLog.Error("Folder.DataPortal_Update", ex);
_ErrorMessage = ex.Message;
if (!ex.Message.EndsWith("has been edited by another user.")) throw ex;
}
@@ -1114,11 +1134,11 @@ namespace VEPROMS.CSLA.Library
internal void SQLUpdate()
{
if (!IsDirty) return; // If not dirty - nothing to do
if(_MyLog.IsDebugEnabled)_MyLog.DebugFormat("[{0}] Folder.SQLUpdate", GetHashCode());
if (_MyLog.IsDebugEnabled) _MyLog.DebugFormat("[{0}] Folder.SQLUpdate", GetHashCode());
try
{
if(_MyConnection != null) _MyConnection.Update();
if(_MyFormat != null) _MyFormat.Update();
if (_MyConnection != null) _MyConnection.Update();
if (_MyFormat != null) _MyFormat.Update();
SqlConnection cn = (SqlConnection)ApplicationContext.LocalContext["cn"];
if (base.IsDirty)
{
@@ -1156,7 +1176,7 @@ namespace VEPROMS.CSLA.Library
}
catch (Exception ex)
{
if(_MyLog.IsErrorEnabled)_MyLog.Error("Folder.SQLUpdate", ex);
if (_MyLog.IsErrorEnabled) _MyLog.Error("Folder.SQLUpdate", ex);
_ErrorMessage = ex.Message;
if (!ex.Message.EndsWith("has been edited by another user.")) throw ex;
}
@@ -1190,7 +1210,7 @@ namespace VEPROMS.CSLA.Library
[Transactional(TransactionalTypes.TransactionScope)]
public static byte[] Update(SqlConnection cn, ref int folderID, Folder myParent, Connection myConnection, string name, string title, string shortName, Format myFormat, string config, DateTime dts, string usrID, ref byte[] lastChanged)
{
if(_MyLog.IsDebugEnabled)_MyLog.DebugFormat("[{0}] Folder.Update", 0);
if (_MyLog.IsDebugEnabled) _MyLog.DebugFormat("[{0}] Folder.Update", 0);
try
{
using (SqlCommand cm = cn.CreateCommand())
@@ -1204,7 +1224,7 @@ namespace VEPROMS.CSLA.Library
cm.Parameters.AddWithValue("@Name", name);
cm.Parameters.AddWithValue("@Title", title);
cm.Parameters.AddWithValue("@ShortName", shortName);
if(myFormat != null)cm.Parameters.AddWithValue("@FormatID", myFormat.FormatID);
if (myFormat != null) cm.Parameters.AddWithValue("@FormatID", myFormat.FormatID);
cm.Parameters.AddWithValue("@Config", config);
if (dts.Year >= 1753 && dts.Year <= 9999) cm.Parameters.AddWithValue("@DTS", dts);
cm.Parameters.AddWithValue("@UsrID", usrID);
@@ -1221,7 +1241,7 @@ namespace VEPROMS.CSLA.Library
}
catch (Exception ex)
{
if(_MyLog.IsErrorEnabled)_MyLog.Error("Folder.Update", ex);
if (_MyLog.IsErrorEnabled) _MyLog.Error("Folder.Update", ex);
throw new DbCslaException("Folder.Update", ex);
}
}
@@ -1233,7 +1253,7 @@ namespace VEPROMS.CSLA.Library
[Transactional(TransactionalTypes.TransactionScope)]
private void DataPortal_Delete(PKCriteria criteria)
{
if(_MyLog.IsDebugEnabled)_MyLog.DebugFormat("[{0}] Folder.DataPortal_Delete", GetHashCode());
if (_MyLog.IsDebugEnabled) _MyLog.DebugFormat("[{0}] Folder.DataPortal_Delete", GetHashCode());
try
{
using (SqlConnection cn = Database.VEPROMS_SqlConnection)
@@ -1249,7 +1269,7 @@ namespace VEPROMS.CSLA.Library
}
catch (Exception ex)
{
if(_MyLog.IsErrorEnabled)_MyLog.Error("Folder.DataPortal_Delete", ex);
if (_MyLog.IsErrorEnabled) _MyLog.Error("Folder.DataPortal_Delete", ex);
_ErrorMessage = ex.Message;
throw new DbCslaException("Folder.DataPortal_Delete", ex);
}
@@ -1257,7 +1277,7 @@ namespace VEPROMS.CSLA.Library
[Transactional(TransactionalTypes.TransactionScope)]
public static void Remove(SqlConnection cn, int folderID)
{
if(_MyLog.IsDebugEnabled)_MyLog.DebugFormat("[{0}] Folder.Remove", 0);
if (_MyLog.IsDebugEnabled) _MyLog.DebugFormat("[{0}] Folder.Remove", 0);
try
{
using (SqlCommand cm = cn.CreateCommand())
@@ -1272,7 +1292,7 @@ namespace VEPROMS.CSLA.Library
}
catch (Exception ex)
{
if(_MyLog.IsErrorEnabled)_MyLog.Error("Folder.Remove", ex);
if (_MyLog.IsErrorEnabled) _MyLog.Error("Folder.Remove", ex);
throw new DbCslaException("Folder.Remove", ex);
}
}
@@ -1306,7 +1326,7 @@ namespace VEPROMS.CSLA.Library
}
protected override void DataPortal_Execute()
{
if(_MyLog.IsDebugEnabled)_MyLog.DebugFormat("[{0}] Folder.DataPortal_Execute", GetHashCode());
if (_MyLog.IsDebugEnabled) _MyLog.DebugFormat("[{0}] Folder.DataPortal_Execute", GetHashCode());
try
{
using (SqlConnection cn = Database.VEPROMS_SqlConnection)
@@ -1324,7 +1344,7 @@ namespace VEPROMS.CSLA.Library
}
catch (Exception ex)
{
if(_MyLog.IsErrorEnabled)_MyLog.Error("Folder.DataPortal_Execute", ex);
if (_MyLog.IsErrorEnabled) _MyLog.Error("Folder.DataPortal_Execute", ex);
throw new DbCslaException("Folder.DataPortal_Execute", ex);
}
}