This commit is contained in:
@@ -43,21 +43,21 @@ namespace VEPROMS.CSLA.Library
|
||||
{
|
||||
foreach (FormatContent tmp in _FormatContents)
|
||||
{
|
||||
if(tmp.IsDirty)refreshFormatContents.Add(tmp);
|
||||
if (tmp.IsDirty) refreshFormatContents.Add(tmp);
|
||||
}
|
||||
}
|
||||
if (_FormatDocVersions != null && _FormatDocVersions.IsDirty)
|
||||
{
|
||||
foreach (FormatDocVersion tmp in _FormatDocVersions)
|
||||
{
|
||||
if(tmp.IsDirty)refreshFormatDocVersions.Add(tmp);
|
||||
if (tmp.IsDirty) refreshFormatDocVersions.Add(tmp);
|
||||
}
|
||||
}
|
||||
if (_FormatFolders != null && _FormatFolders.IsDirty)
|
||||
{
|
||||
foreach (FormatFolder tmp in _FormatFolders)
|
||||
{
|
||||
if(tmp.IsDirty)refreshFormatFolders.Add(tmp);
|
||||
if (tmp.IsDirty) refreshFormatFolders.Add(tmp);
|
||||
}
|
||||
}
|
||||
if (_ChildFormats != null && _ChildFormats.IsDirty)
|
||||
@@ -98,15 +98,20 @@ namespace VEPROMS.CSLA.Library
|
||||
#endregion
|
||||
#region Collection
|
||||
protected static List<Format> _AllList = new List<Format>();
|
||||
private static Dictionary<string, Format> _AllByPrimaryKey = new Dictionary<string, Format>();
|
||||
private static Dictionary<string, Format> _AllByParentID_Name = new Dictionary<string, Format>();
|
||||
private static Dictionary<string, List<Format>> _AllByPrimaryKey = new Dictionary<string, List<Format>>();
|
||||
private static Dictionary<string, List<Format>> _AllByParentID_Name = new Dictionary<string, List<Format>>();
|
||||
private static void ConvertListToDictionary()
|
||||
{
|
||||
List<Format> remove = new List<Format>();
|
||||
foreach (Format tmp in _AllList)
|
||||
{
|
||||
_AllByPrimaryKey[tmp.FormatID.ToString()]=tmp; // Primary Key
|
||||
_AllByParentID_Name[tmp.ParentID.ToString() + "_" + tmp.Name.ToString()] = tmp; // Unique Index
|
||||
if (!_AllByPrimaryKey.ContainsKey(tmp.FormatID.ToString()))
|
||||
{
|
||||
_AllByPrimaryKey[tmp.FormatID.ToString()] = new List<Format>(); // Add new list for PrimaryKey
|
||||
_AllByParentID_Name[tmp.ParentID.ToString() + "_" + tmp.Name.ToString()] = new List<Format>(); // Add new list for ParentID_Name
|
||||
}
|
||||
_AllByPrimaryKey[tmp.FormatID.ToString()].Add(tmp); // Add to Primary Key list
|
||||
_AllByParentID_Name[tmp.ParentID.ToString() + "_" + tmp.Name.ToString()].Add(tmp); // Unique Index
|
||||
remove.Add(tmp);
|
||||
}
|
||||
foreach (Format tmp in remove)
|
||||
@@ -116,14 +121,14 @@ namespace VEPROMS.CSLA.Library
|
||||
{
|
||||
ConvertListToDictionary();
|
||||
string key = formatID.ToString();
|
||||
if (_AllByPrimaryKey.ContainsKey(key)) return _AllByPrimaryKey[key];
|
||||
if (_AllByPrimaryKey.ContainsKey(key)) return _AllByPrimaryKey[key][0];
|
||||
return null;
|
||||
}
|
||||
public static Format 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
|
||||
@@ -145,7 +150,7 @@ namespace VEPROMS.CSLA.Library
|
||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||
get
|
||||
{
|
||||
CanReadProperty("FormatID",true);
|
||||
CanReadProperty("FormatID", true);
|
||||
return _FormatID;
|
||||
}
|
||||
}
|
||||
@@ -155,7 +160,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.FormatID;
|
||||
return _ParentID;
|
||||
}
|
||||
@@ -166,14 +171,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 != _FormatID) _MyParent = Format.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;
|
||||
@@ -187,13 +192,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)
|
||||
{
|
||||
@@ -208,13 +213,13 @@ namespace VEPROMS.CSLA.Library
|
||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||
get
|
||||
{
|
||||
CanReadProperty("Description",true);
|
||||
CanReadProperty("Description", true);
|
||||
return _Description;
|
||||
}
|
||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||
set
|
||||
{
|
||||
CanWriteProperty("Description",true);
|
||||
CanWriteProperty("Description", true);
|
||||
if (value == null) value = string.Empty;
|
||||
if (_Description != value)
|
||||
{
|
||||
@@ -229,13 +234,13 @@ namespace VEPROMS.CSLA.Library
|
||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||
get
|
||||
{
|
||||
CanReadProperty("Data",true);
|
||||
CanReadProperty("Data", true);
|
||||
return _Data;
|
||||
}
|
||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||
set
|
||||
{
|
||||
CanWriteProperty("Data",true);
|
||||
CanWriteProperty("Data", true);
|
||||
if (value == null) value = string.Empty;
|
||||
if (_Data != value)
|
||||
{
|
||||
@@ -250,13 +255,13 @@ namespace VEPROMS.CSLA.Library
|
||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||
get
|
||||
{
|
||||
CanReadProperty("GenMac",true);
|
||||
CanReadProperty("GenMac", true);
|
||||
return _GenMac;
|
||||
}
|
||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||
set
|
||||
{
|
||||
CanWriteProperty("GenMac",true);
|
||||
CanWriteProperty("GenMac", true);
|
||||
if (value == null) value = string.Empty;
|
||||
if (_GenMac != value)
|
||||
{
|
||||
@@ -271,13 +276,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;
|
||||
@@ -291,13 +296,13 @@ namespace VEPROMS.CSLA.Library
|
||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||
get
|
||||
{
|
||||
CanReadProperty("UserID",true);
|
||||
CanReadProperty("UserID", true);
|
||||
return _UserID;
|
||||
}
|
||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||
set
|
||||
{
|
||||
CanWriteProperty("UserID",true);
|
||||
CanWriteProperty("UserID", true);
|
||||
if (value == null) value = string.Empty;
|
||||
if (_UserID != value)
|
||||
{
|
||||
@@ -316,7 +321,7 @@ namespace VEPROMS.CSLA.Library
|
||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||
get
|
||||
{
|
||||
CanReadProperty("FormatContentCount",true);
|
||||
CanReadProperty("FormatContentCount", true);
|
||||
return _FormatContentCount;
|
||||
}
|
||||
}
|
||||
@@ -330,10 +335,10 @@ namespace VEPROMS.CSLA.Library
|
||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||
get
|
||||
{
|
||||
CanReadProperty("FormatContents",true);
|
||||
if(_FormatContentCount > 0 && _FormatContents == null)
|
||||
CanReadProperty("FormatContents", true);
|
||||
if (_FormatContentCount > 0 && _FormatContents == null)
|
||||
_FormatContents = FormatContents.GetByFormatID(FormatID);
|
||||
else if(_FormatContents == null)
|
||||
else if (_FormatContents == null)
|
||||
_FormatContents = FormatContents.New();
|
||||
return _FormatContents;
|
||||
}
|
||||
@@ -347,7 +352,7 @@ namespace VEPROMS.CSLA.Library
|
||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||
get
|
||||
{
|
||||
CanReadProperty("FormatDocVersionCount",true);
|
||||
CanReadProperty("FormatDocVersionCount", true);
|
||||
return _FormatDocVersionCount;
|
||||
}
|
||||
}
|
||||
@@ -361,10 +366,10 @@ namespace VEPROMS.CSLA.Library
|
||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||
get
|
||||
{
|
||||
CanReadProperty("FormatDocVersions",true);
|
||||
if(_FormatDocVersionCount > 0 && _FormatDocVersions == null)
|
||||
CanReadProperty("FormatDocVersions", true);
|
||||
if (_FormatDocVersionCount > 0 && _FormatDocVersions == null)
|
||||
_FormatDocVersions = FormatDocVersions.GetByFormatID(FormatID);
|
||||
else if(_FormatDocVersions == null)
|
||||
else if (_FormatDocVersions == null)
|
||||
_FormatDocVersions = FormatDocVersions.New();
|
||||
return _FormatDocVersions;
|
||||
}
|
||||
@@ -378,7 +383,7 @@ namespace VEPROMS.CSLA.Library
|
||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||
get
|
||||
{
|
||||
CanReadProperty("FormatFolderCount",true);
|
||||
CanReadProperty("FormatFolderCount", true);
|
||||
return _FormatFolderCount;
|
||||
}
|
||||
}
|
||||
@@ -392,10 +397,10 @@ namespace VEPROMS.CSLA.Library
|
||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||
get
|
||||
{
|
||||
CanReadProperty("FormatFolders",true);
|
||||
if(_FormatFolderCount > 0 && _FormatFolders == null)
|
||||
CanReadProperty("FormatFolders", true);
|
||||
if (_FormatFolderCount > 0 && _FormatFolders == null)
|
||||
_FormatFolders = FormatFolders.GetByFormatID(FormatID);
|
||||
else if(_FormatFolders == null)
|
||||
else if (_FormatFolders == null)
|
||||
_FormatFolders = FormatFolders.New();
|
||||
return _FormatFolders;
|
||||
}
|
||||
@@ -409,7 +414,7 @@ namespace VEPROMS.CSLA.Library
|
||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||
get
|
||||
{
|
||||
CanReadProperty("ChildFormatCount",true);
|
||||
CanReadProperty("ChildFormatCount", true);
|
||||
return _ChildFormatCount;
|
||||
}
|
||||
}
|
||||
@@ -423,21 +428,21 @@ namespace VEPROMS.CSLA.Library
|
||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||
get
|
||||
{
|
||||
CanReadProperty("ChildFormats",true);
|
||||
if(_ChildFormatCount > 0 && _ChildFormats == null)
|
||||
CanReadProperty("ChildFormats", true);
|
||||
if (_ChildFormatCount > 0 && _ChildFormats == null)
|
||||
_ChildFormats = ChildFormats.GetByParentID(FormatID);
|
||||
else if(_ChildFormats == null)
|
||||
else if (_ChildFormats == null)
|
||||
_ChildFormats = ChildFormats.New();
|
||||
return _ChildFormats;
|
||||
}
|
||||
}
|
||||
public override bool IsDirty
|
||||
{
|
||||
get { return base.IsDirty || (_FormatContents == null? false : _FormatContents.IsDirty) || (_FormatDocVersions == null? false : _FormatDocVersions.IsDirty) || (_FormatFolders == null? false : _FormatFolders.IsDirty) || (_ChildFormats == null? false : _ChildFormats.IsDirty); }
|
||||
get { return base.IsDirty || (_FormatContents == null ? false : _FormatContents.IsDirty) || (_FormatDocVersions == null ? false : _FormatDocVersions.IsDirty) || (_FormatFolders == null ? false : _FormatFolders.IsDirty) || (_ChildFormats == null ? false : _ChildFormats.IsDirty); }
|
||||
}
|
||||
public override bool IsValid
|
||||
{
|
||||
get { return (IsNew && !IsDirty ? true : base.IsValid) && (_FormatContents == null? true : _FormatContents.IsValid) && (_FormatDocVersions == null? true : _FormatDocVersions.IsValid) && (_FormatFolders == null? true : _FormatFolders.IsValid) && (_ChildFormats == null? true : _ChildFormats.IsValid); }
|
||||
get { return (IsNew && !IsDirty ? true : base.IsValid) && (_FormatContents == null ? true : _FormatContents.IsValid) && (_FormatDocVersions == null ? true : _FormatDocVersions.IsValid) && (_FormatFolders == null ? true : _FormatFolders.IsValid) && (_ChildFormats == null ? true : _ChildFormats.IsValid); }
|
||||
}
|
||||
// TODO: Replace base Format.ToString function as necessary
|
||||
/// <summary>
|
||||
@@ -460,25 +465,26 @@ 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 (_FormatFolders != null && (hasBrokenRules = _FormatFolders.HasBrokenRules) != null) return hasBrokenRules;
|
||||
if (_FormatContents != null && (hasBrokenRules = _FormatContents.HasBrokenRules) != null) return hasBrokenRules;
|
||||
if (_FormatDocVersions != null && (hasBrokenRules = _FormatDocVersions.HasBrokenRules) != null) return hasBrokenRules;
|
||||
if (_ChildFormats != null && (hasBrokenRules = _ChildFormats.HasBrokenRules) != null) return hasBrokenRules;
|
||||
if (_FormatFolders != null && (hasBrokenRules = _FormatFolders.HasBrokenRules) != null) return hasBrokenRules;
|
||||
if (_FormatContents != null && (hasBrokenRules = _FormatContents.HasBrokenRules) != null) return hasBrokenRules;
|
||||
if (_FormatDocVersions != null && (hasBrokenRules = _FormatDocVersions.HasBrokenRules) != null) return hasBrokenRules;
|
||||
if (_ChildFormats != null && (hasBrokenRules = _ChildFormats.HasBrokenRules) != null) return hasBrokenRules;
|
||||
return hasBrokenRules;
|
||||
}
|
||||
finally
|
||||
{
|
||||
_CheckingBrokenRules=false;
|
||||
_CheckingBrokenRules = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -607,15 +613,29 @@ namespace VEPROMS.CSLA.Library
|
||||
#region Factory Methods
|
||||
public int CurrentEditLevel
|
||||
{ get { return EditLevel; } }
|
||||
private static int _FormatUnique = 0;
|
||||
private int _MyFormatUnique;
|
||||
public int MyFormatUnique
|
||||
{
|
||||
get { return _MyFormatUnique; }
|
||||
}
|
||||
protected Format()
|
||||
{/* require use of factory methods */
|
||||
_MyFormatUnique = ++_FormatUnique;
|
||||
_AllList.Add(this);
|
||||
}
|
||||
public void Dispose()
|
||||
{
|
||||
_AllList.Remove(this);
|
||||
_AllByPrimaryKey.Remove(FormatID.ToString());
|
||||
_AllByParentID_Name.Remove(ParentID.ToString() + "_" + Name.ToString());
|
||||
if (!_AllByPrimaryKey.ContainsKey(FormatID.ToString())) return;
|
||||
List<Format> listFormat = _AllByPrimaryKey[FormatID.ToString()]; // Get the list of items
|
||||
listFormat.Remove(this); // Remove the item from the list
|
||||
if (listFormat.Count == 0) //If there are no items left in the list
|
||||
_AllByPrimaryKey.Remove(FormatID.ToString()); // remove the list
|
||||
listFormat = _AllByParentID_Name[FormatID.ToString()]; // Get the list of items
|
||||
listFormat.Remove(this); // Remove the item from the list
|
||||
if (listFormat.Count == 0) //If there are no items left in the list
|
||||
_AllByParentID_Name.Remove(FormatID.ToString()); // remove the list
|
||||
}
|
||||
public static Format New()
|
||||
{
|
||||
@@ -702,7 +722,7 @@ namespace VEPROMS.CSLA.Library
|
||||
if (tmp == null)
|
||||
{
|
||||
tmp = DataPortal.Fetch<Format>(new PKCriteria(formatID));
|
||||
_AllList.Add(tmp);
|
||||
if (!_AllList.Contains(tmp)) _AllList.Add(tmp);
|
||||
}
|
||||
if (tmp.ErrorMessage == "No Record Found") tmp = null;
|
||||
return tmp;
|
||||
@@ -721,8 +741,8 @@ namespace VEPROMS.CSLA.Library
|
||||
Format tmp = GetExistingByParentID_Name(parentID, name);
|
||||
if (tmp == null)
|
||||
{
|
||||
tmp=DataPortal.Fetch<Format>(new ParentID_NameCriteria(parentID, name));
|
||||
_AllList.Add(tmp);
|
||||
tmp = DataPortal.Fetch<Format>(new ParentID_NameCriteria(parentID, name));
|
||||
if (!_AllList.Contains(tmp)) _AllList.Add(tmp);
|
||||
}
|
||||
if (tmp.ErrorMessage == "No Record Found") tmp = null;
|
||||
return tmp;
|
||||
@@ -827,7 +847,7 @@ namespace VEPROMS.CSLA.Library
|
||||
}
|
||||
private void ReadData(SafeDataReader dr)
|
||||
{
|
||||
if(_MyLog.IsDebugEnabled)_MyLog.DebugFormat("[{0}] Format.ReadData", GetHashCode());
|
||||
if (_MyLog.IsDebugEnabled) _MyLog.DebugFormat("[{0}] Format.ReadData", GetHashCode());
|
||||
try
|
||||
{
|
||||
_FormatID = dr.GetInt32("FormatID");
|
||||
@@ -847,14 +867,14 @@ namespace VEPROMS.CSLA.Library
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
if(_MyLog.IsErrorEnabled)_MyLog.Error("Format.ReadData", ex);
|
||||
if (_MyLog.IsErrorEnabled) _MyLog.Error("Format.ReadData", ex);
|
||||
_ErrorMessage = ex.Message;
|
||||
throw new DbCslaException("Format.ReadData", ex);
|
||||
}
|
||||
}
|
||||
private void DataPortal_Fetch(PKCriteria criteria)
|
||||
{
|
||||
if(_MyLog.IsDebugEnabled)_MyLog.DebugFormat("[{0}] Format.DataPortal_Fetch", GetHashCode());
|
||||
if (_MyLog.IsDebugEnabled) _MyLog.DebugFormat("[{0}] Format.DataPortal_Fetch", GetHashCode());
|
||||
try
|
||||
{
|
||||
using (SqlConnection cn = Database.VEPROMS_SqlConnection)
|
||||
@@ -891,14 +911,14 @@ namespace VEPROMS.CSLA.Library
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
if(_MyLog.IsErrorEnabled)_MyLog.Error("Format.DataPortal_Fetch", ex);
|
||||
if (_MyLog.IsErrorEnabled) _MyLog.Error("Format.DataPortal_Fetch", ex);
|
||||
_ErrorMessage = ex.Message;
|
||||
throw new DbCslaException("Format.DataPortal_Fetch", ex);
|
||||
}
|
||||
}
|
||||
private void DataPortal_Fetch(ParentID_NameCriteria criteria)
|
||||
{
|
||||
if(_MyLog.IsDebugEnabled)_MyLog.DebugFormat("[{0}] Format.DataPortal_Fetch", GetHashCode());
|
||||
if (_MyLog.IsDebugEnabled) _MyLog.DebugFormat("[{0}] Format.DataPortal_Fetch", GetHashCode());
|
||||
try
|
||||
{
|
||||
using (SqlConnection cn = Database.VEPROMS_SqlConnection)
|
||||
@@ -927,7 +947,7 @@ namespace VEPROMS.CSLA.Library
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
if(_MyLog.IsErrorEnabled)_MyLog.Error("Format.DataPortal_Fetch", ex);
|
||||
if (_MyLog.IsErrorEnabled) _MyLog.Error("Format.DataPortal_Fetch", ex);
|
||||
_ErrorMessage = ex.Message;
|
||||
throw new DbCslaException("Format.DataPortal_Fetch", ex);
|
||||
}
|
||||
@@ -948,13 +968,13 @@ namespace VEPROMS.CSLA.Library
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
if(_MyLog.IsErrorEnabled)_MyLog.Error("Format.DataPortal_Insert", ex);
|
||||
if (_MyLog.IsErrorEnabled) _MyLog.Error("Format.DataPortal_Insert", ex);
|
||||
_ErrorMessage = ex.Message;
|
||||
throw new DbCslaException("Format.DataPortal_Insert", ex);
|
||||
}
|
||||
finally
|
||||
{
|
||||
if(_MyLog.IsDebugEnabled)_MyLog.DebugFormat("[{0}] Format.DataPortal_Insert", GetHashCode());
|
||||
if (_MyLog.IsDebugEnabled) _MyLog.DebugFormat("[{0}] Format.DataPortal_Insert", GetHashCode());
|
||||
}
|
||||
}
|
||||
[Transactional(TransactionalTypes.TransactionScope)]
|
||||
@@ -995,11 +1015,11 @@ namespace VEPROMS.CSLA.Library
|
||||
if (_FormatContents != null) _FormatContents.Update(this);
|
||||
if (_FormatDocVersions != null) _FormatDocVersions.Update(this);
|
||||
if (_ChildFormats != null) _ChildFormats.Update(this);
|
||||
if(_MyLog.IsDebugEnabled)_MyLog.DebugFormat("[{0}] Format.SQLInsert", GetHashCode());
|
||||
if (_MyLog.IsDebugEnabled) _MyLog.DebugFormat("[{0}] Format.SQLInsert", GetHashCode());
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
if(_MyLog.IsErrorEnabled)_MyLog.Error("Format.SQLInsert", ex);
|
||||
if (_MyLog.IsErrorEnabled) _MyLog.Error("Format.SQLInsert", ex);
|
||||
_ErrorMessage = ex.Message;
|
||||
throw new DbCslaException("Format.SQLInsert", ex);
|
||||
}
|
||||
@@ -1007,7 +1027,7 @@ namespace VEPROMS.CSLA.Library
|
||||
[Transactional(TransactionalTypes.TransactionScope)]
|
||||
public static byte[] Add(SqlConnection cn, ref int formatID, Format myParent, string name, string description, string data, string genMac, DateTime dts, string userID)
|
||||
{
|
||||
if(_MyLog.IsDebugEnabled)_MyLog.DebugFormat("[{0}] Format.Add", 0);
|
||||
if (_MyLog.IsDebugEnabled) _MyLog.DebugFormat("[{0}] Format.Add", 0);
|
||||
try
|
||||
{
|
||||
using (SqlCommand cm = cn.CreateCommand())
|
||||
@@ -1038,7 +1058,7 @@ namespace VEPROMS.CSLA.Library
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
if(_MyLog.IsErrorEnabled)_MyLog.Error("Format.Add", ex);
|
||||
if (_MyLog.IsErrorEnabled) _MyLog.Error("Format.Add", ex);
|
||||
throw new DbCslaException("Format.Add", ex);
|
||||
}
|
||||
}
|
||||
@@ -1046,7 +1066,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}] Format.DataPortal_Update", GetHashCode());
|
||||
if (_MyLog.IsDebugEnabled) _MyLog.DebugFormat("[{0}] Format.DataPortal_Update", GetHashCode());
|
||||
try
|
||||
{
|
||||
using (SqlConnection cn = Database.VEPROMS_SqlConnection)
|
||||
@@ -1060,7 +1080,7 @@ namespace VEPROMS.CSLA.Library
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
if(_MyLog.IsErrorEnabled)_MyLog.Error("Format.DataPortal_Update", ex);
|
||||
if (_MyLog.IsErrorEnabled) _MyLog.Error("Format.DataPortal_Update", ex);
|
||||
_ErrorMessage = ex.Message;
|
||||
if (!ex.Message.EndsWith("has been edited by another user.")) throw ex;
|
||||
}
|
||||
@@ -1069,7 +1089,7 @@ namespace VEPROMS.CSLA.Library
|
||||
internal void SQLUpdate()
|
||||
{
|
||||
if (!IsDirty) return; // If not dirty - nothing to do
|
||||
if(_MyLog.IsDebugEnabled)_MyLog.DebugFormat("[{0}] Format.SQLUpdate", GetHashCode());
|
||||
if (_MyLog.IsDebugEnabled) _MyLog.DebugFormat("[{0}] Format.SQLUpdate", GetHashCode());
|
||||
try
|
||||
{
|
||||
SqlConnection cn = (SqlConnection)ApplicationContext.LocalContext["cn"];
|
||||
@@ -1108,7 +1128,7 @@ namespace VEPROMS.CSLA.Library
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
if(_MyLog.IsErrorEnabled)_MyLog.Error("Format.SQLUpdate", ex);
|
||||
if (_MyLog.IsErrorEnabled) _MyLog.Error("Format.SQLUpdate", ex);
|
||||
_ErrorMessage = ex.Message;
|
||||
if (!ex.Message.EndsWith("has been edited by another user.")) throw ex;
|
||||
}
|
||||
@@ -1143,7 +1163,7 @@ namespace VEPROMS.CSLA.Library
|
||||
[Transactional(TransactionalTypes.TransactionScope)]
|
||||
public static byte[] Update(SqlConnection cn, ref int formatID, Format myParent, string name, string description, string data, string genMac, DateTime dts, string userID, ref byte[] lastChanged)
|
||||
{
|
||||
if(_MyLog.IsDebugEnabled)_MyLog.DebugFormat("[{0}] Format.Update", 0);
|
||||
if (_MyLog.IsDebugEnabled) _MyLog.DebugFormat("[{0}] Format.Update", 0);
|
||||
try
|
||||
{
|
||||
using (SqlCommand cm = cn.CreateCommand())
|
||||
@@ -1172,7 +1192,7 @@ namespace VEPROMS.CSLA.Library
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
if(_MyLog.IsErrorEnabled)_MyLog.Error("Format.Update", ex);
|
||||
if (_MyLog.IsErrorEnabled) _MyLog.Error("Format.Update", ex);
|
||||
throw new DbCslaException("Format.Update", ex);
|
||||
}
|
||||
}
|
||||
@@ -1184,7 +1204,7 @@ namespace VEPROMS.CSLA.Library
|
||||
[Transactional(TransactionalTypes.TransactionScope)]
|
||||
private void DataPortal_Delete(PKCriteria criteria)
|
||||
{
|
||||
if(_MyLog.IsDebugEnabled)_MyLog.DebugFormat("[{0}] Format.DataPortal_Delete", GetHashCode());
|
||||
if (_MyLog.IsDebugEnabled) _MyLog.DebugFormat("[{0}] Format.DataPortal_Delete", GetHashCode());
|
||||
try
|
||||
{
|
||||
using (SqlConnection cn = Database.VEPROMS_SqlConnection)
|
||||
@@ -1200,7 +1220,7 @@ namespace VEPROMS.CSLA.Library
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
if(_MyLog.IsErrorEnabled)_MyLog.Error("Format.DataPortal_Delete", ex);
|
||||
if (_MyLog.IsErrorEnabled) _MyLog.Error("Format.DataPortal_Delete", ex);
|
||||
_ErrorMessage = ex.Message;
|
||||
throw new DbCslaException("Format.DataPortal_Delete", ex);
|
||||
}
|
||||
@@ -1208,7 +1228,7 @@ namespace VEPROMS.CSLA.Library
|
||||
[Transactional(TransactionalTypes.TransactionScope)]
|
||||
public static void Remove(SqlConnection cn, int formatID)
|
||||
{
|
||||
if(_MyLog.IsDebugEnabled)_MyLog.DebugFormat("[{0}] Format.Remove", 0);
|
||||
if (_MyLog.IsDebugEnabled) _MyLog.DebugFormat("[{0}] Format.Remove", 0);
|
||||
try
|
||||
{
|
||||
using (SqlCommand cm = cn.CreateCommand())
|
||||
@@ -1223,7 +1243,7 @@ namespace VEPROMS.CSLA.Library
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
if(_MyLog.IsErrorEnabled)_MyLog.Error("Format.Remove", ex);
|
||||
if (_MyLog.IsErrorEnabled) _MyLog.Error("Format.Remove", ex);
|
||||
throw new DbCslaException("Format.Remove", ex);
|
||||
}
|
||||
}
|
||||
@@ -1257,7 +1277,7 @@ namespace VEPROMS.CSLA.Library
|
||||
}
|
||||
protected override void DataPortal_Execute()
|
||||
{
|
||||
if(_MyLog.IsDebugEnabled)_MyLog.DebugFormat("[{0}] Format.DataPortal_Execute", GetHashCode());
|
||||
if (_MyLog.IsDebugEnabled) _MyLog.DebugFormat("[{0}] Format.DataPortal_Execute", GetHashCode());
|
||||
try
|
||||
{
|
||||
using (SqlConnection cn = Database.VEPROMS_SqlConnection)
|
||||
@@ -1275,7 +1295,7 @@ namespace VEPROMS.CSLA.Library
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
if(_MyLog.IsErrorEnabled)_MyLog.Error("Format.DataPortal_Execute", ex);
|
||||
if (_MyLog.IsErrorEnabled) _MyLog.Error("Format.DataPortal_Execute", ex);
|
||||
throw new DbCslaException("Format.DataPortal_Execute", ex);
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user