This commit is contained in:
@@ -47,21 +47,25 @@ namespace VEPROMS.CSLA.Library
|
||||
foreach (DocVersion tmp in _RefreshDocVersions)
|
||||
{
|
||||
DocVersionInfo.Refresh(tmp);
|
||||
if(tmp._MyFolder != null) FolderInfo.Refresh(tmp._MyFolder);
|
||||
if(tmp._MyFormat != null) FormatInfo.Refresh(tmp._MyFormat);
|
||||
if(tmp._MyItem != null) ItemInfo.Refresh(tmp._MyItem);
|
||||
if (tmp._MyFolder != null) FolderInfo.Refresh(tmp._MyFolder);
|
||||
if (tmp._MyFormat != null) FormatInfo.Refresh(tmp._MyFormat);
|
||||
if (tmp._MyItem != null) ItemInfo.Refresh(tmp._MyItem);
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
#region Collection
|
||||
protected static List<DocVersion> _AllList = new List<DocVersion>();
|
||||
private static Dictionary<string, DocVersion> _AllByPrimaryKey = new Dictionary<string, DocVersion>();
|
||||
private static Dictionary<string, List<DocVersion>> _AllByPrimaryKey = new Dictionary<string, List<DocVersion>>();
|
||||
private static void ConvertListToDictionary()
|
||||
{
|
||||
List<DocVersion> remove = new List<DocVersion>();
|
||||
foreach (DocVersion tmp in _AllList)
|
||||
{
|
||||
_AllByPrimaryKey[tmp.VersionID.ToString()]=tmp; // Primary Key
|
||||
if (!_AllByPrimaryKey.ContainsKey(tmp.VersionID.ToString()))
|
||||
{
|
||||
_AllByPrimaryKey[tmp.VersionID.ToString()] = new List<DocVersion>(); // Add new list for PrimaryKey
|
||||
}
|
||||
_AllByPrimaryKey[tmp.VersionID.ToString()].Add(tmp); // Add to Primary Key list
|
||||
remove.Add(tmp);
|
||||
}
|
||||
foreach (DocVersion tmp in remove)
|
||||
@@ -71,7 +75,7 @@ namespace VEPROMS.CSLA.Library
|
||||
{
|
||||
ConvertListToDictionary();
|
||||
string key = versionID.ToString();
|
||||
if (_AllByPrimaryKey.ContainsKey(key)) return _AllByPrimaryKey[key];
|
||||
if (_AllByPrimaryKey.ContainsKey(key)) return _AllByPrimaryKey[key][0];
|
||||
return null;
|
||||
}
|
||||
#endregion
|
||||
@@ -93,7 +97,7 @@ namespace VEPROMS.CSLA.Library
|
||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||
get
|
||||
{
|
||||
CanReadProperty("VersionID",true);
|
||||
CanReadProperty("VersionID", true);
|
||||
return _VersionID;
|
||||
}
|
||||
}
|
||||
@@ -103,7 +107,7 @@ namespace VEPROMS.CSLA.Library
|
||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||
get
|
||||
{
|
||||
CanReadProperty("FolderID",true);
|
||||
CanReadProperty("FolderID", true);
|
||||
if (_MyFolder != null) _FolderID = _MyFolder.FolderID;
|
||||
return _FolderID;
|
||||
}
|
||||
@@ -114,14 +118,14 @@ namespace VEPROMS.CSLA.Library
|
||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||
get
|
||||
{
|
||||
CanReadProperty("MyFolder",true);
|
||||
CanReadProperty("MyFolder", true);
|
||||
if (_MyFolder == null && _FolderID != 0) _MyFolder = Folder.Get(_FolderID);
|
||||
return _MyFolder;
|
||||
}
|
||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||
set
|
||||
{
|
||||
CanWriteProperty("MyFolder",true);
|
||||
CanWriteProperty("MyFolder", true);
|
||||
if (_MyFolder != value)
|
||||
{
|
||||
_MyFolder = value;
|
||||
@@ -138,13 +142,13 @@ namespace VEPROMS.CSLA.Library
|
||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||
get
|
||||
{
|
||||
CanReadProperty("VersionType",true);
|
||||
CanReadProperty("VersionType", true);
|
||||
return _VersionType;
|
||||
}
|
||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||
set
|
||||
{
|
||||
CanWriteProperty("VersionType",true);
|
||||
CanWriteProperty("VersionType", true);
|
||||
if (_VersionType != value)
|
||||
{
|
||||
_VersionType = value;
|
||||
@@ -158,13 +162,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)
|
||||
{
|
||||
@@ -179,13 +183,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)
|
||||
{
|
||||
@@ -200,7 +204,7 @@ namespace VEPROMS.CSLA.Library
|
||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||
get
|
||||
{
|
||||
CanReadProperty("ItemID",true);
|
||||
CanReadProperty("ItemID", true);
|
||||
if (_MyItem != null) _ItemID = _MyItem.ItemID;
|
||||
return _ItemID;
|
||||
}
|
||||
@@ -211,18 +215,18 @@ namespace VEPROMS.CSLA.Library
|
||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||
get
|
||||
{
|
||||
CanReadProperty("MyItem",true);
|
||||
CanReadProperty("MyItem", true);
|
||||
if (_MyItem == null && _ItemID != null) _MyItem = Item.Get((int)_ItemID);
|
||||
return _MyItem;
|
||||
}
|
||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||
set
|
||||
{
|
||||
CanWriteProperty("MyItem",true);
|
||||
CanWriteProperty("MyItem", true);
|
||||
if (_MyItem != value)
|
||||
{
|
||||
_MyItem = value;
|
||||
_ItemID = (value == null ? null : (int?) value.ItemID);
|
||||
_ItemID = (value == null ? null : (int?)value.ItemID);
|
||||
PropertyHasChanged();
|
||||
}
|
||||
}
|
||||
@@ -233,7 +237,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;
|
||||
}
|
||||
@@ -244,18 +248,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();
|
||||
}
|
||||
}
|
||||
@@ -266,13 +270,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)
|
||||
{
|
||||
@@ -287,13 +291,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;
|
||||
@@ -307,13 +311,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)
|
||||
{
|
||||
@@ -325,11 +329,11 @@ namespace VEPROMS.CSLA.Library
|
||||
private byte[] _LastChanged = new byte[8];//timestamp
|
||||
public override bool IsDirty
|
||||
{
|
||||
get { return base.IsDirty || (_MyFolder == null? false : _MyFolder.IsDirty) || (_MyFormat == null? false : _MyFormat.IsDirty) || (_MyItem == null? false : _MyItem.IsDirty); }
|
||||
get { return base.IsDirty || (_MyFolder == null ? false : _MyFolder.IsDirty) || (_MyFormat == null ? false : _MyFormat.IsDirty) || (_MyItem == null ? false : _MyItem.IsDirty); }
|
||||
}
|
||||
public override bool IsValid
|
||||
{
|
||||
get { return (IsNew && !IsDirty ? true : base.IsValid) && (_MyFolder == null? true : _MyFolder.IsValid) && (_MyFormat == null? true : _MyFormat.IsValid) && (_MyItem == null? true : _MyItem.IsValid); }
|
||||
get { return (IsNew && !IsDirty ? true : base.IsValid) && (_MyFolder == null ? true : _MyFolder.IsValid) && (_MyFormat == null ? true : _MyFormat.IsValid) && (_MyItem == null ? true : _MyItem.IsValid); }
|
||||
}
|
||||
// TODO: Replace base DocVersion.ToString function as necessary
|
||||
/// <summary>
|
||||
@@ -352,24 +356,25 @@ 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 (_MyFolder != null && (hasBrokenRules = _MyFolder.HasBrokenRules) != null) return hasBrokenRules;
|
||||
if (_MyItem != null && (hasBrokenRules = _MyItem.HasBrokenRules) != null) return hasBrokenRules;
|
||||
if (_MyFormat != null && (hasBrokenRules = _MyFormat.HasBrokenRules) != null) return hasBrokenRules;
|
||||
if (_MyFolder != null && (hasBrokenRules = _MyFolder.HasBrokenRules) != null) return hasBrokenRules;
|
||||
if (_MyItem != null && (hasBrokenRules = _MyItem.HasBrokenRules) != null) return hasBrokenRules;
|
||||
if (_MyFormat != null && (hasBrokenRules = _MyFormat.HasBrokenRules) != null) return hasBrokenRules;
|
||||
return hasBrokenRules;
|
||||
}
|
||||
finally
|
||||
{
|
||||
_CheckingBrokenRules=false;
|
||||
_CheckingBrokenRules = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -491,14 +496,25 @@ namespace VEPROMS.CSLA.Library
|
||||
#region Factory Methods
|
||||
public int CurrentEditLevel
|
||||
{ get { return EditLevel; } }
|
||||
private static int _DocVersionUnique = 0;
|
||||
private int _MyDocVersionUnique;
|
||||
public int MyDocVersionUnique
|
||||
{
|
||||
get { return _MyDocVersionUnique; }
|
||||
}
|
||||
protected DocVersion()
|
||||
{/* require use of factory methods */
|
||||
_MyDocVersionUnique = ++_DocVersionUnique;
|
||||
_AllList.Add(this);
|
||||
}
|
||||
public void Dispose()
|
||||
{
|
||||
_AllList.Remove(this);
|
||||
_AllByPrimaryKey.Remove(VersionID.ToString());
|
||||
if (!_AllByPrimaryKey.ContainsKey(VersionID.ToString())) return;
|
||||
List<DocVersion> listDocVersion = _AllByPrimaryKey[VersionID.ToString()]; // Get the list of items
|
||||
listDocVersion.Remove(this); // Remove the item from the list
|
||||
if (listDocVersion.Count == 0) //If there are no items left in the list
|
||||
_AllByPrimaryKey.Remove(VersionID.ToString()); // remove the list
|
||||
}
|
||||
public static DocVersion New()
|
||||
{
|
||||
@@ -587,7 +603,7 @@ namespace VEPROMS.CSLA.Library
|
||||
if (tmp == null)
|
||||
{
|
||||
tmp = DataPortal.Fetch<DocVersion>(new PKCriteria(versionID));
|
||||
_AllList.Add(tmp);
|
||||
if (!_AllList.Contains(tmp)) _AllList.Add(tmp);
|
||||
}
|
||||
if (tmp.ErrorMessage == "No Record Found") tmp = null;
|
||||
return tmp;
|
||||
@@ -667,7 +683,7 @@ namespace VEPROMS.CSLA.Library
|
||||
}
|
||||
private void ReadData(SafeDataReader dr)
|
||||
{
|
||||
if(_MyLog.IsDebugEnabled)_MyLog.DebugFormat("[{0}] DocVersion.ReadData", GetHashCode());
|
||||
if (_MyLog.IsDebugEnabled) _MyLog.DebugFormat("[{0}] DocVersion.ReadData", GetHashCode());
|
||||
try
|
||||
{
|
||||
_VersionID = dr.GetInt32("VersionID");
|
||||
@@ -685,14 +701,14 @@ namespace VEPROMS.CSLA.Library
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
if(_MyLog.IsErrorEnabled)_MyLog.Error("DocVersion.ReadData", ex);
|
||||
if (_MyLog.IsErrorEnabled) _MyLog.Error("DocVersion.ReadData", ex);
|
||||
_ErrorMessage = ex.Message;
|
||||
throw new DbCslaException("DocVersion.ReadData", ex);
|
||||
}
|
||||
}
|
||||
private void DataPortal_Fetch(PKCriteria criteria)
|
||||
{
|
||||
if(_MyLog.IsDebugEnabled)_MyLog.DebugFormat("[{0}] DocVersion.DataPortal_Fetch", GetHashCode());
|
||||
if (_MyLog.IsDebugEnabled) _MyLog.DebugFormat("[{0}] DocVersion.DataPortal_Fetch", GetHashCode());
|
||||
try
|
||||
{
|
||||
using (SqlConnection cn = Database.VEPROMS_SqlConnection)
|
||||
@@ -720,7 +736,7 @@ namespace VEPROMS.CSLA.Library
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
if(_MyLog.IsErrorEnabled)_MyLog.Error("DocVersion.DataPortal_Fetch", ex);
|
||||
if (_MyLog.IsErrorEnabled) _MyLog.Error("DocVersion.DataPortal_Fetch", ex);
|
||||
_ErrorMessage = ex.Message;
|
||||
throw new DbCslaException("DocVersion.DataPortal_Fetch", ex);
|
||||
}
|
||||
@@ -741,13 +757,13 @@ namespace VEPROMS.CSLA.Library
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
if(_MyLog.IsErrorEnabled)_MyLog.Error("DocVersion.DataPortal_Insert", ex);
|
||||
if (_MyLog.IsErrorEnabled) _MyLog.Error("DocVersion.DataPortal_Insert", ex);
|
||||
_ErrorMessage = ex.Message;
|
||||
throw new DbCslaException("DocVersion.DataPortal_Insert", ex);
|
||||
}
|
||||
finally
|
||||
{
|
||||
if(_MyLog.IsDebugEnabled)_MyLog.DebugFormat("[{0}] DocVersion.DataPortal_Insert", GetHashCode());
|
||||
if (_MyLog.IsDebugEnabled) _MyLog.DebugFormat("[{0}] DocVersion.DataPortal_Insert", GetHashCode());
|
||||
}
|
||||
}
|
||||
[Transactional(TransactionalTypes.TransactionScope)]
|
||||
@@ -756,9 +772,9 @@ namespace VEPROMS.CSLA.Library
|
||||
if (!this.IsDirty) return;
|
||||
try
|
||||
{
|
||||
if(_MyFolder != null) _MyFolder.Update();
|
||||
if(_MyFormat != null) _MyFormat.Update();
|
||||
if(_MyItem != null) _MyItem.Update();
|
||||
if (_MyFolder != null) _MyFolder.Update();
|
||||
if (_MyFormat != null) _MyFormat.Update();
|
||||
if (_MyItem != null) _MyItem.Update();
|
||||
SqlConnection cn = (SqlConnection)ApplicationContext.LocalContext["cn"];
|
||||
using (SqlCommand cm = cn.CreateCommand())
|
||||
{
|
||||
@@ -789,11 +805,11 @@ namespace VEPROMS.CSLA.Library
|
||||
}
|
||||
MarkOld();
|
||||
// update child objects
|
||||
if(_MyLog.IsDebugEnabled)_MyLog.DebugFormat("[{0}] DocVersion.SQLInsert", GetHashCode());
|
||||
if (_MyLog.IsDebugEnabled) _MyLog.DebugFormat("[{0}] DocVersion.SQLInsert", GetHashCode());
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
if(_MyLog.IsErrorEnabled)_MyLog.Error("DocVersion.SQLInsert", ex);
|
||||
if (_MyLog.IsErrorEnabled) _MyLog.Error("DocVersion.SQLInsert", ex);
|
||||
_ErrorMessage = ex.Message;
|
||||
throw new DbCslaException("DocVersion.SQLInsert", ex);
|
||||
}
|
||||
@@ -801,7 +817,7 @@ namespace VEPROMS.CSLA.Library
|
||||
[Transactional(TransactionalTypes.TransactionScope)]
|
||||
public static byte[] Add(SqlConnection cn, ref int versionID, Folder myFolder, int versionType, string name, string title, Item myItem, Format myFormat, string config, DateTime dts, string userID)
|
||||
{
|
||||
if(_MyLog.IsDebugEnabled)_MyLog.DebugFormat("[{0}] DocVersion.Add", 0);
|
||||
if (_MyLog.IsDebugEnabled) _MyLog.DebugFormat("[{0}] DocVersion.Add", 0);
|
||||
try
|
||||
{
|
||||
using (SqlCommand cm = cn.CreateCommand())
|
||||
@@ -813,8 +829,8 @@ namespace VEPROMS.CSLA.Library
|
||||
cm.Parameters.AddWithValue("@VersionType", versionType);
|
||||
cm.Parameters.AddWithValue("@Name", name);
|
||||
cm.Parameters.AddWithValue("@Title", title);
|
||||
if(myItem != null)cm.Parameters.AddWithValue("@ItemID", myItem.ItemID);
|
||||
if(myFormat != null)cm.Parameters.AddWithValue("@FormatID", myFormat.FormatID);
|
||||
if (myItem != null) cm.Parameters.AddWithValue("@ItemID", myItem.ItemID);
|
||||
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("@UserID", userID);
|
||||
@@ -834,7 +850,7 @@ namespace VEPROMS.CSLA.Library
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
if(_MyLog.IsErrorEnabled)_MyLog.Error("DocVersion.Add", ex);
|
||||
if (_MyLog.IsErrorEnabled) _MyLog.Error("DocVersion.Add", ex);
|
||||
throw new DbCslaException("DocVersion.Add", ex);
|
||||
}
|
||||
}
|
||||
@@ -842,7 +858,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}] DocVersion.DataPortal_Update", GetHashCode());
|
||||
if (_MyLog.IsDebugEnabled) _MyLog.DebugFormat("[{0}] DocVersion.DataPortal_Update", GetHashCode());
|
||||
try
|
||||
{
|
||||
using (SqlConnection cn = Database.VEPROMS_SqlConnection)
|
||||
@@ -856,7 +872,7 @@ namespace VEPROMS.CSLA.Library
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
if(_MyLog.IsErrorEnabled)_MyLog.Error("DocVersion.DataPortal_Update", ex);
|
||||
if (_MyLog.IsErrorEnabled) _MyLog.Error("DocVersion.DataPortal_Update", ex);
|
||||
_ErrorMessage = ex.Message;
|
||||
if (!ex.Message.EndsWith("has been edited by another user.")) throw ex;
|
||||
}
|
||||
@@ -865,12 +881,12 @@ namespace VEPROMS.CSLA.Library
|
||||
internal void SQLUpdate()
|
||||
{
|
||||
if (!IsDirty) return; // If not dirty - nothing to do
|
||||
if(_MyLog.IsDebugEnabled)_MyLog.DebugFormat("[{0}] DocVersion.SQLUpdate", GetHashCode());
|
||||
if (_MyLog.IsDebugEnabled) _MyLog.DebugFormat("[{0}] DocVersion.SQLUpdate", GetHashCode());
|
||||
try
|
||||
{
|
||||
if(_MyFolder != null) _MyFolder.Update();
|
||||
if(_MyFormat != null) _MyFormat.Update();
|
||||
if(_MyItem != null) _MyItem.Update();
|
||||
if (_MyFolder != null) _MyFolder.Update();
|
||||
if (_MyFormat != null) _MyFormat.Update();
|
||||
if (_MyItem != null) _MyItem.Update();
|
||||
SqlConnection cn = (SqlConnection)ApplicationContext.LocalContext["cn"];
|
||||
if (base.IsDirty)
|
||||
{
|
||||
@@ -905,7 +921,7 @@ namespace VEPROMS.CSLA.Library
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
if(_MyLog.IsErrorEnabled)_MyLog.Error("DocVersion.SQLUpdate", ex);
|
||||
if (_MyLog.IsErrorEnabled) _MyLog.Error("DocVersion.SQLUpdate", ex);
|
||||
_ErrorMessage = ex.Message;
|
||||
if (!ex.Message.EndsWith("has been edited by another user.")) throw ex;
|
||||
}
|
||||
@@ -926,7 +942,7 @@ namespace VEPROMS.CSLA.Library
|
||||
[Transactional(TransactionalTypes.TransactionScope)]
|
||||
public static byte[] Update(SqlConnection cn, ref int versionID, Folder myFolder, int versionType, string name, string title, Item myItem, Format myFormat, string config, DateTime dts, string userID, ref byte[] lastChanged)
|
||||
{
|
||||
if(_MyLog.IsDebugEnabled)_MyLog.DebugFormat("[{0}] DocVersion.Update", 0);
|
||||
if (_MyLog.IsDebugEnabled) _MyLog.DebugFormat("[{0}] DocVersion.Update", 0);
|
||||
try
|
||||
{
|
||||
using (SqlCommand cm = cn.CreateCommand())
|
||||
@@ -939,8 +955,8 @@ namespace VEPROMS.CSLA.Library
|
||||
cm.Parameters.AddWithValue("@VersionType", versionType);
|
||||
cm.Parameters.AddWithValue("@Name", name);
|
||||
cm.Parameters.AddWithValue("@Title", title);
|
||||
if(myItem != null)cm.Parameters.AddWithValue("@ItemID", myItem.ItemID);
|
||||
if(myFormat != null)cm.Parameters.AddWithValue("@FormatID", myFormat.FormatID);
|
||||
if (myItem != null) cm.Parameters.AddWithValue("@ItemID", myItem.ItemID);
|
||||
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("@UserID", userID);
|
||||
@@ -957,7 +973,7 @@ namespace VEPROMS.CSLA.Library
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
if(_MyLog.IsErrorEnabled)_MyLog.Error("DocVersion.Update", ex);
|
||||
if (_MyLog.IsErrorEnabled) _MyLog.Error("DocVersion.Update", ex);
|
||||
throw new DbCslaException("DocVersion.Update", ex);
|
||||
}
|
||||
}
|
||||
@@ -969,7 +985,7 @@ namespace VEPROMS.CSLA.Library
|
||||
[Transactional(TransactionalTypes.TransactionScope)]
|
||||
private void DataPortal_Delete(PKCriteria criteria)
|
||||
{
|
||||
if(_MyLog.IsDebugEnabled)_MyLog.DebugFormat("[{0}] DocVersion.DataPortal_Delete", GetHashCode());
|
||||
if (_MyLog.IsDebugEnabled) _MyLog.DebugFormat("[{0}] DocVersion.DataPortal_Delete", GetHashCode());
|
||||
try
|
||||
{
|
||||
using (SqlConnection cn = Database.VEPROMS_SqlConnection)
|
||||
@@ -985,7 +1001,7 @@ namespace VEPROMS.CSLA.Library
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
if(_MyLog.IsErrorEnabled)_MyLog.Error("DocVersion.DataPortal_Delete", ex);
|
||||
if (_MyLog.IsErrorEnabled) _MyLog.Error("DocVersion.DataPortal_Delete", ex);
|
||||
_ErrorMessage = ex.Message;
|
||||
throw new DbCslaException("DocVersion.DataPortal_Delete", ex);
|
||||
}
|
||||
@@ -993,7 +1009,7 @@ namespace VEPROMS.CSLA.Library
|
||||
[Transactional(TransactionalTypes.TransactionScope)]
|
||||
public static void Remove(SqlConnection cn, int versionID)
|
||||
{
|
||||
if(_MyLog.IsDebugEnabled)_MyLog.DebugFormat("[{0}] DocVersion.Remove", 0);
|
||||
if (_MyLog.IsDebugEnabled) _MyLog.DebugFormat("[{0}] DocVersion.Remove", 0);
|
||||
try
|
||||
{
|
||||
using (SqlCommand cm = cn.CreateCommand())
|
||||
@@ -1008,7 +1024,7 @@ namespace VEPROMS.CSLA.Library
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
if(_MyLog.IsErrorEnabled)_MyLog.Error("DocVersion.Remove", ex);
|
||||
if (_MyLog.IsErrorEnabled) _MyLog.Error("DocVersion.Remove", ex);
|
||||
throw new DbCslaException("DocVersion.Remove", ex);
|
||||
}
|
||||
}
|
||||
@@ -1042,7 +1058,7 @@ namespace VEPROMS.CSLA.Library
|
||||
}
|
||||
protected override void DataPortal_Execute()
|
||||
{
|
||||
if(_MyLog.IsDebugEnabled)_MyLog.DebugFormat("[{0}] DocVersion.DataPortal_Execute", GetHashCode());
|
||||
if (_MyLog.IsDebugEnabled) _MyLog.DebugFormat("[{0}] DocVersion.DataPortal_Execute", GetHashCode());
|
||||
try
|
||||
{
|
||||
using (SqlConnection cn = Database.VEPROMS_SqlConnection)
|
||||
@@ -1060,7 +1076,7 @@ namespace VEPROMS.CSLA.Library
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
if(_MyLog.IsErrorEnabled)_MyLog.Error("DocVersion.DataPortal_Execute", ex);
|
||||
if (_MyLog.IsErrorEnabled) _MyLog.Error("DocVersion.DataPortal_Execute", ex);
|
||||
throw new DbCslaException("DocVersion.DataPortal_Execute", ex);
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user