This commit is contained in:
parent
9d0b3cd543
commit
cda0291dbd
@ -11,30 +11,13 @@ namespace VEPROMS.CSLA.Library
|
||||
return _SearchText;
|
||||
}
|
||||
}
|
||||
|
||||
public partial class AnnotationType
|
||||
{
|
||||
public override string ToString()
|
||||
{
|
||||
return _Name;
|
||||
}
|
||||
|
||||
|
||||
public static IList<AnnotationType> AllTypes()
|
||||
{
|
||||
List<AnnotationType> tlst = new List<AnnotationType>();
|
||||
foreach (AnnotationType at in _AllByPrimaryKey.Values)
|
||||
{
|
||||
tlst.Add(at);
|
||||
}
|
||||
return tlst;
|
||||
}
|
||||
public static Dictionary<string, AnnotationType> AllByName()
|
||||
{
|
||||
return _AllByName;
|
||||
}
|
||||
}
|
||||
|
||||
public partial class AnnotationTypeInfo
|
||||
{
|
||||
public static List<AnnotationTypeInfo> AllList()
|
||||
@ -42,14 +25,11 @@ namespace VEPROMS.CSLA.Library
|
||||
//return _AllList;
|
||||
return AnnotationTypeInfo._AllList;
|
||||
}
|
||||
|
||||
public override string ToString()
|
||||
{
|
||||
return _Name;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public partial class Annotation
|
||||
{
|
||||
/// <summary>
|
||||
@ -73,7 +53,6 @@ namespace VEPROMS.CSLA.Library
|
||||
//Update();
|
||||
}
|
||||
}
|
||||
|
||||
//public partial class AnnotationTypeAnnotations
|
||||
//{
|
||||
// public static int GetAnnotationID()
|
||||
|
@ -47,20 +47,24 @@ namespace VEPROMS.CSLA.Library
|
||||
foreach (Annotation tmp in _RefreshAnnotations)
|
||||
{
|
||||
AnnotationInfo.Refresh(tmp);
|
||||
if(tmp._MyAnnotationType != null) AnnotationTypeInfo.Refresh(tmp._MyAnnotationType);
|
||||
if(tmp._MyItem != null) ItemInfo.Refresh(tmp._MyItem);
|
||||
if (tmp._MyAnnotationType != null) AnnotationTypeInfo.Refresh(tmp._MyAnnotationType);
|
||||
if (tmp._MyItem != null) ItemInfo.Refresh(tmp._MyItem);
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
#region Collection
|
||||
protected static List<Annotation> _AllList = new List<Annotation>();
|
||||
private static Dictionary<string, Annotation> _AllByPrimaryKey = new Dictionary<string, Annotation>();
|
||||
private static Dictionary<string, List<Annotation>> _AllByPrimaryKey = new Dictionary<string, List<Annotation>>();
|
||||
private static void ConvertListToDictionary()
|
||||
{
|
||||
List<Annotation> remove = new List<Annotation>();
|
||||
foreach (Annotation tmp in _AllList)
|
||||
{
|
||||
_AllByPrimaryKey[tmp.AnnotationID.ToString()]=tmp; // Primary Key
|
||||
if (!_AllByPrimaryKey.ContainsKey(tmp.AnnotationID.ToString()))
|
||||
{
|
||||
_AllByPrimaryKey[tmp.AnnotationID.ToString()] = new List<Annotation>(); // Add new list for PrimaryKey
|
||||
}
|
||||
_AllByPrimaryKey[tmp.AnnotationID.ToString()].Add(tmp); // Add to Primary Key list
|
||||
remove.Add(tmp);
|
||||
}
|
||||
foreach (Annotation tmp in remove)
|
||||
@ -70,7 +74,7 @@ namespace VEPROMS.CSLA.Library
|
||||
{
|
||||
ConvertListToDictionary();
|
||||
string key = annotationID.ToString();
|
||||
if (_AllByPrimaryKey.ContainsKey(key)) return _AllByPrimaryKey[key];
|
||||
if (_AllByPrimaryKey.ContainsKey(key)) return _AllByPrimaryKey[key][0];
|
||||
return null;
|
||||
}
|
||||
#endregion
|
||||
@ -92,7 +96,7 @@ namespace VEPROMS.CSLA.Library
|
||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||
get
|
||||
{
|
||||
CanReadProperty("AnnotationID",true);
|
||||
CanReadProperty("AnnotationID", true);
|
||||
return _AnnotationID;
|
||||
}
|
||||
}
|
||||
@ -102,7 +106,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;
|
||||
}
|
||||
@ -113,14 +117,14 @@ namespace VEPROMS.CSLA.Library
|
||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||
get
|
||||
{
|
||||
CanReadProperty("MyItem",true);
|
||||
CanReadProperty("MyItem", true);
|
||||
if (_MyItem == null && _ItemID != 0) _MyItem = Item.Get(_ItemID);
|
||||
return _MyItem;
|
||||
}
|
||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||
set
|
||||
{
|
||||
CanWriteProperty("MyItem",true);
|
||||
CanWriteProperty("MyItem", true);
|
||||
if (_MyItem != value)
|
||||
{
|
||||
_MyItem = value;
|
||||
@ -134,7 +138,7 @@ namespace VEPROMS.CSLA.Library
|
||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||
get
|
||||
{
|
||||
CanReadProperty("TypeID",true);
|
||||
CanReadProperty("TypeID", true);
|
||||
if (_MyAnnotationType != null) _TypeID = _MyAnnotationType.TypeID;
|
||||
return _TypeID;
|
||||
}
|
||||
@ -145,14 +149,14 @@ namespace VEPROMS.CSLA.Library
|
||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||
get
|
||||
{
|
||||
CanReadProperty("MyAnnotationType",true);
|
||||
CanReadProperty("MyAnnotationType", true);
|
||||
if (_MyAnnotationType == null && _TypeID != 0) _MyAnnotationType = AnnotationType.Get(_TypeID);
|
||||
return _MyAnnotationType;
|
||||
}
|
||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||
set
|
||||
{
|
||||
CanWriteProperty("MyAnnotationType",true);
|
||||
CanWriteProperty("MyAnnotationType", true);
|
||||
if (_MyAnnotationType != value)
|
||||
{
|
||||
_MyAnnotationType = value;
|
||||
@ -166,13 +170,13 @@ namespace VEPROMS.CSLA.Library
|
||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||
get
|
||||
{
|
||||
CanReadProperty("RtfText",true);
|
||||
CanReadProperty("RtfText", true);
|
||||
return _RtfText;
|
||||
}
|
||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||
set
|
||||
{
|
||||
CanWriteProperty("RtfText",true);
|
||||
CanWriteProperty("RtfText", true);
|
||||
if (value == null) value = string.Empty;
|
||||
if (_RtfText != value)
|
||||
{
|
||||
@ -187,13 +191,13 @@ namespace VEPROMS.CSLA.Library
|
||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||
get
|
||||
{
|
||||
CanReadProperty("SearchText",true);
|
||||
CanReadProperty("SearchText", true);
|
||||
return _SearchText;
|
||||
}
|
||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||
set
|
||||
{
|
||||
CanWriteProperty("SearchText",true);
|
||||
CanWriteProperty("SearchText", true);
|
||||
if (value == null) value = string.Empty;
|
||||
if (_SearchText != value)
|
||||
{
|
||||
@ -208,13 +212,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)
|
||||
{
|
||||
@ -229,13 +233,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;
|
||||
@ -249,13 +253,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)
|
||||
{
|
||||
@ -267,11 +271,11 @@ namespace VEPROMS.CSLA.Library
|
||||
private byte[] _LastChanged = new byte[8];//timestamp
|
||||
public override bool IsDirty
|
||||
{
|
||||
get { return base.IsDirty || (_MyAnnotationType == null? false : _MyAnnotationType.IsDirty) || (_MyItem == null? false : _MyItem.IsDirty); }
|
||||
get { return base.IsDirty || (_MyAnnotationType == null ? false : _MyAnnotationType.IsDirty) || (_MyItem == null ? false : _MyItem.IsDirty); }
|
||||
}
|
||||
public override bool IsValid
|
||||
{
|
||||
get { return (IsNew && !IsDirty ? true : base.IsValid) && (_MyAnnotationType == null? true : _MyAnnotationType.IsValid) && (_MyItem == null? true : _MyItem.IsValid); }
|
||||
get { return (IsNew && !IsDirty ? true : base.IsValid) && (_MyAnnotationType == null ? true : _MyAnnotationType.IsValid) && (_MyItem == null ? true : _MyItem.IsValid); }
|
||||
}
|
||||
// TODO: Replace base Annotation.ToString function as necessary
|
||||
/// <summary>
|
||||
@ -294,15 +298,16 @@ 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 (_MyItem != null && (hasBrokenRules = _MyItem.HasBrokenRules) != null) return hasBrokenRules;
|
||||
if (_MyAnnotationType != null && (hasBrokenRules = _MyAnnotationType.HasBrokenRules) != null) return hasBrokenRules;
|
||||
@ -310,7 +315,7 @@ namespace VEPROMS.CSLA.Library
|
||||
}
|
||||
finally
|
||||
{
|
||||
_CheckingBrokenRules=false;
|
||||
_CheckingBrokenRules = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -436,14 +441,25 @@ namespace VEPROMS.CSLA.Library
|
||||
#region Factory Methods
|
||||
public int CurrentEditLevel
|
||||
{ get { return EditLevel; } }
|
||||
private static int _AnnotationUnique = 0;
|
||||
private int _MyAnnotationUnique;
|
||||
public int MyAnnotationUnique
|
||||
{
|
||||
get { return _MyAnnotationUnique; }
|
||||
}
|
||||
protected Annotation()
|
||||
{/* require use of factory methods */
|
||||
_MyAnnotationUnique = ++_AnnotationUnique;
|
||||
_AllList.Add(this);
|
||||
}
|
||||
public void Dispose()
|
||||
{
|
||||
_AllList.Remove(this);
|
||||
_AllByPrimaryKey.Remove(AnnotationID.ToString());
|
||||
if (!_AllByPrimaryKey.ContainsKey(AnnotationID.ToString())) return;
|
||||
List<Annotation> listAnnotation = _AllByPrimaryKey[AnnotationID.ToString()]; // Get the list of items
|
||||
listAnnotation.Remove(this); // Remove the item from the list
|
||||
if (listAnnotation.Count == 0) //If there are no items left in the list
|
||||
_AllByPrimaryKey.Remove(AnnotationID.ToString()); // remove the list
|
||||
}
|
||||
public static Annotation New()
|
||||
{
|
||||
@ -529,7 +545,7 @@ namespace VEPROMS.CSLA.Library
|
||||
if (tmp == null)
|
||||
{
|
||||
tmp = DataPortal.Fetch<Annotation>(new PKCriteria(annotationID));
|
||||
_AllList.Add(tmp);
|
||||
if (!_AllList.Contains(tmp)) _AllList.Add(tmp);
|
||||
}
|
||||
if (tmp.ErrorMessage == "No Record Found") tmp = null;
|
||||
return tmp;
|
||||
@ -608,7 +624,7 @@ namespace VEPROMS.CSLA.Library
|
||||
}
|
||||
private void ReadData(SafeDataReader dr)
|
||||
{
|
||||
if(_MyLog.IsDebugEnabled)_MyLog.DebugFormat("[{0}] Annotation.ReadData", GetHashCode());
|
||||
if (_MyLog.IsDebugEnabled) _MyLog.DebugFormat("[{0}] Annotation.ReadData", GetHashCode());
|
||||
try
|
||||
{
|
||||
_AnnotationID = dr.GetInt32("AnnotationID");
|
||||
@ -624,14 +640,14 @@ namespace VEPROMS.CSLA.Library
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
if(_MyLog.IsErrorEnabled)_MyLog.Error("Annotation.ReadData", ex);
|
||||
if (_MyLog.IsErrorEnabled) _MyLog.Error("Annotation.ReadData", ex);
|
||||
_ErrorMessage = ex.Message;
|
||||
throw new DbCslaException("Annotation.ReadData", ex);
|
||||
}
|
||||
}
|
||||
private void DataPortal_Fetch(PKCriteria criteria)
|
||||
{
|
||||
if(_MyLog.IsDebugEnabled)_MyLog.DebugFormat("[{0}] Annotation.DataPortal_Fetch", GetHashCode());
|
||||
if (_MyLog.IsDebugEnabled) _MyLog.DebugFormat("[{0}] Annotation.DataPortal_Fetch", GetHashCode());
|
||||
try
|
||||
{
|
||||
using (SqlConnection cn = Database.VEPROMS_SqlConnection)
|
||||
@ -659,7 +675,7 @@ namespace VEPROMS.CSLA.Library
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
if(_MyLog.IsErrorEnabled)_MyLog.Error("Annotation.DataPortal_Fetch", ex);
|
||||
if (_MyLog.IsErrorEnabled) _MyLog.Error("Annotation.DataPortal_Fetch", ex);
|
||||
_ErrorMessage = ex.Message;
|
||||
throw new DbCslaException("Annotation.DataPortal_Fetch", ex);
|
||||
}
|
||||
@ -680,13 +696,13 @@ namespace VEPROMS.CSLA.Library
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
if(_MyLog.IsErrorEnabled)_MyLog.Error("Annotation.DataPortal_Insert", ex);
|
||||
if (_MyLog.IsErrorEnabled) _MyLog.Error("Annotation.DataPortal_Insert", ex);
|
||||
_ErrorMessage = ex.Message;
|
||||
throw new DbCslaException("Annotation.DataPortal_Insert", ex);
|
||||
}
|
||||
finally
|
||||
{
|
||||
if(_MyLog.IsDebugEnabled)_MyLog.DebugFormat("[{0}] Annotation.DataPortal_Insert", GetHashCode());
|
||||
if (_MyLog.IsDebugEnabled) _MyLog.DebugFormat("[{0}] Annotation.DataPortal_Insert", GetHashCode());
|
||||
}
|
||||
}
|
||||
[Transactional(TransactionalTypes.TransactionScope)]
|
||||
@ -695,8 +711,8 @@ namespace VEPROMS.CSLA.Library
|
||||
if (!this.IsDirty) return;
|
||||
try
|
||||
{
|
||||
if(_MyAnnotationType != null) _MyAnnotationType.Update();
|
||||
if(_MyItem != null) _MyItem.Update();
|
||||
if (_MyAnnotationType != null) _MyAnnotationType.Update();
|
||||
if (_MyItem != null) _MyItem.Update();
|
||||
SqlConnection cn = (SqlConnection)ApplicationContext.LocalContext["cn"];
|
||||
using (SqlCommand cm = cn.CreateCommand())
|
||||
{
|
||||
@ -725,11 +741,11 @@ namespace VEPROMS.CSLA.Library
|
||||
}
|
||||
MarkOld();
|
||||
// update child objects
|
||||
if(_MyLog.IsDebugEnabled)_MyLog.DebugFormat("[{0}] Annotation.SQLInsert", GetHashCode());
|
||||
if (_MyLog.IsDebugEnabled) _MyLog.DebugFormat("[{0}] Annotation.SQLInsert", GetHashCode());
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
if(_MyLog.IsErrorEnabled)_MyLog.Error("Annotation.SQLInsert", ex);
|
||||
if (_MyLog.IsErrorEnabled) _MyLog.Error("Annotation.SQLInsert", ex);
|
||||
_ErrorMessage = ex.Message;
|
||||
throw new DbCslaException("Annotation.SQLInsert", ex);
|
||||
}
|
||||
@ -737,7 +753,7 @@ namespace VEPROMS.CSLA.Library
|
||||
[Transactional(TransactionalTypes.TransactionScope)]
|
||||
public static byte[] Add(SqlConnection cn, ref int annotationID, Item myItem, AnnotationType myAnnotationType, string rtfText, string searchText, string config, DateTime dts, string userID)
|
||||
{
|
||||
if(_MyLog.IsDebugEnabled)_MyLog.DebugFormat("[{0}] Annotation.Add", 0);
|
||||
if (_MyLog.IsDebugEnabled) _MyLog.DebugFormat("[{0}] Annotation.Add", 0);
|
||||
try
|
||||
{
|
||||
using (SqlCommand cm = cn.CreateCommand())
|
||||
@ -768,7 +784,7 @@ namespace VEPROMS.CSLA.Library
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
if(_MyLog.IsErrorEnabled)_MyLog.Error("Annotation.Add", ex);
|
||||
if (_MyLog.IsErrorEnabled) _MyLog.Error("Annotation.Add", ex);
|
||||
throw new DbCslaException("Annotation.Add", ex);
|
||||
}
|
||||
}
|
||||
@ -776,7 +792,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}] Annotation.DataPortal_Update", GetHashCode());
|
||||
if (_MyLog.IsDebugEnabled) _MyLog.DebugFormat("[{0}] Annotation.DataPortal_Update", GetHashCode());
|
||||
try
|
||||
{
|
||||
using (SqlConnection cn = Database.VEPROMS_SqlConnection)
|
||||
@ -790,7 +806,7 @@ namespace VEPROMS.CSLA.Library
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
if(_MyLog.IsErrorEnabled)_MyLog.Error("Annotation.DataPortal_Update", ex);
|
||||
if (_MyLog.IsErrorEnabled) _MyLog.Error("Annotation.DataPortal_Update", ex);
|
||||
_ErrorMessage = ex.Message;
|
||||
if (!ex.Message.EndsWith("has been edited by another user.")) throw ex;
|
||||
}
|
||||
@ -799,11 +815,11 @@ namespace VEPROMS.CSLA.Library
|
||||
internal void SQLUpdate()
|
||||
{
|
||||
if (!IsDirty) return; // If not dirty - nothing to do
|
||||
if(_MyLog.IsDebugEnabled)_MyLog.DebugFormat("[{0}] Annotation.SQLUpdate", GetHashCode());
|
||||
if (_MyLog.IsDebugEnabled) _MyLog.DebugFormat("[{0}] Annotation.SQLUpdate", GetHashCode());
|
||||
try
|
||||
{
|
||||
if(_MyAnnotationType != null) _MyAnnotationType.Update();
|
||||
if(_MyItem != null) _MyItem.Update();
|
||||
if (_MyAnnotationType != null) _MyAnnotationType.Update();
|
||||
if (_MyItem != null) _MyItem.Update();
|
||||
SqlConnection cn = (SqlConnection)ApplicationContext.LocalContext["cn"];
|
||||
if (base.IsDirty)
|
||||
{
|
||||
@ -836,7 +852,7 @@ namespace VEPROMS.CSLA.Library
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
if(_MyLog.IsErrorEnabled)_MyLog.Error("Annotation.SQLUpdate", ex);
|
||||
if (_MyLog.IsErrorEnabled) _MyLog.Error("Annotation.SQLUpdate", ex);
|
||||
_ErrorMessage = ex.Message;
|
||||
if (!ex.Message.EndsWith("has been edited by another user.")) throw ex;
|
||||
}
|
||||
@ -857,7 +873,7 @@ namespace VEPROMS.CSLA.Library
|
||||
[Transactional(TransactionalTypes.TransactionScope)]
|
||||
public static byte[] Update(SqlConnection cn, ref int annotationID, Item myItem, AnnotationType myAnnotationType, string rtfText, string searchText, string config, DateTime dts, string userID, ref byte[] lastChanged)
|
||||
{
|
||||
if(_MyLog.IsDebugEnabled)_MyLog.DebugFormat("[{0}] Annotation.Update", 0);
|
||||
if (_MyLog.IsDebugEnabled) _MyLog.DebugFormat("[{0}] Annotation.Update", 0);
|
||||
try
|
||||
{
|
||||
using (SqlCommand cm = cn.CreateCommand())
|
||||
@ -886,7 +902,7 @@ namespace VEPROMS.CSLA.Library
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
if(_MyLog.IsErrorEnabled)_MyLog.Error("Annotation.Update", ex);
|
||||
if (_MyLog.IsErrorEnabled) _MyLog.Error("Annotation.Update", ex);
|
||||
throw new DbCslaException("Annotation.Update", ex);
|
||||
}
|
||||
}
|
||||
@ -898,7 +914,7 @@ namespace VEPROMS.CSLA.Library
|
||||
[Transactional(TransactionalTypes.TransactionScope)]
|
||||
private void DataPortal_Delete(PKCriteria criteria)
|
||||
{
|
||||
if(_MyLog.IsDebugEnabled)_MyLog.DebugFormat("[{0}] Annotation.DataPortal_Delete", GetHashCode());
|
||||
if (_MyLog.IsDebugEnabled) _MyLog.DebugFormat("[{0}] Annotation.DataPortal_Delete", GetHashCode());
|
||||
try
|
||||
{
|
||||
using (SqlConnection cn = Database.VEPROMS_SqlConnection)
|
||||
@ -914,7 +930,7 @@ namespace VEPROMS.CSLA.Library
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
if(_MyLog.IsErrorEnabled)_MyLog.Error("Annotation.DataPortal_Delete", ex);
|
||||
if (_MyLog.IsErrorEnabled) _MyLog.Error("Annotation.DataPortal_Delete", ex);
|
||||
_ErrorMessage = ex.Message;
|
||||
throw new DbCslaException("Annotation.DataPortal_Delete", ex);
|
||||
}
|
||||
@ -922,7 +938,7 @@ namespace VEPROMS.CSLA.Library
|
||||
[Transactional(TransactionalTypes.TransactionScope)]
|
||||
public static void Remove(SqlConnection cn, int annotationID)
|
||||
{
|
||||
if(_MyLog.IsDebugEnabled)_MyLog.DebugFormat("[{0}] Annotation.Remove", 0);
|
||||
if (_MyLog.IsDebugEnabled) _MyLog.DebugFormat("[{0}] Annotation.Remove", 0);
|
||||
try
|
||||
{
|
||||
using (SqlCommand cm = cn.CreateCommand())
|
||||
@ -937,7 +953,7 @@ namespace VEPROMS.CSLA.Library
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
if(_MyLog.IsErrorEnabled)_MyLog.Error("Annotation.Remove", ex);
|
||||
if (_MyLog.IsErrorEnabled) _MyLog.Error("Annotation.Remove", ex);
|
||||
throw new DbCslaException("Annotation.Remove", ex);
|
||||
}
|
||||
}
|
||||
@ -971,7 +987,7 @@ namespace VEPROMS.CSLA.Library
|
||||
}
|
||||
protected override void DataPortal_Execute()
|
||||
{
|
||||
if(_MyLog.IsDebugEnabled)_MyLog.DebugFormat("[{0}] Annotation.DataPortal_Execute", GetHashCode());
|
||||
if (_MyLog.IsDebugEnabled) _MyLog.DebugFormat("[{0}] Annotation.DataPortal_Execute", GetHashCode());
|
||||
try
|
||||
{
|
||||
using (SqlConnection cn = Database.VEPROMS_SqlConnection)
|
||||
@ -989,7 +1005,7 @@ namespace VEPROMS.CSLA.Library
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
if(_MyLog.IsErrorEnabled)_MyLog.Error("Annotation.DataPortal_Execute", ex);
|
||||
if (_MyLog.IsErrorEnabled) _MyLog.Error("Annotation.DataPortal_Execute", ex);
|
||||
throw new DbCslaException("Annotation.DataPortal_Execute", ex);
|
||||
}
|
||||
}
|
||||
|
@ -37,13 +37,17 @@ namespace VEPROMS.CSLA.Library
|
||||
#endregion
|
||||
#region Collection
|
||||
protected static List<AnnotationInfo> _AllList = new List<AnnotationInfo>();
|
||||
private static Dictionary<string, AnnotationInfo> _AllByPrimaryKey = new Dictionary<string, AnnotationInfo>();
|
||||
private static Dictionary<string, List<AnnotationInfo>> _AllByPrimaryKey = new Dictionary<string, List<AnnotationInfo>>();
|
||||
private static void ConvertListToDictionary()
|
||||
{
|
||||
List<AnnotationInfo> remove = new List<AnnotationInfo>();
|
||||
foreach (AnnotationInfo tmp in _AllList)
|
||||
{
|
||||
_AllByPrimaryKey[tmp.AnnotationID.ToString()]=tmp; // Primary Key
|
||||
if (!_AllByPrimaryKey.ContainsKey(tmp.AnnotationID.ToString()))
|
||||
{
|
||||
_AllByPrimaryKey[tmp.AnnotationID.ToString()] = new List<AnnotationInfo>(); // Add new list for PrimaryKey
|
||||
}
|
||||
_AllByPrimaryKey[tmp.AnnotationID.ToString()].Add(tmp); // Add to Primary Key list
|
||||
remove.Add(tmp);
|
||||
}
|
||||
foreach (AnnotationInfo tmp in remove)
|
||||
@ -57,7 +61,7 @@ namespace VEPROMS.CSLA.Library
|
||||
{
|
||||
ConvertListToDictionary();
|
||||
string key = annotationID.ToString();
|
||||
if (_AllByPrimaryKey.ContainsKey(key)) return _AllByPrimaryKey[key];
|
||||
if (_AllByPrimaryKey.ContainsKey(key)) return _AllByPrimaryKey[key][0];
|
||||
return null;
|
||||
}
|
||||
#endregion
|
||||
@ -85,7 +89,7 @@ namespace VEPROMS.CSLA.Library
|
||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||
get
|
||||
{
|
||||
CanReadProperty("AnnotationID",true);
|
||||
CanReadProperty("AnnotationID", true);
|
||||
return _AnnotationID;
|
||||
}
|
||||
}
|
||||
@ -95,7 +99,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;
|
||||
}
|
||||
@ -106,7 +110,7 @@ namespace VEPROMS.CSLA.Library
|
||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||
get
|
||||
{
|
||||
CanReadProperty("MyItem",true);
|
||||
CanReadProperty("MyItem", true);
|
||||
if (_MyItem == null && _ItemID != 0) _MyItem = ItemInfo.Get(_ItemID);
|
||||
return _MyItem;
|
||||
}
|
||||
@ -117,7 +121,7 @@ namespace VEPROMS.CSLA.Library
|
||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||
get
|
||||
{
|
||||
CanReadProperty("TypeID",true);
|
||||
CanReadProperty("TypeID", true);
|
||||
if (_MyAnnotationType != null) _TypeID = _MyAnnotationType.TypeID;
|
||||
return _TypeID;
|
||||
}
|
||||
@ -128,7 +132,7 @@ namespace VEPROMS.CSLA.Library
|
||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||
get
|
||||
{
|
||||
CanReadProperty("MyAnnotationType",true);
|
||||
CanReadProperty("MyAnnotationType", true);
|
||||
if (_MyAnnotationType == null && _TypeID != 0) _MyAnnotationType = AnnotationTypeInfo.Get(_TypeID);
|
||||
return _MyAnnotationType;
|
||||
}
|
||||
@ -139,7 +143,7 @@ namespace VEPROMS.CSLA.Library
|
||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||
get
|
||||
{
|
||||
CanReadProperty("RtfText",true);
|
||||
CanReadProperty("RtfText", true);
|
||||
return _RtfText;
|
||||
}
|
||||
}
|
||||
@ -149,7 +153,7 @@ namespace VEPROMS.CSLA.Library
|
||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||
get
|
||||
{
|
||||
CanReadProperty("SearchText",true);
|
||||
CanReadProperty("SearchText", true);
|
||||
return _SearchText;
|
||||
}
|
||||
}
|
||||
@ -159,7 +163,7 @@ namespace VEPROMS.CSLA.Library
|
||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||
get
|
||||
{
|
||||
CanReadProperty("Config",true);
|
||||
CanReadProperty("Config", true);
|
||||
return _Config;
|
||||
}
|
||||
}
|
||||
@ -169,7 +173,7 @@ namespace VEPROMS.CSLA.Library
|
||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||
get
|
||||
{
|
||||
CanReadProperty("DTS",true);
|
||||
CanReadProperty("DTS", true);
|
||||
return _DTS;
|
||||
}
|
||||
}
|
||||
@ -179,7 +183,7 @@ namespace VEPROMS.CSLA.Library
|
||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||
get
|
||||
{
|
||||
CanReadProperty("UserID",true);
|
||||
CanReadProperty("UserID", true);
|
||||
return _UserID;
|
||||
}
|
||||
}
|
||||
@ -203,14 +207,25 @@ namespace VEPROMS.CSLA.Library
|
||||
}
|
||||
#endregion
|
||||
#region Factory Methods
|
||||
private static int _AnnotationInfoUnique = 0;
|
||||
private int _MyAnnotationInfoUnique;
|
||||
public int MyAnnotationInfoUnique
|
||||
{
|
||||
get { return _MyAnnotationInfoUnique; }
|
||||
}
|
||||
private AnnotationInfo()
|
||||
{/* require use of factory methods */
|
||||
_MyAnnotationInfoUnique = ++_AnnotationInfoUnique;
|
||||
_AllList.Add(this);
|
||||
}
|
||||
public void Dispose()
|
||||
{
|
||||
_AllList.Remove(this);
|
||||
_AllByPrimaryKey.Remove(AnnotationID.ToString());
|
||||
if (!_AllByPrimaryKey.ContainsKey(AnnotationID.ToString())) return;
|
||||
List<AnnotationInfo> listAnnotationInfo = _AllByPrimaryKey[AnnotationID.ToString()]; // Get the list of items
|
||||
listAnnotationInfo.Remove(this); // Remove the item from the list
|
||||
if (listAnnotationInfo.Count == 0) // If there are no items left in the list
|
||||
_AllByPrimaryKey.Remove(AnnotationID.ToString()); // remove the list
|
||||
}
|
||||
public virtual Annotation Get()
|
||||
{
|
||||
@ -218,8 +233,10 @@ namespace VEPROMS.CSLA.Library
|
||||
}
|
||||
public static void Refresh(Annotation tmp)
|
||||
{
|
||||
AnnotationInfo tmpInfo = GetExistingByPrimaryKey(tmp.AnnotationID);
|
||||
if (tmpInfo == null) return;
|
||||
string key = tmp.AnnotationID.ToString();
|
||||
ConvertListToDictionary();
|
||||
if (_AllByPrimaryKey.ContainsKey(key))
|
||||
foreach (AnnotationInfo tmpInfo in _AllByPrimaryKey[key])
|
||||
tmpInfo.RefreshFields(tmp);
|
||||
}
|
||||
private void RefreshFields(Annotation tmp)
|
||||
@ -228,16 +245,16 @@ namespace VEPROMS.CSLA.Library
|
||||
{
|
||||
MyItem.RefreshItemAnnotations(); // Update List for old value
|
||||
_ItemID = tmp.ItemID; // Update the value
|
||||
_MyItem = null; // Reset list so that the next line gets a new list
|
||||
MyItem.RefreshItemAnnotations(); // Update List for new value
|
||||
}
|
||||
_MyItem = null; // Reset list so that the next line gets a new list
|
||||
if (MyItem != null) MyItem.RefreshItemAnnotations(); // Update List for new value
|
||||
if (_TypeID != tmp.TypeID)
|
||||
{
|
||||
MyAnnotationType.RefreshAnnotationTypeAnnotations(); // Update List for old value
|
||||
_TypeID = tmp.TypeID; // Update the value
|
||||
_MyAnnotationType = null; // Reset list so that the next line gets a new list
|
||||
MyAnnotationType.RefreshAnnotationTypeAnnotations(); // Update List for new value
|
||||
}
|
||||
_MyAnnotationType = null; // Reset list so that the next line gets a new list
|
||||
if (MyAnnotationType != null) MyAnnotationType.RefreshAnnotationTypeAnnotations(); // Update List for new value
|
||||
_RtfText = tmp.RtfText;
|
||||
_SearchText = tmp.SearchText;
|
||||
_Config = tmp.Config;
|
||||
@ -250,8 +267,10 @@ namespace VEPROMS.CSLA.Library
|
||||
}
|
||||
public static void Refresh(AnnotationTypeAnnotation tmp)
|
||||
{
|
||||
AnnotationInfo tmpInfo = GetExistingByPrimaryKey(tmp.AnnotationID);
|
||||
if (tmpInfo == null) return;
|
||||
string key = tmp.AnnotationID.ToString();
|
||||
ConvertListToDictionary();
|
||||
if (_AllByPrimaryKey.ContainsKey(key))
|
||||
foreach (AnnotationInfo tmpInfo in _AllByPrimaryKey[key])
|
||||
tmpInfo.RefreshFields(tmp);
|
||||
}
|
||||
private void RefreshFields(AnnotationTypeAnnotation tmp)
|
||||
@ -260,9 +279,9 @@ namespace VEPROMS.CSLA.Library
|
||||
{
|
||||
MyItem.RefreshItemAnnotations(); // Update List for old value
|
||||
_ItemID = tmp.ItemID; // Update the value
|
||||
_MyItem = null; // Reset list so that the next line gets a new list
|
||||
MyItem.RefreshItemAnnotations(); // Update List for new value
|
||||
}
|
||||
_MyItem = null; // Reset list so that the next line gets a new list
|
||||
if (MyItem != null) MyItem.RefreshItemAnnotations(); // Update List for new value
|
||||
_RtfText = tmp.RtfText;
|
||||
_SearchText = tmp.SearchText;
|
||||
_Config = tmp.Config;
|
||||
@ -275,8 +294,10 @@ namespace VEPROMS.CSLA.Library
|
||||
}
|
||||
public static void Refresh(ItemAnnotation tmp)
|
||||
{
|
||||
AnnotationInfo tmpInfo = GetExistingByPrimaryKey(tmp.AnnotationID);
|
||||
if (tmpInfo == null) return;
|
||||
string key = tmp.AnnotationID.ToString();
|
||||
ConvertListToDictionary();
|
||||
if (_AllByPrimaryKey.ContainsKey(key))
|
||||
foreach (AnnotationInfo tmpInfo in _AllByPrimaryKey[key])
|
||||
tmpInfo.RefreshFields(tmp);
|
||||
}
|
||||
private void RefreshFields(ItemAnnotation tmp)
|
||||
@ -285,9 +306,9 @@ namespace VEPROMS.CSLA.Library
|
||||
{
|
||||
MyAnnotationType.RefreshAnnotationTypeAnnotations(); // Update List for old value
|
||||
_TypeID = tmp.TypeID; // Update the value
|
||||
_MyAnnotationType = null; // Reset list so that the next line gets a new list
|
||||
MyAnnotationType.RefreshAnnotationTypeAnnotations(); // Update List for new value
|
||||
}
|
||||
_MyAnnotationType = null; // Reset list so that the next line gets a new list
|
||||
if (MyAnnotationType != null) MyAnnotationType.RefreshAnnotationTypeAnnotations(); // Update List for new value
|
||||
_RtfText = tmp.RtfText;
|
||||
_SearchText = tmp.SearchText;
|
||||
_Config = tmp.Config;
|
||||
@ -308,7 +329,7 @@ namespace VEPROMS.CSLA.Library
|
||||
if (tmp == null)
|
||||
{
|
||||
tmp = DataPortal.Fetch<AnnotationInfo>(new PKCriteria(annotationID));
|
||||
_AllList.Add(tmp);
|
||||
if (!_AllList.Contains(tmp)) _AllList.Add(tmp);
|
||||
}
|
||||
if (tmp.ErrorMessage == "No Record Found") tmp = null;
|
||||
return tmp;
|
||||
@ -322,14 +343,15 @@ namespace VEPROMS.CSLA.Library
|
||||
#region Data Access Portal
|
||||
internal AnnotationInfo(SafeDataReader dr)
|
||||
{
|
||||
if(_MyLog.IsDebugEnabled)_MyLog.DebugFormat("[{0}] AnnotationInfo.Constructor", GetHashCode());
|
||||
_MyAnnotationInfoUnique = ++_AnnotationInfoUnique;
|
||||
if (_MyLog.IsDebugEnabled) _MyLog.DebugFormat("[{0}] AnnotationInfo.Constructor", GetHashCode());
|
||||
try
|
||||
{
|
||||
ReadData(dr);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
if(_MyLog.IsErrorEnabled)_MyLog.Error("AnnotationInfo.Constructor", ex);
|
||||
if (_MyLog.IsErrorEnabled) _MyLog.Error("AnnotationInfo.Constructor", ex);
|
||||
throw new DbCslaException("AnnotationInfo.Constructor", ex);
|
||||
}
|
||||
}
|
||||
@ -346,7 +368,7 @@ namespace VEPROMS.CSLA.Library
|
||||
}
|
||||
private void ReadData(SafeDataReader dr)
|
||||
{
|
||||
if(_MyLog.IsDebugEnabled)_MyLog.DebugFormat("[{0}] AnnotationInfo.ReadData", GetHashCode());
|
||||
if (_MyLog.IsDebugEnabled) _MyLog.DebugFormat("[{0}] AnnotationInfo.ReadData", GetHashCode());
|
||||
try
|
||||
{
|
||||
_AnnotationID = dr.GetInt32("AnnotationID");
|
||||
@ -360,14 +382,14 @@ namespace VEPROMS.CSLA.Library
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
if(_MyLog.IsErrorEnabled)_MyLog.Error("AnnotationInfo.ReadData", ex);
|
||||
if (_MyLog.IsErrorEnabled) _MyLog.Error("AnnotationInfo.ReadData", ex);
|
||||
_ErrorMessage = ex.Message;
|
||||
throw new DbCslaException("AnnotationInfo.ReadData", ex);
|
||||
}
|
||||
}
|
||||
private void DataPortal_Fetch(PKCriteria criteria)
|
||||
{
|
||||
if(_MyLog.IsDebugEnabled)_MyLog.DebugFormat("[{0}] AnnotationInfo.DataPortal_Fetch", GetHashCode());
|
||||
if (_MyLog.IsDebugEnabled) _MyLog.DebugFormat("[{0}] AnnotationInfo.DataPortal_Fetch", GetHashCode());
|
||||
try
|
||||
{
|
||||
using (SqlConnection cn = Database.VEPROMS_SqlConnection)
|
||||
@ -395,7 +417,7 @@ namespace VEPROMS.CSLA.Library
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
if(_MyLog.IsErrorEnabled)_MyLog.Error("AnnotationInfo.DataPortal_Fetch", ex);
|
||||
if (_MyLog.IsErrorEnabled) _MyLog.Error("AnnotationInfo.DataPortal_Fetch", ex);
|
||||
_ErrorMessage = ex.Message;
|
||||
throw new DbCslaException("AnnotationInfo.DataPortal_Fetch", ex);
|
||||
}
|
||||
@ -405,7 +427,7 @@ namespace VEPROMS.CSLA.Library
|
||||
#region extension
|
||||
AnnotationInfoExtension _AnnotationInfoExtension = new AnnotationInfoExtension();
|
||||
[Serializable()]
|
||||
partial class AnnotationInfoExtension : extensionBase {}
|
||||
partial class AnnotationInfoExtension : extensionBase { }
|
||||
[Serializable()]
|
||||
class extensionBase
|
||||
{
|
||||
|
@ -124,7 +124,7 @@ namespace VEPROMS.CSLA.Library
|
||||
private void DataPortal_Fetch()
|
||||
{
|
||||
this.RaiseListChangedEvents = false;
|
||||
if(_MyLog.IsDebugEnabled)_MyLog.DebugFormat("[{0}] AnnotationInfoList.DataPortal_Fetch", GetHashCode());
|
||||
if (_MyLog.IsDebugEnabled) _MyLog.DebugFormat("[{0}] AnnotationInfoList.DataPortal_Fetch", GetHashCode());
|
||||
try
|
||||
{
|
||||
using (SqlConnection cn = Database.VEPROMS_SqlConnection)
|
||||
@ -144,7 +144,7 @@ namespace VEPROMS.CSLA.Library
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
if(_MyLog.IsErrorEnabled)_MyLog.Error("AnnotationInfoList.DataPortal_Fetch", ex);
|
||||
if (_MyLog.IsErrorEnabled) _MyLog.Error("AnnotationInfoList.DataPortal_Fetch", ex);
|
||||
throw new DbCslaException("AnnotationInfoList.DataPortal_Fetch", ex);
|
||||
}
|
||||
this.RaiseListChangedEvents = true;
|
||||
@ -166,7 +166,7 @@ namespace VEPROMS.CSLA.Library
|
||||
private void DataPortal_Fetch(TypeIDCriteria criteria)
|
||||
{
|
||||
this.RaiseListChangedEvents = false;
|
||||
if(_MyLog.IsDebugEnabled)_MyLog.DebugFormat("[{0}] AnnotationInfoList.DataPortal_FetchTypeID", GetHashCode());
|
||||
if (_MyLog.IsDebugEnabled) _MyLog.DebugFormat("[{0}] AnnotationInfoList.DataPortal_FetchTypeID", GetHashCode());
|
||||
try
|
||||
{
|
||||
using (SqlConnection cn = Database.VEPROMS_SqlConnection)
|
||||
@ -187,7 +187,7 @@ namespace VEPROMS.CSLA.Library
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
if(_MyLog.IsErrorEnabled)_MyLog.Error("AnnotationInfoList.DataPortal_FetchTypeID", ex);
|
||||
if (_MyLog.IsErrorEnabled) _MyLog.Error("AnnotationInfoList.DataPortal_FetchTypeID", ex);
|
||||
throw new DbCslaException("AnnotationInfoList.DataPortal_Fetch", ex);
|
||||
}
|
||||
this.RaiseListChangedEvents = true;
|
||||
@ -209,7 +209,7 @@ namespace VEPROMS.CSLA.Library
|
||||
private void DataPortal_Fetch(ItemIDCriteria criteria)
|
||||
{
|
||||
this.RaiseListChangedEvents = false;
|
||||
if(_MyLog.IsDebugEnabled)_MyLog.DebugFormat("[{0}] AnnotationInfoList.DataPortal_FetchItemID", GetHashCode());
|
||||
if (_MyLog.IsDebugEnabled) _MyLog.DebugFormat("[{0}] AnnotationInfoList.DataPortal_FetchItemID", GetHashCode());
|
||||
try
|
||||
{
|
||||
using (SqlConnection cn = Database.VEPROMS_SqlConnection)
|
||||
@ -230,7 +230,7 @@ namespace VEPROMS.CSLA.Library
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
if(_MyLog.IsErrorEnabled)_MyLog.Error("AnnotationInfoList.DataPortal_FetchItemID", ex);
|
||||
if (_MyLog.IsErrorEnabled) _MyLog.Error("AnnotationInfoList.DataPortal_FetchItemID", ex);
|
||||
throw new DbCslaException("AnnotationInfoList.DataPortal_Fetch", ex);
|
||||
}
|
||||
this.RaiseListChangedEvents = true;
|
||||
@ -291,8 +291,8 @@ namespace VEPROMS.CSLA.Library
|
||||
/// </summary>
|
||||
public partial class AnnotationInfoListPropertyDescriptor : vlnListPropertyDescriptor
|
||||
{
|
||||
private AnnotationInfo Item { get { return (AnnotationInfo) _Item;} }
|
||||
public AnnotationInfoListPropertyDescriptor(AnnotationInfoList collection, int index):base(collection, index){;}
|
||||
private AnnotationInfo Item { get { return (AnnotationInfo)_Item; } }
|
||||
public AnnotationInfoListPropertyDescriptor(AnnotationInfoList collection, int index) : base(collection, index) { ;}
|
||||
}
|
||||
#endregion
|
||||
#region Converter
|
||||
@ -303,7 +303,7 @@ namespace VEPROMS.CSLA.Library
|
||||
if (destType == typeof(string) && value is AnnotationInfoList)
|
||||
{
|
||||
// Return department and department role separated by comma.
|
||||
return ((AnnotationInfoList) value).Items.Count.ToString() + " Annotations";
|
||||
return ((AnnotationInfoList)value).Items.Count.ToString() + " Annotations";
|
||||
}
|
||||
return base.ConvertTo(context, culture, value, destType);
|
||||
}
|
||||
|
@ -41,7 +41,7 @@ namespace VEPROMS.CSLA.Library
|
||||
{
|
||||
foreach (AnnotationTypeAnnotation tmp in _AnnotationTypeAnnotations)
|
||||
{
|
||||
if(tmp.IsDirty)refreshAnnotationTypeAnnotations.Add(tmp);
|
||||
if (tmp.IsDirty) refreshAnnotationTypeAnnotations.Add(tmp);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -65,15 +65,20 @@ namespace VEPROMS.CSLA.Library
|
||||
#endregion
|
||||
#region Collection
|
||||
protected static List<AnnotationType> _AllList = new List<AnnotationType>();
|
||||
private static Dictionary<string, AnnotationType> _AllByPrimaryKey = new Dictionary<string, AnnotationType>();
|
||||
private static Dictionary<string, AnnotationType> _AllByName = new Dictionary<string, AnnotationType>();
|
||||
private static Dictionary<string, List<AnnotationType>> _AllByPrimaryKey = new Dictionary<string, List<AnnotationType>>();
|
||||
private static Dictionary<string, List<AnnotationType>> _AllByName = new Dictionary<string, List<AnnotationType>>();
|
||||
private static void ConvertListToDictionary()
|
||||
{
|
||||
List<AnnotationType> remove = new List<AnnotationType>();
|
||||
foreach (AnnotationType tmp in _AllList)
|
||||
{
|
||||
_AllByPrimaryKey[tmp.TypeID.ToString()]=tmp; // Primary Key
|
||||
_AllByName[tmp.Name.ToString()] = tmp; // Unique Index
|
||||
if (!_AllByPrimaryKey.ContainsKey(tmp.TypeID.ToString()))
|
||||
{
|
||||
_AllByPrimaryKey[tmp.TypeID.ToString()] = new List<AnnotationType>(); // Add new list for PrimaryKey
|
||||
_AllByName[tmp.Name.ToString()] = new List<AnnotationType>(); // Add new list for Name
|
||||
}
|
||||
_AllByPrimaryKey[tmp.TypeID.ToString()].Add(tmp); // Add to Primary Key list
|
||||
_AllByName[tmp.Name.ToString()].Add(tmp); // Unique Index
|
||||
remove.Add(tmp);
|
||||
}
|
||||
foreach (AnnotationType tmp in remove)
|
||||
@ -83,14 +88,14 @@ namespace VEPROMS.CSLA.Library
|
||||
{
|
||||
ConvertListToDictionary();
|
||||
string key = typeID.ToString();
|
||||
if (_AllByPrimaryKey.ContainsKey(key)) return _AllByPrimaryKey[key];
|
||||
if (_AllByPrimaryKey.ContainsKey(key)) return _AllByPrimaryKey[key][0];
|
||||
return null;
|
||||
}
|
||||
public static AnnotationType GetExistingByName(string name)
|
||||
{
|
||||
ConvertListToDictionary();
|
||||
string key = name.ToString();
|
||||
if (_AllByName.ContainsKey(key)) return _AllByName[key];
|
||||
if (_AllByName.ContainsKey(key)) return _AllByName[key][0];
|
||||
return null;
|
||||
}
|
||||
#endregion
|
||||
@ -112,7 +117,7 @@ namespace VEPROMS.CSLA.Library
|
||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||
get
|
||||
{
|
||||
CanReadProperty("TypeID",true);
|
||||
CanReadProperty("TypeID", true);
|
||||
return _TypeID;
|
||||
}
|
||||
}
|
||||
@ -122,13 +127,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)
|
||||
{
|
||||
@ -143,13 +148,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)
|
||||
{
|
||||
@ -164,13 +169,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;
|
||||
@ -184,13 +189,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)
|
||||
{
|
||||
@ -209,7 +214,7 @@ namespace VEPROMS.CSLA.Library
|
||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||
get
|
||||
{
|
||||
CanReadProperty("AnnotationTypeAnnotationCount",true);
|
||||
CanReadProperty("AnnotationTypeAnnotationCount", true);
|
||||
return _AnnotationTypeAnnotationCount;
|
||||
}
|
||||
}
|
||||
@ -223,21 +228,21 @@ namespace VEPROMS.CSLA.Library
|
||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||
get
|
||||
{
|
||||
CanReadProperty("AnnotationTypeAnnotations",true);
|
||||
if(_AnnotationTypeAnnotationCount > 0 && _AnnotationTypeAnnotations == null)
|
||||
CanReadProperty("AnnotationTypeAnnotations", true);
|
||||
if (_AnnotationTypeAnnotationCount > 0 && _AnnotationTypeAnnotations == null)
|
||||
_AnnotationTypeAnnotations = AnnotationTypeAnnotations.GetByTypeID(TypeID);
|
||||
else if(_AnnotationTypeAnnotations == null)
|
||||
else if (_AnnotationTypeAnnotations == null)
|
||||
_AnnotationTypeAnnotations = AnnotationTypeAnnotations.New();
|
||||
return _AnnotationTypeAnnotations;
|
||||
}
|
||||
}
|
||||
public override bool IsDirty
|
||||
{
|
||||
get { return base.IsDirty || (_AnnotationTypeAnnotations == null? false : _AnnotationTypeAnnotations.IsDirty); }
|
||||
get { return base.IsDirty || (_AnnotationTypeAnnotations == null ? false : _AnnotationTypeAnnotations.IsDirty); }
|
||||
}
|
||||
public override bool IsValid
|
||||
{
|
||||
get { return (IsNew && !IsDirty ? true : base.IsValid) && (_AnnotationTypeAnnotations == null? true : _AnnotationTypeAnnotations.IsValid); }
|
||||
get { return (IsNew && !IsDirty ? true : base.IsValid) && (_AnnotationTypeAnnotations == null ? true : _AnnotationTypeAnnotations.IsValid); }
|
||||
}
|
||||
// TODO: Replace base AnnotationType.ToString function as necessary
|
||||
/// <summary>
|
||||
@ -260,22 +265,23 @@ 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 (_AnnotationTypeAnnotations != null && (hasBrokenRules = _AnnotationTypeAnnotations.HasBrokenRules) != null) return hasBrokenRules;
|
||||
return hasBrokenRules;
|
||||
}
|
||||
finally
|
||||
{
|
||||
_CheckingBrokenRules=false;
|
||||
_CheckingBrokenRules = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -387,15 +393,29 @@ namespace VEPROMS.CSLA.Library
|
||||
#region Factory Methods
|
||||
public int CurrentEditLevel
|
||||
{ get { return EditLevel; } }
|
||||
private static int _AnnotationTypeUnique = 0;
|
||||
private int _MyAnnotationTypeUnique;
|
||||
public int MyAnnotationTypeUnique
|
||||
{
|
||||
get { return _MyAnnotationTypeUnique; }
|
||||
}
|
||||
protected AnnotationType()
|
||||
{/* require use of factory methods */
|
||||
_MyAnnotationTypeUnique = ++_AnnotationTypeUnique;
|
||||
_AllList.Add(this);
|
||||
}
|
||||
public void Dispose()
|
||||
{
|
||||
_AllList.Remove(this);
|
||||
_AllByPrimaryKey.Remove(TypeID.ToString());
|
||||
_AllByName.Remove(Name.ToString());
|
||||
if (!_AllByPrimaryKey.ContainsKey(TypeID.ToString())) return;
|
||||
List<AnnotationType> listAnnotationType = _AllByPrimaryKey[TypeID.ToString()]; // Get the list of items
|
||||
listAnnotationType.Remove(this); // Remove the item from the list
|
||||
if (listAnnotationType.Count == 0) //If there are no items left in the list
|
||||
_AllByPrimaryKey.Remove(TypeID.ToString()); // remove the list
|
||||
listAnnotationType = _AllByName[TypeID.ToString()]; // Get the list of items
|
||||
listAnnotationType.Remove(this); // Remove the item from the list
|
||||
if (listAnnotationType.Count == 0) //If there are no items left in the list
|
||||
_AllByName.Remove(TypeID.ToString()); // remove the list
|
||||
}
|
||||
public static AnnotationType New()
|
||||
{
|
||||
@ -474,7 +494,7 @@ namespace VEPROMS.CSLA.Library
|
||||
if (tmp == null)
|
||||
{
|
||||
tmp = DataPortal.Fetch<AnnotationType>(new PKCriteria(typeID));
|
||||
_AllList.Add(tmp);
|
||||
if (!_AllList.Contains(tmp)) _AllList.Add(tmp);
|
||||
}
|
||||
if (tmp.ErrorMessage == "No Record Found") tmp = null;
|
||||
return tmp;
|
||||
@ -493,8 +513,8 @@ namespace VEPROMS.CSLA.Library
|
||||
AnnotationType tmp = GetExistingByName(name);
|
||||
if (tmp == null)
|
||||
{
|
||||
tmp=DataPortal.Fetch<AnnotationType>(new NameCriteria(name));
|
||||
_AllList.Add(tmp);
|
||||
tmp = DataPortal.Fetch<AnnotationType>(new NameCriteria(name));
|
||||
if (!_AllList.Contains(tmp)) _AllList.Add(tmp);
|
||||
}
|
||||
if (tmp.ErrorMessage == "No Record Found") tmp = null;
|
||||
return tmp;
|
||||
@ -584,7 +604,7 @@ namespace VEPROMS.CSLA.Library
|
||||
}
|
||||
private void ReadData(SafeDataReader dr)
|
||||
{
|
||||
if(_MyLog.IsDebugEnabled)_MyLog.DebugFormat("[{0}] AnnotationType.ReadData", GetHashCode());
|
||||
if (_MyLog.IsDebugEnabled) _MyLog.DebugFormat("[{0}] AnnotationType.ReadData", GetHashCode());
|
||||
try
|
||||
{
|
||||
_TypeID = dr.GetInt32("TypeID");
|
||||
@ -598,14 +618,14 @@ namespace VEPROMS.CSLA.Library
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
if(_MyLog.IsErrorEnabled)_MyLog.Error("AnnotationType.ReadData", ex);
|
||||
if (_MyLog.IsErrorEnabled) _MyLog.Error("AnnotationType.ReadData", ex);
|
||||
_ErrorMessage = ex.Message;
|
||||
throw new DbCslaException("AnnotationType.ReadData", ex);
|
||||
}
|
||||
}
|
||||
private void DataPortal_Fetch(PKCriteria criteria)
|
||||
{
|
||||
if(_MyLog.IsDebugEnabled)_MyLog.DebugFormat("[{0}] AnnotationType.DataPortal_Fetch", GetHashCode());
|
||||
if (_MyLog.IsDebugEnabled) _MyLog.DebugFormat("[{0}] AnnotationType.DataPortal_Fetch", GetHashCode());
|
||||
try
|
||||
{
|
||||
using (SqlConnection cn = Database.VEPROMS_SqlConnection)
|
||||
@ -636,14 +656,14 @@ namespace VEPROMS.CSLA.Library
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
if(_MyLog.IsErrorEnabled)_MyLog.Error("AnnotationType.DataPortal_Fetch", ex);
|
||||
if (_MyLog.IsErrorEnabled) _MyLog.Error("AnnotationType.DataPortal_Fetch", ex);
|
||||
_ErrorMessage = ex.Message;
|
||||
throw new DbCslaException("AnnotationType.DataPortal_Fetch", ex);
|
||||
}
|
||||
}
|
||||
private void DataPortal_Fetch(NameCriteria criteria)
|
||||
{
|
||||
if(_MyLog.IsDebugEnabled)_MyLog.DebugFormat("[{0}] AnnotationType.DataPortal_Fetch", GetHashCode());
|
||||
if (_MyLog.IsDebugEnabled) _MyLog.DebugFormat("[{0}] AnnotationType.DataPortal_Fetch", GetHashCode());
|
||||
try
|
||||
{
|
||||
using (SqlConnection cn = Database.VEPROMS_SqlConnection)
|
||||
@ -671,7 +691,7 @@ namespace VEPROMS.CSLA.Library
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
if(_MyLog.IsErrorEnabled)_MyLog.Error("AnnotationType.DataPortal_Fetch", ex);
|
||||
if (_MyLog.IsErrorEnabled) _MyLog.Error("AnnotationType.DataPortal_Fetch", ex);
|
||||
_ErrorMessage = ex.Message;
|
||||
throw new DbCslaException("AnnotationType.DataPortal_Fetch", ex);
|
||||
}
|
||||
@ -692,13 +712,13 @@ namespace VEPROMS.CSLA.Library
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
if(_MyLog.IsErrorEnabled)_MyLog.Error("AnnotationType.DataPortal_Insert", ex);
|
||||
if (_MyLog.IsErrorEnabled) _MyLog.Error("AnnotationType.DataPortal_Insert", ex);
|
||||
_ErrorMessage = ex.Message;
|
||||
throw new DbCslaException("AnnotationType.DataPortal_Insert", ex);
|
||||
}
|
||||
finally
|
||||
{
|
||||
if(_MyLog.IsDebugEnabled)_MyLog.DebugFormat("[{0}] AnnotationType.DataPortal_Insert", GetHashCode());
|
||||
if (_MyLog.IsDebugEnabled) _MyLog.DebugFormat("[{0}] AnnotationType.DataPortal_Insert", GetHashCode());
|
||||
}
|
||||
}
|
||||
[Transactional(TransactionalTypes.TransactionScope)]
|
||||
@ -733,11 +753,11 @@ namespace VEPROMS.CSLA.Library
|
||||
MarkOld();
|
||||
// update child objects
|
||||
if (_AnnotationTypeAnnotations != null) _AnnotationTypeAnnotations.Update(this);
|
||||
if(_MyLog.IsDebugEnabled)_MyLog.DebugFormat("[{0}] AnnotationType.SQLInsert", GetHashCode());
|
||||
if (_MyLog.IsDebugEnabled) _MyLog.DebugFormat("[{0}] AnnotationType.SQLInsert", GetHashCode());
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
if(_MyLog.IsErrorEnabled)_MyLog.Error("AnnotationType.SQLInsert", ex);
|
||||
if (_MyLog.IsErrorEnabled) _MyLog.Error("AnnotationType.SQLInsert", ex);
|
||||
_ErrorMessage = ex.Message;
|
||||
throw new DbCslaException("AnnotationType.SQLInsert", ex);
|
||||
}
|
||||
@ -745,7 +765,7 @@ namespace VEPROMS.CSLA.Library
|
||||
[Transactional(TransactionalTypes.TransactionScope)]
|
||||
public static byte[] Add(SqlConnection cn, ref int typeID, string name, string config, DateTime dts, string userID)
|
||||
{
|
||||
if(_MyLog.IsDebugEnabled)_MyLog.DebugFormat("[{0}] AnnotationType.Add", 0);
|
||||
if (_MyLog.IsDebugEnabled) _MyLog.DebugFormat("[{0}] AnnotationType.Add", 0);
|
||||
try
|
||||
{
|
||||
using (SqlCommand cm = cn.CreateCommand())
|
||||
@ -773,7 +793,7 @@ namespace VEPROMS.CSLA.Library
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
if(_MyLog.IsErrorEnabled)_MyLog.Error("AnnotationType.Add", ex);
|
||||
if (_MyLog.IsErrorEnabled) _MyLog.Error("AnnotationType.Add", ex);
|
||||
throw new DbCslaException("AnnotationType.Add", ex);
|
||||
}
|
||||
}
|
||||
@ -781,7 +801,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}] AnnotationType.DataPortal_Update", GetHashCode());
|
||||
if (_MyLog.IsDebugEnabled) _MyLog.DebugFormat("[{0}] AnnotationType.DataPortal_Update", GetHashCode());
|
||||
try
|
||||
{
|
||||
using (SqlConnection cn = Database.VEPROMS_SqlConnection)
|
||||
@ -795,7 +815,7 @@ namespace VEPROMS.CSLA.Library
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
if(_MyLog.IsErrorEnabled)_MyLog.Error("AnnotationType.DataPortal_Update", ex);
|
||||
if (_MyLog.IsErrorEnabled) _MyLog.Error("AnnotationType.DataPortal_Update", ex);
|
||||
_ErrorMessage = ex.Message;
|
||||
if (!ex.Message.EndsWith("has been edited by another user.")) throw ex;
|
||||
}
|
||||
@ -804,7 +824,7 @@ namespace VEPROMS.CSLA.Library
|
||||
internal void SQLUpdate()
|
||||
{
|
||||
if (!IsDirty) return; // If not dirty - nothing to do
|
||||
if(_MyLog.IsDebugEnabled)_MyLog.DebugFormat("[{0}] AnnotationType.SQLUpdate", GetHashCode());
|
||||
if (_MyLog.IsDebugEnabled) _MyLog.DebugFormat("[{0}] AnnotationType.SQLUpdate", GetHashCode());
|
||||
try
|
||||
{
|
||||
SqlConnection cn = (SqlConnection)ApplicationContext.LocalContext["cn"];
|
||||
@ -837,7 +857,7 @@ namespace VEPROMS.CSLA.Library
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
if(_MyLog.IsErrorEnabled)_MyLog.Error("AnnotationType.SQLUpdate", ex);
|
||||
if (_MyLog.IsErrorEnabled) _MyLog.Error("AnnotationType.SQLUpdate", ex);
|
||||
_ErrorMessage = ex.Message;
|
||||
if (!ex.Message.EndsWith("has been edited by another user.")) throw ex;
|
||||
}
|
||||
@ -859,7 +879,7 @@ namespace VEPROMS.CSLA.Library
|
||||
[Transactional(TransactionalTypes.TransactionScope)]
|
||||
public static byte[] Update(SqlConnection cn, ref int typeID, string name, string config, DateTime dts, string userID, ref byte[] lastChanged)
|
||||
{
|
||||
if(_MyLog.IsDebugEnabled)_MyLog.DebugFormat("[{0}] AnnotationType.Update", 0);
|
||||
if (_MyLog.IsDebugEnabled) _MyLog.DebugFormat("[{0}] AnnotationType.Update", 0);
|
||||
try
|
||||
{
|
||||
using (SqlCommand cm = cn.CreateCommand())
|
||||
@ -885,7 +905,7 @@ namespace VEPROMS.CSLA.Library
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
if(_MyLog.IsErrorEnabled)_MyLog.Error("AnnotationType.Update", ex);
|
||||
if (_MyLog.IsErrorEnabled) _MyLog.Error("AnnotationType.Update", ex);
|
||||
throw new DbCslaException("AnnotationType.Update", ex);
|
||||
}
|
||||
}
|
||||
@ -897,7 +917,7 @@ namespace VEPROMS.CSLA.Library
|
||||
[Transactional(TransactionalTypes.TransactionScope)]
|
||||
private void DataPortal_Delete(PKCriteria criteria)
|
||||
{
|
||||
if(_MyLog.IsDebugEnabled)_MyLog.DebugFormat("[{0}] AnnotationType.DataPortal_Delete", GetHashCode());
|
||||
if (_MyLog.IsDebugEnabled) _MyLog.DebugFormat("[{0}] AnnotationType.DataPortal_Delete", GetHashCode());
|
||||
try
|
||||
{
|
||||
using (SqlConnection cn = Database.VEPROMS_SqlConnection)
|
||||
@ -913,7 +933,7 @@ namespace VEPROMS.CSLA.Library
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
if(_MyLog.IsErrorEnabled)_MyLog.Error("AnnotationType.DataPortal_Delete", ex);
|
||||
if (_MyLog.IsErrorEnabled) _MyLog.Error("AnnotationType.DataPortal_Delete", ex);
|
||||
_ErrorMessage = ex.Message;
|
||||
throw new DbCslaException("AnnotationType.DataPortal_Delete", ex);
|
||||
}
|
||||
@ -921,7 +941,7 @@ namespace VEPROMS.CSLA.Library
|
||||
[Transactional(TransactionalTypes.TransactionScope)]
|
||||
public static void Remove(SqlConnection cn, int typeID)
|
||||
{
|
||||
if(_MyLog.IsDebugEnabled)_MyLog.DebugFormat("[{0}] AnnotationType.Remove", 0);
|
||||
if (_MyLog.IsDebugEnabled) _MyLog.DebugFormat("[{0}] AnnotationType.Remove", 0);
|
||||
try
|
||||
{
|
||||
using (SqlCommand cm = cn.CreateCommand())
|
||||
@ -936,7 +956,7 @@ namespace VEPROMS.CSLA.Library
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
if(_MyLog.IsErrorEnabled)_MyLog.Error("AnnotationType.Remove", ex);
|
||||
if (_MyLog.IsErrorEnabled) _MyLog.Error("AnnotationType.Remove", ex);
|
||||
throw new DbCslaException("AnnotationType.Remove", ex);
|
||||
}
|
||||
}
|
||||
@ -970,7 +990,7 @@ namespace VEPROMS.CSLA.Library
|
||||
}
|
||||
protected override void DataPortal_Execute()
|
||||
{
|
||||
if(_MyLog.IsDebugEnabled)_MyLog.DebugFormat("[{0}] AnnotationType.DataPortal_Execute", GetHashCode());
|
||||
if (_MyLog.IsDebugEnabled) _MyLog.DebugFormat("[{0}] AnnotationType.DataPortal_Execute", GetHashCode());
|
||||
try
|
||||
{
|
||||
using (SqlConnection cn = Database.VEPROMS_SqlConnection)
|
||||
@ -988,7 +1008,7 @@ namespace VEPROMS.CSLA.Library
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
if(_MyLog.IsErrorEnabled)_MyLog.Error("AnnotationType.DataPortal_Execute", ex);
|
||||
if (_MyLog.IsErrorEnabled) _MyLog.Error("AnnotationType.DataPortal_Execute", ex);
|
||||
throw new DbCslaException("AnnotationType.DataPortal_Execute", ex);
|
||||
}
|
||||
}
|
||||
|
@ -42,7 +42,7 @@ namespace VEPROMS.CSLA.Library
|
||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||
get
|
||||
{
|
||||
CanReadProperty("AnnotationID",true);
|
||||
CanReadProperty("AnnotationID", true);
|
||||
if (_MyAnnotation != null) _AnnotationID = _MyAnnotation.AnnotationID;
|
||||
return _AnnotationID;
|
||||
}
|
||||
@ -54,7 +54,7 @@ namespace VEPROMS.CSLA.Library
|
||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||
get
|
||||
{
|
||||
CanReadProperty("MyAnnotation",true);
|
||||
CanReadProperty("MyAnnotation", true);
|
||||
if (_MyAnnotation == null && _AnnotationID != 0) _MyAnnotation = Annotation.Get(_AnnotationID);
|
||||
return _MyAnnotation;
|
||||
}
|
||||
@ -65,7 +65,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;
|
||||
}
|
||||
@ -76,14 +76,14 @@ namespace VEPROMS.CSLA.Library
|
||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||
get
|
||||
{
|
||||
CanReadProperty("MyItem",true);
|
||||
CanReadProperty("MyItem", true);
|
||||
if (_MyItem == null && _ItemID != 0) _MyItem = Item.Get(_ItemID);
|
||||
return _MyItem;
|
||||
}
|
||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||
set
|
||||
{
|
||||
CanWriteProperty("MyItem",true);
|
||||
CanWriteProperty("MyItem", true);
|
||||
if (_MyItem != value)
|
||||
{
|
||||
_MyItem = value;
|
||||
@ -97,13 +97,13 @@ namespace VEPROMS.CSLA.Library
|
||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||
get
|
||||
{
|
||||
CanReadProperty("RtfText",true);
|
||||
CanReadProperty("RtfText", true);
|
||||
return _RtfText;
|
||||
}
|
||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||
set
|
||||
{
|
||||
CanWriteProperty("RtfText",true);
|
||||
CanWriteProperty("RtfText", true);
|
||||
if (value == null) value = string.Empty;
|
||||
if (_RtfText != value)
|
||||
{
|
||||
@ -118,13 +118,13 @@ namespace VEPROMS.CSLA.Library
|
||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||
get
|
||||
{
|
||||
CanReadProperty("SearchText",true);
|
||||
CanReadProperty("SearchText", true);
|
||||
return _SearchText;
|
||||
}
|
||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||
set
|
||||
{
|
||||
CanWriteProperty("SearchText",true);
|
||||
CanWriteProperty("SearchText", true);
|
||||
if (value == null) value = string.Empty;
|
||||
if (_SearchText != value)
|
||||
{
|
||||
@ -139,13 +139,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)
|
||||
{
|
||||
@ -160,13 +160,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;
|
||||
@ -180,13 +180,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)
|
||||
{
|
||||
@ -202,7 +202,7 @@ namespace VEPROMS.CSLA.Library
|
||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||
get
|
||||
{
|
||||
CanReadProperty("Item_PreviousID",true);
|
||||
CanReadProperty("Item_PreviousID", true);
|
||||
return _Item_PreviousID;
|
||||
}
|
||||
}
|
||||
@ -212,7 +212,7 @@ namespace VEPROMS.CSLA.Library
|
||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||
get
|
||||
{
|
||||
CanReadProperty("Item_ContentID",true);
|
||||
CanReadProperty("Item_ContentID", true);
|
||||
return _Item_ContentID;
|
||||
}
|
||||
}
|
||||
@ -222,7 +222,7 @@ namespace VEPROMS.CSLA.Library
|
||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||
get
|
||||
{
|
||||
CanReadProperty("Item_DTS",true);
|
||||
CanReadProperty("Item_DTS", true);
|
||||
return _Item_DTS;
|
||||
}
|
||||
}
|
||||
@ -232,7 +232,7 @@ namespace VEPROMS.CSLA.Library
|
||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||
get
|
||||
{
|
||||
CanReadProperty("Item_UserID",true);
|
||||
CanReadProperty("Item_UserID", true);
|
||||
return _Item_UserID;
|
||||
}
|
||||
}
|
||||
@ -265,23 +265,23 @@ namespace VEPROMS.CSLA.Library
|
||||
#endregion
|
||||
#region ValidationRules
|
||||
[NonSerialized]
|
||||
private bool _CheckingBrokenRules=false;
|
||||
private bool _CheckingBrokenRules = false;
|
||||
public IVEHasBrokenRules HasBrokenRules
|
||||
{
|
||||
get
|
||||
{
|
||||
if(_CheckingBrokenRules)return null;
|
||||
if (_CheckingBrokenRules) return null;
|
||||
if (BrokenRulesCollection.Count > 0) return this;
|
||||
try
|
||||
{
|
||||
_CheckingBrokenRules=true;
|
||||
_CheckingBrokenRules = true;
|
||||
IVEHasBrokenRules hasBrokenRules = null;
|
||||
if (_MyItem != null && (hasBrokenRules = _MyItem.HasBrokenRules) != null) return hasBrokenRules;
|
||||
return hasBrokenRules;
|
||||
}
|
||||
finally
|
||||
{
|
||||
_CheckingBrokenRules=false;
|
||||
_CheckingBrokenRules = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -416,7 +416,7 @@ namespace VEPROMS.CSLA.Library
|
||||
#region Data Access Portal
|
||||
private void Fetch(SafeDataReader dr)
|
||||
{
|
||||
if(_MyLog.IsDebugEnabled)_MyLog.DebugFormat("[{0}] AnnotationTypeAnnotation.FetchDR", GetHashCode());
|
||||
if (_MyLog.IsDebugEnabled) _MyLog.DebugFormat("[{0}] AnnotationTypeAnnotation.FetchDR", GetHashCode());
|
||||
try
|
||||
{
|
||||
_AnnotationID = dr.GetInt32("AnnotationID");
|
||||
@ -434,7 +434,7 @@ namespace VEPROMS.CSLA.Library
|
||||
}
|
||||
catch (Exception ex) // FKItem Fetch
|
||||
{
|
||||
if(_MyLog.IsErrorEnabled)_MyLog.Error("AnnotationTypeAnnotation.FetchDR", ex);
|
||||
if (_MyLog.IsErrorEnabled) _MyLog.Error("AnnotationTypeAnnotation.FetchDR", ex);
|
||||
throw new DbCslaException("AnnotationTypeAnnotation.Fetch", ex);
|
||||
}
|
||||
MarkOld();
|
||||
|
@ -94,8 +94,8 @@ namespace VEPROMS.CSLA.Library
|
||||
{
|
||||
get
|
||||
{
|
||||
IVEHasBrokenRules hasBrokenRules=null;
|
||||
foreach(AnnotationTypeAnnotation annotationTypeAnnotation in this)
|
||||
IVEHasBrokenRules hasBrokenRules = null;
|
||||
foreach (AnnotationTypeAnnotation annotationTypeAnnotation in this)
|
||||
if ((hasBrokenRules = annotationTypeAnnotation.HasBrokenRules) != null) return hasBrokenRules;
|
||||
return hasBrokenRules;
|
||||
}
|
||||
@ -165,7 +165,7 @@ namespace VEPROMS.CSLA.Library
|
||||
private void DataPortal_Fetch(TypeIDCriteria criteria)
|
||||
{
|
||||
this.RaiseListChangedEvents = false;
|
||||
if(_MyLog.IsDebugEnabled)_MyLog.DebugFormat("[{0}] AnnotationTypeAnnotations.DataPortal_FetchTypeID", GetHashCode());
|
||||
if (_MyLog.IsDebugEnabled) _MyLog.DebugFormat("[{0}] AnnotationTypeAnnotations.DataPortal_FetchTypeID", GetHashCode());
|
||||
try
|
||||
{
|
||||
using (SqlConnection cn = Database.VEPROMS_SqlConnection)
|
||||
@ -184,7 +184,7 @@ namespace VEPROMS.CSLA.Library
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
if(_MyLog.IsErrorEnabled)_MyLog.Error("AnnotationTypeAnnotations.DataPortal_FetchTypeID", ex);
|
||||
if (_MyLog.IsErrorEnabled) _MyLog.Error("AnnotationTypeAnnotations.DataPortal_FetchTypeID", ex);
|
||||
throw new DbCslaException("AnnotationTypeAnnotations.DataPortal_Fetch", ex);
|
||||
}
|
||||
this.RaiseListChangedEvents = true;
|
||||
@ -269,8 +269,8 @@ namespace VEPROMS.CSLA.Library
|
||||
/// </summary>
|
||||
public partial class AnnotationTypeAnnotationsPropertyDescriptor : vlnListPropertyDescriptor
|
||||
{
|
||||
private AnnotationTypeAnnotation Item { get { return (AnnotationTypeAnnotation) _Item;} }
|
||||
public AnnotationTypeAnnotationsPropertyDescriptor(AnnotationTypeAnnotations collection, int index):base(collection, index){;}
|
||||
private AnnotationTypeAnnotation Item { get { return (AnnotationTypeAnnotation)_Item; } }
|
||||
public AnnotationTypeAnnotationsPropertyDescriptor(AnnotationTypeAnnotations collection, int index) : base(collection, index) { ;}
|
||||
}
|
||||
#endregion
|
||||
#region Converter
|
||||
@ -281,7 +281,7 @@ namespace VEPROMS.CSLA.Library
|
||||
if (destType == typeof(string) && value is AnnotationTypeAnnotations)
|
||||
{
|
||||
// Return department and department role separated by comma.
|
||||
return ((AnnotationTypeAnnotations) value).Items.Count.ToString() + " Annotations";
|
||||
return ((AnnotationTypeAnnotations)value).Items.Count.ToString() + " Annotations";
|
||||
}
|
||||
return base.ConvertTo(context, culture, value, destType);
|
||||
}
|
||||
|
@ -37,13 +37,17 @@ namespace VEPROMS.CSLA.Library
|
||||
#endregion
|
||||
#region Collection
|
||||
protected static List<AnnotationTypeInfo> _AllList = new List<AnnotationTypeInfo>();
|
||||
private static Dictionary<string, AnnotationTypeInfo> _AllByPrimaryKey = new Dictionary<string, AnnotationTypeInfo>();
|
||||
private static Dictionary<string, List<AnnotationTypeInfo>> _AllByPrimaryKey = new Dictionary<string, List<AnnotationTypeInfo>>();
|
||||
private static void ConvertListToDictionary()
|
||||
{
|
||||
List<AnnotationTypeInfo> remove = new List<AnnotationTypeInfo>();
|
||||
foreach (AnnotationTypeInfo tmp in _AllList)
|
||||
{
|
||||
_AllByPrimaryKey[tmp.TypeID.ToString()]=tmp; // Primary Key
|
||||
if (!_AllByPrimaryKey.ContainsKey(tmp.TypeID.ToString()))
|
||||
{
|
||||
_AllByPrimaryKey[tmp.TypeID.ToString()] = new List<AnnotationTypeInfo>(); // Add new list for PrimaryKey
|
||||
}
|
||||
_AllByPrimaryKey[tmp.TypeID.ToString()].Add(tmp); // Add to Primary Key list
|
||||
remove.Add(tmp);
|
||||
}
|
||||
foreach (AnnotationTypeInfo tmp in remove)
|
||||
@ -57,7 +61,7 @@ namespace VEPROMS.CSLA.Library
|
||||
{
|
||||
ConvertListToDictionary();
|
||||
string key = typeID.ToString();
|
||||
if (_AllByPrimaryKey.ContainsKey(key)) return _AllByPrimaryKey[key];
|
||||
if (_AllByPrimaryKey.ContainsKey(key)) return _AllByPrimaryKey[key][0];
|
||||
return null;
|
||||
}
|
||||
#endregion
|
||||
@ -85,7 +89,7 @@ namespace VEPROMS.CSLA.Library
|
||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||
get
|
||||
{
|
||||
CanReadProperty("TypeID",true);
|
||||
CanReadProperty("TypeID", true);
|
||||
return _TypeID;
|
||||
}
|
||||
}
|
||||
@ -95,7 +99,7 @@ namespace VEPROMS.CSLA.Library
|
||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||
get
|
||||
{
|
||||
CanReadProperty("Name",true);
|
||||
CanReadProperty("Name", true);
|
||||
return _Name;
|
||||
}
|
||||
}
|
||||
@ -105,7 +109,7 @@ namespace VEPROMS.CSLA.Library
|
||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||
get
|
||||
{
|
||||
CanReadProperty("Config",true);
|
||||
CanReadProperty("Config", true);
|
||||
return _Config;
|
||||
}
|
||||
}
|
||||
@ -115,7 +119,7 @@ namespace VEPROMS.CSLA.Library
|
||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||
get
|
||||
{
|
||||
CanReadProperty("DTS",true);
|
||||
CanReadProperty("DTS", true);
|
||||
return _DTS;
|
||||
}
|
||||
}
|
||||
@ -125,7 +129,7 @@ namespace VEPROMS.CSLA.Library
|
||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||
get
|
||||
{
|
||||
CanReadProperty("UserID",true);
|
||||
CanReadProperty("UserID", true);
|
||||
return _UserID;
|
||||
}
|
||||
}
|
||||
@ -138,7 +142,7 @@ namespace VEPROMS.CSLA.Library
|
||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||
get
|
||||
{
|
||||
CanReadProperty("AnnotationTypeAnnotationCount",true);
|
||||
CanReadProperty("AnnotationTypeAnnotationCount", true);
|
||||
return _AnnotationTypeAnnotationCount;
|
||||
}
|
||||
}
|
||||
@ -149,7 +153,7 @@ namespace VEPROMS.CSLA.Library
|
||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||
get
|
||||
{
|
||||
CanReadProperty("AnnotationTypeAnnotations",true);
|
||||
CanReadProperty("AnnotationTypeAnnotations", true);
|
||||
if (_AnnotationTypeAnnotationCount < 0 || (_AnnotationTypeAnnotationCount > 0 && _AnnotationTypeAnnotations == null))
|
||||
_AnnotationTypeAnnotations = AnnotationInfoList.GetByTypeID(_TypeID);
|
||||
if (_AnnotationTypeAnnotationCount < 0)
|
||||
@ -159,7 +163,10 @@ namespace VEPROMS.CSLA.Library
|
||||
}
|
||||
internal void RefreshAnnotationTypeAnnotations()
|
||||
{
|
||||
_AnnotationTypeAnnotationCount = -1; // This will cause the data to be requeried
|
||||
ConvertListToDictionary();
|
||||
if (_AllByPrimaryKey.ContainsKey(_TypeID.ToString()))
|
||||
foreach (AnnotationTypeInfo tmp in _AllByPrimaryKey[_TypeID.ToString()])
|
||||
tmp._AnnotationTypeAnnotationCount = -1; // This will cause the data to be requeried
|
||||
}
|
||||
// TODO: Replace base AnnotationTypeInfo.ToString function as necessary
|
||||
/// <summary>
|
||||
@ -181,14 +188,25 @@ namespace VEPROMS.CSLA.Library
|
||||
}
|
||||
#endregion
|
||||
#region Factory Methods
|
||||
private static int _AnnotationTypeInfoUnique = 0;
|
||||
private int _MyAnnotationTypeInfoUnique;
|
||||
public int MyAnnotationTypeInfoUnique
|
||||
{
|
||||
get { return _MyAnnotationTypeInfoUnique; }
|
||||
}
|
||||
private AnnotationTypeInfo()
|
||||
{/* require use of factory methods */
|
||||
_MyAnnotationTypeInfoUnique = ++_AnnotationTypeInfoUnique;
|
||||
_AllList.Add(this);
|
||||
}
|
||||
public void Dispose()
|
||||
{
|
||||
_AllList.Remove(this);
|
||||
_AllByPrimaryKey.Remove(TypeID.ToString());
|
||||
if (!_AllByPrimaryKey.ContainsKey(TypeID.ToString())) return;
|
||||
List<AnnotationTypeInfo> listAnnotationTypeInfo = _AllByPrimaryKey[TypeID.ToString()]; // Get the list of items
|
||||
listAnnotationTypeInfo.Remove(this); // Remove the item from the list
|
||||
if (listAnnotationTypeInfo.Count == 0) // If there are no items left in the list
|
||||
_AllByPrimaryKey.Remove(TypeID.ToString()); // remove the list
|
||||
}
|
||||
public virtual AnnotationType Get()
|
||||
{
|
||||
@ -196,8 +214,10 @@ namespace VEPROMS.CSLA.Library
|
||||
}
|
||||
public static void Refresh(AnnotationType tmp)
|
||||
{
|
||||
AnnotationTypeInfo tmpInfo = GetExistingByPrimaryKey(tmp.TypeID);
|
||||
if (tmpInfo == null) return;
|
||||
string key = tmp.TypeID.ToString();
|
||||
ConvertListToDictionary();
|
||||
if (_AllByPrimaryKey.ContainsKey(key))
|
||||
foreach (AnnotationTypeInfo tmpInfo in _AllByPrimaryKey[key])
|
||||
tmpInfo.RefreshFields(tmp);
|
||||
}
|
||||
private void RefreshFields(AnnotationType tmp)
|
||||
@ -219,7 +239,7 @@ namespace VEPROMS.CSLA.Library
|
||||
if (tmp == null)
|
||||
{
|
||||
tmp = DataPortal.Fetch<AnnotationTypeInfo>(new PKCriteria(typeID));
|
||||
_AllList.Add(tmp);
|
||||
if (!_AllList.Contains(tmp)) _AllList.Add(tmp);
|
||||
}
|
||||
if (tmp.ErrorMessage == "No Record Found") tmp = null;
|
||||
return tmp;
|
||||
@ -233,14 +253,15 @@ namespace VEPROMS.CSLA.Library
|
||||
#region Data Access Portal
|
||||
internal AnnotationTypeInfo(SafeDataReader dr)
|
||||
{
|
||||
if(_MyLog.IsDebugEnabled)_MyLog.DebugFormat("[{0}] AnnotationTypeInfo.Constructor", GetHashCode());
|
||||
_MyAnnotationTypeInfoUnique = ++_AnnotationTypeInfoUnique;
|
||||
if (_MyLog.IsDebugEnabled) _MyLog.DebugFormat("[{0}] AnnotationTypeInfo.Constructor", GetHashCode());
|
||||
try
|
||||
{
|
||||
ReadData(dr);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
if(_MyLog.IsErrorEnabled)_MyLog.Error("AnnotationTypeInfo.Constructor", ex);
|
||||
if (_MyLog.IsErrorEnabled) _MyLog.Error("AnnotationTypeInfo.Constructor", ex);
|
||||
throw new DbCslaException("AnnotationTypeInfo.Constructor", ex);
|
||||
}
|
||||
}
|
||||
@ -257,7 +278,7 @@ namespace VEPROMS.CSLA.Library
|
||||
}
|
||||
private void ReadData(SafeDataReader dr)
|
||||
{
|
||||
if(_MyLog.IsDebugEnabled)_MyLog.DebugFormat("[{0}] AnnotationTypeInfo.ReadData", GetHashCode());
|
||||
if (_MyLog.IsDebugEnabled) _MyLog.DebugFormat("[{0}] AnnotationTypeInfo.ReadData", GetHashCode());
|
||||
try
|
||||
{
|
||||
_TypeID = dr.GetInt32("TypeID");
|
||||
@ -269,14 +290,14 @@ namespace VEPROMS.CSLA.Library
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
if(_MyLog.IsErrorEnabled)_MyLog.Error("AnnotationTypeInfo.ReadData", ex);
|
||||
if (_MyLog.IsErrorEnabled) _MyLog.Error("AnnotationTypeInfo.ReadData", ex);
|
||||
_ErrorMessage = ex.Message;
|
||||
throw new DbCslaException("AnnotationTypeInfo.ReadData", ex);
|
||||
}
|
||||
}
|
||||
private void DataPortal_Fetch(PKCriteria criteria)
|
||||
{
|
||||
if(_MyLog.IsDebugEnabled)_MyLog.DebugFormat("[{0}] AnnotationTypeInfo.DataPortal_Fetch", GetHashCode());
|
||||
if (_MyLog.IsDebugEnabled) _MyLog.DebugFormat("[{0}] AnnotationTypeInfo.DataPortal_Fetch", GetHashCode());
|
||||
try
|
||||
{
|
||||
using (SqlConnection cn = Database.VEPROMS_SqlConnection)
|
||||
@ -304,7 +325,7 @@ namespace VEPROMS.CSLA.Library
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
if(_MyLog.IsErrorEnabled)_MyLog.Error("AnnotationTypeInfo.DataPortal_Fetch", ex);
|
||||
if (_MyLog.IsErrorEnabled) _MyLog.Error("AnnotationTypeInfo.DataPortal_Fetch", ex);
|
||||
_ErrorMessage = ex.Message;
|
||||
throw new DbCslaException("AnnotationTypeInfo.DataPortal_Fetch", ex);
|
||||
}
|
||||
@ -314,7 +335,7 @@ namespace VEPROMS.CSLA.Library
|
||||
#region extension
|
||||
AnnotationTypeInfoExtension _AnnotationTypeInfoExtension = new AnnotationTypeInfoExtension();
|
||||
[Serializable()]
|
||||
partial class AnnotationTypeInfoExtension : extensionBase {}
|
||||
partial class AnnotationTypeInfoExtension : extensionBase { }
|
||||
[Serializable()]
|
||||
class extensionBase
|
||||
{
|
||||
|
@ -96,7 +96,7 @@ namespace VEPROMS.CSLA.Library
|
||||
private void DataPortal_Fetch()
|
||||
{
|
||||
this.RaiseListChangedEvents = false;
|
||||
if(_MyLog.IsDebugEnabled)_MyLog.DebugFormat("[{0}] AnnotationTypeInfoList.DataPortal_Fetch", GetHashCode());
|
||||
if (_MyLog.IsDebugEnabled) _MyLog.DebugFormat("[{0}] AnnotationTypeInfoList.DataPortal_Fetch", GetHashCode());
|
||||
try
|
||||
{
|
||||
using (SqlConnection cn = Database.VEPROMS_SqlConnection)
|
||||
@ -116,7 +116,7 @@ namespace VEPROMS.CSLA.Library
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
if(_MyLog.IsErrorEnabled)_MyLog.Error("AnnotationTypeInfoList.DataPortal_Fetch", ex);
|
||||
if (_MyLog.IsErrorEnabled) _MyLog.Error("AnnotationTypeInfoList.DataPortal_Fetch", ex);
|
||||
throw new DbCslaException("AnnotationTypeInfoList.DataPortal_Fetch", ex);
|
||||
}
|
||||
this.RaiseListChangedEvents = true;
|
||||
@ -177,8 +177,8 @@ namespace VEPROMS.CSLA.Library
|
||||
/// </summary>
|
||||
public partial class AnnotationTypeInfoListPropertyDescriptor : vlnListPropertyDescriptor
|
||||
{
|
||||
private AnnotationTypeInfo Item { get { return (AnnotationTypeInfo) _Item;} }
|
||||
public AnnotationTypeInfoListPropertyDescriptor(AnnotationTypeInfoList collection, int index):base(collection, index){;}
|
||||
private AnnotationTypeInfo Item { get { return (AnnotationTypeInfo)_Item; } }
|
||||
public AnnotationTypeInfoListPropertyDescriptor(AnnotationTypeInfoList collection, int index) : base(collection, index) { ;}
|
||||
}
|
||||
#endregion
|
||||
#region Converter
|
||||
@ -189,7 +189,7 @@ namespace VEPROMS.CSLA.Library
|
||||
if (destType == typeof(string) && value is AnnotationTypeInfoList)
|
||||
{
|
||||
// Return department and department role separated by comma.
|
||||
return ((AnnotationTypeInfoList) value).Items.Count.ToString() + " AnnotationTypes";
|
||||
return ((AnnotationTypeInfoList)value).Items.Count.ToString() + " AnnotationTypes";
|
||||
}
|
||||
return base.ConvertTo(context, culture, value, destType);
|
||||
}
|
||||
|
@ -47,21 +47,25 @@ namespace VEPROMS.CSLA.Library
|
||||
foreach (Assignment tmp in _RefreshAssignments)
|
||||
{
|
||||
AssignmentInfo.Refresh(tmp);
|
||||
if(tmp._MyFolder != null) FolderInfo.Refresh(tmp._MyFolder);
|
||||
if(tmp._MyGroup != null) GroupInfo.Refresh(tmp._MyGroup);
|
||||
if(tmp._MyRole != null) RoleInfo.Refresh(tmp._MyRole);
|
||||
if (tmp._MyFolder != null) FolderInfo.Refresh(tmp._MyFolder);
|
||||
if (tmp._MyGroup != null) GroupInfo.Refresh(tmp._MyGroup);
|
||||
if (tmp._MyRole != null) RoleInfo.Refresh(tmp._MyRole);
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
#region Collection
|
||||
protected static List<Assignment> _AllList = new List<Assignment>();
|
||||
private static Dictionary<string, Assignment> _AllByPrimaryKey = new Dictionary<string, Assignment>();
|
||||
private static Dictionary<string, List<Assignment>> _AllByPrimaryKey = new Dictionary<string, List<Assignment>>();
|
||||
private static void ConvertListToDictionary()
|
||||
{
|
||||
List<Assignment> remove = new List<Assignment>();
|
||||
foreach (Assignment tmp in _AllList)
|
||||
{
|
||||
_AllByPrimaryKey[tmp.AID.ToString()]=tmp; // Primary Key
|
||||
if (!_AllByPrimaryKey.ContainsKey(tmp.AID.ToString()))
|
||||
{
|
||||
_AllByPrimaryKey[tmp.AID.ToString()] = new List<Assignment>(); // Add new list for PrimaryKey
|
||||
}
|
||||
_AllByPrimaryKey[tmp.AID.ToString()].Add(tmp); // Add to Primary Key list
|
||||
remove.Add(tmp);
|
||||
}
|
||||
foreach (Assignment tmp in remove)
|
||||
@ -71,7 +75,7 @@ namespace VEPROMS.CSLA.Library
|
||||
{
|
||||
ConvertListToDictionary();
|
||||
string key = aid.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("AID",true);
|
||||
CanReadProperty("AID", true);
|
||||
return _AID;
|
||||
}
|
||||
}
|
||||
@ -103,7 +107,7 @@ namespace VEPROMS.CSLA.Library
|
||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||
get
|
||||
{
|
||||
CanReadProperty("GID",true);
|
||||
CanReadProperty("GID", true);
|
||||
if (_MyGroup != null) _GID = _MyGroup.GID;
|
||||
return _GID;
|
||||
}
|
||||
@ -114,14 +118,14 @@ namespace VEPROMS.CSLA.Library
|
||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||
get
|
||||
{
|
||||
CanReadProperty("MyGroup",true);
|
||||
CanReadProperty("MyGroup", true);
|
||||
if (_MyGroup == null && _GID != 0) _MyGroup = Group.Get(_GID);
|
||||
return _MyGroup;
|
||||
}
|
||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||
set
|
||||
{
|
||||
CanWriteProperty("MyGroup",true);
|
||||
CanWriteProperty("MyGroup", true);
|
||||
if (_MyGroup != value)
|
||||
{
|
||||
_MyGroup = value;
|
||||
@ -135,7 +139,7 @@ namespace VEPROMS.CSLA.Library
|
||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||
get
|
||||
{
|
||||
CanReadProperty("RID",true);
|
||||
CanReadProperty("RID", true);
|
||||
if (_MyRole != null) _RID = _MyRole.RID;
|
||||
return _RID;
|
||||
}
|
||||
@ -146,14 +150,14 @@ namespace VEPROMS.CSLA.Library
|
||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||
get
|
||||
{
|
||||
CanReadProperty("MyRole",true);
|
||||
CanReadProperty("MyRole", true);
|
||||
if (_MyRole == null && _RID != 0) _MyRole = Role.Get(_RID);
|
||||
return _MyRole;
|
||||
}
|
||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||
set
|
||||
{
|
||||
CanWriteProperty("MyRole",true);
|
||||
CanWriteProperty("MyRole", true);
|
||||
if (_MyRole != value)
|
||||
{
|
||||
_MyRole = value;
|
||||
@ -167,7 +171,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;
|
||||
}
|
||||
@ -178,14 +182,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;
|
||||
@ -199,13 +203,13 @@ namespace VEPROMS.CSLA.Library
|
||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||
get
|
||||
{
|
||||
CanReadProperty("StartDate",true);
|
||||
CanReadProperty("StartDate", true);
|
||||
return _StartDate;
|
||||
}
|
||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||
set
|
||||
{
|
||||
CanWriteProperty("StartDate",true);
|
||||
CanWriteProperty("StartDate", true);
|
||||
if (value == null) value = string.Empty;
|
||||
_StartDate = value;
|
||||
try
|
||||
@ -229,13 +233,13 @@ namespace VEPROMS.CSLA.Library
|
||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||
get
|
||||
{
|
||||
CanReadProperty("EndDate",true);
|
||||
CanReadProperty("EndDate", true);
|
||||
return _EndDate;
|
||||
}
|
||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||
set
|
||||
{
|
||||
CanWriteProperty("EndDate",true);
|
||||
CanWriteProperty("EndDate", true);
|
||||
if (value == null) value = string.Empty;
|
||||
_EndDate = value;
|
||||
try
|
||||
@ -259,13 +263,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;
|
||||
@ -279,13 +283,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)
|
||||
{
|
||||
@ -297,11 +301,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) || (_MyGroup == null? false : _MyGroup.IsDirty) || (_MyRole == null? false : _MyRole.IsDirty); }
|
||||
get { return base.IsDirty || (_MyFolder == null ? false : _MyFolder.IsDirty) || (_MyGroup == null ? false : _MyGroup.IsDirty) || (_MyRole == null ? false : _MyRole.IsDirty); }
|
||||
}
|
||||
public override bool IsValid
|
||||
{
|
||||
get { return (IsNew && !IsDirty ? true : base.IsValid) && (_MyFolder == null? true : _MyFolder.IsValid) && (_MyGroup == null? true : _MyGroup.IsValid) && (_MyRole == null? true : _MyRole.IsValid); }
|
||||
get { return (IsNew && !IsDirty ? true : base.IsValid) && (_MyFolder == null ? true : _MyFolder.IsValid) && (_MyGroup == null ? true : _MyGroup.IsValid) && (_MyRole == null ? true : _MyRole.IsValid); }
|
||||
}
|
||||
// TODO: Replace base Assignment.ToString function as necessary
|
||||
/// <summary>
|
||||
@ -324,15 +328,16 @@ 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 (_MyGroup != null && (hasBrokenRules = _MyGroup.HasBrokenRules) != null) return hasBrokenRules;
|
||||
if (_MyRole != null && (hasBrokenRules = _MyRole.HasBrokenRules) != null) return hasBrokenRules;
|
||||
@ -341,7 +346,7 @@ namespace VEPROMS.CSLA.Library
|
||||
}
|
||||
finally
|
||||
{
|
||||
_CheckingBrokenRules=false;
|
||||
_CheckingBrokenRules = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -498,14 +503,25 @@ namespace VEPROMS.CSLA.Library
|
||||
#region Factory Methods
|
||||
public int CurrentEditLevel
|
||||
{ get { return EditLevel; } }
|
||||
private static int _AssignmentUnique = 0;
|
||||
private int _MyAssignmentUnique;
|
||||
public int MyAssignmentUnique
|
||||
{
|
||||
get { return _MyAssignmentUnique; }
|
||||
}
|
||||
protected Assignment()
|
||||
{/* require use of factory methods */
|
||||
_MyAssignmentUnique = ++_AssignmentUnique;
|
||||
_AllList.Add(this);
|
||||
}
|
||||
public void Dispose()
|
||||
{
|
||||
_AllList.Remove(this);
|
||||
_AllByPrimaryKey.Remove(AID.ToString());
|
||||
if (!_AllByPrimaryKey.ContainsKey(AID.ToString())) return;
|
||||
List<Assignment> listAssignment = _AllByPrimaryKey[AID.ToString()]; // Get the list of items
|
||||
listAssignment.Remove(this); // Remove the item from the list
|
||||
if (listAssignment.Count == 0) //If there are no items left in the list
|
||||
_AllByPrimaryKey.Remove(AID.ToString()); // remove the list
|
||||
}
|
||||
public static Assignment New()
|
||||
{
|
||||
@ -591,7 +607,7 @@ namespace VEPROMS.CSLA.Library
|
||||
if (tmp == null)
|
||||
{
|
||||
tmp = DataPortal.Fetch<Assignment>(new PKCriteria(aid));
|
||||
_AllList.Add(tmp);
|
||||
if (!_AllList.Contains(tmp)) _AllList.Add(tmp);
|
||||
}
|
||||
if (tmp.ErrorMessage == "No Record Found") tmp = null;
|
||||
return tmp;
|
||||
@ -671,7 +687,7 @@ namespace VEPROMS.CSLA.Library
|
||||
}
|
||||
private void ReadData(SafeDataReader dr)
|
||||
{
|
||||
if(_MyLog.IsDebugEnabled)_MyLog.DebugFormat("[{0}] Assignment.ReadData", GetHashCode());
|
||||
if (_MyLog.IsDebugEnabled) _MyLog.DebugFormat("[{0}] Assignment.ReadData", GetHashCode());
|
||||
try
|
||||
{
|
||||
_AID = dr.GetInt32("AID");
|
||||
@ -687,14 +703,14 @@ namespace VEPROMS.CSLA.Library
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
if(_MyLog.IsErrorEnabled)_MyLog.Error("Assignment.ReadData", ex);
|
||||
if (_MyLog.IsErrorEnabled) _MyLog.Error("Assignment.ReadData", ex);
|
||||
_ErrorMessage = ex.Message;
|
||||
throw new DbCslaException("Assignment.ReadData", ex);
|
||||
}
|
||||
}
|
||||
private void DataPortal_Fetch(PKCriteria criteria)
|
||||
{
|
||||
if(_MyLog.IsDebugEnabled)_MyLog.DebugFormat("[{0}] Assignment.DataPortal_Fetch", GetHashCode());
|
||||
if (_MyLog.IsDebugEnabled) _MyLog.DebugFormat("[{0}] Assignment.DataPortal_Fetch", GetHashCode());
|
||||
try
|
||||
{
|
||||
using (SqlConnection cn = Database.VEPROMS_SqlConnection)
|
||||
@ -722,7 +738,7 @@ namespace VEPROMS.CSLA.Library
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
if(_MyLog.IsErrorEnabled)_MyLog.Error("Assignment.DataPortal_Fetch", ex);
|
||||
if (_MyLog.IsErrorEnabled) _MyLog.Error("Assignment.DataPortal_Fetch", ex);
|
||||
_ErrorMessage = ex.Message;
|
||||
throw new DbCslaException("Assignment.DataPortal_Fetch", ex);
|
||||
}
|
||||
@ -743,13 +759,13 @@ namespace VEPROMS.CSLA.Library
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
if(_MyLog.IsErrorEnabled)_MyLog.Error("Assignment.DataPortal_Insert", ex);
|
||||
if (_MyLog.IsErrorEnabled) _MyLog.Error("Assignment.DataPortal_Insert", ex);
|
||||
_ErrorMessage = ex.Message;
|
||||
throw new DbCslaException("Assignment.DataPortal_Insert", ex);
|
||||
}
|
||||
finally
|
||||
{
|
||||
if(_MyLog.IsDebugEnabled)_MyLog.DebugFormat("[{0}] Assignment.DataPortal_Insert", GetHashCode());
|
||||
if (_MyLog.IsDebugEnabled) _MyLog.DebugFormat("[{0}] Assignment.DataPortal_Insert", GetHashCode());
|
||||
}
|
||||
}
|
||||
[Transactional(TransactionalTypes.TransactionScope)]
|
||||
@ -758,9 +774,9 @@ namespace VEPROMS.CSLA.Library
|
||||
if (!this.IsDirty) return;
|
||||
try
|
||||
{
|
||||
if(_MyFolder != null) _MyFolder.Update();
|
||||
if(_MyGroup != null) _MyGroup.Update();
|
||||
if(_MyRole != null) _MyRole.Update();
|
||||
if (_MyFolder != null) _MyFolder.Update();
|
||||
if (_MyGroup != null) _MyGroup.Update();
|
||||
if (_MyRole != null) _MyRole.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}] Assignment.SQLInsert", GetHashCode());
|
||||
if (_MyLog.IsDebugEnabled) _MyLog.DebugFormat("[{0}] Assignment.SQLInsert", GetHashCode());
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
if(_MyLog.IsErrorEnabled)_MyLog.Error("Assignment.SQLInsert", ex);
|
||||
if (_MyLog.IsErrorEnabled) _MyLog.Error("Assignment.SQLInsert", ex);
|
||||
_ErrorMessage = ex.Message;
|
||||
throw new DbCslaException("Assignment.SQLInsert", ex);
|
||||
}
|
||||
@ -801,7 +817,7 @@ namespace VEPROMS.CSLA.Library
|
||||
[Transactional(TransactionalTypes.TransactionScope)]
|
||||
public static byte[] Add(SqlConnection cn, ref int aid, Group myGroup, Role myRole, Folder myFolder, SmartDate startDate, SmartDate endDate, DateTime dts, string usrID)
|
||||
{
|
||||
if(_MyLog.IsDebugEnabled)_MyLog.DebugFormat("[{0}] Assignment.Add", 0);
|
||||
if (_MyLog.IsDebugEnabled) _MyLog.DebugFormat("[{0}] Assignment.Add", 0);
|
||||
try
|
||||
{
|
||||
using (SqlCommand cm = cn.CreateCommand())
|
||||
@ -832,7 +848,7 @@ namespace VEPROMS.CSLA.Library
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
if(_MyLog.IsErrorEnabled)_MyLog.Error("Assignment.Add", ex);
|
||||
if (_MyLog.IsErrorEnabled) _MyLog.Error("Assignment.Add", ex);
|
||||
throw new DbCslaException("Assignment.Add", ex);
|
||||
}
|
||||
}
|
||||
@ -840,7 +856,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}] Assignment.DataPortal_Update", GetHashCode());
|
||||
if (_MyLog.IsDebugEnabled) _MyLog.DebugFormat("[{0}] Assignment.DataPortal_Update", GetHashCode());
|
||||
try
|
||||
{
|
||||
using (SqlConnection cn = Database.VEPROMS_SqlConnection)
|
||||
@ -854,7 +870,7 @@ namespace VEPROMS.CSLA.Library
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
if(_MyLog.IsErrorEnabled)_MyLog.Error("Assignment.DataPortal_Update", ex);
|
||||
if (_MyLog.IsErrorEnabled) _MyLog.Error("Assignment.DataPortal_Update", ex);
|
||||
_ErrorMessage = ex.Message;
|
||||
if (!ex.Message.EndsWith("has been edited by another user.")) throw ex;
|
||||
}
|
||||
@ -863,12 +879,12 @@ namespace VEPROMS.CSLA.Library
|
||||
internal void SQLUpdate()
|
||||
{
|
||||
if (!IsDirty) return; // If not dirty - nothing to do
|
||||
if(_MyLog.IsDebugEnabled)_MyLog.DebugFormat("[{0}] Assignment.SQLUpdate", GetHashCode());
|
||||
if (_MyLog.IsDebugEnabled) _MyLog.DebugFormat("[{0}] Assignment.SQLUpdate", GetHashCode());
|
||||
try
|
||||
{
|
||||
if(_MyFolder != null) _MyFolder.Update();
|
||||
if(_MyGroup != null) _MyGroup.Update();
|
||||
if(_MyRole != null) _MyRole.Update();
|
||||
if (_MyFolder != null) _MyFolder.Update();
|
||||
if (_MyGroup != null) _MyGroup.Update();
|
||||
if (_MyRole != null) _MyRole.Update();
|
||||
SqlConnection cn = (SqlConnection)ApplicationContext.LocalContext["cn"];
|
||||
if (base.IsDirty)
|
||||
{
|
||||
@ -901,7 +917,7 @@ namespace VEPROMS.CSLA.Library
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
if(_MyLog.IsErrorEnabled)_MyLog.Error("Assignment.SQLUpdate", ex);
|
||||
if (_MyLog.IsErrorEnabled) _MyLog.Error("Assignment.SQLUpdate", ex);
|
||||
_ErrorMessage = ex.Message;
|
||||
if (!ex.Message.EndsWith("has been edited by another user.")) throw ex;
|
||||
}
|
||||
@ -922,7 +938,7 @@ namespace VEPROMS.CSLA.Library
|
||||
[Transactional(TransactionalTypes.TransactionScope)]
|
||||
public static byte[] Update(SqlConnection cn, ref int aid, Group myGroup, Role myRole, Folder myFolder, SmartDate startDate, SmartDate endDate, DateTime dts, string usrID, ref byte[] lastChanged)
|
||||
{
|
||||
if(_MyLog.IsDebugEnabled)_MyLog.DebugFormat("[{0}] Assignment.Update", 0);
|
||||
if (_MyLog.IsDebugEnabled) _MyLog.DebugFormat("[{0}] Assignment.Update", 0);
|
||||
try
|
||||
{
|
||||
using (SqlCommand cm = cn.CreateCommand())
|
||||
@ -951,7 +967,7 @@ namespace VEPROMS.CSLA.Library
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
if(_MyLog.IsErrorEnabled)_MyLog.Error("Assignment.Update", ex);
|
||||
if (_MyLog.IsErrorEnabled) _MyLog.Error("Assignment.Update", ex);
|
||||
throw new DbCslaException("Assignment.Update", ex);
|
||||
}
|
||||
}
|
||||
@ -963,7 +979,7 @@ namespace VEPROMS.CSLA.Library
|
||||
[Transactional(TransactionalTypes.TransactionScope)]
|
||||
private void DataPortal_Delete(PKCriteria criteria)
|
||||
{
|
||||
if(_MyLog.IsDebugEnabled)_MyLog.DebugFormat("[{0}] Assignment.DataPortal_Delete", GetHashCode());
|
||||
if (_MyLog.IsDebugEnabled) _MyLog.DebugFormat("[{0}] Assignment.DataPortal_Delete", GetHashCode());
|
||||
try
|
||||
{
|
||||
using (SqlConnection cn = Database.VEPROMS_SqlConnection)
|
||||
@ -979,7 +995,7 @@ namespace VEPROMS.CSLA.Library
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
if(_MyLog.IsErrorEnabled)_MyLog.Error("Assignment.DataPortal_Delete", ex);
|
||||
if (_MyLog.IsErrorEnabled) _MyLog.Error("Assignment.DataPortal_Delete", ex);
|
||||
_ErrorMessage = ex.Message;
|
||||
throw new DbCslaException("Assignment.DataPortal_Delete", ex);
|
||||
}
|
||||
@ -987,7 +1003,7 @@ namespace VEPROMS.CSLA.Library
|
||||
[Transactional(TransactionalTypes.TransactionScope)]
|
||||
public static void Remove(SqlConnection cn, int aid)
|
||||
{
|
||||
if(_MyLog.IsDebugEnabled)_MyLog.DebugFormat("[{0}] Assignment.Remove", 0);
|
||||
if (_MyLog.IsDebugEnabled) _MyLog.DebugFormat("[{0}] Assignment.Remove", 0);
|
||||
try
|
||||
{
|
||||
using (SqlCommand cm = cn.CreateCommand())
|
||||
@ -1002,7 +1018,7 @@ namespace VEPROMS.CSLA.Library
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
if(_MyLog.IsErrorEnabled)_MyLog.Error("Assignment.Remove", ex);
|
||||
if (_MyLog.IsErrorEnabled) _MyLog.Error("Assignment.Remove", ex);
|
||||
throw new DbCslaException("Assignment.Remove", ex);
|
||||
}
|
||||
}
|
||||
@ -1036,7 +1052,7 @@ namespace VEPROMS.CSLA.Library
|
||||
}
|
||||
protected override void DataPortal_Execute()
|
||||
{
|
||||
if(_MyLog.IsDebugEnabled)_MyLog.DebugFormat("[{0}] Assignment.DataPortal_Execute", GetHashCode());
|
||||
if (_MyLog.IsDebugEnabled) _MyLog.DebugFormat("[{0}] Assignment.DataPortal_Execute", GetHashCode());
|
||||
try
|
||||
{
|
||||
using (SqlConnection cn = Database.VEPROMS_SqlConnection)
|
||||
@ -1054,7 +1070,7 @@ namespace VEPROMS.CSLA.Library
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
if(_MyLog.IsErrorEnabled)_MyLog.Error("Assignment.DataPortal_Execute", ex);
|
||||
if (_MyLog.IsErrorEnabled) _MyLog.Error("Assignment.DataPortal_Execute", ex);
|
||||
throw new DbCslaException("Assignment.DataPortal_Execute", ex);
|
||||
}
|
||||
}
|
||||
|
@ -37,13 +37,17 @@ namespace VEPROMS.CSLA.Library
|
||||
#endregion
|
||||
#region Collection
|
||||
protected static List<AssignmentInfo> _AllList = new List<AssignmentInfo>();
|
||||
private static Dictionary<string, AssignmentInfo> _AllByPrimaryKey = new Dictionary<string, AssignmentInfo>();
|
||||
private static Dictionary<string, List<AssignmentInfo>> _AllByPrimaryKey = new Dictionary<string, List<AssignmentInfo>>();
|
||||
private static void ConvertListToDictionary()
|
||||
{
|
||||
List<AssignmentInfo> remove = new List<AssignmentInfo>();
|
||||
foreach (AssignmentInfo tmp in _AllList)
|
||||
{
|
||||
_AllByPrimaryKey[tmp.AID.ToString()]=tmp; // Primary Key
|
||||
if (!_AllByPrimaryKey.ContainsKey(tmp.AID.ToString()))
|
||||
{
|
||||
_AllByPrimaryKey[tmp.AID.ToString()] = new List<AssignmentInfo>(); // Add new list for PrimaryKey
|
||||
}
|
||||
_AllByPrimaryKey[tmp.AID.ToString()].Add(tmp); // Add to Primary Key list
|
||||
remove.Add(tmp);
|
||||
}
|
||||
foreach (AssignmentInfo tmp in remove)
|
||||
@ -57,7 +61,7 @@ namespace VEPROMS.CSLA.Library
|
||||
{
|
||||
ConvertListToDictionary();
|
||||
string key = aid.ToString();
|
||||
if (_AllByPrimaryKey.ContainsKey(key)) return _AllByPrimaryKey[key];
|
||||
if (_AllByPrimaryKey.ContainsKey(key)) return _AllByPrimaryKey[key][0];
|
||||
return null;
|
||||
}
|
||||
#endregion
|
||||
@ -85,7 +89,7 @@ namespace VEPROMS.CSLA.Library
|
||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||
get
|
||||
{
|
||||
CanReadProperty("AID",true);
|
||||
CanReadProperty("AID", true);
|
||||
return _AID;
|
||||
}
|
||||
}
|
||||
@ -95,7 +99,7 @@ namespace VEPROMS.CSLA.Library
|
||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||
get
|
||||
{
|
||||
CanReadProperty("GID",true);
|
||||
CanReadProperty("GID", true);
|
||||
if (_MyGroup != null) _GID = _MyGroup.GID;
|
||||
return _GID;
|
||||
}
|
||||
@ -106,7 +110,7 @@ namespace VEPROMS.CSLA.Library
|
||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||
get
|
||||
{
|
||||
CanReadProperty("MyGroup",true);
|
||||
CanReadProperty("MyGroup", true);
|
||||
if (_MyGroup == null && _GID != 0) _MyGroup = GroupInfo.Get(_GID);
|
||||
return _MyGroup;
|
||||
}
|
||||
@ -117,7 +121,7 @@ namespace VEPROMS.CSLA.Library
|
||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||
get
|
||||
{
|
||||
CanReadProperty("RID",true);
|
||||
CanReadProperty("RID", true);
|
||||
if (_MyRole != null) _RID = _MyRole.RID;
|
||||
return _RID;
|
||||
}
|
||||
@ -128,7 +132,7 @@ namespace VEPROMS.CSLA.Library
|
||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||
get
|
||||
{
|
||||
CanReadProperty("MyRole",true);
|
||||
CanReadProperty("MyRole", true);
|
||||
if (_MyRole == null && _RID != 0) _MyRole = RoleInfo.Get(_RID);
|
||||
return _MyRole;
|
||||
}
|
||||
@ -139,7 +143,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;
|
||||
}
|
||||
@ -150,7 +154,7 @@ 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 = FolderInfo.Get(_FolderID);
|
||||
return _MyFolder;
|
||||
}
|
||||
@ -161,7 +165,7 @@ namespace VEPROMS.CSLA.Library
|
||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||
get
|
||||
{
|
||||
CanReadProperty("StartDate",true);
|
||||
CanReadProperty("StartDate", true);
|
||||
return _StartDate;
|
||||
}
|
||||
}
|
||||
@ -171,7 +175,7 @@ namespace VEPROMS.CSLA.Library
|
||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||
get
|
||||
{
|
||||
CanReadProperty("EndDate",true);
|
||||
CanReadProperty("EndDate", true);
|
||||
return _EndDate;
|
||||
}
|
||||
}
|
||||
@ -181,7 +185,7 @@ namespace VEPROMS.CSLA.Library
|
||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||
get
|
||||
{
|
||||
CanReadProperty("DTS",true);
|
||||
CanReadProperty("DTS", true);
|
||||
return _DTS;
|
||||
}
|
||||
}
|
||||
@ -191,7 +195,7 @@ namespace VEPROMS.CSLA.Library
|
||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||
get
|
||||
{
|
||||
CanReadProperty("UsrID",true);
|
||||
CanReadProperty("UsrID", true);
|
||||
return _UsrID;
|
||||
}
|
||||
}
|
||||
@ -215,14 +219,25 @@ namespace VEPROMS.CSLA.Library
|
||||
}
|
||||
#endregion
|
||||
#region Factory Methods
|
||||
private static int _AssignmentInfoUnique = 0;
|
||||
private int _MyAssignmentInfoUnique;
|
||||
public int MyAssignmentInfoUnique
|
||||
{
|
||||
get { return _MyAssignmentInfoUnique; }
|
||||
}
|
||||
private AssignmentInfo()
|
||||
{/* require use of factory methods */
|
||||
_MyAssignmentInfoUnique = ++_AssignmentInfoUnique;
|
||||
_AllList.Add(this);
|
||||
}
|
||||
public void Dispose()
|
||||
{
|
||||
_AllList.Remove(this);
|
||||
_AllByPrimaryKey.Remove(AID.ToString());
|
||||
if (!_AllByPrimaryKey.ContainsKey(AID.ToString())) return;
|
||||
List<AssignmentInfo> listAssignmentInfo = _AllByPrimaryKey[AID.ToString()]; // Get the list of items
|
||||
listAssignmentInfo.Remove(this); // Remove the item from the list
|
||||
if (listAssignmentInfo.Count == 0) // If there are no items left in the list
|
||||
_AllByPrimaryKey.Remove(AID.ToString()); // remove the list
|
||||
}
|
||||
public virtual Assignment Get()
|
||||
{
|
||||
@ -230,8 +245,10 @@ namespace VEPROMS.CSLA.Library
|
||||
}
|
||||
public static void Refresh(Assignment tmp)
|
||||
{
|
||||
AssignmentInfo tmpInfo = GetExistingByPrimaryKey(tmp.AID);
|
||||
if (tmpInfo == null) return;
|
||||
string key = tmp.AID.ToString();
|
||||
ConvertListToDictionary();
|
||||
if (_AllByPrimaryKey.ContainsKey(key))
|
||||
foreach (AssignmentInfo tmpInfo in _AllByPrimaryKey[key])
|
||||
tmpInfo.RefreshFields(tmp);
|
||||
}
|
||||
private void RefreshFields(Assignment tmp)
|
||||
@ -240,23 +257,23 @@ namespace VEPROMS.CSLA.Library
|
||||
{
|
||||
MyGroup.RefreshGroupAssignments(); // Update List for old value
|
||||
_GID = tmp.GID; // Update the value
|
||||
_MyGroup = null; // Reset list so that the next line gets a new list
|
||||
MyGroup.RefreshGroupAssignments(); // Update List for new value
|
||||
}
|
||||
_MyGroup = null; // Reset list so that the next line gets a new list
|
||||
if (MyGroup != null) MyGroup.RefreshGroupAssignments(); // Update List for new value
|
||||
if (_RID != tmp.RID)
|
||||
{
|
||||
MyRole.RefreshRoleAssignments(); // Update List for old value
|
||||
_RID = tmp.RID; // Update the value
|
||||
_MyRole = null; // Reset list so that the next line gets a new list
|
||||
MyRole.RefreshRoleAssignments(); // Update List for new value
|
||||
}
|
||||
_MyRole = null; // Reset list so that the next line gets a new list
|
||||
if (MyRole != null) MyRole.RefreshRoleAssignments(); // Update List for new value
|
||||
if (_FolderID != tmp.FolderID)
|
||||
{
|
||||
MyFolder.RefreshFolderAssignments(); // Update List for old value
|
||||
_FolderID = tmp.FolderID; // Update the value
|
||||
_MyFolder = null; // Reset list so that the next line gets a new list
|
||||
MyFolder.RefreshFolderAssignments(); // Update List for new value
|
||||
}
|
||||
_MyFolder = null; // Reset list so that the next line gets a new list
|
||||
if (MyFolder != null) MyFolder.RefreshFolderAssignments(); // Update List for new value
|
||||
_StartDate = tmp.StartDate;
|
||||
_EndDate = tmp.EndDate;
|
||||
_DTS = tmp.DTS;
|
||||
@ -269,8 +286,10 @@ namespace VEPROMS.CSLA.Library
|
||||
}
|
||||
public static void Refresh(FolderAssignment tmp)
|
||||
{
|
||||
AssignmentInfo tmpInfo = GetExistingByPrimaryKey(tmp.AID);
|
||||
if (tmpInfo == null) return;
|
||||
string key = tmp.AID.ToString();
|
||||
ConvertListToDictionary();
|
||||
if (_AllByPrimaryKey.ContainsKey(key))
|
||||
foreach (AssignmentInfo tmpInfo in _AllByPrimaryKey[key])
|
||||
tmpInfo.RefreshFields(tmp);
|
||||
}
|
||||
private void RefreshFields(FolderAssignment tmp)
|
||||
@ -279,16 +298,16 @@ namespace VEPROMS.CSLA.Library
|
||||
{
|
||||
MyGroup.RefreshGroupAssignments(); // Update List for old value
|
||||
_GID = tmp.GID; // Update the value
|
||||
_MyGroup = null; // Reset list so that the next line gets a new list
|
||||
MyGroup.RefreshGroupAssignments(); // Update List for new value
|
||||
}
|
||||
_MyGroup = null; // Reset list so that the next line gets a new list
|
||||
if (MyGroup != null) MyGroup.RefreshGroupAssignments(); // Update List for new value
|
||||
if (_RID != tmp.RID)
|
||||
{
|
||||
MyRole.RefreshRoleAssignments(); // Update List for old value
|
||||
_RID = tmp.RID; // Update the value
|
||||
_MyRole = null; // Reset list so that the next line gets a new list
|
||||
MyRole.RefreshRoleAssignments(); // Update List for new value
|
||||
}
|
||||
_MyRole = null; // Reset list so that the next line gets a new list
|
||||
if (MyRole != null) MyRole.RefreshRoleAssignments(); // Update List for new value
|
||||
_StartDate = tmp.StartDate;
|
||||
_EndDate = tmp.EndDate;
|
||||
_DTS = tmp.DTS;
|
||||
@ -301,8 +320,10 @@ namespace VEPROMS.CSLA.Library
|
||||
}
|
||||
public static void Refresh(GroupAssignment tmp)
|
||||
{
|
||||
AssignmentInfo tmpInfo = GetExistingByPrimaryKey(tmp.AID);
|
||||
if (tmpInfo == null) return;
|
||||
string key = tmp.AID.ToString();
|
||||
ConvertListToDictionary();
|
||||
if (_AllByPrimaryKey.ContainsKey(key))
|
||||
foreach (AssignmentInfo tmpInfo in _AllByPrimaryKey[key])
|
||||
tmpInfo.RefreshFields(tmp);
|
||||
}
|
||||
private void RefreshFields(GroupAssignment tmp)
|
||||
@ -311,16 +332,16 @@ namespace VEPROMS.CSLA.Library
|
||||
{
|
||||
MyRole.RefreshRoleAssignments(); // Update List for old value
|
||||
_RID = tmp.RID; // Update the value
|
||||
_MyRole = null; // Reset list so that the next line gets a new list
|
||||
MyRole.RefreshRoleAssignments(); // Update List for new value
|
||||
}
|
||||
_MyRole = null; // Reset list so that the next line gets a new list
|
||||
if (MyRole != null) MyRole.RefreshRoleAssignments(); // Update List for new value
|
||||
if (_FolderID != tmp.FolderID)
|
||||
{
|
||||
MyFolder.RefreshFolderAssignments(); // Update List for old value
|
||||
_FolderID = tmp.FolderID; // Update the value
|
||||
_MyFolder = null; // Reset list so that the next line gets a new list
|
||||
MyFolder.RefreshFolderAssignments(); // Update List for new value
|
||||
}
|
||||
_MyFolder = null; // Reset list so that the next line gets a new list
|
||||
if (MyFolder != null) MyFolder.RefreshFolderAssignments(); // Update List for new value
|
||||
_StartDate = tmp.StartDate;
|
||||
_EndDate = tmp.EndDate;
|
||||
_DTS = tmp.DTS;
|
||||
@ -333,8 +354,10 @@ namespace VEPROMS.CSLA.Library
|
||||
}
|
||||
public static void Refresh(RoleAssignment tmp)
|
||||
{
|
||||
AssignmentInfo tmpInfo = GetExistingByPrimaryKey(tmp.AID);
|
||||
if (tmpInfo == null) return;
|
||||
string key = tmp.AID.ToString();
|
||||
ConvertListToDictionary();
|
||||
if (_AllByPrimaryKey.ContainsKey(key))
|
||||
foreach (AssignmentInfo tmpInfo in _AllByPrimaryKey[key])
|
||||
tmpInfo.RefreshFields(tmp);
|
||||
}
|
||||
private void RefreshFields(RoleAssignment tmp)
|
||||
@ -343,16 +366,16 @@ namespace VEPROMS.CSLA.Library
|
||||
{
|
||||
MyGroup.RefreshGroupAssignments(); // Update List for old value
|
||||
_GID = tmp.GID; // Update the value
|
||||
_MyGroup = null; // Reset list so that the next line gets a new list
|
||||
MyGroup.RefreshGroupAssignments(); // Update List for new value
|
||||
}
|
||||
_MyGroup = null; // Reset list so that the next line gets a new list
|
||||
if (MyGroup != null) MyGroup.RefreshGroupAssignments(); // Update List for new value
|
||||
if (_FolderID != tmp.FolderID)
|
||||
{
|
||||
MyFolder.RefreshFolderAssignments(); // Update List for old value
|
||||
_FolderID = tmp.FolderID; // Update the value
|
||||
_MyFolder = null; // Reset list so that the next line gets a new list
|
||||
MyFolder.RefreshFolderAssignments(); // Update List for new value
|
||||
}
|
||||
_MyFolder = null; // Reset list so that the next line gets a new list
|
||||
if (MyFolder != null) MyFolder.RefreshFolderAssignments(); // Update List for new value
|
||||
_StartDate = tmp.StartDate;
|
||||
_EndDate = tmp.EndDate;
|
||||
_DTS = tmp.DTS;
|
||||
@ -373,7 +396,7 @@ namespace VEPROMS.CSLA.Library
|
||||
if (tmp == null)
|
||||
{
|
||||
tmp = DataPortal.Fetch<AssignmentInfo>(new PKCriteria(aid));
|
||||
_AllList.Add(tmp);
|
||||
if (!_AllList.Contains(tmp)) _AllList.Add(tmp);
|
||||
}
|
||||
if (tmp.ErrorMessage == "No Record Found") tmp = null;
|
||||
return tmp;
|
||||
@ -387,14 +410,15 @@ namespace VEPROMS.CSLA.Library
|
||||
#region Data Access Portal
|
||||
internal AssignmentInfo(SafeDataReader dr)
|
||||
{
|
||||
if(_MyLog.IsDebugEnabled)_MyLog.DebugFormat("[{0}] AssignmentInfo.Constructor", GetHashCode());
|
||||
_MyAssignmentInfoUnique = ++_AssignmentInfoUnique;
|
||||
if (_MyLog.IsDebugEnabled) _MyLog.DebugFormat("[{0}] AssignmentInfo.Constructor", GetHashCode());
|
||||
try
|
||||
{
|
||||
ReadData(dr);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
if(_MyLog.IsErrorEnabled)_MyLog.Error("AssignmentInfo.Constructor", ex);
|
||||
if (_MyLog.IsErrorEnabled) _MyLog.Error("AssignmentInfo.Constructor", ex);
|
||||
throw new DbCslaException("AssignmentInfo.Constructor", ex);
|
||||
}
|
||||
}
|
||||
@ -411,7 +435,7 @@ namespace VEPROMS.CSLA.Library
|
||||
}
|
||||
private void ReadData(SafeDataReader dr)
|
||||
{
|
||||
if(_MyLog.IsDebugEnabled)_MyLog.DebugFormat("[{0}] AssignmentInfo.ReadData", GetHashCode());
|
||||
if (_MyLog.IsDebugEnabled) _MyLog.DebugFormat("[{0}] AssignmentInfo.ReadData", GetHashCode());
|
||||
try
|
||||
{
|
||||
_AID = dr.GetInt32("AID");
|
||||
@ -425,14 +449,14 @@ namespace VEPROMS.CSLA.Library
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
if(_MyLog.IsErrorEnabled)_MyLog.Error("AssignmentInfo.ReadData", ex);
|
||||
if (_MyLog.IsErrorEnabled) _MyLog.Error("AssignmentInfo.ReadData", ex);
|
||||
_ErrorMessage = ex.Message;
|
||||
throw new DbCslaException("AssignmentInfo.ReadData", ex);
|
||||
}
|
||||
}
|
||||
private void DataPortal_Fetch(PKCriteria criteria)
|
||||
{
|
||||
if(_MyLog.IsDebugEnabled)_MyLog.DebugFormat("[{0}] AssignmentInfo.DataPortal_Fetch", GetHashCode());
|
||||
if (_MyLog.IsDebugEnabled) _MyLog.DebugFormat("[{0}] AssignmentInfo.DataPortal_Fetch", GetHashCode());
|
||||
try
|
||||
{
|
||||
using (SqlConnection cn = Database.VEPROMS_SqlConnection)
|
||||
@ -460,7 +484,7 @@ namespace VEPROMS.CSLA.Library
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
if(_MyLog.IsErrorEnabled)_MyLog.Error("AssignmentInfo.DataPortal_Fetch", ex);
|
||||
if (_MyLog.IsErrorEnabled) _MyLog.Error("AssignmentInfo.DataPortal_Fetch", ex);
|
||||
_ErrorMessage = ex.Message;
|
||||
throw new DbCslaException("AssignmentInfo.DataPortal_Fetch", ex);
|
||||
}
|
||||
@ -470,7 +494,7 @@ namespace VEPROMS.CSLA.Library
|
||||
#region extension
|
||||
AssignmentInfoExtension _AssignmentInfoExtension = new AssignmentInfoExtension();
|
||||
[Serializable()]
|
||||
partial class AssignmentInfoExtension : extensionBase {}
|
||||
partial class AssignmentInfoExtension : extensionBase { }
|
||||
[Serializable()]
|
||||
class extensionBase
|
||||
{
|
||||
|
@ -138,7 +138,7 @@ namespace VEPROMS.CSLA.Library
|
||||
private void DataPortal_Fetch()
|
||||
{
|
||||
this.RaiseListChangedEvents = false;
|
||||
if(_MyLog.IsDebugEnabled)_MyLog.DebugFormat("[{0}] AssignmentInfoList.DataPortal_Fetch", GetHashCode());
|
||||
if (_MyLog.IsDebugEnabled) _MyLog.DebugFormat("[{0}] AssignmentInfoList.DataPortal_Fetch", GetHashCode());
|
||||
try
|
||||
{
|
||||
using (SqlConnection cn = Database.VEPROMS_SqlConnection)
|
||||
@ -158,7 +158,7 @@ namespace VEPROMS.CSLA.Library
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
if(_MyLog.IsErrorEnabled)_MyLog.Error("AssignmentInfoList.DataPortal_Fetch", ex);
|
||||
if (_MyLog.IsErrorEnabled) _MyLog.Error("AssignmentInfoList.DataPortal_Fetch", ex);
|
||||
throw new DbCslaException("AssignmentInfoList.DataPortal_Fetch", ex);
|
||||
}
|
||||
this.RaiseListChangedEvents = true;
|
||||
@ -180,7 +180,7 @@ namespace VEPROMS.CSLA.Library
|
||||
private void DataPortal_Fetch(FolderIDCriteria criteria)
|
||||
{
|
||||
this.RaiseListChangedEvents = false;
|
||||
if(_MyLog.IsDebugEnabled)_MyLog.DebugFormat("[{0}] AssignmentInfoList.DataPortal_FetchFolderID", GetHashCode());
|
||||
if (_MyLog.IsDebugEnabled) _MyLog.DebugFormat("[{0}] AssignmentInfoList.DataPortal_FetchFolderID", GetHashCode());
|
||||
try
|
||||
{
|
||||
using (SqlConnection cn = Database.VEPROMS_SqlConnection)
|
||||
@ -201,7 +201,7 @@ namespace VEPROMS.CSLA.Library
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
if(_MyLog.IsErrorEnabled)_MyLog.Error("AssignmentInfoList.DataPortal_FetchFolderID", ex);
|
||||
if (_MyLog.IsErrorEnabled) _MyLog.Error("AssignmentInfoList.DataPortal_FetchFolderID", ex);
|
||||
throw new DbCslaException("AssignmentInfoList.DataPortal_Fetch", ex);
|
||||
}
|
||||
this.RaiseListChangedEvents = true;
|
||||
@ -223,7 +223,7 @@ namespace VEPROMS.CSLA.Library
|
||||
private void DataPortal_Fetch(GIDCriteria criteria)
|
||||
{
|
||||
this.RaiseListChangedEvents = false;
|
||||
if(_MyLog.IsDebugEnabled)_MyLog.DebugFormat("[{0}] AssignmentInfoList.DataPortal_FetchGID", GetHashCode());
|
||||
if (_MyLog.IsDebugEnabled) _MyLog.DebugFormat("[{0}] AssignmentInfoList.DataPortal_FetchGID", GetHashCode());
|
||||
try
|
||||
{
|
||||
using (SqlConnection cn = Database.VEPROMS_SqlConnection)
|
||||
@ -244,7 +244,7 @@ namespace VEPROMS.CSLA.Library
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
if(_MyLog.IsErrorEnabled)_MyLog.Error("AssignmentInfoList.DataPortal_FetchGID", ex);
|
||||
if (_MyLog.IsErrorEnabled) _MyLog.Error("AssignmentInfoList.DataPortal_FetchGID", ex);
|
||||
throw new DbCslaException("AssignmentInfoList.DataPortal_Fetch", ex);
|
||||
}
|
||||
this.RaiseListChangedEvents = true;
|
||||
@ -266,7 +266,7 @@ namespace VEPROMS.CSLA.Library
|
||||
private void DataPortal_Fetch(RIDCriteria criteria)
|
||||
{
|
||||
this.RaiseListChangedEvents = false;
|
||||
if(_MyLog.IsDebugEnabled)_MyLog.DebugFormat("[{0}] AssignmentInfoList.DataPortal_FetchRID", GetHashCode());
|
||||
if (_MyLog.IsDebugEnabled) _MyLog.DebugFormat("[{0}] AssignmentInfoList.DataPortal_FetchRID", GetHashCode());
|
||||
try
|
||||
{
|
||||
using (SqlConnection cn = Database.VEPROMS_SqlConnection)
|
||||
@ -287,7 +287,7 @@ namespace VEPROMS.CSLA.Library
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
if(_MyLog.IsErrorEnabled)_MyLog.Error("AssignmentInfoList.DataPortal_FetchRID", ex);
|
||||
if (_MyLog.IsErrorEnabled) _MyLog.Error("AssignmentInfoList.DataPortal_FetchRID", ex);
|
||||
throw new DbCslaException("AssignmentInfoList.DataPortal_Fetch", ex);
|
||||
}
|
||||
this.RaiseListChangedEvents = true;
|
||||
@ -348,8 +348,8 @@ namespace VEPROMS.CSLA.Library
|
||||
/// </summary>
|
||||
public partial class AssignmentInfoListPropertyDescriptor : vlnListPropertyDescriptor
|
||||
{
|
||||
private AssignmentInfo Item { get { return (AssignmentInfo) _Item;} }
|
||||
public AssignmentInfoListPropertyDescriptor(AssignmentInfoList collection, int index):base(collection, index){;}
|
||||
private AssignmentInfo Item { get { return (AssignmentInfo)_Item; } }
|
||||
public AssignmentInfoListPropertyDescriptor(AssignmentInfoList collection, int index) : base(collection, index) { ;}
|
||||
}
|
||||
#endregion
|
||||
#region Converter
|
||||
@ -360,7 +360,7 @@ namespace VEPROMS.CSLA.Library
|
||||
if (destType == typeof(string) && value is AssignmentInfoList)
|
||||
{
|
||||
// Return department and department role separated by comma.
|
||||
return ((AssignmentInfoList) value).Items.Count.ToString() + " Assignments";
|
||||
return ((AssignmentInfoList)value).Items.Count.ToString() + " Assignments";
|
||||
}
|
||||
return base.ConvertTo(context, culture, value, destType);
|
||||
}
|
||||
|
@ -113,8 +113,8 @@ namespace VEPROMS.CSLA.Library
|
||||
{
|
||||
get
|
||||
{
|
||||
IVEHasBrokenRules hasBrokenRules=null;
|
||||
foreach(Folder folder in this)
|
||||
IVEHasBrokenRules hasBrokenRules = null;
|
||||
foreach (Folder folder in this)
|
||||
if ((hasBrokenRules = folder.HasBrokenRules) != null) return hasBrokenRules;
|
||||
return hasBrokenRules;
|
||||
}
|
||||
@ -184,7 +184,7 @@ namespace VEPROMS.CSLA.Library
|
||||
private void DataPortal_Fetch(ParentIDCriteria criteria)
|
||||
{
|
||||
this.RaiseListChangedEvents = false;
|
||||
if(_MyLog.IsDebugEnabled)_MyLog.DebugFormat("[{0}] ChildFolders.DataPortal_FetchParentID", GetHashCode());
|
||||
if (_MyLog.IsDebugEnabled) _MyLog.DebugFormat("[{0}] ChildFolders.DataPortal_FetchParentID", GetHashCode());
|
||||
try
|
||||
{
|
||||
using (SqlConnection cn = Database.VEPROMS_SqlConnection)
|
||||
@ -203,7 +203,7 @@ namespace VEPROMS.CSLA.Library
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
if(_MyLog.IsErrorEnabled)_MyLog.Error("ChildFolders.DataPortal_FetchParentID", ex);
|
||||
if (_MyLog.IsErrorEnabled) _MyLog.Error("ChildFolders.DataPortal_FetchParentID", ex);
|
||||
throw new DbCslaException("ChildFolders.DataPortal_Fetch", ex);
|
||||
}
|
||||
this.RaiseListChangedEvents = true;
|
||||
@ -288,8 +288,8 @@ namespace VEPROMS.CSLA.Library
|
||||
/// </summary>
|
||||
public partial class ChildFoldersPropertyDescriptor : vlnListPropertyDescriptor
|
||||
{
|
||||
private Folder Item { get { return (Folder) _Item;} }
|
||||
public ChildFoldersPropertyDescriptor(ChildFolders collection, int index):base(collection, index){;}
|
||||
private Folder Item { get { return (Folder)_Item; } }
|
||||
public ChildFoldersPropertyDescriptor(ChildFolders collection, int index) : base(collection, index) { ;}
|
||||
}
|
||||
#endregion
|
||||
#region Converter
|
||||
@ -300,7 +300,7 @@ namespace VEPROMS.CSLA.Library
|
||||
if (destType == typeof(string) && value is ChildFolders)
|
||||
{
|
||||
// Return department and department role separated by comma.
|
||||
return ((ChildFolders) value).Items.Count.ToString() + " Folders";
|
||||
return ((ChildFolders)value).Items.Count.ToString() + " Folders";
|
||||
}
|
||||
return base.ConvertTo(context, culture, value, destType);
|
||||
}
|
||||
|
@ -113,8 +113,8 @@ namespace VEPROMS.CSLA.Library
|
||||
{
|
||||
get
|
||||
{
|
||||
IVEHasBrokenRules hasBrokenRules=null;
|
||||
foreach(Format format in this)
|
||||
IVEHasBrokenRules hasBrokenRules = null;
|
||||
foreach (Format format in this)
|
||||
if ((hasBrokenRules = format.HasBrokenRules) != null) return hasBrokenRules;
|
||||
return hasBrokenRules;
|
||||
}
|
||||
@ -184,7 +184,7 @@ namespace VEPROMS.CSLA.Library
|
||||
private void DataPortal_Fetch(ParentIDCriteria criteria)
|
||||
{
|
||||
this.RaiseListChangedEvents = false;
|
||||
if(_MyLog.IsDebugEnabled)_MyLog.DebugFormat("[{0}] ChildFormats.DataPortal_FetchParentID", GetHashCode());
|
||||
if (_MyLog.IsDebugEnabled) _MyLog.DebugFormat("[{0}] ChildFormats.DataPortal_FetchParentID", GetHashCode());
|
||||
try
|
||||
{
|
||||
using (SqlConnection cn = Database.VEPROMS_SqlConnection)
|
||||
@ -203,7 +203,7 @@ namespace VEPROMS.CSLA.Library
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
if(_MyLog.IsErrorEnabled)_MyLog.Error("ChildFormats.DataPortal_FetchParentID", ex);
|
||||
if (_MyLog.IsErrorEnabled) _MyLog.Error("ChildFormats.DataPortal_FetchParentID", ex);
|
||||
throw new DbCslaException("ChildFormats.DataPortal_Fetch", ex);
|
||||
}
|
||||
this.RaiseListChangedEvents = true;
|
||||
@ -288,8 +288,8 @@ namespace VEPROMS.CSLA.Library
|
||||
/// </summary>
|
||||
public partial class ChildFormatsPropertyDescriptor : vlnListPropertyDescriptor
|
||||
{
|
||||
private Format Item { get { return (Format) _Item;} }
|
||||
public ChildFormatsPropertyDescriptor(ChildFormats collection, int index):base(collection, index){;}
|
||||
private Format Item { get { return (Format)_Item; } }
|
||||
public ChildFormatsPropertyDescriptor(ChildFormats collection, int index) : base(collection, index) { ;}
|
||||
}
|
||||
#endregion
|
||||
#region Converter
|
||||
@ -300,7 +300,7 @@ namespace VEPROMS.CSLA.Library
|
||||
if (destType == typeof(string) && value is ChildFormats)
|
||||
{
|
||||
// Return department and department role separated by comma.
|
||||
return ((ChildFormats) value).Items.Count.ToString() + " Formats";
|
||||
return ((ChildFormats)value).Items.Count.ToString() + " Formats";
|
||||
}
|
||||
return base.ConvertTo(context, culture, value, destType);
|
||||
}
|
||||
|
@ -41,7 +41,7 @@ namespace VEPROMS.CSLA.Library
|
||||
{
|
||||
foreach (ConnectionFolder tmp in _ConnectionFolders)
|
||||
{
|
||||
if(tmp.IsDirty)refreshConnectionFolders.Add(tmp);
|
||||
if (tmp.IsDirty) refreshConnectionFolders.Add(tmp);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -65,15 +65,20 @@ namespace VEPROMS.CSLA.Library
|
||||
#endregion
|
||||
#region Collection
|
||||
protected static List<Connection> _AllList = new List<Connection>();
|
||||
private static Dictionary<string, Connection> _AllByPrimaryKey = new Dictionary<string, Connection>();
|
||||
private static Dictionary<string, Connection> _AllByName = new Dictionary<string, Connection>();
|
||||
private static Dictionary<string, List<Connection>> _AllByPrimaryKey = new Dictionary<string, List<Connection>>();
|
||||
private static Dictionary<string, List<Connection>> _AllByName = new Dictionary<string, List<Connection>>();
|
||||
private static void ConvertListToDictionary()
|
||||
{
|
||||
List<Connection> remove = new List<Connection>();
|
||||
foreach (Connection tmp in _AllList)
|
||||
{
|
||||
_AllByPrimaryKey[tmp.DBID.ToString()]=tmp; // Primary Key
|
||||
_AllByName[tmp.Name.ToString()] = tmp; // Unique Index
|
||||
if (!_AllByPrimaryKey.ContainsKey(tmp.DBID.ToString()))
|
||||
{
|
||||
_AllByPrimaryKey[tmp.DBID.ToString()] = new List<Connection>(); // Add new list for PrimaryKey
|
||||
_AllByName[tmp.Name.ToString()] = new List<Connection>(); // Add new list for Name
|
||||
}
|
||||
_AllByPrimaryKey[tmp.DBID.ToString()].Add(tmp); // Add to Primary Key list
|
||||
_AllByName[tmp.Name.ToString()].Add(tmp); // Unique Index
|
||||
remove.Add(tmp);
|
||||
}
|
||||
foreach (Connection tmp in remove)
|
||||
@ -83,14 +88,14 @@ namespace VEPROMS.CSLA.Library
|
||||
{
|
||||
ConvertListToDictionary();
|
||||
string key = dbid.ToString();
|
||||
if (_AllByPrimaryKey.ContainsKey(key)) return _AllByPrimaryKey[key];
|
||||
if (_AllByPrimaryKey.ContainsKey(key)) return _AllByPrimaryKey[key][0];
|
||||
return null;
|
||||
}
|
||||
public static Connection GetExistingByName(string name)
|
||||
{
|
||||
ConvertListToDictionary();
|
||||
string key = name.ToString();
|
||||
if (_AllByName.ContainsKey(key)) return _AllByName[key];
|
||||
if (_AllByName.ContainsKey(key)) return _AllByName[key][0];
|
||||
return null;
|
||||
}
|
||||
#endregion
|
||||
@ -112,7 +117,7 @@ namespace VEPROMS.CSLA.Library
|
||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||
get
|
||||
{
|
||||
CanReadProperty("DBID",true);
|
||||
CanReadProperty("DBID", true);
|
||||
return _DBID;
|
||||
}
|
||||
}
|
||||
@ -122,13 +127,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)
|
||||
{
|
||||
@ -143,13 +148,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)
|
||||
{
|
||||
@ -164,13 +169,13 @@ namespace VEPROMS.CSLA.Library
|
||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||
get
|
||||
{
|
||||
CanReadProperty("ConnectionString",true);
|
||||
CanReadProperty("ConnectionString", true);
|
||||
return _ConnectionString;
|
||||
}
|
||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||
set
|
||||
{
|
||||
CanWriteProperty("ConnectionString",true);
|
||||
CanWriteProperty("ConnectionString", true);
|
||||
if (value == null) value = string.Empty;
|
||||
if (_ConnectionString != value)
|
||||
{
|
||||
@ -188,13 +193,13 @@ namespace VEPROMS.CSLA.Library
|
||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||
get
|
||||
{
|
||||
CanReadProperty("ServerType",true);
|
||||
CanReadProperty("ServerType", true);
|
||||
return _ServerType;
|
||||
}
|
||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||
set
|
||||
{
|
||||
CanWriteProperty("ServerType",true);
|
||||
CanWriteProperty("ServerType", true);
|
||||
if (_ServerType != value)
|
||||
{
|
||||
_ServerType = value;
|
||||
@ -208,13 +213,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)
|
||||
{
|
||||
@ -229,13 +234,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;
|
||||
@ -249,13 +254,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)
|
||||
{
|
||||
@ -274,7 +279,7 @@ namespace VEPROMS.CSLA.Library
|
||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||
get
|
||||
{
|
||||
CanReadProperty("ConnectionFolderCount",true);
|
||||
CanReadProperty("ConnectionFolderCount", true);
|
||||
return _ConnectionFolderCount;
|
||||
}
|
||||
}
|
||||
@ -288,21 +293,21 @@ namespace VEPROMS.CSLA.Library
|
||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||
get
|
||||
{
|
||||
CanReadProperty("ConnectionFolders",true);
|
||||
if(_ConnectionFolderCount > 0 && _ConnectionFolders == null)
|
||||
CanReadProperty("ConnectionFolders", true);
|
||||
if (_ConnectionFolderCount > 0 && _ConnectionFolders == null)
|
||||
_ConnectionFolders = ConnectionFolders.GetByDBID(DBID);
|
||||
else if(_ConnectionFolders == null)
|
||||
else if (_ConnectionFolders == null)
|
||||
_ConnectionFolders = ConnectionFolders.New();
|
||||
return _ConnectionFolders;
|
||||
}
|
||||
}
|
||||
public override bool IsDirty
|
||||
{
|
||||
get { return base.IsDirty || (_ConnectionFolders == null? false : _ConnectionFolders.IsDirty); }
|
||||
get { return base.IsDirty || (_ConnectionFolders == null ? false : _ConnectionFolders.IsDirty); }
|
||||
}
|
||||
public override bool IsValid
|
||||
{
|
||||
get { return (IsNew && !IsDirty ? true : base.IsValid) && (_ConnectionFolders == null? true : _ConnectionFolders.IsValid); }
|
||||
get { return (IsNew && !IsDirty ? true : base.IsValid) && (_ConnectionFolders == null ? true : _ConnectionFolders.IsValid); }
|
||||
}
|
||||
// TODO: Replace base Connection.ToString function as necessary
|
||||
/// <summary>
|
||||
@ -325,22 +330,23 @@ 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 (_ConnectionFolders != null && (hasBrokenRules = _ConnectionFolders.HasBrokenRules) != null) return hasBrokenRules;
|
||||
return hasBrokenRules;
|
||||
}
|
||||
finally
|
||||
{
|
||||
_CheckingBrokenRules=false;
|
||||
_CheckingBrokenRules = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -462,15 +468,29 @@ namespace VEPROMS.CSLA.Library
|
||||
#region Factory Methods
|
||||
public int CurrentEditLevel
|
||||
{ get { return EditLevel; } }
|
||||
private static int _ConnectionUnique = 0;
|
||||
private int _MyConnectionUnique;
|
||||
public int MyConnectionUnique
|
||||
{
|
||||
get { return _MyConnectionUnique; }
|
||||
}
|
||||
protected Connection()
|
||||
{/* require use of factory methods */
|
||||
_MyConnectionUnique = ++_ConnectionUnique;
|
||||
_AllList.Add(this);
|
||||
}
|
||||
public void Dispose()
|
||||
{
|
||||
_AllList.Remove(this);
|
||||
_AllByPrimaryKey.Remove(DBID.ToString());
|
||||
_AllByName.Remove(Name.ToString());
|
||||
if (!_AllByPrimaryKey.ContainsKey(DBID.ToString())) return;
|
||||
List<Connection> listConnection = _AllByPrimaryKey[DBID.ToString()]; // Get the list of items
|
||||
listConnection.Remove(this); // Remove the item from the list
|
||||
if (listConnection.Count == 0) //If there are no items left in the list
|
||||
_AllByPrimaryKey.Remove(DBID.ToString()); // remove the list
|
||||
listConnection = _AllByName[DBID.ToString()]; // Get the list of items
|
||||
listConnection.Remove(this); // Remove the item from the list
|
||||
if (listConnection.Count == 0) //If there are no items left in the list
|
||||
_AllByName.Remove(DBID.ToString()); // remove the list
|
||||
}
|
||||
public static Connection New()
|
||||
{
|
||||
@ -548,7 +568,7 @@ namespace VEPROMS.CSLA.Library
|
||||
if (tmp == null)
|
||||
{
|
||||
tmp = DataPortal.Fetch<Connection>(new PKCriteria(dbid));
|
||||
_AllList.Add(tmp);
|
||||
if (!_AllList.Contains(tmp)) _AllList.Add(tmp);
|
||||
}
|
||||
if (tmp.ErrorMessage == "No Record Found") tmp = null;
|
||||
return tmp;
|
||||
@ -567,8 +587,8 @@ namespace VEPROMS.CSLA.Library
|
||||
Connection tmp = GetExistingByName(name);
|
||||
if (tmp == null)
|
||||
{
|
||||
tmp=DataPortal.Fetch<Connection>(new NameCriteria(name));
|
||||
_AllList.Add(tmp);
|
||||
tmp = DataPortal.Fetch<Connection>(new NameCriteria(name));
|
||||
if (!_AllList.Contains(tmp)) _AllList.Add(tmp);
|
||||
}
|
||||
if (tmp.ErrorMessage == "No Record Found") tmp = null;
|
||||
return tmp;
|
||||
@ -659,7 +679,7 @@ namespace VEPROMS.CSLA.Library
|
||||
}
|
||||
private void ReadData(SafeDataReader dr)
|
||||
{
|
||||
if(_MyLog.IsDebugEnabled)_MyLog.DebugFormat("[{0}] Connection.ReadData", GetHashCode());
|
||||
if (_MyLog.IsDebugEnabled) _MyLog.DebugFormat("[{0}] Connection.ReadData", GetHashCode());
|
||||
try
|
||||
{
|
||||
_DBID = dr.GetInt32("DBID");
|
||||
@ -676,14 +696,14 @@ namespace VEPROMS.CSLA.Library
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
if(_MyLog.IsErrorEnabled)_MyLog.Error("Connection.ReadData", ex);
|
||||
if (_MyLog.IsErrorEnabled) _MyLog.Error("Connection.ReadData", ex);
|
||||
_ErrorMessage = ex.Message;
|
||||
throw new DbCslaException("Connection.ReadData", ex);
|
||||
}
|
||||
}
|
||||
private void DataPortal_Fetch(PKCriteria criteria)
|
||||
{
|
||||
if(_MyLog.IsDebugEnabled)_MyLog.DebugFormat("[{0}] Connection.DataPortal_Fetch", GetHashCode());
|
||||
if (_MyLog.IsDebugEnabled) _MyLog.DebugFormat("[{0}] Connection.DataPortal_Fetch", GetHashCode());
|
||||
try
|
||||
{
|
||||
using (SqlConnection cn = Database.VEPROMS_SqlConnection)
|
||||
@ -714,14 +734,14 @@ namespace VEPROMS.CSLA.Library
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
if(_MyLog.IsErrorEnabled)_MyLog.Error("Connection.DataPortal_Fetch", ex);
|
||||
if (_MyLog.IsErrorEnabled) _MyLog.Error("Connection.DataPortal_Fetch", ex);
|
||||
_ErrorMessage = ex.Message;
|
||||
throw new DbCslaException("Connection.DataPortal_Fetch", ex);
|
||||
}
|
||||
}
|
||||
private void DataPortal_Fetch(NameCriteria criteria)
|
||||
{
|
||||
if(_MyLog.IsDebugEnabled)_MyLog.DebugFormat("[{0}] Connection.DataPortal_Fetch", GetHashCode());
|
||||
if (_MyLog.IsDebugEnabled) _MyLog.DebugFormat("[{0}] Connection.DataPortal_Fetch", GetHashCode());
|
||||
try
|
||||
{
|
||||
using (SqlConnection cn = Database.VEPROMS_SqlConnection)
|
||||
@ -749,7 +769,7 @@ namespace VEPROMS.CSLA.Library
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
if(_MyLog.IsErrorEnabled)_MyLog.Error("Connection.DataPortal_Fetch", ex);
|
||||
if (_MyLog.IsErrorEnabled) _MyLog.Error("Connection.DataPortal_Fetch", ex);
|
||||
_ErrorMessage = ex.Message;
|
||||
throw new DbCslaException("Connection.DataPortal_Fetch", ex);
|
||||
}
|
||||
@ -770,13 +790,13 @@ namespace VEPROMS.CSLA.Library
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
if(_MyLog.IsErrorEnabled)_MyLog.Error("Connection.DataPortal_Insert", ex);
|
||||
if (_MyLog.IsErrorEnabled) _MyLog.Error("Connection.DataPortal_Insert", ex);
|
||||
_ErrorMessage = ex.Message;
|
||||
throw new DbCslaException("Connection.DataPortal_Insert", ex);
|
||||
}
|
||||
finally
|
||||
{
|
||||
if(_MyLog.IsDebugEnabled)_MyLog.DebugFormat("[{0}] Connection.DataPortal_Insert", GetHashCode());
|
||||
if (_MyLog.IsDebugEnabled) _MyLog.DebugFormat("[{0}] Connection.DataPortal_Insert", GetHashCode());
|
||||
}
|
||||
}
|
||||
[Transactional(TransactionalTypes.TransactionScope)]
|
||||
@ -814,11 +834,11 @@ namespace VEPROMS.CSLA.Library
|
||||
MarkOld();
|
||||
// update child objects
|
||||
if (_ConnectionFolders != null) _ConnectionFolders.Update(this);
|
||||
if(_MyLog.IsDebugEnabled)_MyLog.DebugFormat("[{0}] Connection.SQLInsert", GetHashCode());
|
||||
if (_MyLog.IsDebugEnabled) _MyLog.DebugFormat("[{0}] Connection.SQLInsert", GetHashCode());
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
if(_MyLog.IsErrorEnabled)_MyLog.Error("Connection.SQLInsert", ex);
|
||||
if (_MyLog.IsErrorEnabled) _MyLog.Error("Connection.SQLInsert", ex);
|
||||
_ErrorMessage = ex.Message;
|
||||
throw new DbCslaException("Connection.SQLInsert", ex);
|
||||
}
|
||||
@ -826,7 +846,7 @@ namespace VEPROMS.CSLA.Library
|
||||
[Transactional(TransactionalTypes.TransactionScope)]
|
||||
public static byte[] Add(SqlConnection cn, ref int dbid, string name, string title, string connectionString, int serverType, string config, DateTime dts, string usrID)
|
||||
{
|
||||
if(_MyLog.IsDebugEnabled)_MyLog.DebugFormat("[{0}] Connection.Add", 0);
|
||||
if (_MyLog.IsDebugEnabled) _MyLog.DebugFormat("[{0}] Connection.Add", 0);
|
||||
try
|
||||
{
|
||||
using (SqlCommand cm = cn.CreateCommand())
|
||||
@ -857,7 +877,7 @@ namespace VEPROMS.CSLA.Library
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
if(_MyLog.IsErrorEnabled)_MyLog.Error("Connection.Add", ex);
|
||||
if (_MyLog.IsErrorEnabled) _MyLog.Error("Connection.Add", ex);
|
||||
throw new DbCslaException("Connection.Add", ex);
|
||||
}
|
||||
}
|
||||
@ -865,7 +885,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}] Connection.DataPortal_Update", GetHashCode());
|
||||
if (_MyLog.IsDebugEnabled) _MyLog.DebugFormat("[{0}] Connection.DataPortal_Update", GetHashCode());
|
||||
try
|
||||
{
|
||||
using (SqlConnection cn = Database.VEPROMS_SqlConnection)
|
||||
@ -879,7 +899,7 @@ namespace VEPROMS.CSLA.Library
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
if(_MyLog.IsErrorEnabled)_MyLog.Error("Connection.DataPortal_Update", ex);
|
||||
if (_MyLog.IsErrorEnabled) _MyLog.Error("Connection.DataPortal_Update", ex);
|
||||
_ErrorMessage = ex.Message;
|
||||
if (!ex.Message.EndsWith("has been edited by another user.")) throw ex;
|
||||
}
|
||||
@ -888,7 +908,7 @@ namespace VEPROMS.CSLA.Library
|
||||
internal void SQLUpdate()
|
||||
{
|
||||
if (!IsDirty) return; // If not dirty - nothing to do
|
||||
if(_MyLog.IsDebugEnabled)_MyLog.DebugFormat("[{0}] Connection.SQLUpdate", GetHashCode());
|
||||
if (_MyLog.IsDebugEnabled) _MyLog.DebugFormat("[{0}] Connection.SQLUpdate", GetHashCode());
|
||||
try
|
||||
{
|
||||
SqlConnection cn = (SqlConnection)ApplicationContext.LocalContext["cn"];
|
||||
@ -924,7 +944,7 @@ namespace VEPROMS.CSLA.Library
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
if(_MyLog.IsErrorEnabled)_MyLog.Error("Connection.SQLUpdate", ex);
|
||||
if (_MyLog.IsErrorEnabled) _MyLog.Error("Connection.SQLUpdate", ex);
|
||||
_ErrorMessage = ex.Message;
|
||||
if (!ex.Message.EndsWith("has been edited by another user.")) throw ex;
|
||||
}
|
||||
@ -946,7 +966,7 @@ namespace VEPROMS.CSLA.Library
|
||||
[Transactional(TransactionalTypes.TransactionScope)]
|
||||
public static byte[] Update(SqlConnection cn, ref int dbid, string name, string title, string connectionString, int serverType, string config, DateTime dts, string usrID, ref byte[] lastChanged)
|
||||
{
|
||||
if(_MyLog.IsDebugEnabled)_MyLog.DebugFormat("[{0}] Connection.Update", 0);
|
||||
if (_MyLog.IsDebugEnabled) _MyLog.DebugFormat("[{0}] Connection.Update", 0);
|
||||
try
|
||||
{
|
||||
using (SqlCommand cm = cn.CreateCommand())
|
||||
@ -975,7 +995,7 @@ namespace VEPROMS.CSLA.Library
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
if(_MyLog.IsErrorEnabled)_MyLog.Error("Connection.Update", ex);
|
||||
if (_MyLog.IsErrorEnabled) _MyLog.Error("Connection.Update", ex);
|
||||
throw new DbCslaException("Connection.Update", ex);
|
||||
}
|
||||
}
|
||||
@ -987,7 +1007,7 @@ namespace VEPROMS.CSLA.Library
|
||||
[Transactional(TransactionalTypes.TransactionScope)]
|
||||
private void DataPortal_Delete(PKCriteria criteria)
|
||||
{
|
||||
if(_MyLog.IsDebugEnabled)_MyLog.DebugFormat("[{0}] Connection.DataPortal_Delete", GetHashCode());
|
||||
if (_MyLog.IsDebugEnabled) _MyLog.DebugFormat("[{0}] Connection.DataPortal_Delete", GetHashCode());
|
||||
try
|
||||
{
|
||||
using (SqlConnection cn = Database.VEPROMS_SqlConnection)
|
||||
@ -1003,7 +1023,7 @@ namespace VEPROMS.CSLA.Library
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
if(_MyLog.IsErrorEnabled)_MyLog.Error("Connection.DataPortal_Delete", ex);
|
||||
if (_MyLog.IsErrorEnabled) _MyLog.Error("Connection.DataPortal_Delete", ex);
|
||||
_ErrorMessage = ex.Message;
|
||||
throw new DbCslaException("Connection.DataPortal_Delete", ex);
|
||||
}
|
||||
@ -1011,7 +1031,7 @@ namespace VEPROMS.CSLA.Library
|
||||
[Transactional(TransactionalTypes.TransactionScope)]
|
||||
public static void Remove(SqlConnection cn, int dbid)
|
||||
{
|
||||
if(_MyLog.IsDebugEnabled)_MyLog.DebugFormat("[{0}] Connection.Remove", 0);
|
||||
if (_MyLog.IsDebugEnabled) _MyLog.DebugFormat("[{0}] Connection.Remove", 0);
|
||||
try
|
||||
{
|
||||
using (SqlCommand cm = cn.CreateCommand())
|
||||
@ -1026,7 +1046,7 @@ namespace VEPROMS.CSLA.Library
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
if(_MyLog.IsErrorEnabled)_MyLog.Error("Connection.Remove", ex);
|
||||
if (_MyLog.IsErrorEnabled) _MyLog.Error("Connection.Remove", ex);
|
||||
throw new DbCslaException("Connection.Remove", ex);
|
||||
}
|
||||
}
|
||||
@ -1060,7 +1080,7 @@ namespace VEPROMS.CSLA.Library
|
||||
}
|
||||
protected override void DataPortal_Execute()
|
||||
{
|
||||
if(_MyLog.IsDebugEnabled)_MyLog.DebugFormat("[{0}] Connection.DataPortal_Execute", GetHashCode());
|
||||
if (_MyLog.IsDebugEnabled) _MyLog.DebugFormat("[{0}] Connection.DataPortal_Execute", GetHashCode());
|
||||
try
|
||||
{
|
||||
using (SqlConnection cn = Database.VEPROMS_SqlConnection)
|
||||
@ -1078,7 +1098,7 @@ namespace VEPROMS.CSLA.Library
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
if(_MyLog.IsErrorEnabled)_MyLog.Error("Connection.DataPortal_Execute", ex);
|
||||
if (_MyLog.IsErrorEnabled) _MyLog.Error("Connection.DataPortal_Execute", ex);
|
||||
throw new DbCslaException("Connection.DataPortal_Execute", ex);
|
||||
}
|
||||
}
|
||||
|
@ -42,7 +42,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;
|
||||
}
|
||||
@ -54,7 +54,7 @@ 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;
|
||||
}
|
||||
@ -65,7 +65,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;
|
||||
}
|
||||
@ -76,14 +76,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;
|
||||
@ -97,13 +97,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)
|
||||
{
|
||||
@ -118,13 +118,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)
|
||||
{
|
||||
@ -139,13 +139,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)
|
||||
{
|
||||
@ -160,7 +160,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;
|
||||
}
|
||||
@ -171,18 +171,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();
|
||||
}
|
||||
}
|
||||
@ -193,13 +193,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)
|
||||
{
|
||||
@ -214,13 +214,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;
|
||||
@ -234,13 +234,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)
|
||||
{
|
||||
@ -279,16 +279,16 @@ namespace VEPROMS.CSLA.Library
|
||||
#endregion
|
||||
#region ValidationRules
|
||||
[NonSerialized]
|
||||
private bool _CheckingBrokenRules=false;
|
||||
private bool _CheckingBrokenRules = false;
|
||||
public IVEHasBrokenRules HasBrokenRules
|
||||
{
|
||||
get
|
||||
{
|
||||
if(_CheckingBrokenRules)return null;
|
||||
if (_CheckingBrokenRules) return null;
|
||||
if (BrokenRulesCollection.Count > 0) return this;
|
||||
try
|
||||
{
|
||||
_CheckingBrokenRules=true;
|
||||
_CheckingBrokenRules = true;
|
||||
IVEHasBrokenRules hasBrokenRules = null;
|
||||
if (_MyFolder != null && (hasBrokenRules = _MyFolder.HasBrokenRules) != null) return hasBrokenRules;
|
||||
if (_MyFormat != null && (hasBrokenRules = _MyFormat.HasBrokenRules) != null) return hasBrokenRules;
|
||||
@ -296,7 +296,7 @@ namespace VEPROMS.CSLA.Library
|
||||
}
|
||||
finally
|
||||
{
|
||||
_CheckingBrokenRules=false;
|
||||
_CheckingBrokenRules = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -446,7 +446,7 @@ namespace VEPROMS.CSLA.Library
|
||||
#region Data Access Portal
|
||||
private void Fetch(SafeDataReader dr)
|
||||
{
|
||||
if(_MyLog.IsDebugEnabled)_MyLog.DebugFormat("[{0}] ConnectionFolder.FetchDR", GetHashCode());
|
||||
if (_MyLog.IsDebugEnabled) _MyLog.DebugFormat("[{0}] ConnectionFolder.FetchDR", GetHashCode());
|
||||
try
|
||||
{
|
||||
_FolderID = dr.GetInt32("FolderID");
|
||||
@ -462,7 +462,7 @@ namespace VEPROMS.CSLA.Library
|
||||
}
|
||||
catch (Exception ex) // FKItem Fetch
|
||||
{
|
||||
if(_MyLog.IsErrorEnabled)_MyLog.Error("ConnectionFolder.FetchDR", ex);
|
||||
if (_MyLog.IsErrorEnabled) _MyLog.Error("ConnectionFolder.FetchDR", ex);
|
||||
throw new DbCslaException("ConnectionFolder.Fetch", ex);
|
||||
}
|
||||
MarkOld();
|
||||
|
@ -94,8 +94,8 @@ namespace VEPROMS.CSLA.Library
|
||||
{
|
||||
get
|
||||
{
|
||||
IVEHasBrokenRules hasBrokenRules=null;
|
||||
foreach(ConnectionFolder connectionFolder in this)
|
||||
IVEHasBrokenRules hasBrokenRules = null;
|
||||
foreach (ConnectionFolder connectionFolder in this)
|
||||
if ((hasBrokenRules = connectionFolder.HasBrokenRules) != null) return hasBrokenRules;
|
||||
return hasBrokenRules;
|
||||
}
|
||||
@ -165,7 +165,7 @@ namespace VEPROMS.CSLA.Library
|
||||
private void DataPortal_Fetch(DBIDCriteria criteria)
|
||||
{
|
||||
this.RaiseListChangedEvents = false;
|
||||
if(_MyLog.IsDebugEnabled)_MyLog.DebugFormat("[{0}] ConnectionFolders.DataPortal_FetchDBID", GetHashCode());
|
||||
if (_MyLog.IsDebugEnabled) _MyLog.DebugFormat("[{0}] ConnectionFolders.DataPortal_FetchDBID", GetHashCode());
|
||||
try
|
||||
{
|
||||
using (SqlConnection cn = Database.VEPROMS_SqlConnection)
|
||||
@ -184,7 +184,7 @@ namespace VEPROMS.CSLA.Library
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
if(_MyLog.IsErrorEnabled)_MyLog.Error("ConnectionFolders.DataPortal_FetchDBID", ex);
|
||||
if (_MyLog.IsErrorEnabled) _MyLog.Error("ConnectionFolders.DataPortal_FetchDBID", ex);
|
||||
throw new DbCslaException("ConnectionFolders.DataPortal_Fetch", ex);
|
||||
}
|
||||
this.RaiseListChangedEvents = true;
|
||||
@ -269,8 +269,8 @@ namespace VEPROMS.CSLA.Library
|
||||
/// </summary>
|
||||
public partial class ConnectionFoldersPropertyDescriptor : vlnListPropertyDescriptor
|
||||
{
|
||||
private ConnectionFolder Item { get { return (ConnectionFolder) _Item;} }
|
||||
public ConnectionFoldersPropertyDescriptor(ConnectionFolders collection, int index):base(collection, index){;}
|
||||
private ConnectionFolder Item { get { return (ConnectionFolder)_Item; } }
|
||||
public ConnectionFoldersPropertyDescriptor(ConnectionFolders collection, int index) : base(collection, index) { ;}
|
||||
}
|
||||
#endregion
|
||||
#region Converter
|
||||
@ -281,7 +281,7 @@ namespace VEPROMS.CSLA.Library
|
||||
if (destType == typeof(string) && value is ConnectionFolders)
|
||||
{
|
||||
// Return department and department role separated by comma.
|
||||
return ((ConnectionFolders) value).Items.Count.ToString() + " Folders";
|
||||
return ((ConnectionFolders)value).Items.Count.ToString() + " Folders";
|
||||
}
|
||||
return base.ConvertTo(context, culture, value, destType);
|
||||
}
|
||||
|
@ -37,13 +37,17 @@ namespace VEPROMS.CSLA.Library
|
||||
#endregion
|
||||
#region Collection
|
||||
protected static List<ConnectionInfo> _AllList = new List<ConnectionInfo>();
|
||||
private static Dictionary<string, ConnectionInfo> _AllByPrimaryKey = new Dictionary<string, ConnectionInfo>();
|
||||
private static Dictionary<string, List<ConnectionInfo>> _AllByPrimaryKey = new Dictionary<string, List<ConnectionInfo>>();
|
||||
private static void ConvertListToDictionary()
|
||||
{
|
||||
List<ConnectionInfo> remove = new List<ConnectionInfo>();
|
||||
foreach (ConnectionInfo tmp in _AllList)
|
||||
{
|
||||
_AllByPrimaryKey[tmp.DBID.ToString()]=tmp; // Primary Key
|
||||
if (!_AllByPrimaryKey.ContainsKey(tmp.DBID.ToString()))
|
||||
{
|
||||
_AllByPrimaryKey[tmp.DBID.ToString()] = new List<ConnectionInfo>(); // Add new list for PrimaryKey
|
||||
}
|
||||
_AllByPrimaryKey[tmp.DBID.ToString()].Add(tmp); // Add to Primary Key list
|
||||
remove.Add(tmp);
|
||||
}
|
||||
foreach (ConnectionInfo tmp in remove)
|
||||
@ -57,7 +61,7 @@ namespace VEPROMS.CSLA.Library
|
||||
{
|
||||
ConvertListToDictionary();
|
||||
string key = dbid.ToString();
|
||||
if (_AllByPrimaryKey.ContainsKey(key)) return _AllByPrimaryKey[key];
|
||||
if (_AllByPrimaryKey.ContainsKey(key)) return _AllByPrimaryKey[key][0];
|
||||
return null;
|
||||
}
|
||||
#endregion
|
||||
@ -85,7 +89,7 @@ namespace VEPROMS.CSLA.Library
|
||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||
get
|
||||
{
|
||||
CanReadProperty("DBID",true);
|
||||
CanReadProperty("DBID", true);
|
||||
return _DBID;
|
||||
}
|
||||
}
|
||||
@ -95,7 +99,7 @@ namespace VEPROMS.CSLA.Library
|
||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||
get
|
||||
{
|
||||
CanReadProperty("Name",true);
|
||||
CanReadProperty("Name", true);
|
||||
return _Name;
|
||||
}
|
||||
}
|
||||
@ -105,7 +109,7 @@ namespace VEPROMS.CSLA.Library
|
||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||
get
|
||||
{
|
||||
CanReadProperty("Title",true);
|
||||
CanReadProperty("Title", true);
|
||||
return _Title;
|
||||
}
|
||||
}
|
||||
@ -115,7 +119,7 @@ namespace VEPROMS.CSLA.Library
|
||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||
get
|
||||
{
|
||||
CanReadProperty("ConnectionString",true);
|
||||
CanReadProperty("ConnectionString", true);
|
||||
return _ConnectionString;
|
||||
}
|
||||
}
|
||||
@ -128,7 +132,7 @@ namespace VEPROMS.CSLA.Library
|
||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||
get
|
||||
{
|
||||
CanReadProperty("ServerType",true);
|
||||
CanReadProperty("ServerType", true);
|
||||
return _ServerType;
|
||||
}
|
||||
}
|
||||
@ -138,7 +142,7 @@ namespace VEPROMS.CSLA.Library
|
||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||
get
|
||||
{
|
||||
CanReadProperty("Config",true);
|
||||
CanReadProperty("Config", true);
|
||||
return _Config;
|
||||
}
|
||||
}
|
||||
@ -148,7 +152,7 @@ namespace VEPROMS.CSLA.Library
|
||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||
get
|
||||
{
|
||||
CanReadProperty("DTS",true);
|
||||
CanReadProperty("DTS", true);
|
||||
return _DTS;
|
||||
}
|
||||
}
|
||||
@ -158,7 +162,7 @@ namespace VEPROMS.CSLA.Library
|
||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||
get
|
||||
{
|
||||
CanReadProperty("UsrID",true);
|
||||
CanReadProperty("UsrID", true);
|
||||
return _UsrID;
|
||||
}
|
||||
}
|
||||
@ -171,7 +175,7 @@ namespace VEPROMS.CSLA.Library
|
||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||
get
|
||||
{
|
||||
CanReadProperty("ConnectionFolderCount",true);
|
||||
CanReadProperty("ConnectionFolderCount", true);
|
||||
return _ConnectionFolderCount;
|
||||
}
|
||||
}
|
||||
@ -182,7 +186,7 @@ namespace VEPROMS.CSLA.Library
|
||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||
get
|
||||
{
|
||||
CanReadProperty("ConnectionFolders",true);
|
||||
CanReadProperty("ConnectionFolders", true);
|
||||
if (_ConnectionFolderCount < 0 || (_ConnectionFolderCount > 0 && _ConnectionFolders == null))
|
||||
_ConnectionFolders = FolderInfoList.GetByDBID(_DBID);
|
||||
if (_ConnectionFolderCount < 0)
|
||||
@ -192,7 +196,10 @@ namespace VEPROMS.CSLA.Library
|
||||
}
|
||||
internal void RefreshConnectionFolders()
|
||||
{
|
||||
_ConnectionFolderCount = -1; // This will cause the data to be requeried
|
||||
ConvertListToDictionary();
|
||||
if (_AllByPrimaryKey.ContainsKey(_DBID.ToString()))
|
||||
foreach (ConnectionInfo tmp in _AllByPrimaryKey[_DBID.ToString()])
|
||||
tmp._ConnectionFolderCount = -1; // This will cause the data to be requeried
|
||||
}
|
||||
// TODO: Replace base ConnectionInfo.ToString function as necessary
|
||||
/// <summary>
|
||||
@ -214,14 +221,25 @@ namespace VEPROMS.CSLA.Library
|
||||
}
|
||||
#endregion
|
||||
#region Factory Methods
|
||||
private static int _ConnectionInfoUnique = 0;
|
||||
private int _MyConnectionInfoUnique;
|
||||
public int MyConnectionInfoUnique
|
||||
{
|
||||
get { return _MyConnectionInfoUnique; }
|
||||
}
|
||||
private ConnectionInfo()
|
||||
{/* require use of factory methods */
|
||||
_MyConnectionInfoUnique = ++_ConnectionInfoUnique;
|
||||
_AllList.Add(this);
|
||||
}
|
||||
public void Dispose()
|
||||
{
|
||||
_AllList.Remove(this);
|
||||
_AllByPrimaryKey.Remove(DBID.ToString());
|
||||
if (!_AllByPrimaryKey.ContainsKey(DBID.ToString())) return;
|
||||
List<ConnectionInfo> listConnectionInfo = _AllByPrimaryKey[DBID.ToString()]; // Get the list of items
|
||||
listConnectionInfo.Remove(this); // Remove the item from the list
|
||||
if (listConnectionInfo.Count == 0) // If there are no items left in the list
|
||||
_AllByPrimaryKey.Remove(DBID.ToString()); // remove the list
|
||||
}
|
||||
public virtual Connection Get()
|
||||
{
|
||||
@ -229,8 +247,10 @@ namespace VEPROMS.CSLA.Library
|
||||
}
|
||||
public static void Refresh(Connection tmp)
|
||||
{
|
||||
ConnectionInfo tmpInfo = GetExistingByPrimaryKey(tmp.DBID);
|
||||
if (tmpInfo == null) return;
|
||||
string key = tmp.DBID.ToString();
|
||||
ConvertListToDictionary();
|
||||
if (_AllByPrimaryKey.ContainsKey(key))
|
||||
foreach (ConnectionInfo tmpInfo in _AllByPrimaryKey[key])
|
||||
tmpInfo.RefreshFields(tmp);
|
||||
}
|
||||
private void RefreshFields(Connection tmp)
|
||||
@ -255,7 +275,7 @@ namespace VEPROMS.CSLA.Library
|
||||
if (tmp == null)
|
||||
{
|
||||
tmp = DataPortal.Fetch<ConnectionInfo>(new PKCriteria(dbid));
|
||||
_AllList.Add(tmp);
|
||||
if (!_AllList.Contains(tmp)) _AllList.Add(tmp);
|
||||
}
|
||||
if (tmp.ErrorMessage == "No Record Found") tmp = null;
|
||||
return tmp;
|
||||
@ -269,14 +289,15 @@ namespace VEPROMS.CSLA.Library
|
||||
#region Data Access Portal
|
||||
internal ConnectionInfo(SafeDataReader dr)
|
||||
{
|
||||
if(_MyLog.IsDebugEnabled)_MyLog.DebugFormat("[{0}] ConnectionInfo.Constructor", GetHashCode());
|
||||
_MyConnectionInfoUnique = ++_ConnectionInfoUnique;
|
||||
if (_MyLog.IsDebugEnabled) _MyLog.DebugFormat("[{0}] ConnectionInfo.Constructor", GetHashCode());
|
||||
try
|
||||
{
|
||||
ReadData(dr);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
if(_MyLog.IsErrorEnabled)_MyLog.Error("ConnectionInfo.Constructor", ex);
|
||||
if (_MyLog.IsErrorEnabled) _MyLog.Error("ConnectionInfo.Constructor", ex);
|
||||
throw new DbCslaException("ConnectionInfo.Constructor", ex);
|
||||
}
|
||||
}
|
||||
@ -293,7 +314,7 @@ namespace VEPROMS.CSLA.Library
|
||||
}
|
||||
private void ReadData(SafeDataReader dr)
|
||||
{
|
||||
if(_MyLog.IsDebugEnabled)_MyLog.DebugFormat("[{0}] ConnectionInfo.ReadData", GetHashCode());
|
||||
if (_MyLog.IsDebugEnabled) _MyLog.DebugFormat("[{0}] ConnectionInfo.ReadData", GetHashCode());
|
||||
try
|
||||
{
|
||||
_DBID = dr.GetInt32("DBID");
|
||||
@ -308,14 +329,14 @@ namespace VEPROMS.CSLA.Library
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
if(_MyLog.IsErrorEnabled)_MyLog.Error("ConnectionInfo.ReadData", ex);
|
||||
if (_MyLog.IsErrorEnabled) _MyLog.Error("ConnectionInfo.ReadData", ex);
|
||||
_ErrorMessage = ex.Message;
|
||||
throw new DbCslaException("ConnectionInfo.ReadData", ex);
|
||||
}
|
||||
}
|
||||
private void DataPortal_Fetch(PKCriteria criteria)
|
||||
{
|
||||
if(_MyLog.IsDebugEnabled)_MyLog.DebugFormat("[{0}] ConnectionInfo.DataPortal_Fetch", GetHashCode());
|
||||
if (_MyLog.IsDebugEnabled) _MyLog.DebugFormat("[{0}] ConnectionInfo.DataPortal_Fetch", GetHashCode());
|
||||
try
|
||||
{
|
||||
using (SqlConnection cn = Database.VEPROMS_SqlConnection)
|
||||
@ -343,7 +364,7 @@ namespace VEPROMS.CSLA.Library
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
if(_MyLog.IsErrorEnabled)_MyLog.Error("ConnectionInfo.DataPortal_Fetch", ex);
|
||||
if (_MyLog.IsErrorEnabled) _MyLog.Error("ConnectionInfo.DataPortal_Fetch", ex);
|
||||
_ErrorMessage = ex.Message;
|
||||
throw new DbCslaException("ConnectionInfo.DataPortal_Fetch", ex);
|
||||
}
|
||||
@ -353,7 +374,7 @@ namespace VEPROMS.CSLA.Library
|
||||
#region extension
|
||||
ConnectionInfoExtension _ConnectionInfoExtension = new ConnectionInfoExtension();
|
||||
[Serializable()]
|
||||
partial class ConnectionInfoExtension : extensionBase {}
|
||||
partial class ConnectionInfoExtension : extensionBase { }
|
||||
[Serializable()]
|
||||
class extensionBase
|
||||
{
|
||||
|
@ -96,7 +96,7 @@ namespace VEPROMS.CSLA.Library
|
||||
private void DataPortal_Fetch()
|
||||
{
|
||||
this.RaiseListChangedEvents = false;
|
||||
if(_MyLog.IsDebugEnabled)_MyLog.DebugFormat("[{0}] ConnectionInfoList.DataPortal_Fetch", GetHashCode());
|
||||
if (_MyLog.IsDebugEnabled) _MyLog.DebugFormat("[{0}] ConnectionInfoList.DataPortal_Fetch", GetHashCode());
|
||||
try
|
||||
{
|
||||
using (SqlConnection cn = Database.VEPROMS_SqlConnection)
|
||||
@ -116,7 +116,7 @@ namespace VEPROMS.CSLA.Library
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
if(_MyLog.IsErrorEnabled)_MyLog.Error("ConnectionInfoList.DataPortal_Fetch", ex);
|
||||
if (_MyLog.IsErrorEnabled) _MyLog.Error("ConnectionInfoList.DataPortal_Fetch", ex);
|
||||
throw new DbCslaException("ConnectionInfoList.DataPortal_Fetch", ex);
|
||||
}
|
||||
this.RaiseListChangedEvents = true;
|
||||
@ -177,8 +177,8 @@ namespace VEPROMS.CSLA.Library
|
||||
/// </summary>
|
||||
public partial class ConnectionInfoListPropertyDescriptor : vlnListPropertyDescriptor
|
||||
{
|
||||
private ConnectionInfo Item { get { return (ConnectionInfo) _Item;} }
|
||||
public ConnectionInfoListPropertyDescriptor(ConnectionInfoList collection, int index):base(collection, index){;}
|
||||
private ConnectionInfo Item { get { return (ConnectionInfo)_Item; } }
|
||||
public ConnectionInfoListPropertyDescriptor(ConnectionInfoList collection, int index) : base(collection, index) { ;}
|
||||
}
|
||||
#endregion
|
||||
#region Converter
|
||||
@ -189,7 +189,7 @@ namespace VEPROMS.CSLA.Library
|
||||
if (destType == typeof(string) && value is ConnectionInfoList)
|
||||
{
|
||||
// Return department and department role separated by comma.
|
||||
return ((ConnectionInfoList) value).Items.Count.ToString() + " Connections";
|
||||
return ((ConnectionInfoList)value).Items.Count.ToString() + " Connections";
|
||||
}
|
||||
return base.ConvertTo(context, culture, value, destType);
|
||||
}
|
||||
|
@ -45,35 +45,35 @@ namespace VEPROMS.CSLA.Library
|
||||
{
|
||||
foreach (ContentDetail tmp in _ContentDetails)
|
||||
{
|
||||
if(tmp.IsDirty)refreshContentDetails.Add(tmp);
|
||||
if (tmp.IsDirty) refreshContentDetails.Add(tmp);
|
||||
}
|
||||
}
|
||||
if (_ContentItems != null && _ContentItems.IsDirty)
|
||||
{
|
||||
foreach (ContentItem tmp in _ContentItems)
|
||||
{
|
||||
if(tmp.IsDirty)refreshContentItems.Add(tmp);
|
||||
if (tmp.IsDirty) refreshContentItems.Add(tmp);
|
||||
}
|
||||
}
|
||||
if (_ContentParts != null && _ContentParts.IsDirty)
|
||||
{
|
||||
foreach (ContentPart tmp in _ContentParts)
|
||||
{
|
||||
if(tmp.IsDirty)refreshContentParts.Add(tmp);
|
||||
if (tmp.IsDirty) refreshContentParts.Add(tmp);
|
||||
}
|
||||
}
|
||||
if (_ContentRoUsages != null && _ContentRoUsages.IsDirty)
|
||||
{
|
||||
foreach (ContentRoUsage tmp in _ContentRoUsages)
|
||||
{
|
||||
if(tmp.IsDirty)refreshContentRoUsages.Add(tmp);
|
||||
if (tmp.IsDirty) refreshContentRoUsages.Add(tmp);
|
||||
}
|
||||
}
|
||||
if (_ContentTransitions != null && _ContentTransitions.IsDirty)
|
||||
{
|
||||
foreach (ContentTransition tmp in _ContentTransitions)
|
||||
{
|
||||
if(tmp.IsDirty)refreshContentTransitions.Add(tmp);
|
||||
if (tmp.IsDirty) refreshContentTransitions.Add(tmp);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -92,7 +92,7 @@ namespace VEPROMS.CSLA.Library
|
||||
foreach (Content tmp in _RefreshContents)
|
||||
{
|
||||
ContentInfo.Refresh(tmp);
|
||||
if(tmp._MyFormat != null) FormatInfo.Refresh(tmp._MyFormat);
|
||||
if (tmp._MyFormat != null) FormatInfo.Refresh(tmp._MyFormat);
|
||||
}
|
||||
foreach (ContentDetail tmp in _RefreshContentDetails)
|
||||
{
|
||||
@ -118,13 +118,17 @@ namespace VEPROMS.CSLA.Library
|
||||
#endregion
|
||||
#region Collection
|
||||
protected static List<Content> _AllList = new List<Content>();
|
||||
private static Dictionary<string, Content> _AllByPrimaryKey = new Dictionary<string, Content>();
|
||||
private static Dictionary<string, List<Content>> _AllByPrimaryKey = new Dictionary<string, List<Content>>();
|
||||
private static void ConvertListToDictionary()
|
||||
{
|
||||
List<Content> remove = new List<Content>();
|
||||
foreach (Content tmp in _AllList)
|
||||
{
|
||||
_AllByPrimaryKey[tmp.ContentID.ToString()]=tmp; // Primary Key
|
||||
if (!_AllByPrimaryKey.ContainsKey(tmp.ContentID.ToString()))
|
||||
{
|
||||
_AllByPrimaryKey[tmp.ContentID.ToString()] = new List<Content>(); // Add new list for PrimaryKey
|
||||
}
|
||||
_AllByPrimaryKey[tmp.ContentID.ToString()].Add(tmp); // Add to Primary Key list
|
||||
remove.Add(tmp);
|
||||
}
|
||||
foreach (Content tmp in remove)
|
||||
@ -134,7 +138,7 @@ namespace VEPROMS.CSLA.Library
|
||||
{
|
||||
ConvertListToDictionary();
|
||||
string key = contentID.ToString();
|
||||
if (_AllByPrimaryKey.ContainsKey(key)) return _AllByPrimaryKey[key];
|
||||
if (_AllByPrimaryKey.ContainsKey(key)) return _AllByPrimaryKey[key][0];
|
||||
return null;
|
||||
}
|
||||
#endregion
|
||||
@ -156,7 +160,7 @@ namespace VEPROMS.CSLA.Library
|
||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||
get
|
||||
{
|
||||
CanReadProperty("ContentID",true);
|
||||
CanReadProperty("ContentID", true);
|
||||
return _ContentID;
|
||||
}
|
||||
}
|
||||
@ -166,13 +170,13 @@ namespace VEPROMS.CSLA.Library
|
||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||
get
|
||||
{
|
||||
CanReadProperty("Number",true);
|
||||
CanReadProperty("Number", true);
|
||||
return _Number;
|
||||
}
|
||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||
set
|
||||
{
|
||||
CanWriteProperty("Number",true);
|
||||
CanWriteProperty("Number", true);
|
||||
if (value == null) value = string.Empty;
|
||||
if (_Number != value)
|
||||
{
|
||||
@ -187,13 +191,13 @@ namespace VEPROMS.CSLA.Library
|
||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||
get
|
||||
{
|
||||
CanReadProperty("Text",true);
|
||||
CanReadProperty("Text", true);
|
||||
return _Text;
|
||||
}
|
||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||
set
|
||||
{
|
||||
CanWriteProperty("Text",true);
|
||||
CanWriteProperty("Text", true);
|
||||
if (value == null) value = string.Empty;
|
||||
if (_Text != value)
|
||||
{
|
||||
@ -211,13 +215,13 @@ namespace VEPROMS.CSLA.Library
|
||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||
get
|
||||
{
|
||||
CanReadProperty("Type",true);
|
||||
CanReadProperty("Type", true);
|
||||
return _Type;
|
||||
}
|
||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||
set
|
||||
{
|
||||
CanWriteProperty("Type",true);
|
||||
CanWriteProperty("Type", true);
|
||||
if (_Type != value)
|
||||
{
|
||||
_Type = value;
|
||||
@ -231,7 +235,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;
|
||||
}
|
||||
@ -242,18 +246,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();
|
||||
}
|
||||
}
|
||||
@ -264,13 +268,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)
|
||||
{
|
||||
@ -285,13 +289,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;
|
||||
@ -305,13 +309,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)
|
||||
{
|
||||
@ -330,7 +334,7 @@ namespace VEPROMS.CSLA.Library
|
||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||
get
|
||||
{
|
||||
CanReadProperty("ContentDetailCount",true);
|
||||
CanReadProperty("ContentDetailCount", true);
|
||||
return _ContentDetailCount;
|
||||
}
|
||||
}
|
||||
@ -344,10 +348,10 @@ namespace VEPROMS.CSLA.Library
|
||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||
get
|
||||
{
|
||||
CanReadProperty("ContentDetails",true);
|
||||
if(_ContentDetailCount > 0 && _ContentDetails == null)
|
||||
CanReadProperty("ContentDetails", true);
|
||||
if (_ContentDetailCount > 0 && _ContentDetails == null)
|
||||
_ContentDetails = ContentDetails.GetByContentID(ContentID);
|
||||
else if(_ContentDetails == null)
|
||||
else if (_ContentDetails == null)
|
||||
_ContentDetails = ContentDetails.New();
|
||||
return _ContentDetails;
|
||||
}
|
||||
@ -361,7 +365,7 @@ namespace VEPROMS.CSLA.Library
|
||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||
get
|
||||
{
|
||||
CanReadProperty("ContentEntryCount",true);
|
||||
CanReadProperty("ContentEntryCount", true);
|
||||
return _ContentEntryCount;
|
||||
}
|
||||
}
|
||||
@ -375,8 +379,8 @@ namespace VEPROMS.CSLA.Library
|
||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||
get
|
||||
{
|
||||
CanReadProperty("MyEntry",true);
|
||||
if ( _MyEntry == null) _MyEntry = Entry.New(this);
|
||||
CanReadProperty("MyEntry", true);
|
||||
if (_MyEntry == null) _MyEntry = Entry.New(this);
|
||||
return _MyEntry;
|
||||
}
|
||||
}
|
||||
@ -389,7 +393,7 @@ namespace VEPROMS.CSLA.Library
|
||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||
get
|
||||
{
|
||||
CanReadProperty("ContentItemCount",true);
|
||||
CanReadProperty("ContentItemCount", true);
|
||||
return _ContentItemCount;
|
||||
}
|
||||
}
|
||||
@ -403,10 +407,10 @@ namespace VEPROMS.CSLA.Library
|
||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||
get
|
||||
{
|
||||
CanReadProperty("ContentItems",true);
|
||||
if(_ContentItemCount > 0 && _ContentItems == null)
|
||||
CanReadProperty("ContentItems", true);
|
||||
if (_ContentItemCount > 0 && _ContentItems == null)
|
||||
_ContentItems = ContentItems.GetByContentID(ContentID);
|
||||
else if(_ContentItems == null)
|
||||
else if (_ContentItems == null)
|
||||
_ContentItems = ContentItems.New();
|
||||
return _ContentItems;
|
||||
}
|
||||
@ -420,7 +424,7 @@ namespace VEPROMS.CSLA.Library
|
||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||
get
|
||||
{
|
||||
CanReadProperty("ContentPartCount",true);
|
||||
CanReadProperty("ContentPartCount", true);
|
||||
return _ContentPartCount;
|
||||
}
|
||||
}
|
||||
@ -434,10 +438,10 @@ namespace VEPROMS.CSLA.Library
|
||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||
get
|
||||
{
|
||||
CanReadProperty("ContentParts",true);
|
||||
if(_ContentPartCount > 0 && _ContentParts == null)
|
||||
CanReadProperty("ContentParts", true);
|
||||
if (_ContentPartCount > 0 && _ContentParts == null)
|
||||
_ContentParts = ContentParts.GetByContentID(ContentID);
|
||||
else if(_ContentParts == null)
|
||||
else if (_ContentParts == null)
|
||||
_ContentParts = ContentParts.New();
|
||||
return _ContentParts;
|
||||
}
|
||||
@ -451,7 +455,7 @@ namespace VEPROMS.CSLA.Library
|
||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||
get
|
||||
{
|
||||
CanReadProperty("ContentRoUsageCount",true);
|
||||
CanReadProperty("ContentRoUsageCount", true);
|
||||
return _ContentRoUsageCount;
|
||||
}
|
||||
}
|
||||
@ -465,10 +469,10 @@ namespace VEPROMS.CSLA.Library
|
||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||
get
|
||||
{
|
||||
CanReadProperty("ContentRoUsages",true);
|
||||
if(_ContentRoUsageCount > 0 && _ContentRoUsages == null)
|
||||
CanReadProperty("ContentRoUsages", true);
|
||||
if (_ContentRoUsageCount > 0 && _ContentRoUsages == null)
|
||||
_ContentRoUsages = ContentRoUsages.GetByContentID(ContentID);
|
||||
else if(_ContentRoUsages == null)
|
||||
else if (_ContentRoUsages == null)
|
||||
_ContentRoUsages = ContentRoUsages.New();
|
||||
return _ContentRoUsages;
|
||||
}
|
||||
@ -482,7 +486,7 @@ namespace VEPROMS.CSLA.Library
|
||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||
get
|
||||
{
|
||||
CanReadProperty("ContentTransitionCount",true);
|
||||
CanReadProperty("ContentTransitionCount", true);
|
||||
return _ContentTransitionCount;
|
||||
}
|
||||
}
|
||||
@ -496,10 +500,10 @@ namespace VEPROMS.CSLA.Library
|
||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||
get
|
||||
{
|
||||
CanReadProperty("ContentTransitions",true);
|
||||
if(_ContentTransitionCount > 0 && _ContentTransitions == null)
|
||||
CanReadProperty("ContentTransitions", true);
|
||||
if (_ContentTransitionCount > 0 && _ContentTransitions == null)
|
||||
_ContentTransitions = ContentTransitions.GetByFromID(ContentID);
|
||||
else if(_ContentTransitions == null)
|
||||
else if (_ContentTransitions == null)
|
||||
_ContentTransitions = ContentTransitions.New();
|
||||
return _ContentTransitions;
|
||||
}
|
||||
@ -513,7 +517,7 @@ namespace VEPROMS.CSLA.Library
|
||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||
get
|
||||
{
|
||||
CanReadProperty("ContentZContentCount",true);
|
||||
CanReadProperty("ContentZContentCount", true);
|
||||
return _ContentZContentCount;
|
||||
}
|
||||
}
|
||||
@ -527,18 +531,18 @@ namespace VEPROMS.CSLA.Library
|
||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||
get
|
||||
{
|
||||
CanReadProperty("MyZContent",true);
|
||||
if ( _MyZContent == null) _MyZContent = ZContent.New(this);
|
||||
CanReadProperty("MyZContent", true);
|
||||
if (_MyZContent == null) _MyZContent = ZContent.New(this);
|
||||
return _MyZContent;
|
||||
}
|
||||
}
|
||||
public override bool IsDirty
|
||||
{
|
||||
get { return base.IsDirty || (_ContentDetails == null? false : _ContentDetails.IsDirty) || (_MyEntry == null? false : _MyEntry.IsDirty) || (_ContentItems == null? false : _ContentItems.IsDirty) || (_ContentParts == null? false : _ContentParts.IsDirty) || (_ContentRoUsages == null? false : _ContentRoUsages.IsDirty) || (_ContentTransitions == null? false : _ContentTransitions.IsDirty) || (_MyZContent == null? false : _MyZContent.IsDirty) || (_MyFormat == null? false : _MyFormat.IsDirty); }
|
||||
get { return base.IsDirty || (_ContentDetails == null ? false : _ContentDetails.IsDirty) || (_MyEntry == null ? false : _MyEntry.IsDirty) || (_ContentItems == null ? false : _ContentItems.IsDirty) || (_ContentParts == null ? false : _ContentParts.IsDirty) || (_ContentRoUsages == null ? false : _ContentRoUsages.IsDirty) || (_ContentTransitions == null ? false : _ContentTransitions.IsDirty) || (_MyZContent == null ? false : _MyZContent.IsDirty) || (_MyFormat == null ? false : _MyFormat.IsDirty); }
|
||||
}
|
||||
public override bool IsValid
|
||||
{
|
||||
get { return (IsNew && !IsDirty ? true : base.IsValid) && (_ContentDetails == null? true : _ContentDetails.IsValid) && (_MyEntry == null? true : _MyEntry.IsValid) && (_ContentItems == null? true : _ContentItems.IsValid) && (_ContentParts == null? true : _ContentParts.IsValid) && (_ContentRoUsages == null? true : _ContentRoUsages.IsValid) && (_ContentTransitions == null? true : _ContentTransitions.IsValid) && (_MyZContent == null? true : _MyZContent.IsValid) && (_MyFormat == null? true : _MyFormat.IsValid); }
|
||||
get { return (IsNew && !IsDirty ? true : base.IsValid) && (_ContentDetails == null ? true : _ContentDetails.IsValid) && (_MyEntry == null ? true : _MyEntry.IsValid) && (_ContentItems == null ? true : _ContentItems.IsValid) && (_ContentParts == null ? true : _ContentParts.IsValid) && (_ContentRoUsages == null ? true : _ContentRoUsages.IsValid) && (_ContentTransitions == null ? true : _ContentTransitions.IsValid) && (_MyZContent == null ? true : _MyZContent.IsValid) && (_MyFormat == null ? true : _MyFormat.IsValid); }
|
||||
}
|
||||
// TODO: Replace base Content.ToString function as necessary
|
||||
/// <summary>
|
||||
@ -561,15 +565,16 @@ 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 (_ContentItems != null && (hasBrokenRules = _ContentItems.HasBrokenRules) != null) return hasBrokenRules;
|
||||
if (_ContentDetails != null && (hasBrokenRules = _ContentDetails.HasBrokenRules) != null) return hasBrokenRules;
|
||||
@ -583,7 +588,7 @@ namespace VEPROMS.CSLA.Library
|
||||
}
|
||||
finally
|
||||
{
|
||||
_CheckingBrokenRules=false;
|
||||
_CheckingBrokenRules = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -708,14 +713,25 @@ namespace VEPROMS.CSLA.Library
|
||||
#region Factory Methods
|
||||
public int CurrentEditLevel
|
||||
{ get { return EditLevel; } }
|
||||
private static int _ContentUnique = 0;
|
||||
private int _MyContentUnique;
|
||||
public int MyContentUnique
|
||||
{
|
||||
get { return _MyContentUnique; }
|
||||
}
|
||||
protected Content()
|
||||
{/* require use of factory methods */
|
||||
_MyContentUnique = ++_ContentUnique;
|
||||
_AllList.Add(this);
|
||||
}
|
||||
public void Dispose()
|
||||
{
|
||||
_AllList.Remove(this);
|
||||
_AllByPrimaryKey.Remove(ContentID.ToString());
|
||||
if (!_AllByPrimaryKey.ContainsKey(ContentID.ToString())) return;
|
||||
List<Content> listContent = _AllByPrimaryKey[ContentID.ToString()]; // Get the list of items
|
||||
listContent.Remove(this); // Remove the item from the list
|
||||
if (listContent.Count == 0) //If there are no items left in the list
|
||||
_AllByPrimaryKey.Remove(ContentID.ToString()); // remove the list
|
||||
}
|
||||
public static Content New()
|
||||
{
|
||||
@ -794,7 +810,7 @@ namespace VEPROMS.CSLA.Library
|
||||
if (tmp == null)
|
||||
{
|
||||
tmp = DataPortal.Fetch<Content>(new PKCriteria(contentID));
|
||||
_AllList.Add(tmp);
|
||||
if (!_AllList.Contains(tmp)) _AllList.Add(tmp);
|
||||
}
|
||||
if (tmp.ErrorMessage == "No Record Found") tmp = null;
|
||||
return tmp;
|
||||
@ -873,7 +889,7 @@ namespace VEPROMS.CSLA.Library
|
||||
}
|
||||
private void ReadData(SafeDataReader dr)
|
||||
{
|
||||
if(_MyLog.IsDebugEnabled)_MyLog.DebugFormat("[{0}] Content.ReadData", GetHashCode());
|
||||
if (_MyLog.IsDebugEnabled) _MyLog.DebugFormat("[{0}] Content.ReadData", GetHashCode());
|
||||
try
|
||||
{
|
||||
_ContentID = dr.GetInt32("ContentID");
|
||||
@ -896,14 +912,14 @@ namespace VEPROMS.CSLA.Library
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
if(_MyLog.IsErrorEnabled)_MyLog.Error("Content.ReadData", ex);
|
||||
if (_MyLog.IsErrorEnabled) _MyLog.Error("Content.ReadData", ex);
|
||||
_ErrorMessage = ex.Message;
|
||||
throw new DbCslaException("Content.ReadData", ex);
|
||||
}
|
||||
}
|
||||
private void DataPortal_Fetch(PKCriteria criteria)
|
||||
{
|
||||
if(_MyLog.IsDebugEnabled)_MyLog.DebugFormat("[{0}] Content.DataPortal_Fetch", GetHashCode());
|
||||
if (_MyLog.IsDebugEnabled) _MyLog.DebugFormat("[{0}] Content.DataPortal_Fetch", GetHashCode());
|
||||
try
|
||||
{
|
||||
using (SqlConnection cn = Database.VEPROMS_SqlConnection)
|
||||
@ -952,7 +968,7 @@ namespace VEPROMS.CSLA.Library
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
if(_MyLog.IsErrorEnabled)_MyLog.Error("Content.DataPortal_Fetch", ex);
|
||||
if (_MyLog.IsErrorEnabled) _MyLog.Error("Content.DataPortal_Fetch", ex);
|
||||
_ErrorMessage = ex.Message;
|
||||
throw new DbCslaException("Content.DataPortal_Fetch", ex);
|
||||
}
|
||||
@ -973,13 +989,13 @@ namespace VEPROMS.CSLA.Library
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
if(_MyLog.IsErrorEnabled)_MyLog.Error("Content.DataPortal_Insert", ex);
|
||||
if (_MyLog.IsErrorEnabled) _MyLog.Error("Content.DataPortal_Insert", ex);
|
||||
_ErrorMessage = ex.Message;
|
||||
throw new DbCslaException("Content.DataPortal_Insert", ex);
|
||||
}
|
||||
finally
|
||||
{
|
||||
if(_MyLog.IsDebugEnabled)_MyLog.DebugFormat("[{0}] Content.DataPortal_Insert", GetHashCode());
|
||||
if (_MyLog.IsDebugEnabled) _MyLog.DebugFormat("[{0}] Content.DataPortal_Insert", GetHashCode());
|
||||
}
|
||||
}
|
||||
[Transactional(TransactionalTypes.TransactionScope)]
|
||||
@ -988,7 +1004,7 @@ namespace VEPROMS.CSLA.Library
|
||||
if (!this.IsDirty) return;
|
||||
try
|
||||
{
|
||||
if(_MyFormat != null) _MyFormat.Update();
|
||||
if (_MyFormat != null) _MyFormat.Update();
|
||||
SqlConnection cn = (SqlConnection)ApplicationContext.LocalContext["cn"];
|
||||
using (SqlCommand cm = cn.CreateCommand())
|
||||
{
|
||||
@ -1024,11 +1040,11 @@ namespace VEPROMS.CSLA.Library
|
||||
if (_ContentRoUsages != null) _ContentRoUsages.Update(this);
|
||||
if (_ContentTransitions != null) _ContentTransitions.Update(this);
|
||||
if (_MyZContent != null) _MyZContent.Update(this);
|
||||
if(_MyLog.IsDebugEnabled)_MyLog.DebugFormat("[{0}] Content.SQLInsert", GetHashCode());
|
||||
if (_MyLog.IsDebugEnabled) _MyLog.DebugFormat("[{0}] Content.SQLInsert", GetHashCode());
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
if(_MyLog.IsErrorEnabled)_MyLog.Error("Content.SQLInsert", ex);
|
||||
if (_MyLog.IsErrorEnabled) _MyLog.Error("Content.SQLInsert", ex);
|
||||
_ErrorMessage = ex.Message;
|
||||
throw new DbCslaException("Content.SQLInsert", ex);
|
||||
}
|
||||
@ -1036,7 +1052,7 @@ namespace VEPROMS.CSLA.Library
|
||||
[Transactional(TransactionalTypes.TransactionScope)]
|
||||
public static byte[] Add(SqlConnection cn, ref int contentID, string number, string text, int? type, Format myFormat, string config, DateTime dts, string userID)
|
||||
{
|
||||
if(_MyLog.IsDebugEnabled)_MyLog.DebugFormat("[{0}] Content.Add", 0);
|
||||
if (_MyLog.IsDebugEnabled) _MyLog.DebugFormat("[{0}] Content.Add", 0);
|
||||
try
|
||||
{
|
||||
using (SqlCommand cm = cn.CreateCommand())
|
||||
@ -1047,7 +1063,7 @@ namespace VEPROMS.CSLA.Library
|
||||
cm.Parameters.AddWithValue("@Number", number);
|
||||
cm.Parameters.AddWithValue("@Text", text);
|
||||
cm.Parameters.AddWithValue("@Type", type);
|
||||
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("@UserID", userID);
|
||||
@ -1067,7 +1083,7 @@ namespace VEPROMS.CSLA.Library
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
if(_MyLog.IsErrorEnabled)_MyLog.Error("Content.Add", ex);
|
||||
if (_MyLog.IsErrorEnabled) _MyLog.Error("Content.Add", ex);
|
||||
throw new DbCslaException("Content.Add", ex);
|
||||
}
|
||||
}
|
||||
@ -1075,7 +1091,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}] Content.DataPortal_Update", GetHashCode());
|
||||
if (_MyLog.IsDebugEnabled) _MyLog.DebugFormat("[{0}] Content.DataPortal_Update", GetHashCode());
|
||||
try
|
||||
{
|
||||
using (SqlConnection cn = Database.VEPROMS_SqlConnection)
|
||||
@ -1089,7 +1105,7 @@ namespace VEPROMS.CSLA.Library
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
if(_MyLog.IsErrorEnabled)_MyLog.Error("Content.DataPortal_Update", ex);
|
||||
if (_MyLog.IsErrorEnabled) _MyLog.Error("Content.DataPortal_Update", ex);
|
||||
_ErrorMessage = ex.Message;
|
||||
if (!ex.Message.EndsWith("has been edited by another user.")) throw ex;
|
||||
}
|
||||
@ -1098,10 +1114,10 @@ namespace VEPROMS.CSLA.Library
|
||||
internal void SQLUpdate()
|
||||
{
|
||||
if (!IsDirty) return; // If not dirty - nothing to do
|
||||
if(_MyLog.IsDebugEnabled)_MyLog.DebugFormat("[{0}] Content.SQLUpdate", GetHashCode());
|
||||
if (_MyLog.IsDebugEnabled) _MyLog.DebugFormat("[{0}] Content.SQLUpdate", GetHashCode());
|
||||
try
|
||||
{
|
||||
if(_MyFormat != null) _MyFormat.Update();
|
||||
if (_MyFormat != null) _MyFormat.Update();
|
||||
SqlConnection cn = (SqlConnection)ApplicationContext.LocalContext["cn"];
|
||||
if (base.IsDirty)
|
||||
{
|
||||
@ -1141,7 +1157,7 @@ namespace VEPROMS.CSLA.Library
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
if(_MyLog.IsErrorEnabled)_MyLog.Error("Content.SQLUpdate", ex);
|
||||
if (_MyLog.IsErrorEnabled) _MyLog.Error("Content.SQLUpdate", ex);
|
||||
_ErrorMessage = ex.Message;
|
||||
if (!ex.Message.EndsWith("has been edited by another user.")) throw ex;
|
||||
}
|
||||
@ -1169,7 +1185,7 @@ namespace VEPROMS.CSLA.Library
|
||||
[Transactional(TransactionalTypes.TransactionScope)]
|
||||
public static byte[] Update(SqlConnection cn, ref int contentID, string number, string text, int? type, Format myFormat, string config, DateTime dts, string userID, ref byte[] lastChanged)
|
||||
{
|
||||
if(_MyLog.IsDebugEnabled)_MyLog.DebugFormat("[{0}] Content.Update", 0);
|
||||
if (_MyLog.IsDebugEnabled) _MyLog.DebugFormat("[{0}] Content.Update", 0);
|
||||
try
|
||||
{
|
||||
using (SqlCommand cm = cn.CreateCommand())
|
||||
@ -1181,7 +1197,7 @@ namespace VEPROMS.CSLA.Library
|
||||
cm.Parameters.AddWithValue("@Number", number);
|
||||
cm.Parameters.AddWithValue("@Text", text);
|
||||
cm.Parameters.AddWithValue("@Type", type);
|
||||
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("@UserID", userID);
|
||||
@ -1198,7 +1214,7 @@ namespace VEPROMS.CSLA.Library
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
if(_MyLog.IsErrorEnabled)_MyLog.Error("Content.Update", ex);
|
||||
if (_MyLog.IsErrorEnabled) _MyLog.Error("Content.Update", ex);
|
||||
throw new DbCslaException("Content.Update", ex);
|
||||
}
|
||||
}
|
||||
@ -1210,7 +1226,7 @@ namespace VEPROMS.CSLA.Library
|
||||
[Transactional(TransactionalTypes.TransactionScope)]
|
||||
private void DataPortal_Delete(PKCriteria criteria)
|
||||
{
|
||||
if(_MyLog.IsDebugEnabled)_MyLog.DebugFormat("[{0}] Content.DataPortal_Delete", GetHashCode());
|
||||
if (_MyLog.IsDebugEnabled) _MyLog.DebugFormat("[{0}] Content.DataPortal_Delete", GetHashCode());
|
||||
try
|
||||
{
|
||||
using (SqlConnection cn = Database.VEPROMS_SqlConnection)
|
||||
@ -1226,7 +1242,7 @@ namespace VEPROMS.CSLA.Library
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
if(_MyLog.IsErrorEnabled)_MyLog.Error("Content.DataPortal_Delete", ex);
|
||||
if (_MyLog.IsErrorEnabled) _MyLog.Error("Content.DataPortal_Delete", ex);
|
||||
_ErrorMessage = ex.Message;
|
||||
throw new DbCslaException("Content.DataPortal_Delete", ex);
|
||||
}
|
||||
@ -1234,7 +1250,7 @@ namespace VEPROMS.CSLA.Library
|
||||
[Transactional(TransactionalTypes.TransactionScope)]
|
||||
public static void Remove(SqlConnection cn, int contentID)
|
||||
{
|
||||
if(_MyLog.IsDebugEnabled)_MyLog.DebugFormat("[{0}] Content.Remove", 0);
|
||||
if (_MyLog.IsDebugEnabled) _MyLog.DebugFormat("[{0}] Content.Remove", 0);
|
||||
try
|
||||
{
|
||||
using (SqlCommand cm = cn.CreateCommand())
|
||||
@ -1249,7 +1265,7 @@ namespace VEPROMS.CSLA.Library
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
if(_MyLog.IsErrorEnabled)_MyLog.Error("Content.Remove", ex);
|
||||
if (_MyLog.IsErrorEnabled) _MyLog.Error("Content.Remove", ex);
|
||||
throw new DbCslaException("Content.Remove", ex);
|
||||
}
|
||||
}
|
||||
@ -1283,7 +1299,7 @@ namespace VEPROMS.CSLA.Library
|
||||
}
|
||||
protected override void DataPortal_Execute()
|
||||
{
|
||||
if(_MyLog.IsDebugEnabled)_MyLog.DebugFormat("[{0}] Content.DataPortal_Execute", GetHashCode());
|
||||
if (_MyLog.IsDebugEnabled) _MyLog.DebugFormat("[{0}] Content.DataPortal_Execute", GetHashCode());
|
||||
try
|
||||
{
|
||||
using (SqlConnection cn = Database.VEPROMS_SqlConnection)
|
||||
@ -1301,7 +1317,7 @@ namespace VEPROMS.CSLA.Library
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
if(_MyLog.IsErrorEnabled)_MyLog.Error("Content.DataPortal_Execute", ex);
|
||||
if (_MyLog.IsErrorEnabled) _MyLog.Error("Content.DataPortal_Execute", ex);
|
||||
throw new DbCslaException("Content.DataPortal_Execute", ex);
|
||||
}
|
||||
}
|
||||
|
@ -42,7 +42,7 @@ namespace VEPROMS.CSLA.Library
|
||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||
get
|
||||
{
|
||||
CanReadProperty("DetailID",true);
|
||||
CanReadProperty("DetailID", true);
|
||||
if (_MyDetail != null) _DetailID = _MyDetail.DetailID;
|
||||
return _DetailID;
|
||||
}
|
||||
@ -54,7 +54,7 @@ namespace VEPROMS.CSLA.Library
|
||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||
get
|
||||
{
|
||||
CanReadProperty("MyDetail",true);
|
||||
CanReadProperty("MyDetail", true);
|
||||
if (_MyDetail == null && _DetailID != 0) _MyDetail = Detail.Get(_DetailID);
|
||||
return _MyDetail;
|
||||
}
|
||||
@ -65,13 +65,13 @@ namespace VEPROMS.CSLA.Library
|
||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||
get
|
||||
{
|
||||
CanReadProperty("ItemType",true);
|
||||
CanReadProperty("ItemType", true);
|
||||
return _ItemType;
|
||||
}
|
||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||
set
|
||||
{
|
||||
CanWriteProperty("ItemType",true);
|
||||
CanWriteProperty("ItemType", true);
|
||||
if (_ItemType != value)
|
||||
{
|
||||
_ItemType = value;
|
||||
@ -85,13 +85,13 @@ namespace VEPROMS.CSLA.Library
|
||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||
get
|
||||
{
|
||||
CanReadProperty("Text",true);
|
||||
CanReadProperty("Text", true);
|
||||
return _Text;
|
||||
}
|
||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||
set
|
||||
{
|
||||
CanWriteProperty("Text",true);
|
||||
CanWriteProperty("Text", true);
|
||||
if (value == null) value = string.Empty;
|
||||
if (_Text != value)
|
||||
{
|
||||
@ -106,13 +106,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)
|
||||
{
|
||||
@ -127,13 +127,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;
|
||||
@ -147,13 +147,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)
|
||||
{
|
||||
@ -184,22 +184,22 @@ namespace VEPROMS.CSLA.Library
|
||||
#endregion
|
||||
#region ValidationRules
|
||||
[NonSerialized]
|
||||
private bool _CheckingBrokenRules=false;
|
||||
private bool _CheckingBrokenRules = false;
|
||||
public IVEHasBrokenRules HasBrokenRules
|
||||
{
|
||||
get
|
||||
{
|
||||
if(_CheckingBrokenRules)return null;
|
||||
if (_CheckingBrokenRules) return null;
|
||||
if (BrokenRulesCollection.Count > 0) return this;
|
||||
try
|
||||
{
|
||||
_CheckingBrokenRules=true;
|
||||
_CheckingBrokenRules = true;
|
||||
IVEHasBrokenRules hasBrokenRules = null;
|
||||
return hasBrokenRules;
|
||||
}
|
||||
finally
|
||||
{
|
||||
_CheckingBrokenRules=false;
|
||||
_CheckingBrokenRules = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -322,7 +322,7 @@ namespace VEPROMS.CSLA.Library
|
||||
#region Data Access Portal
|
||||
private void Fetch(SafeDataReader dr)
|
||||
{
|
||||
if(_MyLog.IsDebugEnabled)_MyLog.DebugFormat("[{0}] ContentDetail.FetchDR", GetHashCode());
|
||||
if (_MyLog.IsDebugEnabled) _MyLog.DebugFormat("[{0}] ContentDetail.FetchDR", GetHashCode());
|
||||
try
|
||||
{
|
||||
_DetailID = dr.GetInt32("DetailID");
|
||||
@ -335,7 +335,7 @@ namespace VEPROMS.CSLA.Library
|
||||
}
|
||||
catch (Exception ex) // FKItem Fetch
|
||||
{
|
||||
if(_MyLog.IsErrorEnabled)_MyLog.Error("ContentDetail.FetchDR", ex);
|
||||
if (_MyLog.IsErrorEnabled) _MyLog.Error("ContentDetail.FetchDR", ex);
|
||||
throw new DbCslaException("ContentDetail.Fetch", ex);
|
||||
}
|
||||
MarkOld();
|
||||
|
@ -94,8 +94,8 @@ namespace VEPROMS.CSLA.Library
|
||||
{
|
||||
get
|
||||
{
|
||||
IVEHasBrokenRules hasBrokenRules=null;
|
||||
foreach(ContentDetail contentDetail in this)
|
||||
IVEHasBrokenRules hasBrokenRules = null;
|
||||
foreach (ContentDetail contentDetail in this)
|
||||
if ((hasBrokenRules = contentDetail.HasBrokenRules) != null) return hasBrokenRules;
|
||||
return hasBrokenRules;
|
||||
}
|
||||
@ -165,7 +165,7 @@ namespace VEPROMS.CSLA.Library
|
||||
private void DataPortal_Fetch(ContentIDCriteria criteria)
|
||||
{
|
||||
this.RaiseListChangedEvents = false;
|
||||
if(_MyLog.IsDebugEnabled)_MyLog.DebugFormat("[{0}] ContentDetails.DataPortal_FetchContentID", GetHashCode());
|
||||
if (_MyLog.IsDebugEnabled) _MyLog.DebugFormat("[{0}] ContentDetails.DataPortal_FetchContentID", GetHashCode());
|
||||
try
|
||||
{
|
||||
using (SqlConnection cn = Database.VEPROMS_SqlConnection)
|
||||
@ -184,7 +184,7 @@ namespace VEPROMS.CSLA.Library
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
if(_MyLog.IsErrorEnabled)_MyLog.Error("ContentDetails.DataPortal_FetchContentID", ex);
|
||||
if (_MyLog.IsErrorEnabled) _MyLog.Error("ContentDetails.DataPortal_FetchContentID", ex);
|
||||
throw new DbCslaException("ContentDetails.DataPortal_Fetch", ex);
|
||||
}
|
||||
this.RaiseListChangedEvents = true;
|
||||
@ -269,8 +269,8 @@ namespace VEPROMS.CSLA.Library
|
||||
/// </summary>
|
||||
public partial class ContentDetailsPropertyDescriptor : vlnListPropertyDescriptor
|
||||
{
|
||||
private ContentDetail Item { get { return (ContentDetail) _Item;} }
|
||||
public ContentDetailsPropertyDescriptor(ContentDetails collection, int index):base(collection, index){;}
|
||||
private ContentDetail Item { get { return (ContentDetail)_Item; } }
|
||||
public ContentDetailsPropertyDescriptor(ContentDetails collection, int index) : base(collection, index) { ;}
|
||||
}
|
||||
#endregion
|
||||
#region Converter
|
||||
@ -281,7 +281,7 @@ namespace VEPROMS.CSLA.Library
|
||||
if (destType == typeof(string) && value is ContentDetails)
|
||||
{
|
||||
// Return department and department role separated by comma.
|
||||
return ((ContentDetails) value).Items.Count.ToString() + " Details";
|
||||
return ((ContentDetails)value).Items.Count.ToString() + " Details";
|
||||
}
|
||||
return base.ConvertTo(context, culture, value, destType);
|
||||
}
|
||||
|
@ -37,13 +37,17 @@ namespace VEPROMS.CSLA.Library
|
||||
#endregion
|
||||
#region Collection
|
||||
protected static List<ContentInfo> _AllList = new List<ContentInfo>();
|
||||
private static Dictionary<string, ContentInfo> _AllByPrimaryKey = new Dictionary<string, ContentInfo>();
|
||||
private static Dictionary<string, List<ContentInfo>> _AllByPrimaryKey = new Dictionary<string, List<ContentInfo>>();
|
||||
private static void ConvertListToDictionary()
|
||||
{
|
||||
List<ContentInfo> remove = new List<ContentInfo>();
|
||||
foreach (ContentInfo tmp in _AllList)
|
||||
{
|
||||
_AllByPrimaryKey[tmp.ContentID.ToString()]=tmp; // Primary Key
|
||||
if (!_AllByPrimaryKey.ContainsKey(tmp.ContentID.ToString()))
|
||||
{
|
||||
_AllByPrimaryKey[tmp.ContentID.ToString()] = new List<ContentInfo>(); // Add new list for PrimaryKey
|
||||
}
|
||||
_AllByPrimaryKey[tmp.ContentID.ToString()].Add(tmp); // Add to Primary Key list
|
||||
remove.Add(tmp);
|
||||
}
|
||||
foreach (ContentInfo tmp in remove)
|
||||
@ -57,7 +61,7 @@ namespace VEPROMS.CSLA.Library
|
||||
{
|
||||
ConvertListToDictionary();
|
||||
string key = contentID.ToString();
|
||||
if (_AllByPrimaryKey.ContainsKey(key)) return _AllByPrimaryKey[key];
|
||||
if (_AllByPrimaryKey.ContainsKey(key)) return _AllByPrimaryKey[key][0];
|
||||
return null;
|
||||
}
|
||||
#endregion
|
||||
@ -85,7 +89,7 @@ namespace VEPROMS.CSLA.Library
|
||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||
get
|
||||
{
|
||||
CanReadProperty("ContentID",true);
|
||||
CanReadProperty("ContentID", true);
|
||||
return _ContentID;
|
||||
}
|
||||
}
|
||||
@ -95,7 +99,7 @@ namespace VEPROMS.CSLA.Library
|
||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||
get
|
||||
{
|
||||
CanReadProperty("Number",true);
|
||||
CanReadProperty("Number", true);
|
||||
return _Number;
|
||||
}
|
||||
}
|
||||
@ -105,7 +109,7 @@ namespace VEPROMS.CSLA.Library
|
||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||
get
|
||||
{
|
||||
CanReadProperty("Text",true);
|
||||
CanReadProperty("Text", true);
|
||||
return _Text;
|
||||
}
|
||||
}
|
||||
@ -118,7 +122,7 @@ namespace VEPROMS.CSLA.Library
|
||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||
get
|
||||
{
|
||||
CanReadProperty("Type",true);
|
||||
CanReadProperty("Type", true);
|
||||
return _Type;
|
||||
}
|
||||
}
|
||||
@ -128,7 +132,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;
|
||||
}
|
||||
@ -139,7 +143,7 @@ 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 = FormatInfo.Get((int)_FormatID);
|
||||
return _MyFormat;
|
||||
}
|
||||
@ -150,7 +154,7 @@ namespace VEPROMS.CSLA.Library
|
||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||
get
|
||||
{
|
||||
CanReadProperty("Config",true);
|
||||
CanReadProperty("Config", true);
|
||||
return _Config;
|
||||
}
|
||||
}
|
||||
@ -160,7 +164,7 @@ namespace VEPROMS.CSLA.Library
|
||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||
get
|
||||
{
|
||||
CanReadProperty("DTS",true);
|
||||
CanReadProperty("DTS", true);
|
||||
return _DTS;
|
||||
}
|
||||
}
|
||||
@ -170,7 +174,7 @@ namespace VEPROMS.CSLA.Library
|
||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||
get
|
||||
{
|
||||
CanReadProperty("UserID",true);
|
||||
CanReadProperty("UserID", true);
|
||||
return _UserID;
|
||||
}
|
||||
}
|
||||
@ -183,7 +187,7 @@ namespace VEPROMS.CSLA.Library
|
||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||
get
|
||||
{
|
||||
CanReadProperty("ContentDetailCount",true);
|
||||
CanReadProperty("ContentDetailCount", true);
|
||||
return _ContentDetailCount;
|
||||
}
|
||||
}
|
||||
@ -194,7 +198,7 @@ namespace VEPROMS.CSLA.Library
|
||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||
get
|
||||
{
|
||||
CanReadProperty("ContentDetails",true);
|
||||
CanReadProperty("ContentDetails", true);
|
||||
if (_ContentDetailCount < 0 || (_ContentDetailCount > 0 && _ContentDetails == null))
|
||||
_ContentDetails = DetailInfoList.GetByContentID(_ContentID);
|
||||
if (_ContentDetailCount < 0)
|
||||
@ -204,7 +208,10 @@ namespace VEPROMS.CSLA.Library
|
||||
}
|
||||
internal void RefreshContentDetails()
|
||||
{
|
||||
_ContentDetailCount = -1; // This will cause the data to be requeried
|
||||
ConvertListToDictionary();
|
||||
if (_AllByPrimaryKey.ContainsKey(_ContentID.ToString()))
|
||||
foreach (ContentInfo tmp in _AllByPrimaryKey[_ContentID.ToString()])
|
||||
tmp._ContentDetailCount = -1; // This will cause the data to be requeried
|
||||
}
|
||||
private int _ContentEntryCount = 0;
|
||||
/// <summary>
|
||||
@ -215,7 +222,7 @@ namespace VEPROMS.CSLA.Library
|
||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||
get
|
||||
{
|
||||
CanReadProperty("ContentEntryCount",true);
|
||||
CanReadProperty("ContentEntryCount", true);
|
||||
return _ContentEntryCount;
|
||||
}
|
||||
}
|
||||
@ -226,7 +233,7 @@ namespace VEPROMS.CSLA.Library
|
||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||
get
|
||||
{
|
||||
CanReadProperty("MyEntry",true);
|
||||
CanReadProperty("MyEntry", true);
|
||||
if (_ContentEntryCount > 0 && _MyEntry == null)
|
||||
_MyEntry = EntryInfo.Get(_ContentID);
|
||||
return _MyEntry;
|
||||
@ -241,7 +248,7 @@ namespace VEPROMS.CSLA.Library
|
||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||
get
|
||||
{
|
||||
CanReadProperty("ContentItemCount",true);
|
||||
CanReadProperty("ContentItemCount", true);
|
||||
return _ContentItemCount;
|
||||
}
|
||||
}
|
||||
@ -252,7 +259,7 @@ namespace VEPROMS.CSLA.Library
|
||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||
get
|
||||
{
|
||||
CanReadProperty("ContentItems",true);
|
||||
CanReadProperty("ContentItems", true);
|
||||
if (_ContentItemCount < 0 || (_ContentItemCount > 0 && _ContentItems == null))
|
||||
_ContentItems = ItemInfoList.GetByContentID(_ContentID);
|
||||
if (_ContentItemCount < 0)
|
||||
@ -262,7 +269,10 @@ namespace VEPROMS.CSLA.Library
|
||||
}
|
||||
internal void RefreshContentItems()
|
||||
{
|
||||
_ContentItemCount = -1; // This will cause the data to be requeried
|
||||
ConvertListToDictionary();
|
||||
if (_AllByPrimaryKey.ContainsKey(_ContentID.ToString()))
|
||||
foreach (ContentInfo tmp in _AllByPrimaryKey[_ContentID.ToString()])
|
||||
tmp._ContentItemCount = -1; // This will cause the data to be requeried
|
||||
}
|
||||
private int _ContentPartCount = 0;
|
||||
/// <summary>
|
||||
@ -273,7 +283,7 @@ namespace VEPROMS.CSLA.Library
|
||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||
get
|
||||
{
|
||||
CanReadProperty("ContentPartCount",true);
|
||||
CanReadProperty("ContentPartCount", true);
|
||||
return _ContentPartCount;
|
||||
}
|
||||
}
|
||||
@ -284,7 +294,7 @@ namespace VEPROMS.CSLA.Library
|
||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||
get
|
||||
{
|
||||
CanReadProperty("ContentParts",true);
|
||||
CanReadProperty("ContentParts", true);
|
||||
if (_ContentPartCount < 0 || (_ContentPartCount > 0 && _ContentParts == null))
|
||||
_ContentParts = PartInfoList.GetByContentID(_ContentID);
|
||||
if (_ContentPartCount < 0)
|
||||
@ -294,7 +304,10 @@ namespace VEPROMS.CSLA.Library
|
||||
}
|
||||
internal void RefreshContentParts()
|
||||
{
|
||||
_ContentPartCount = -1; // This will cause the data to be requeried
|
||||
ConvertListToDictionary();
|
||||
if (_AllByPrimaryKey.ContainsKey(_ContentID.ToString()))
|
||||
foreach (ContentInfo tmp in _AllByPrimaryKey[_ContentID.ToString()])
|
||||
tmp._ContentPartCount = -1; // This will cause the data to be requeried
|
||||
}
|
||||
private int _ContentRoUsageCount = 0;
|
||||
/// <summary>
|
||||
@ -305,7 +318,7 @@ namespace VEPROMS.CSLA.Library
|
||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||
get
|
||||
{
|
||||
CanReadProperty("ContentRoUsageCount",true);
|
||||
CanReadProperty("ContentRoUsageCount", true);
|
||||
return _ContentRoUsageCount;
|
||||
}
|
||||
}
|
||||
@ -316,7 +329,7 @@ namespace VEPROMS.CSLA.Library
|
||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||
get
|
||||
{
|
||||
CanReadProperty("ContentRoUsages",true);
|
||||
CanReadProperty("ContentRoUsages", true);
|
||||
if (_ContentRoUsageCount < 0 || (_ContentRoUsageCount > 0 && _ContentRoUsages == null))
|
||||
_ContentRoUsages = RoUsageInfoList.GetByContentID(_ContentID);
|
||||
if (_ContentRoUsageCount < 0)
|
||||
@ -326,7 +339,10 @@ namespace VEPROMS.CSLA.Library
|
||||
}
|
||||
internal void RefreshContentRoUsages()
|
||||
{
|
||||
_ContentRoUsageCount = -1; // This will cause the data to be requeried
|
||||
ConvertListToDictionary();
|
||||
if (_AllByPrimaryKey.ContainsKey(_ContentID.ToString()))
|
||||
foreach (ContentInfo tmp in _AllByPrimaryKey[_ContentID.ToString()])
|
||||
tmp._ContentRoUsageCount = -1; // This will cause the data to be requeried
|
||||
}
|
||||
private int _ContentTransitionCount = 0;
|
||||
/// <summary>
|
||||
@ -337,7 +353,7 @@ namespace VEPROMS.CSLA.Library
|
||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||
get
|
||||
{
|
||||
CanReadProperty("ContentTransitionCount",true);
|
||||
CanReadProperty("ContentTransitionCount", true);
|
||||
return _ContentTransitionCount;
|
||||
}
|
||||
}
|
||||
@ -348,7 +364,7 @@ namespace VEPROMS.CSLA.Library
|
||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||
get
|
||||
{
|
||||
CanReadProperty("ContentTransitions",true);
|
||||
CanReadProperty("ContentTransitions", true);
|
||||
if (_ContentTransitionCount < 0 || (_ContentTransitionCount > 0 && _ContentTransitions == null))
|
||||
_ContentTransitions = TransitionInfoList.GetByFromID(_ContentID);
|
||||
if (_ContentTransitionCount < 0)
|
||||
@ -358,7 +374,10 @@ namespace VEPROMS.CSLA.Library
|
||||
}
|
||||
internal void RefreshContentTransitions()
|
||||
{
|
||||
_ContentTransitionCount = -1; // This will cause the data to be requeried
|
||||
ConvertListToDictionary();
|
||||
if (_AllByPrimaryKey.ContainsKey(_ContentID.ToString()))
|
||||
foreach (ContentInfo tmp in _AllByPrimaryKey[_ContentID.ToString()])
|
||||
tmp._ContentTransitionCount = -1; // This will cause the data to be requeried
|
||||
}
|
||||
private int _ContentZContentCount = 0;
|
||||
/// <summary>
|
||||
@ -369,7 +388,7 @@ namespace VEPROMS.CSLA.Library
|
||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||
get
|
||||
{
|
||||
CanReadProperty("ContentZContentCount",true);
|
||||
CanReadProperty("ContentZContentCount", true);
|
||||
return _ContentZContentCount;
|
||||
}
|
||||
}
|
||||
@ -380,7 +399,7 @@ namespace VEPROMS.CSLA.Library
|
||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||
get
|
||||
{
|
||||
CanReadProperty("MyZContent",true);
|
||||
CanReadProperty("MyZContent", true);
|
||||
if (_ContentZContentCount > 0 && _MyZContent == null)
|
||||
_MyZContent = ZContentInfo.Get(_ContentID);
|
||||
return _MyZContent;
|
||||
@ -406,14 +425,25 @@ namespace VEPROMS.CSLA.Library
|
||||
}
|
||||
#endregion
|
||||
#region Factory Methods
|
||||
private static int _ContentInfoUnique = 0;
|
||||
private int _MyContentInfoUnique;
|
||||
public int MyContentInfoUnique
|
||||
{
|
||||
get { return _MyContentInfoUnique; }
|
||||
}
|
||||
private ContentInfo()
|
||||
{/* require use of factory methods */
|
||||
_MyContentInfoUnique = ++_ContentInfoUnique;
|
||||
_AllList.Add(this);
|
||||
}
|
||||
public void Dispose()
|
||||
{
|
||||
_AllList.Remove(this);
|
||||
_AllByPrimaryKey.Remove(ContentID.ToString());
|
||||
if (!_AllByPrimaryKey.ContainsKey(ContentID.ToString())) return;
|
||||
List<ContentInfo> listContentInfo = _AllByPrimaryKey[ContentID.ToString()]; // Get the list of items
|
||||
listContentInfo.Remove(this); // Remove the item from the list
|
||||
if (listContentInfo.Count == 0) // If there are no items left in the list
|
||||
_AllByPrimaryKey.Remove(ContentID.ToString()); // remove the list
|
||||
}
|
||||
public virtual Content Get()
|
||||
{
|
||||
@ -421,8 +451,10 @@ namespace VEPROMS.CSLA.Library
|
||||
}
|
||||
public static void Refresh(Content tmp)
|
||||
{
|
||||
ContentInfo tmpInfo = GetExistingByPrimaryKey(tmp.ContentID);
|
||||
if (tmpInfo == null) return;
|
||||
string key = tmp.ContentID.ToString();
|
||||
ConvertListToDictionary();
|
||||
if (_AllByPrimaryKey.ContainsKey(key))
|
||||
foreach (ContentInfo tmpInfo in _AllByPrimaryKey[key])
|
||||
tmpInfo.RefreshFields(tmp);
|
||||
}
|
||||
private void RefreshFields(Content tmp)
|
||||
@ -434,9 +466,9 @@ namespace VEPROMS.CSLA.Library
|
||||
{
|
||||
MyFormat.RefreshFormatContents(); // Update List for old value
|
||||
_FormatID = tmp.FormatID; // Update the value
|
||||
_MyFormat = null; // Reset list so that the next line gets a new list
|
||||
MyFormat.RefreshFormatContents(); // Update List for new value
|
||||
}
|
||||
_MyFormat = null; // Reset list so that the next line gets a new list
|
||||
if (MyFormat != null) MyFormat.RefreshFormatContents(); // Update List for new value
|
||||
_Config = tmp.Config;
|
||||
_DTS = tmp.DTS;
|
||||
_UserID = tmp.UserID;
|
||||
@ -448,8 +480,10 @@ namespace VEPROMS.CSLA.Library
|
||||
}
|
||||
public static void Refresh(FormatContent tmp)
|
||||
{
|
||||
ContentInfo tmpInfo = GetExistingByPrimaryKey(tmp.ContentID);
|
||||
if (tmpInfo == null) return;
|
||||
string key = tmp.ContentID.ToString();
|
||||
ConvertListToDictionary();
|
||||
if (_AllByPrimaryKey.ContainsKey(key))
|
||||
foreach (ContentInfo tmpInfo in _AllByPrimaryKey[key])
|
||||
tmpInfo.RefreshFields(tmp);
|
||||
}
|
||||
private void RefreshFields(FormatContent tmp)
|
||||
@ -476,7 +510,7 @@ namespace VEPROMS.CSLA.Library
|
||||
if (tmp == null)
|
||||
{
|
||||
tmp = DataPortal.Fetch<ContentInfo>(new PKCriteria(contentID));
|
||||
_AllList.Add(tmp);
|
||||
if (!_AllList.Contains(tmp)) _AllList.Add(tmp);
|
||||
}
|
||||
if (tmp.ErrorMessage == "No Record Found") tmp = null;
|
||||
return tmp;
|
||||
@ -490,14 +524,15 @@ namespace VEPROMS.CSLA.Library
|
||||
#region Data Access Portal
|
||||
internal ContentInfo(SafeDataReader dr)
|
||||
{
|
||||
if(_MyLog.IsDebugEnabled)_MyLog.DebugFormat("[{0}] ContentInfo.Constructor", GetHashCode());
|
||||
_MyContentInfoUnique = ++_ContentInfoUnique;
|
||||
if (_MyLog.IsDebugEnabled) _MyLog.DebugFormat("[{0}] ContentInfo.Constructor", GetHashCode());
|
||||
try
|
||||
{
|
||||
ReadData(dr);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
if(_MyLog.IsErrorEnabled)_MyLog.Error("ContentInfo.Constructor", ex);
|
||||
if (_MyLog.IsErrorEnabled) _MyLog.Error("ContentInfo.Constructor", ex);
|
||||
throw new DbCslaException("ContentInfo.Constructor", ex);
|
||||
}
|
||||
}
|
||||
@ -514,7 +549,7 @@ namespace VEPROMS.CSLA.Library
|
||||
}
|
||||
private void ReadData(SafeDataReader dr)
|
||||
{
|
||||
if(_MyLog.IsDebugEnabled)_MyLog.DebugFormat("[{0}] ContentInfo.ReadData", GetHashCode());
|
||||
if (_MyLog.IsDebugEnabled) _MyLog.DebugFormat("[{0}] ContentInfo.ReadData", GetHashCode());
|
||||
try
|
||||
{
|
||||
_ContentID = dr.GetInt32("ContentID");
|
||||
@ -535,14 +570,14 @@ namespace VEPROMS.CSLA.Library
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
if(_MyLog.IsErrorEnabled)_MyLog.Error("ContentInfo.ReadData", ex);
|
||||
if (_MyLog.IsErrorEnabled) _MyLog.Error("ContentInfo.ReadData", ex);
|
||||
_ErrorMessage = ex.Message;
|
||||
throw new DbCslaException("ContentInfo.ReadData", ex);
|
||||
}
|
||||
}
|
||||
private void DataPortal_Fetch(PKCriteria criteria)
|
||||
{
|
||||
if(_MyLog.IsDebugEnabled)_MyLog.DebugFormat("[{0}] ContentInfo.DataPortal_Fetch", GetHashCode());
|
||||
if (_MyLog.IsDebugEnabled) _MyLog.DebugFormat("[{0}] ContentInfo.DataPortal_Fetch", GetHashCode());
|
||||
try
|
||||
{
|
||||
using (SqlConnection cn = Database.VEPROMS_SqlConnection)
|
||||
@ -570,7 +605,7 @@ namespace VEPROMS.CSLA.Library
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
if(_MyLog.IsErrorEnabled)_MyLog.Error("ContentInfo.DataPortal_Fetch", ex);
|
||||
if (_MyLog.IsErrorEnabled) _MyLog.Error("ContentInfo.DataPortal_Fetch", ex);
|
||||
_ErrorMessage = ex.Message;
|
||||
throw new DbCslaException("ContentInfo.DataPortal_Fetch", ex);
|
||||
}
|
||||
@ -580,7 +615,7 @@ namespace VEPROMS.CSLA.Library
|
||||
#region extension
|
||||
ContentInfoExtension _ContentInfoExtension = new ContentInfoExtension();
|
||||
[Serializable()]
|
||||
partial class ContentInfoExtension : extensionBase {}
|
||||
partial class ContentInfoExtension : extensionBase { }
|
||||
[Serializable()]
|
||||
class extensionBase
|
||||
{
|
||||
|
@ -110,7 +110,7 @@ namespace VEPROMS.CSLA.Library
|
||||
private void DataPortal_Fetch()
|
||||
{
|
||||
this.RaiseListChangedEvents = false;
|
||||
if(_MyLog.IsDebugEnabled)_MyLog.DebugFormat("[{0}] ContentInfoList.DataPortal_Fetch", GetHashCode());
|
||||
if (_MyLog.IsDebugEnabled) _MyLog.DebugFormat("[{0}] ContentInfoList.DataPortal_Fetch", GetHashCode());
|
||||
try
|
||||
{
|
||||
using (SqlConnection cn = Database.VEPROMS_SqlConnection)
|
||||
@ -130,7 +130,7 @@ namespace VEPROMS.CSLA.Library
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
if(_MyLog.IsErrorEnabled)_MyLog.Error("ContentInfoList.DataPortal_Fetch", ex);
|
||||
if (_MyLog.IsErrorEnabled) _MyLog.Error("ContentInfoList.DataPortal_Fetch", ex);
|
||||
throw new DbCslaException("ContentInfoList.DataPortal_Fetch", ex);
|
||||
}
|
||||
this.RaiseListChangedEvents = true;
|
||||
@ -152,7 +152,7 @@ namespace VEPROMS.CSLA.Library
|
||||
private void DataPortal_Fetch(FormatIDCriteria criteria)
|
||||
{
|
||||
this.RaiseListChangedEvents = false;
|
||||
if(_MyLog.IsDebugEnabled)_MyLog.DebugFormat("[{0}] ContentInfoList.DataPortal_FetchFormatID", GetHashCode());
|
||||
if (_MyLog.IsDebugEnabled) _MyLog.DebugFormat("[{0}] ContentInfoList.DataPortal_FetchFormatID", GetHashCode());
|
||||
try
|
||||
{
|
||||
using (SqlConnection cn = Database.VEPROMS_SqlConnection)
|
||||
@ -173,7 +173,7 @@ namespace VEPROMS.CSLA.Library
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
if(_MyLog.IsErrorEnabled)_MyLog.Error("ContentInfoList.DataPortal_FetchFormatID", ex);
|
||||
if (_MyLog.IsErrorEnabled) _MyLog.Error("ContentInfoList.DataPortal_FetchFormatID", ex);
|
||||
throw new DbCslaException("ContentInfoList.DataPortal_Fetch", ex);
|
||||
}
|
||||
this.RaiseListChangedEvents = true;
|
||||
@ -234,8 +234,8 @@ namespace VEPROMS.CSLA.Library
|
||||
/// </summary>
|
||||
public partial class ContentInfoListPropertyDescriptor : vlnListPropertyDescriptor
|
||||
{
|
||||
private ContentInfo Item { get { return (ContentInfo) _Item;} }
|
||||
public ContentInfoListPropertyDescriptor(ContentInfoList collection, int index):base(collection, index){;}
|
||||
private ContentInfo Item { get { return (ContentInfo)_Item; } }
|
||||
public ContentInfoListPropertyDescriptor(ContentInfoList collection, int index) : base(collection, index) { ;}
|
||||
}
|
||||
#endregion
|
||||
#region Converter
|
||||
@ -246,7 +246,7 @@ namespace VEPROMS.CSLA.Library
|
||||
if (destType == typeof(string) && value is ContentInfoList)
|
||||
{
|
||||
// Return department and department role separated by comma.
|
||||
return ((ContentInfoList) value).Items.Count.ToString() + " Contents";
|
||||
return ((ContentInfoList)value).Items.Count.ToString() + " Contents";
|
||||
}
|
||||
return base.ConvertTo(context, culture, value, destType);
|
||||
}
|
||||
|
@ -42,7 +42,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;
|
||||
}
|
||||
@ -54,7 +54,7 @@ namespace VEPROMS.CSLA.Library
|
||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||
get
|
||||
{
|
||||
CanReadProperty("MyItem",true);
|
||||
CanReadProperty("MyItem", true);
|
||||
if (_MyItem == null && _ItemID != 0) _MyItem = Item.Get(_ItemID);
|
||||
return _MyItem;
|
||||
}
|
||||
@ -65,7 +65,7 @@ namespace VEPROMS.CSLA.Library
|
||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||
get
|
||||
{
|
||||
CanReadProperty("PreviousID",true);
|
||||
CanReadProperty("PreviousID", true);
|
||||
if (_MyPrevious != null) _PreviousID = _MyPrevious.ItemID;
|
||||
return _PreviousID;
|
||||
}
|
||||
@ -76,18 +76,18 @@ namespace VEPROMS.CSLA.Library
|
||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||
get
|
||||
{
|
||||
CanReadProperty("MyPrevious",true);
|
||||
CanReadProperty("MyPrevious", true);
|
||||
if (_MyPrevious == null && _PreviousID != null) _MyPrevious = Item.Get((int)_PreviousID);
|
||||
return _MyPrevious;
|
||||
}
|
||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||
set
|
||||
{
|
||||
CanWriteProperty("MyPrevious",true);
|
||||
CanWriteProperty("MyPrevious", true);
|
||||
if (_MyPrevious != value)
|
||||
{
|
||||
_MyPrevious = value;
|
||||
_PreviousID = (value == null ? null : (int?) value.ItemID);
|
||||
_PreviousID = (value == null ? null : (int?)value.ItemID);
|
||||
PropertyHasChanged();
|
||||
}
|
||||
}
|
||||
@ -98,13 +98,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;
|
||||
@ -118,13 +118,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)
|
||||
{
|
||||
@ -155,23 +155,23 @@ namespace VEPROMS.CSLA.Library
|
||||
#endregion
|
||||
#region ValidationRules
|
||||
[NonSerialized]
|
||||
private bool _CheckingBrokenRules=false;
|
||||
private bool _CheckingBrokenRules = false;
|
||||
public IVEHasBrokenRules HasBrokenRules
|
||||
{
|
||||
get
|
||||
{
|
||||
if(_CheckingBrokenRules)return null;
|
||||
if (_CheckingBrokenRules) return null;
|
||||
if (BrokenRulesCollection.Count > 0) return this;
|
||||
try
|
||||
{
|
||||
_CheckingBrokenRules=true;
|
||||
_CheckingBrokenRules = true;
|
||||
IVEHasBrokenRules hasBrokenRules = null;
|
||||
if (_MyItem != null && (hasBrokenRules = _MyItem.HasBrokenRules) != null) return hasBrokenRules;
|
||||
return hasBrokenRules;
|
||||
}
|
||||
finally
|
||||
{
|
||||
_CheckingBrokenRules=false;
|
||||
_CheckingBrokenRules = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -272,7 +272,7 @@ namespace VEPROMS.CSLA.Library
|
||||
#region Data Access Portal
|
||||
private void Fetch(SafeDataReader dr)
|
||||
{
|
||||
if(_MyLog.IsDebugEnabled)_MyLog.DebugFormat("[{0}] ContentItem.FetchDR", GetHashCode());
|
||||
if (_MyLog.IsDebugEnabled) _MyLog.DebugFormat("[{0}] ContentItem.FetchDR", GetHashCode());
|
||||
try
|
||||
{
|
||||
_ItemID = dr.GetInt32("ItemID");
|
||||
@ -283,7 +283,7 @@ namespace VEPROMS.CSLA.Library
|
||||
}
|
||||
catch (Exception ex) // FKItem Fetch
|
||||
{
|
||||
if(_MyLog.IsErrorEnabled)_MyLog.Error("ContentItem.FetchDR", ex);
|
||||
if (_MyLog.IsErrorEnabled) _MyLog.Error("ContentItem.FetchDR", ex);
|
||||
throw new DbCslaException("ContentItem.Fetch", ex);
|
||||
}
|
||||
MarkOld();
|
||||
|
@ -94,8 +94,8 @@ namespace VEPROMS.CSLA.Library
|
||||
{
|
||||
get
|
||||
{
|
||||
IVEHasBrokenRules hasBrokenRules=null;
|
||||
foreach(ContentItem contentItem in this)
|
||||
IVEHasBrokenRules hasBrokenRules = null;
|
||||
foreach (ContentItem contentItem in this)
|
||||
if ((hasBrokenRules = contentItem.HasBrokenRules) != null) return hasBrokenRules;
|
||||
return hasBrokenRules;
|
||||
}
|
||||
@ -165,7 +165,7 @@ namespace VEPROMS.CSLA.Library
|
||||
private void DataPortal_Fetch(ContentIDCriteria criteria)
|
||||
{
|
||||
this.RaiseListChangedEvents = false;
|
||||
if(_MyLog.IsDebugEnabled)_MyLog.DebugFormat("[{0}] ContentItems.DataPortal_FetchContentID", GetHashCode());
|
||||
if (_MyLog.IsDebugEnabled) _MyLog.DebugFormat("[{0}] ContentItems.DataPortal_FetchContentID", GetHashCode());
|
||||
try
|
||||
{
|
||||
using (SqlConnection cn = Database.VEPROMS_SqlConnection)
|
||||
@ -184,7 +184,7 @@ namespace VEPROMS.CSLA.Library
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
if(_MyLog.IsErrorEnabled)_MyLog.Error("ContentItems.DataPortal_FetchContentID", ex);
|
||||
if (_MyLog.IsErrorEnabled) _MyLog.Error("ContentItems.DataPortal_FetchContentID", ex);
|
||||
throw new DbCslaException("ContentItems.DataPortal_Fetch", ex);
|
||||
}
|
||||
this.RaiseListChangedEvents = true;
|
||||
@ -269,8 +269,8 @@ namespace VEPROMS.CSLA.Library
|
||||
/// </summary>
|
||||
public partial class ContentItemsPropertyDescriptor : vlnListPropertyDescriptor
|
||||
{
|
||||
private ContentItem Item { get { return (ContentItem) _Item;} }
|
||||
public ContentItemsPropertyDescriptor(ContentItems collection, int index):base(collection, index){;}
|
||||
private ContentItem Item { get { return (ContentItem)_Item; } }
|
||||
public ContentItemsPropertyDescriptor(ContentItems collection, int index) : base(collection, index) { ;}
|
||||
}
|
||||
#endregion
|
||||
#region Converter
|
||||
@ -281,7 +281,7 @@ namespace VEPROMS.CSLA.Library
|
||||
if (destType == typeof(string) && value is ContentItems)
|
||||
{
|
||||
// Return department and department role separated by comma.
|
||||
return ((ContentItems) value).Items.Count.ToString() + " Items";
|
||||
return ((ContentItems)value).Items.Count.ToString() + " Items";
|
||||
}
|
||||
return base.ConvertTo(context, culture, value, destType);
|
||||
}
|
||||
|
@ -42,7 +42,7 @@ namespace VEPROMS.CSLA.Library
|
||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||
get
|
||||
{
|
||||
CanReadProperty("FromType",true);
|
||||
CanReadProperty("FromType", true);
|
||||
return _FromType;
|
||||
}
|
||||
}
|
||||
@ -52,7 +52,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;
|
||||
}
|
||||
@ -63,14 +63,14 @@ namespace VEPROMS.CSLA.Library
|
||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||
get
|
||||
{
|
||||
CanReadProperty("MyItem",true);
|
||||
CanReadProperty("MyItem", true);
|
||||
if (_MyItem == null && _ItemID != 0) _MyItem = Item.Get(_ItemID);
|
||||
return _MyItem;
|
||||
}
|
||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||
set
|
||||
{
|
||||
CanWriteProperty("MyItem",true);
|
||||
CanWriteProperty("MyItem", true);
|
||||
if (_MyItem != value)
|
||||
{
|
||||
_MyItem = value;
|
||||
@ -84,13 +84,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;
|
||||
@ -104,13 +104,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)
|
||||
{
|
||||
@ -126,7 +126,7 @@ namespace VEPROMS.CSLA.Library
|
||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||
get
|
||||
{
|
||||
CanReadProperty("Item_PreviousID",true);
|
||||
CanReadProperty("Item_PreviousID", true);
|
||||
return _Item_PreviousID;
|
||||
}
|
||||
}
|
||||
@ -136,7 +136,7 @@ namespace VEPROMS.CSLA.Library
|
||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||
get
|
||||
{
|
||||
CanReadProperty("Item_ContentID",true);
|
||||
CanReadProperty("Item_ContentID", true);
|
||||
return _Item_ContentID;
|
||||
}
|
||||
}
|
||||
@ -146,7 +146,7 @@ namespace VEPROMS.CSLA.Library
|
||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||
get
|
||||
{
|
||||
CanReadProperty("Item_DTS",true);
|
||||
CanReadProperty("Item_DTS", true);
|
||||
return _Item_DTS;
|
||||
}
|
||||
}
|
||||
@ -156,7 +156,7 @@ namespace VEPROMS.CSLA.Library
|
||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||
get
|
||||
{
|
||||
CanReadProperty("Item_UserID",true);
|
||||
CanReadProperty("Item_UserID", true);
|
||||
return _Item_UserID;
|
||||
}
|
||||
}
|
||||
@ -189,23 +189,23 @@ namespace VEPROMS.CSLA.Library
|
||||
#endregion
|
||||
#region ValidationRules
|
||||
[NonSerialized]
|
||||
private bool _CheckingBrokenRules=false;
|
||||
private bool _CheckingBrokenRules = false;
|
||||
public IVEHasBrokenRules HasBrokenRules
|
||||
{
|
||||
get
|
||||
{
|
||||
if(_CheckingBrokenRules)return null;
|
||||
if (_CheckingBrokenRules) return null;
|
||||
if (BrokenRulesCollection.Count > 0) return this;
|
||||
try
|
||||
{
|
||||
_CheckingBrokenRules=true;
|
||||
_CheckingBrokenRules = true;
|
||||
IVEHasBrokenRules hasBrokenRules = null;
|
||||
if (_MyItem != null && (hasBrokenRules = _MyItem.HasBrokenRules) != null) return hasBrokenRules;
|
||||
return hasBrokenRules;
|
||||
}
|
||||
finally
|
||||
{
|
||||
_CheckingBrokenRules=false;
|
||||
_CheckingBrokenRules = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -326,7 +326,7 @@ namespace VEPROMS.CSLA.Library
|
||||
#region Data Access Portal
|
||||
private void Fetch(SafeDataReader dr)
|
||||
{
|
||||
if(_MyLog.IsDebugEnabled)_MyLog.DebugFormat("[{0}] ContentPart.FetchDR", GetHashCode());
|
||||
if (_MyLog.IsDebugEnabled) _MyLog.DebugFormat("[{0}] ContentPart.FetchDR", GetHashCode());
|
||||
try
|
||||
{
|
||||
_FromType = dr.GetInt32("FromType");
|
||||
@ -341,7 +341,7 @@ namespace VEPROMS.CSLA.Library
|
||||
}
|
||||
catch (Exception ex) // FKItem Fetch
|
||||
{
|
||||
if(_MyLog.IsErrorEnabled)_MyLog.Error("ContentPart.FetchDR", ex);
|
||||
if (_MyLog.IsErrorEnabled) _MyLog.Error("ContentPart.FetchDR", ex);
|
||||
throw new DbCslaException("ContentPart.Fetch", ex);
|
||||
}
|
||||
MarkOld();
|
||||
|
@ -99,8 +99,8 @@ namespace VEPROMS.CSLA.Library
|
||||
{
|
||||
get
|
||||
{
|
||||
IVEHasBrokenRules hasBrokenRules=null;
|
||||
foreach(ContentPart contentPart in this)
|
||||
IVEHasBrokenRules hasBrokenRules = null;
|
||||
foreach (ContentPart contentPart in this)
|
||||
if ((hasBrokenRules = contentPart.HasBrokenRules) != null) return hasBrokenRules;
|
||||
return hasBrokenRules;
|
||||
}
|
||||
@ -170,7 +170,7 @@ namespace VEPROMS.CSLA.Library
|
||||
private void DataPortal_Fetch(ContentIDCriteria criteria)
|
||||
{
|
||||
this.RaiseListChangedEvents = false;
|
||||
if(_MyLog.IsDebugEnabled)_MyLog.DebugFormat("[{0}] ContentParts.DataPortal_FetchContentID", GetHashCode());
|
||||
if (_MyLog.IsDebugEnabled) _MyLog.DebugFormat("[{0}] ContentParts.DataPortal_FetchContentID", GetHashCode());
|
||||
try
|
||||
{
|
||||
using (SqlConnection cn = Database.VEPROMS_SqlConnection)
|
||||
@ -189,7 +189,7 @@ namespace VEPROMS.CSLA.Library
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
if(_MyLog.IsErrorEnabled)_MyLog.Error("ContentParts.DataPortal_FetchContentID", ex);
|
||||
if (_MyLog.IsErrorEnabled) _MyLog.Error("ContentParts.DataPortal_FetchContentID", ex);
|
||||
throw new DbCslaException("ContentParts.DataPortal_Fetch", ex);
|
||||
}
|
||||
this.RaiseListChangedEvents = true;
|
||||
@ -274,8 +274,8 @@ namespace VEPROMS.CSLA.Library
|
||||
/// </summary>
|
||||
public partial class ContentPartsPropertyDescriptor : vlnListPropertyDescriptor
|
||||
{
|
||||
private ContentPart Item { get { return (ContentPart) _Item;} }
|
||||
public ContentPartsPropertyDescriptor(ContentParts collection, int index):base(collection, index){;}
|
||||
private ContentPart Item { get { return (ContentPart)_Item; } }
|
||||
public ContentPartsPropertyDescriptor(ContentParts collection, int index) : base(collection, index) { ;}
|
||||
}
|
||||
#endregion
|
||||
#region Converter
|
||||
@ -286,7 +286,7 @@ namespace VEPROMS.CSLA.Library
|
||||
if (destType == typeof(string) && value is ContentParts)
|
||||
{
|
||||
// Return department and department role separated by comma.
|
||||
return ((ContentParts) value).Items.Count.ToString() + " Parts";
|
||||
return ((ContentParts)value).Items.Count.ToString() + " Parts";
|
||||
}
|
||||
return base.ConvertTo(context, culture, value, destType);
|
||||
}
|
||||
|
@ -42,7 +42,7 @@ namespace VEPROMS.CSLA.Library
|
||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||
get
|
||||
{
|
||||
CanReadProperty("ROUsageID",true);
|
||||
CanReadProperty("ROUsageID", true);
|
||||
if (_MyRoUsage != null) _ROUsageID = _MyRoUsage.ROUsageID;
|
||||
return _ROUsageID;
|
||||
}
|
||||
@ -54,7 +54,7 @@ namespace VEPROMS.CSLA.Library
|
||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||
get
|
||||
{
|
||||
CanReadProperty("MyRoUsage",true);
|
||||
CanReadProperty("MyRoUsage", true);
|
||||
if (_MyRoUsage == null && _ROUsageID != 0) _MyRoUsage = RoUsage.Get(_ROUsageID);
|
||||
return _MyRoUsage;
|
||||
}
|
||||
@ -65,13 +65,13 @@ namespace VEPROMS.CSLA.Library
|
||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||
get
|
||||
{
|
||||
CanReadProperty("ROID",true);
|
||||
CanReadProperty("ROID", true);
|
||||
return _ROID;
|
||||
}
|
||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||
set
|
||||
{
|
||||
CanWriteProperty("ROID",true);
|
||||
CanWriteProperty("ROID", true);
|
||||
if (value == null) value = string.Empty;
|
||||
if (_ROID != value)
|
||||
{
|
||||
@ -86,13 +86,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)
|
||||
{
|
||||
@ -107,13 +107,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;
|
||||
@ -127,13 +127,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)
|
||||
{
|
||||
@ -164,22 +164,22 @@ namespace VEPROMS.CSLA.Library
|
||||
#endregion
|
||||
#region ValidationRules
|
||||
[NonSerialized]
|
||||
private bool _CheckingBrokenRules=false;
|
||||
private bool _CheckingBrokenRules = false;
|
||||
public IVEHasBrokenRules HasBrokenRules
|
||||
{
|
||||
get
|
||||
{
|
||||
if(_CheckingBrokenRules)return null;
|
||||
if (_CheckingBrokenRules) return null;
|
||||
if (BrokenRulesCollection.Count > 0) return this;
|
||||
try
|
||||
{
|
||||
_CheckingBrokenRules=true;
|
||||
_CheckingBrokenRules = true;
|
||||
IVEHasBrokenRules hasBrokenRules = null;
|
||||
return hasBrokenRules;
|
||||
}
|
||||
finally
|
||||
{
|
||||
_CheckingBrokenRules=false;
|
||||
_CheckingBrokenRules = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -299,7 +299,7 @@ namespace VEPROMS.CSLA.Library
|
||||
#region Data Access Portal
|
||||
private void Fetch(SafeDataReader dr)
|
||||
{
|
||||
if(_MyLog.IsDebugEnabled)_MyLog.DebugFormat("[{0}] ContentRoUsage.FetchDR", GetHashCode());
|
||||
if (_MyLog.IsDebugEnabled) _MyLog.DebugFormat("[{0}] ContentRoUsage.FetchDR", GetHashCode());
|
||||
try
|
||||
{
|
||||
_ROUsageID = dr.GetInt32("ROUsageID");
|
||||
@ -311,7 +311,7 @@ namespace VEPROMS.CSLA.Library
|
||||
}
|
||||
catch (Exception ex) // FKItem Fetch
|
||||
{
|
||||
if(_MyLog.IsErrorEnabled)_MyLog.Error("ContentRoUsage.FetchDR", ex);
|
||||
if (_MyLog.IsErrorEnabled) _MyLog.Error("ContentRoUsage.FetchDR", ex);
|
||||
throw new DbCslaException("ContentRoUsage.Fetch", ex);
|
||||
}
|
||||
MarkOld();
|
||||
|
@ -94,8 +94,8 @@ namespace VEPROMS.CSLA.Library
|
||||
{
|
||||
get
|
||||
{
|
||||
IVEHasBrokenRules hasBrokenRules=null;
|
||||
foreach(ContentRoUsage contentRoUsage in this)
|
||||
IVEHasBrokenRules hasBrokenRules = null;
|
||||
foreach (ContentRoUsage contentRoUsage in this)
|
||||
if ((hasBrokenRules = contentRoUsage.HasBrokenRules) != null) return hasBrokenRules;
|
||||
return hasBrokenRules;
|
||||
}
|
||||
@ -165,7 +165,7 @@ namespace VEPROMS.CSLA.Library
|
||||
private void DataPortal_Fetch(ContentIDCriteria criteria)
|
||||
{
|
||||
this.RaiseListChangedEvents = false;
|
||||
if(_MyLog.IsDebugEnabled)_MyLog.DebugFormat("[{0}] ContentRoUsages.DataPortal_FetchContentID", GetHashCode());
|
||||
if (_MyLog.IsDebugEnabled) _MyLog.DebugFormat("[{0}] ContentRoUsages.DataPortal_FetchContentID", GetHashCode());
|
||||
try
|
||||
{
|
||||
using (SqlConnection cn = Database.VEPROMS_SqlConnection)
|
||||
@ -184,7 +184,7 @@ namespace VEPROMS.CSLA.Library
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
if(_MyLog.IsErrorEnabled)_MyLog.Error("ContentRoUsages.DataPortal_FetchContentID", ex);
|
||||
if (_MyLog.IsErrorEnabled) _MyLog.Error("ContentRoUsages.DataPortal_FetchContentID", ex);
|
||||
throw new DbCslaException("ContentRoUsages.DataPortal_Fetch", ex);
|
||||
}
|
||||
this.RaiseListChangedEvents = true;
|
||||
@ -269,8 +269,8 @@ namespace VEPROMS.CSLA.Library
|
||||
/// </summary>
|
||||
public partial class ContentRoUsagesPropertyDescriptor : vlnListPropertyDescriptor
|
||||
{
|
||||
private ContentRoUsage Item { get { return (ContentRoUsage) _Item;} }
|
||||
public ContentRoUsagesPropertyDescriptor(ContentRoUsages collection, int index):base(collection, index){;}
|
||||
private ContentRoUsage Item { get { return (ContentRoUsage)_Item; } }
|
||||
public ContentRoUsagesPropertyDescriptor(ContentRoUsages collection, int index) : base(collection, index) { ;}
|
||||
}
|
||||
#endregion
|
||||
#region Converter
|
||||
@ -281,7 +281,7 @@ namespace VEPROMS.CSLA.Library
|
||||
if (destType == typeof(string) && value is ContentRoUsages)
|
||||
{
|
||||
// Return department and department role separated by comma.
|
||||
return ((ContentRoUsages) value).Items.Count.ToString() + " RoUsages";
|
||||
return ((ContentRoUsages)value).Items.Count.ToString() + " RoUsages";
|
||||
}
|
||||
return base.ConvertTo(context, culture, value, destType);
|
||||
}
|
||||
|
@ -42,7 +42,7 @@ namespace VEPROMS.CSLA.Library
|
||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||
get
|
||||
{
|
||||
CanReadProperty("TransitionID",true);
|
||||
CanReadProperty("TransitionID", true);
|
||||
if (_MyTransition != null) _TransitionID = _MyTransition.TransitionID;
|
||||
return _TransitionID;
|
||||
}
|
||||
@ -54,7 +54,7 @@ namespace VEPROMS.CSLA.Library
|
||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||
get
|
||||
{
|
||||
CanReadProperty("MyTransition",true);
|
||||
CanReadProperty("MyTransition", true);
|
||||
if (_MyTransition == null && _TransitionID != 0) _MyTransition = Transition.Get(_TransitionID);
|
||||
return _MyTransition;
|
||||
}
|
||||
@ -68,7 +68,7 @@ namespace VEPROMS.CSLA.Library
|
||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||
get
|
||||
{
|
||||
CanReadProperty("ToID",true);
|
||||
CanReadProperty("ToID", true);
|
||||
if (_MyItemToID != null) _ToID = _MyItemToID.ItemID;
|
||||
return _ToID;
|
||||
}
|
||||
@ -79,14 +79,14 @@ namespace VEPROMS.CSLA.Library
|
||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||
get
|
||||
{
|
||||
CanReadProperty("MyItemToID",true);
|
||||
CanReadProperty("MyItemToID", true);
|
||||
if (_MyItemToID == null && _ToID != 0) _MyItemToID = Item.Get(_ToID);
|
||||
return _MyItemToID;
|
||||
}
|
||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||
set
|
||||
{
|
||||
CanWriteProperty("MyItemToID",true);
|
||||
CanWriteProperty("MyItemToID", true);
|
||||
if (_MyItemToID != value)
|
||||
{
|
||||
_MyItemToID = value;
|
||||
@ -100,7 +100,7 @@ namespace VEPROMS.CSLA.Library
|
||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||
get
|
||||
{
|
||||
CanReadProperty("RangeID",true);
|
||||
CanReadProperty("RangeID", true);
|
||||
if (_MyItemRangeID != null) _RangeID = _MyItemRangeID.ItemID;
|
||||
return _RangeID;
|
||||
}
|
||||
@ -111,14 +111,14 @@ namespace VEPROMS.CSLA.Library
|
||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||
get
|
||||
{
|
||||
CanReadProperty("MyItemRangeID",true);
|
||||
CanReadProperty("MyItemRangeID", true);
|
||||
if (_MyItemRangeID == null && _RangeID != 0) _MyItemRangeID = Item.Get(_RangeID);
|
||||
return _MyItemRangeID;
|
||||
}
|
||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||
set
|
||||
{
|
||||
CanWriteProperty("MyItemRangeID",true);
|
||||
CanWriteProperty("MyItemRangeID", true);
|
||||
if (_MyItemRangeID != value)
|
||||
{
|
||||
_MyItemRangeID = value;
|
||||
@ -132,13 +132,13 @@ namespace VEPROMS.CSLA.Library
|
||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||
get
|
||||
{
|
||||
CanReadProperty("TranType",true);
|
||||
CanReadProperty("TranType", true);
|
||||
return _TranType;
|
||||
}
|
||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||
set
|
||||
{
|
||||
CanWriteProperty("TranType",true);
|
||||
CanWriteProperty("TranType", true);
|
||||
if (_TranType != value)
|
||||
{
|
||||
_TranType = value;
|
||||
@ -152,13 +152,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)
|
||||
{
|
||||
@ -173,13 +173,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;
|
||||
@ -193,13 +193,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)
|
||||
{
|
||||
@ -215,7 +215,7 @@ namespace VEPROMS.CSLA.Library
|
||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||
get
|
||||
{
|
||||
CanReadProperty("Item_RangeID_PreviousID",true);
|
||||
CanReadProperty("Item_RangeID_PreviousID", true);
|
||||
return _Item_RangeID_PreviousID;
|
||||
}
|
||||
}
|
||||
@ -225,7 +225,7 @@ namespace VEPROMS.CSLA.Library
|
||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||
get
|
||||
{
|
||||
CanReadProperty("Item_RangeID_ContentID",true);
|
||||
CanReadProperty("Item_RangeID_ContentID", true);
|
||||
return _Item_RangeID_ContentID;
|
||||
}
|
||||
}
|
||||
@ -235,7 +235,7 @@ namespace VEPROMS.CSLA.Library
|
||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||
get
|
||||
{
|
||||
CanReadProperty("Item_RangeID_DTS",true);
|
||||
CanReadProperty("Item_RangeID_DTS", true);
|
||||
return _Item_RangeID_DTS;
|
||||
}
|
||||
}
|
||||
@ -245,7 +245,7 @@ namespace VEPROMS.CSLA.Library
|
||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||
get
|
||||
{
|
||||
CanReadProperty("Item_RangeID_UserID",true);
|
||||
CanReadProperty("Item_RangeID_UserID", true);
|
||||
return _Item_RangeID_UserID;
|
||||
}
|
||||
}
|
||||
@ -255,7 +255,7 @@ namespace VEPROMS.CSLA.Library
|
||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||
get
|
||||
{
|
||||
CanReadProperty("Item_ToID_PreviousID",true);
|
||||
CanReadProperty("Item_ToID_PreviousID", true);
|
||||
return _Item_ToID_PreviousID;
|
||||
}
|
||||
}
|
||||
@ -265,7 +265,7 @@ namespace VEPROMS.CSLA.Library
|
||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||
get
|
||||
{
|
||||
CanReadProperty("Item_ToID_ContentID",true);
|
||||
CanReadProperty("Item_ToID_ContentID", true);
|
||||
return _Item_ToID_ContentID;
|
||||
}
|
||||
}
|
||||
@ -275,7 +275,7 @@ namespace VEPROMS.CSLA.Library
|
||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||
get
|
||||
{
|
||||
CanReadProperty("Item_ToID_DTS",true);
|
||||
CanReadProperty("Item_ToID_DTS", true);
|
||||
return _Item_ToID_DTS;
|
||||
}
|
||||
}
|
||||
@ -285,7 +285,7 @@ namespace VEPROMS.CSLA.Library
|
||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||
get
|
||||
{
|
||||
CanReadProperty("Item_ToID_UserID",true);
|
||||
CanReadProperty("Item_ToID_UserID", true);
|
||||
return _Item_ToID_UserID;
|
||||
}
|
||||
}
|
||||
@ -318,16 +318,16 @@ namespace VEPROMS.CSLA.Library
|
||||
#endregion
|
||||
#region ValidationRules
|
||||
[NonSerialized]
|
||||
private bool _CheckingBrokenRules=false;
|
||||
private bool _CheckingBrokenRules = false;
|
||||
public IVEHasBrokenRules HasBrokenRules
|
||||
{
|
||||
get
|
||||
{
|
||||
if(_CheckingBrokenRules)return null;
|
||||
if (_CheckingBrokenRules) return null;
|
||||
if (BrokenRulesCollection.Count > 0) return this;
|
||||
try
|
||||
{
|
||||
_CheckingBrokenRules=true;
|
||||
_CheckingBrokenRules = true;
|
||||
IVEHasBrokenRules hasBrokenRules = null;
|
||||
if (_MyItemToID != null && (hasBrokenRules = _MyItemToID.HasBrokenRules) != null) return hasBrokenRules;
|
||||
if (_MyItemRangeID != null && (hasBrokenRules = _MyItemRangeID.HasBrokenRules) != null) return hasBrokenRules;
|
||||
@ -335,7 +335,7 @@ namespace VEPROMS.CSLA.Library
|
||||
}
|
||||
finally
|
||||
{
|
||||
_CheckingBrokenRules=false;
|
||||
_CheckingBrokenRules = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -477,7 +477,7 @@ namespace VEPROMS.CSLA.Library
|
||||
#region Data Access Portal
|
||||
private void Fetch(SafeDataReader dr)
|
||||
{
|
||||
if(_MyLog.IsDebugEnabled)_MyLog.DebugFormat("[{0}] ContentTransition.FetchDR", GetHashCode());
|
||||
if (_MyLog.IsDebugEnabled) _MyLog.DebugFormat("[{0}] ContentTransition.FetchDR", GetHashCode());
|
||||
try
|
||||
{
|
||||
_TransitionID = dr.GetInt32("TransitionID");
|
||||
@ -499,7 +499,7 @@ namespace VEPROMS.CSLA.Library
|
||||
}
|
||||
catch (Exception ex) // FKItem Fetch
|
||||
{
|
||||
if(_MyLog.IsErrorEnabled)_MyLog.Error("ContentTransition.FetchDR", ex);
|
||||
if (_MyLog.IsErrorEnabled) _MyLog.Error("ContentTransition.FetchDR", ex);
|
||||
throw new DbCslaException("ContentTransition.Fetch", ex);
|
||||
}
|
||||
MarkOld();
|
||||
|
@ -94,8 +94,8 @@ namespace VEPROMS.CSLA.Library
|
||||
{
|
||||
get
|
||||
{
|
||||
IVEHasBrokenRules hasBrokenRules=null;
|
||||
foreach(ContentTransition contentTransition in this)
|
||||
IVEHasBrokenRules hasBrokenRules = null;
|
||||
foreach (ContentTransition contentTransition in this)
|
||||
if ((hasBrokenRules = contentTransition.HasBrokenRules) != null) return hasBrokenRules;
|
||||
return hasBrokenRules;
|
||||
}
|
||||
@ -165,7 +165,7 @@ namespace VEPROMS.CSLA.Library
|
||||
private void DataPortal_Fetch(FromIDCriteria criteria)
|
||||
{
|
||||
this.RaiseListChangedEvents = false;
|
||||
if(_MyLog.IsDebugEnabled)_MyLog.DebugFormat("[{0}] ContentTransitions.DataPortal_FetchFromID", GetHashCode());
|
||||
if (_MyLog.IsDebugEnabled) _MyLog.DebugFormat("[{0}] ContentTransitions.DataPortal_FetchFromID", GetHashCode());
|
||||
try
|
||||
{
|
||||
using (SqlConnection cn = Database.VEPROMS_SqlConnection)
|
||||
@ -184,7 +184,7 @@ namespace VEPROMS.CSLA.Library
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
if(_MyLog.IsErrorEnabled)_MyLog.Error("ContentTransitions.DataPortal_FetchFromID", ex);
|
||||
if (_MyLog.IsErrorEnabled) _MyLog.Error("ContentTransitions.DataPortal_FetchFromID", ex);
|
||||
throw new DbCslaException("ContentTransitions.DataPortal_Fetch", ex);
|
||||
}
|
||||
this.RaiseListChangedEvents = true;
|
||||
@ -269,8 +269,8 @@ namespace VEPROMS.CSLA.Library
|
||||
/// </summary>
|
||||
public partial class ContentTransitionsPropertyDescriptor : vlnListPropertyDescriptor
|
||||
{
|
||||
private ContentTransition Item { get { return (ContentTransition) _Item;} }
|
||||
public ContentTransitionsPropertyDescriptor(ContentTransitions collection, int index):base(collection, index){;}
|
||||
private ContentTransition Item { get { return (ContentTransition)_Item; } }
|
||||
public ContentTransitionsPropertyDescriptor(ContentTransitions collection, int index) : base(collection, index) { ;}
|
||||
}
|
||||
#endregion
|
||||
#region Converter
|
||||
@ -281,7 +281,7 @@ namespace VEPROMS.CSLA.Library
|
||||
if (destType == typeof(string) && value is ContentTransitions)
|
||||
{
|
||||
// Return department and department role separated by comma.
|
||||
return ((ContentTransitions) value).Items.Count.ToString() + " Transitions";
|
||||
return ((ContentTransitions)value).Items.Count.ToString() + " Transitions";
|
||||
}
|
||||
return base.ConvertTo(context, culture, value, destType);
|
||||
}
|
||||
|
@ -28,7 +28,7 @@ namespace VEPROMS.CSLA.Library
|
||||
#region Log4Net
|
||||
private static readonly log4net.ILog _MyLog = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
|
||||
#endregion
|
||||
public static void LogException(string s,Exception ex)
|
||||
public static void LogException(string s, Exception ex)
|
||||
{
|
||||
int i = 0;
|
||||
Console.WriteLine("Error - {0}", s);
|
||||
@ -44,12 +44,12 @@ namespace VEPROMS.CSLA.Library
|
||||
set { _LoggingInfo = value; }
|
||||
}
|
||||
static System.Diagnostics.Process _CurrentProcess = System.Diagnostics.Process.GetCurrentProcess();
|
||||
public static void LogInfo(string s,int hashCode)
|
||||
public static void LogInfo(string s, int hashCode)
|
||||
{
|
||||
if (_LoggingInfo)
|
||||
Console.WriteLine("{0} MB {1}", _CurrentProcess.WorkingSet64 / 1000000, string.Format(s, hashCode));
|
||||
}
|
||||
public static void LogDebug(string s,int hashCode)
|
||||
public static void LogDebug(string s, int hashCode)
|
||||
{
|
||||
if (_LoggingInfo)
|
||||
Console.WriteLine("{0} MB {1}", _CurrentProcess.WorkingSet64 / 1000000, string.Format(s, hashCode));
|
||||
@ -107,7 +107,7 @@ namespace VEPROMS.CSLA.Library
|
||||
}
|
||||
catch (Exception ex)// Throw Application Exception on Failure
|
||||
{
|
||||
if(_MyLog.IsErrorEnabled)_MyLog.Error("Connection Error", ex);
|
||||
if (_MyLog.IsErrorEnabled) _MyLog.Error("Connection Error", ex);
|
||||
throw new ApplicationException("Failure on Connect", ex);
|
||||
}
|
||||
}
|
||||
@ -124,14 +124,14 @@ namespace VEPROMS.CSLA.Library
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
if(_MyLog.IsErrorEnabled)_MyLog.Error("Purge Error", ex);
|
||||
if (_MyLog.IsErrorEnabled) _MyLog.Error("Purge Error", ex);
|
||||
throw new ApplicationException("Failure on Purge", ex);
|
||||
}
|
||||
}
|
||||
}
|
||||
public class DbCslaException : Exception
|
||||
{
|
||||
internal DbCslaException(string message, Exception innerException):base(message,innerException){;}
|
||||
internal DbCslaException(string message, Exception innerException) : base(message, innerException) { ;}
|
||||
internal DbCslaException(string message) : base(message) { ;}
|
||||
internal DbCslaException() : base() { ;}
|
||||
} // Class
|
||||
|
@ -47,19 +47,23 @@ namespace VEPROMS.CSLA.Library
|
||||
foreach (Detail tmp in _RefreshDetails)
|
||||
{
|
||||
DetailInfo.Refresh(tmp);
|
||||
if(tmp._MyContent != null) ContentInfo.Refresh(tmp._MyContent);
|
||||
if (tmp._MyContent != null) ContentInfo.Refresh(tmp._MyContent);
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
#region Collection
|
||||
protected static List<Detail> _AllList = new List<Detail>();
|
||||
private static Dictionary<string, Detail> _AllByPrimaryKey = new Dictionary<string, Detail>();
|
||||
private static Dictionary<string, List<Detail>> _AllByPrimaryKey = new Dictionary<string, List<Detail>>();
|
||||
private static void ConvertListToDictionary()
|
||||
{
|
||||
List<Detail> remove = new List<Detail>();
|
||||
foreach (Detail tmp in _AllList)
|
||||
{
|
||||
_AllByPrimaryKey[tmp.DetailID.ToString()]=tmp; // Primary Key
|
||||
if (!_AllByPrimaryKey.ContainsKey(tmp.DetailID.ToString()))
|
||||
{
|
||||
_AllByPrimaryKey[tmp.DetailID.ToString()] = new List<Detail>(); // Add new list for PrimaryKey
|
||||
}
|
||||
_AllByPrimaryKey[tmp.DetailID.ToString()].Add(tmp); // Add to Primary Key list
|
||||
remove.Add(tmp);
|
||||
}
|
||||
foreach (Detail tmp in remove)
|
||||
@ -69,7 +73,7 @@ namespace VEPROMS.CSLA.Library
|
||||
{
|
||||
ConvertListToDictionary();
|
||||
string key = detailID.ToString();
|
||||
if (_AllByPrimaryKey.ContainsKey(key)) return _AllByPrimaryKey[key];
|
||||
if (_AllByPrimaryKey.ContainsKey(key)) return _AllByPrimaryKey[key][0];
|
||||
return null;
|
||||
}
|
||||
#endregion
|
||||
@ -91,7 +95,7 @@ namespace VEPROMS.CSLA.Library
|
||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||
get
|
||||
{
|
||||
CanReadProperty("DetailID",true);
|
||||
CanReadProperty("DetailID", true);
|
||||
return _DetailID;
|
||||
}
|
||||
}
|
||||
@ -101,7 +105,7 @@ namespace VEPROMS.CSLA.Library
|
||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||
get
|
||||
{
|
||||
CanReadProperty("ContentID",true);
|
||||
CanReadProperty("ContentID", true);
|
||||
if (_MyContent != null) _ContentID = _MyContent.ContentID;
|
||||
return _ContentID;
|
||||
}
|
||||
@ -112,14 +116,14 @@ namespace VEPROMS.CSLA.Library
|
||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||
get
|
||||
{
|
||||
CanReadProperty("MyContent",true);
|
||||
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);
|
||||
CanWriteProperty("MyContent", true);
|
||||
if (_MyContent != value)
|
||||
{
|
||||
_MyContent = value;
|
||||
@ -133,13 +137,13 @@ namespace VEPROMS.CSLA.Library
|
||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||
get
|
||||
{
|
||||
CanReadProperty("ItemType",true);
|
||||
CanReadProperty("ItemType", true);
|
||||
return _ItemType;
|
||||
}
|
||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||
set
|
||||
{
|
||||
CanWriteProperty("ItemType",true);
|
||||
CanWriteProperty("ItemType", true);
|
||||
if (_ItemType != value)
|
||||
{
|
||||
_ItemType = value;
|
||||
@ -153,13 +157,13 @@ namespace VEPROMS.CSLA.Library
|
||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||
get
|
||||
{
|
||||
CanReadProperty("Text",true);
|
||||
CanReadProperty("Text", true);
|
||||
return _Text;
|
||||
}
|
||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||
set
|
||||
{
|
||||
CanWriteProperty("Text",true);
|
||||
CanWriteProperty("Text", true);
|
||||
if (value == null) value = string.Empty;
|
||||
if (_Text != value)
|
||||
{
|
||||
@ -174,13 +178,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)
|
||||
{
|
||||
@ -195,13 +199,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;
|
||||
@ -215,13 +219,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)
|
||||
{
|
||||
@ -233,11 +237,11 @@ namespace VEPROMS.CSLA.Library
|
||||
private byte[] _LastChanged = new byte[8];//timestamp
|
||||
public override bool IsDirty
|
||||
{
|
||||
get { return base.IsDirty || (_MyContent == null? false : _MyContent.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); }
|
||||
get { return (IsNew && !IsDirty ? true : base.IsValid) && (_MyContent == null ? true : _MyContent.IsValid); }
|
||||
}
|
||||
// TODO: Replace base Detail.ToString function as necessary
|
||||
/// <summary>
|
||||
@ -260,22 +264,23 @@ 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 (_MyContent != null && (hasBrokenRules = _MyContent.HasBrokenRules) != null) return hasBrokenRules;
|
||||
return hasBrokenRules;
|
||||
}
|
||||
finally
|
||||
{
|
||||
_CheckingBrokenRules=false;
|
||||
_CheckingBrokenRules = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -388,14 +393,25 @@ namespace VEPROMS.CSLA.Library
|
||||
#region Factory Methods
|
||||
public int CurrentEditLevel
|
||||
{ get { return EditLevel; } }
|
||||
private static int _DetailUnique = 0;
|
||||
private int _MyDetailUnique;
|
||||
public int MyDetailUnique
|
||||
{
|
||||
get { return _MyDetailUnique; }
|
||||
}
|
||||
protected Detail()
|
||||
{/* require use of factory methods */
|
||||
_MyDetailUnique = ++_DetailUnique;
|
||||
_AllList.Add(this);
|
||||
}
|
||||
public void Dispose()
|
||||
{
|
||||
_AllList.Remove(this);
|
||||
_AllByPrimaryKey.Remove(DetailID.ToString());
|
||||
if (!_AllByPrimaryKey.ContainsKey(DetailID.ToString())) return;
|
||||
List<Detail> listDetail = _AllByPrimaryKey[DetailID.ToString()]; // Get the list of items
|
||||
listDetail.Remove(this); // Remove the item from the list
|
||||
if (listDetail.Count == 0) //If there are no items left in the list
|
||||
_AllByPrimaryKey.Remove(DetailID.ToString()); // remove the list
|
||||
}
|
||||
public static Detail New()
|
||||
{
|
||||
@ -480,7 +496,7 @@ namespace VEPROMS.CSLA.Library
|
||||
if (tmp == null)
|
||||
{
|
||||
tmp = DataPortal.Fetch<Detail>(new PKCriteria(detailID));
|
||||
_AllList.Add(tmp);
|
||||
if (!_AllList.Contains(tmp)) _AllList.Add(tmp);
|
||||
}
|
||||
if (tmp.ErrorMessage == "No Record Found") tmp = null;
|
||||
return tmp;
|
||||
@ -559,7 +575,7 @@ namespace VEPROMS.CSLA.Library
|
||||
}
|
||||
private void ReadData(SafeDataReader dr)
|
||||
{
|
||||
if(_MyLog.IsDebugEnabled)_MyLog.DebugFormat("[{0}] Detail.ReadData", GetHashCode());
|
||||
if (_MyLog.IsDebugEnabled) _MyLog.DebugFormat("[{0}] Detail.ReadData", GetHashCode());
|
||||
try
|
||||
{
|
||||
_DetailID = dr.GetInt32("DetailID");
|
||||
@ -574,14 +590,14 @@ namespace VEPROMS.CSLA.Library
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
if(_MyLog.IsErrorEnabled)_MyLog.Error("Detail.ReadData", ex);
|
||||
if (_MyLog.IsErrorEnabled) _MyLog.Error("Detail.ReadData", ex);
|
||||
_ErrorMessage = ex.Message;
|
||||
throw new DbCslaException("Detail.ReadData", ex);
|
||||
}
|
||||
}
|
||||
private void DataPortal_Fetch(PKCriteria criteria)
|
||||
{
|
||||
if(_MyLog.IsDebugEnabled)_MyLog.DebugFormat("[{0}] Detail.DataPortal_Fetch", GetHashCode());
|
||||
if (_MyLog.IsDebugEnabled) _MyLog.DebugFormat("[{0}] Detail.DataPortal_Fetch", GetHashCode());
|
||||
try
|
||||
{
|
||||
using (SqlConnection cn = Database.VEPROMS_SqlConnection)
|
||||
@ -609,7 +625,7 @@ namespace VEPROMS.CSLA.Library
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
if(_MyLog.IsErrorEnabled)_MyLog.Error("Detail.DataPortal_Fetch", ex);
|
||||
if (_MyLog.IsErrorEnabled) _MyLog.Error("Detail.DataPortal_Fetch", ex);
|
||||
_ErrorMessage = ex.Message;
|
||||
throw new DbCslaException("Detail.DataPortal_Fetch", ex);
|
||||
}
|
||||
@ -630,13 +646,13 @@ namespace VEPROMS.CSLA.Library
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
if(_MyLog.IsErrorEnabled)_MyLog.Error("Detail.DataPortal_Insert", ex);
|
||||
if (_MyLog.IsErrorEnabled) _MyLog.Error("Detail.DataPortal_Insert", ex);
|
||||
_ErrorMessage = ex.Message;
|
||||
throw new DbCslaException("Detail.DataPortal_Insert", ex);
|
||||
}
|
||||
finally
|
||||
{
|
||||
if(_MyLog.IsDebugEnabled)_MyLog.DebugFormat("[{0}] Detail.DataPortal_Insert", GetHashCode());
|
||||
if (_MyLog.IsDebugEnabled) _MyLog.DebugFormat("[{0}] Detail.DataPortal_Insert", GetHashCode());
|
||||
}
|
||||
}
|
||||
[Transactional(TransactionalTypes.TransactionScope)]
|
||||
@ -645,7 +661,7 @@ namespace VEPROMS.CSLA.Library
|
||||
if (!this.IsDirty) return;
|
||||
try
|
||||
{
|
||||
if(_MyContent != null) _MyContent.Update();
|
||||
if (_MyContent != null) _MyContent.Update();
|
||||
SqlConnection cn = (SqlConnection)ApplicationContext.LocalContext["cn"];
|
||||
using (SqlCommand cm = cn.CreateCommand())
|
||||
{
|
||||
@ -673,11 +689,11 @@ namespace VEPROMS.CSLA.Library
|
||||
}
|
||||
MarkOld();
|
||||
// update child objects
|
||||
if(_MyLog.IsDebugEnabled)_MyLog.DebugFormat("[{0}] Detail.SQLInsert", GetHashCode());
|
||||
if (_MyLog.IsDebugEnabled) _MyLog.DebugFormat("[{0}] Detail.SQLInsert", GetHashCode());
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
if(_MyLog.IsErrorEnabled)_MyLog.Error("Detail.SQLInsert", ex);
|
||||
if (_MyLog.IsErrorEnabled) _MyLog.Error("Detail.SQLInsert", ex);
|
||||
_ErrorMessage = ex.Message;
|
||||
throw new DbCslaException("Detail.SQLInsert", ex);
|
||||
}
|
||||
@ -685,7 +701,7 @@ namespace VEPROMS.CSLA.Library
|
||||
[Transactional(TransactionalTypes.TransactionScope)]
|
||||
public static byte[] Add(SqlConnection cn, ref int detailID, Content myContent, int itemType, string text, string config, DateTime dts, string userID)
|
||||
{
|
||||
if(_MyLog.IsDebugEnabled)_MyLog.DebugFormat("[{0}] Detail.Add", 0);
|
||||
if (_MyLog.IsDebugEnabled) _MyLog.DebugFormat("[{0}] Detail.Add", 0);
|
||||
try
|
||||
{
|
||||
using (SqlCommand cm = cn.CreateCommand())
|
||||
@ -715,7 +731,7 @@ namespace VEPROMS.CSLA.Library
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
if(_MyLog.IsErrorEnabled)_MyLog.Error("Detail.Add", ex);
|
||||
if (_MyLog.IsErrorEnabled) _MyLog.Error("Detail.Add", ex);
|
||||
throw new DbCslaException("Detail.Add", ex);
|
||||
}
|
||||
}
|
||||
@ -723,7 +739,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}] Detail.DataPortal_Update", GetHashCode());
|
||||
if (_MyLog.IsDebugEnabled) _MyLog.DebugFormat("[{0}] Detail.DataPortal_Update", GetHashCode());
|
||||
try
|
||||
{
|
||||
using (SqlConnection cn = Database.VEPROMS_SqlConnection)
|
||||
@ -737,7 +753,7 @@ namespace VEPROMS.CSLA.Library
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
if(_MyLog.IsErrorEnabled)_MyLog.Error("Detail.DataPortal_Update", ex);
|
||||
if (_MyLog.IsErrorEnabled) _MyLog.Error("Detail.DataPortal_Update", ex);
|
||||
_ErrorMessage = ex.Message;
|
||||
if (!ex.Message.EndsWith("has been edited by another user.")) throw ex;
|
||||
}
|
||||
@ -746,10 +762,10 @@ namespace VEPROMS.CSLA.Library
|
||||
internal void SQLUpdate()
|
||||
{
|
||||
if (!IsDirty) return; // If not dirty - nothing to do
|
||||
if(_MyLog.IsDebugEnabled)_MyLog.DebugFormat("[{0}] Detail.SQLUpdate", GetHashCode());
|
||||
if (_MyLog.IsDebugEnabled) _MyLog.DebugFormat("[{0}] Detail.SQLUpdate", GetHashCode());
|
||||
try
|
||||
{
|
||||
if(_MyContent != null) _MyContent.Update();
|
||||
if (_MyContent != null) _MyContent.Update();
|
||||
SqlConnection cn = (SqlConnection)ApplicationContext.LocalContext["cn"];
|
||||
if (base.IsDirty)
|
||||
{
|
||||
@ -781,7 +797,7 @@ namespace VEPROMS.CSLA.Library
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
if(_MyLog.IsErrorEnabled)_MyLog.Error("Detail.SQLUpdate", ex);
|
||||
if (_MyLog.IsErrorEnabled) _MyLog.Error("Detail.SQLUpdate", ex);
|
||||
_ErrorMessage = ex.Message;
|
||||
if (!ex.Message.EndsWith("has been edited by another user.")) throw ex;
|
||||
}
|
||||
@ -802,7 +818,7 @@ namespace VEPROMS.CSLA.Library
|
||||
[Transactional(TransactionalTypes.TransactionScope)]
|
||||
public static byte[] Update(SqlConnection cn, ref int detailID, Content myContent, int itemType, string text, string config, DateTime dts, string userID, ref byte[] lastChanged)
|
||||
{
|
||||
if(_MyLog.IsDebugEnabled)_MyLog.DebugFormat("[{0}] Detail.Update", 0);
|
||||
if (_MyLog.IsDebugEnabled) _MyLog.DebugFormat("[{0}] Detail.Update", 0);
|
||||
try
|
||||
{
|
||||
using (SqlCommand cm = cn.CreateCommand())
|
||||
@ -830,7 +846,7 @@ namespace VEPROMS.CSLA.Library
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
if(_MyLog.IsErrorEnabled)_MyLog.Error("Detail.Update", ex);
|
||||
if (_MyLog.IsErrorEnabled) _MyLog.Error("Detail.Update", ex);
|
||||
throw new DbCslaException("Detail.Update", ex);
|
||||
}
|
||||
}
|
||||
@ -842,7 +858,7 @@ namespace VEPROMS.CSLA.Library
|
||||
[Transactional(TransactionalTypes.TransactionScope)]
|
||||
private void DataPortal_Delete(PKCriteria criteria)
|
||||
{
|
||||
if(_MyLog.IsDebugEnabled)_MyLog.DebugFormat("[{0}] Detail.DataPortal_Delete", GetHashCode());
|
||||
if (_MyLog.IsDebugEnabled) _MyLog.DebugFormat("[{0}] Detail.DataPortal_Delete", GetHashCode());
|
||||
try
|
||||
{
|
||||
using (SqlConnection cn = Database.VEPROMS_SqlConnection)
|
||||
@ -858,7 +874,7 @@ namespace VEPROMS.CSLA.Library
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
if(_MyLog.IsErrorEnabled)_MyLog.Error("Detail.DataPortal_Delete", ex);
|
||||
if (_MyLog.IsErrorEnabled) _MyLog.Error("Detail.DataPortal_Delete", ex);
|
||||
_ErrorMessage = ex.Message;
|
||||
throw new DbCslaException("Detail.DataPortal_Delete", ex);
|
||||
}
|
||||
@ -866,7 +882,7 @@ namespace VEPROMS.CSLA.Library
|
||||
[Transactional(TransactionalTypes.TransactionScope)]
|
||||
public static void Remove(SqlConnection cn, int detailID)
|
||||
{
|
||||
if(_MyLog.IsDebugEnabled)_MyLog.DebugFormat("[{0}] Detail.Remove", 0);
|
||||
if (_MyLog.IsDebugEnabled) _MyLog.DebugFormat("[{0}] Detail.Remove", 0);
|
||||
try
|
||||
{
|
||||
using (SqlCommand cm = cn.CreateCommand())
|
||||
@ -881,7 +897,7 @@ namespace VEPROMS.CSLA.Library
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
if(_MyLog.IsErrorEnabled)_MyLog.Error("Detail.Remove", ex);
|
||||
if (_MyLog.IsErrorEnabled) _MyLog.Error("Detail.Remove", ex);
|
||||
throw new DbCslaException("Detail.Remove", ex);
|
||||
}
|
||||
}
|
||||
@ -915,7 +931,7 @@ namespace VEPROMS.CSLA.Library
|
||||
}
|
||||
protected override void DataPortal_Execute()
|
||||
{
|
||||
if(_MyLog.IsDebugEnabled)_MyLog.DebugFormat("[{0}] Detail.DataPortal_Execute", GetHashCode());
|
||||
if (_MyLog.IsDebugEnabled) _MyLog.DebugFormat("[{0}] Detail.DataPortal_Execute", GetHashCode());
|
||||
try
|
||||
{
|
||||
using (SqlConnection cn = Database.VEPROMS_SqlConnection)
|
||||
@ -933,7 +949,7 @@ namespace VEPROMS.CSLA.Library
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
if(_MyLog.IsErrorEnabled)_MyLog.Error("Detail.DataPortal_Execute", ex);
|
||||
if (_MyLog.IsErrorEnabled) _MyLog.Error("Detail.DataPortal_Execute", ex);
|
||||
throw new DbCslaException("Detail.DataPortal_Execute", ex);
|
||||
}
|
||||
}
|
||||
|
@ -37,13 +37,17 @@ namespace VEPROMS.CSLA.Library
|
||||
#endregion
|
||||
#region Collection
|
||||
protected static List<DetailInfo> _AllList = new List<DetailInfo>();
|
||||
private static Dictionary<string, DetailInfo> _AllByPrimaryKey = new Dictionary<string, DetailInfo>();
|
||||
private static Dictionary<string, List<DetailInfo>> _AllByPrimaryKey = new Dictionary<string, List<DetailInfo>>();
|
||||
private static void ConvertListToDictionary()
|
||||
{
|
||||
List<DetailInfo> remove = new List<DetailInfo>();
|
||||
foreach (DetailInfo tmp in _AllList)
|
||||
{
|
||||
_AllByPrimaryKey[tmp.DetailID.ToString()]=tmp; // Primary Key
|
||||
if (!_AllByPrimaryKey.ContainsKey(tmp.DetailID.ToString()))
|
||||
{
|
||||
_AllByPrimaryKey[tmp.DetailID.ToString()] = new List<DetailInfo>(); // Add new list for PrimaryKey
|
||||
}
|
||||
_AllByPrimaryKey[tmp.DetailID.ToString()].Add(tmp); // Add to Primary Key list
|
||||
remove.Add(tmp);
|
||||
}
|
||||
foreach (DetailInfo tmp in remove)
|
||||
@ -57,7 +61,7 @@ namespace VEPROMS.CSLA.Library
|
||||
{
|
||||
ConvertListToDictionary();
|
||||
string key = detailID.ToString();
|
||||
if (_AllByPrimaryKey.ContainsKey(key)) return _AllByPrimaryKey[key];
|
||||
if (_AllByPrimaryKey.ContainsKey(key)) return _AllByPrimaryKey[key][0];
|
||||
return null;
|
||||
}
|
||||
#endregion
|
||||
@ -85,7 +89,7 @@ namespace VEPROMS.CSLA.Library
|
||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||
get
|
||||
{
|
||||
CanReadProperty("DetailID",true);
|
||||
CanReadProperty("DetailID", true);
|
||||
return _DetailID;
|
||||
}
|
||||
}
|
||||
@ -95,7 +99,7 @@ namespace VEPROMS.CSLA.Library
|
||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||
get
|
||||
{
|
||||
CanReadProperty("ContentID",true);
|
||||
CanReadProperty("ContentID", true);
|
||||
if (_MyContent != null) _ContentID = _MyContent.ContentID;
|
||||
return _ContentID;
|
||||
}
|
||||
@ -106,7 +110,7 @@ namespace VEPROMS.CSLA.Library
|
||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||
get
|
||||
{
|
||||
CanReadProperty("MyContent",true);
|
||||
CanReadProperty("MyContent", true);
|
||||
if (_MyContent == null && _ContentID != 0) _MyContent = ContentInfo.Get(_ContentID);
|
||||
return _MyContent;
|
||||
}
|
||||
@ -117,7 +121,7 @@ namespace VEPROMS.CSLA.Library
|
||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||
get
|
||||
{
|
||||
CanReadProperty("ItemType",true);
|
||||
CanReadProperty("ItemType", true);
|
||||
return _ItemType;
|
||||
}
|
||||
}
|
||||
@ -127,7 +131,7 @@ namespace VEPROMS.CSLA.Library
|
||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||
get
|
||||
{
|
||||
CanReadProperty("Text",true);
|
||||
CanReadProperty("Text", true);
|
||||
return _Text;
|
||||
}
|
||||
}
|
||||
@ -137,7 +141,7 @@ namespace VEPROMS.CSLA.Library
|
||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||
get
|
||||
{
|
||||
CanReadProperty("Config",true);
|
||||
CanReadProperty("Config", true);
|
||||
return _Config;
|
||||
}
|
||||
}
|
||||
@ -147,7 +151,7 @@ namespace VEPROMS.CSLA.Library
|
||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||
get
|
||||
{
|
||||
CanReadProperty("DTS",true);
|
||||
CanReadProperty("DTS", true);
|
||||
return _DTS;
|
||||
}
|
||||
}
|
||||
@ -157,7 +161,7 @@ namespace VEPROMS.CSLA.Library
|
||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||
get
|
||||
{
|
||||
CanReadProperty("UserID",true);
|
||||
CanReadProperty("UserID", true);
|
||||
return _UserID;
|
||||
}
|
||||
}
|
||||
@ -181,14 +185,25 @@ namespace VEPROMS.CSLA.Library
|
||||
}
|
||||
#endregion
|
||||
#region Factory Methods
|
||||
private static int _DetailInfoUnique = 0;
|
||||
private int _MyDetailInfoUnique;
|
||||
public int MyDetailInfoUnique
|
||||
{
|
||||
get { return _MyDetailInfoUnique; }
|
||||
}
|
||||
private DetailInfo()
|
||||
{/* require use of factory methods */
|
||||
_MyDetailInfoUnique = ++_DetailInfoUnique;
|
||||
_AllList.Add(this);
|
||||
}
|
||||
public void Dispose()
|
||||
{
|
||||
_AllList.Remove(this);
|
||||
_AllByPrimaryKey.Remove(DetailID.ToString());
|
||||
if (!_AllByPrimaryKey.ContainsKey(DetailID.ToString())) return;
|
||||
List<DetailInfo> listDetailInfo = _AllByPrimaryKey[DetailID.ToString()]; // Get the list of items
|
||||
listDetailInfo.Remove(this); // Remove the item from the list
|
||||
if (listDetailInfo.Count == 0) // If there are no items left in the list
|
||||
_AllByPrimaryKey.Remove(DetailID.ToString()); // remove the list
|
||||
}
|
||||
public virtual Detail Get()
|
||||
{
|
||||
@ -196,8 +211,10 @@ namespace VEPROMS.CSLA.Library
|
||||
}
|
||||
public static void Refresh(Detail tmp)
|
||||
{
|
||||
DetailInfo tmpInfo = GetExistingByPrimaryKey(tmp.DetailID);
|
||||
if (tmpInfo == null) return;
|
||||
string key = tmp.DetailID.ToString();
|
||||
ConvertListToDictionary();
|
||||
if (_AllByPrimaryKey.ContainsKey(key))
|
||||
foreach (DetailInfo tmpInfo in _AllByPrimaryKey[key])
|
||||
tmpInfo.RefreshFields(tmp);
|
||||
}
|
||||
private void RefreshFields(Detail tmp)
|
||||
@ -206,9 +223,9 @@ namespace VEPROMS.CSLA.Library
|
||||
{
|
||||
MyContent.RefreshContentDetails(); // Update List for old value
|
||||
_ContentID = tmp.ContentID; // Update the value
|
||||
_MyContent = null; // Reset list so that the next line gets a new list
|
||||
MyContent.RefreshContentDetails(); // Update List for new value
|
||||
}
|
||||
_MyContent = null; // Reset list so that the next line gets a new list
|
||||
if (MyContent != null) MyContent.RefreshContentDetails(); // Update List for new value
|
||||
_ItemType = tmp.ItemType;
|
||||
_Text = tmp.Text;
|
||||
_Config = tmp.Config;
|
||||
@ -220,8 +237,10 @@ namespace VEPROMS.CSLA.Library
|
||||
}
|
||||
public static void Refresh(ContentDetail tmp)
|
||||
{
|
||||
DetailInfo tmpInfo = GetExistingByPrimaryKey(tmp.DetailID);
|
||||
if (tmpInfo == null) return;
|
||||
string key = tmp.DetailID.ToString();
|
||||
ConvertListToDictionary();
|
||||
if (_AllByPrimaryKey.ContainsKey(key))
|
||||
foreach (DetailInfo tmpInfo in _AllByPrimaryKey[key])
|
||||
tmpInfo.RefreshFields(tmp);
|
||||
}
|
||||
private void RefreshFields(ContentDetail tmp)
|
||||
@ -245,7 +264,7 @@ namespace VEPROMS.CSLA.Library
|
||||
if (tmp == null)
|
||||
{
|
||||
tmp = DataPortal.Fetch<DetailInfo>(new PKCriteria(detailID));
|
||||
_AllList.Add(tmp);
|
||||
if (!_AllList.Contains(tmp)) _AllList.Add(tmp);
|
||||
}
|
||||
if (tmp.ErrorMessage == "No Record Found") tmp = null;
|
||||
return tmp;
|
||||
@ -259,14 +278,15 @@ namespace VEPROMS.CSLA.Library
|
||||
#region Data Access Portal
|
||||
internal DetailInfo(SafeDataReader dr)
|
||||
{
|
||||
if(_MyLog.IsDebugEnabled)_MyLog.DebugFormat("[{0}] DetailInfo.Constructor", GetHashCode());
|
||||
_MyDetailInfoUnique = ++_DetailInfoUnique;
|
||||
if (_MyLog.IsDebugEnabled) _MyLog.DebugFormat("[{0}] DetailInfo.Constructor", GetHashCode());
|
||||
try
|
||||
{
|
||||
ReadData(dr);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
if(_MyLog.IsErrorEnabled)_MyLog.Error("DetailInfo.Constructor", ex);
|
||||
if (_MyLog.IsErrorEnabled) _MyLog.Error("DetailInfo.Constructor", ex);
|
||||
throw new DbCslaException("DetailInfo.Constructor", ex);
|
||||
}
|
||||
}
|
||||
@ -283,7 +303,7 @@ namespace VEPROMS.CSLA.Library
|
||||
}
|
||||
private void ReadData(SafeDataReader dr)
|
||||
{
|
||||
if(_MyLog.IsDebugEnabled)_MyLog.DebugFormat("[{0}] DetailInfo.ReadData", GetHashCode());
|
||||
if (_MyLog.IsDebugEnabled) _MyLog.DebugFormat("[{0}] DetailInfo.ReadData", GetHashCode());
|
||||
try
|
||||
{
|
||||
_DetailID = dr.GetInt32("DetailID");
|
||||
@ -296,14 +316,14 @@ namespace VEPROMS.CSLA.Library
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
if(_MyLog.IsErrorEnabled)_MyLog.Error("DetailInfo.ReadData", ex);
|
||||
if (_MyLog.IsErrorEnabled) _MyLog.Error("DetailInfo.ReadData", ex);
|
||||
_ErrorMessage = ex.Message;
|
||||
throw new DbCslaException("DetailInfo.ReadData", ex);
|
||||
}
|
||||
}
|
||||
private void DataPortal_Fetch(PKCriteria criteria)
|
||||
{
|
||||
if(_MyLog.IsDebugEnabled)_MyLog.DebugFormat("[{0}] DetailInfo.DataPortal_Fetch", GetHashCode());
|
||||
if (_MyLog.IsDebugEnabled) _MyLog.DebugFormat("[{0}] DetailInfo.DataPortal_Fetch", GetHashCode());
|
||||
try
|
||||
{
|
||||
using (SqlConnection cn = Database.VEPROMS_SqlConnection)
|
||||
@ -331,7 +351,7 @@ namespace VEPROMS.CSLA.Library
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
if(_MyLog.IsErrorEnabled)_MyLog.Error("DetailInfo.DataPortal_Fetch", ex);
|
||||
if (_MyLog.IsErrorEnabled) _MyLog.Error("DetailInfo.DataPortal_Fetch", ex);
|
||||
_ErrorMessage = ex.Message;
|
||||
throw new DbCslaException("DetailInfo.DataPortal_Fetch", ex);
|
||||
}
|
||||
@ -341,7 +361,7 @@ namespace VEPROMS.CSLA.Library
|
||||
#region extension
|
||||
DetailInfoExtension _DetailInfoExtension = new DetailInfoExtension();
|
||||
[Serializable()]
|
||||
partial class DetailInfoExtension : extensionBase {}
|
||||
partial class DetailInfoExtension : extensionBase { }
|
||||
[Serializable()]
|
||||
class extensionBase
|
||||
{
|
||||
|
@ -110,7 +110,7 @@ namespace VEPROMS.CSLA.Library
|
||||
private void DataPortal_Fetch()
|
||||
{
|
||||
this.RaiseListChangedEvents = false;
|
||||
if(_MyLog.IsDebugEnabled)_MyLog.DebugFormat("[{0}] DetailInfoList.DataPortal_Fetch", GetHashCode());
|
||||
if (_MyLog.IsDebugEnabled) _MyLog.DebugFormat("[{0}] DetailInfoList.DataPortal_Fetch", GetHashCode());
|
||||
try
|
||||
{
|
||||
using (SqlConnection cn = Database.VEPROMS_SqlConnection)
|
||||
@ -130,7 +130,7 @@ namespace VEPROMS.CSLA.Library
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
if(_MyLog.IsErrorEnabled)_MyLog.Error("DetailInfoList.DataPortal_Fetch", ex);
|
||||
if (_MyLog.IsErrorEnabled) _MyLog.Error("DetailInfoList.DataPortal_Fetch", ex);
|
||||
throw new DbCslaException("DetailInfoList.DataPortal_Fetch", ex);
|
||||
}
|
||||
this.RaiseListChangedEvents = true;
|
||||
@ -152,7 +152,7 @@ namespace VEPROMS.CSLA.Library
|
||||
private void DataPortal_Fetch(ContentIDCriteria criteria)
|
||||
{
|
||||
this.RaiseListChangedEvents = false;
|
||||
if(_MyLog.IsDebugEnabled)_MyLog.DebugFormat("[{0}] DetailInfoList.DataPortal_FetchContentID", GetHashCode());
|
||||
if (_MyLog.IsDebugEnabled) _MyLog.DebugFormat("[{0}] DetailInfoList.DataPortal_FetchContentID", GetHashCode());
|
||||
try
|
||||
{
|
||||
using (SqlConnection cn = Database.VEPROMS_SqlConnection)
|
||||
@ -173,7 +173,7 @@ namespace VEPROMS.CSLA.Library
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
if(_MyLog.IsErrorEnabled)_MyLog.Error("DetailInfoList.DataPortal_FetchContentID", ex);
|
||||
if (_MyLog.IsErrorEnabled) _MyLog.Error("DetailInfoList.DataPortal_FetchContentID", ex);
|
||||
throw new DbCslaException("DetailInfoList.DataPortal_Fetch", ex);
|
||||
}
|
||||
this.RaiseListChangedEvents = true;
|
||||
@ -234,8 +234,8 @@ namespace VEPROMS.CSLA.Library
|
||||
/// </summary>
|
||||
public partial class DetailInfoListPropertyDescriptor : vlnListPropertyDescriptor
|
||||
{
|
||||
private DetailInfo Item { get { return (DetailInfo) _Item;} }
|
||||
public DetailInfoListPropertyDescriptor(DetailInfoList collection, int index):base(collection, index){;}
|
||||
private DetailInfo Item { get { return (DetailInfo)_Item; } }
|
||||
public DetailInfoListPropertyDescriptor(DetailInfoList collection, int index) : base(collection, index) { ;}
|
||||
}
|
||||
#endregion
|
||||
#region Converter
|
||||
@ -246,7 +246,7 @@ namespace VEPROMS.CSLA.Library
|
||||
if (destType == typeof(string) && value is DetailInfoList)
|
||||
{
|
||||
// Return department and department role separated by comma.
|
||||
return ((DetailInfoList) value).Items.Count.ToString() + " Details";
|
||||
return ((DetailInfoList)value).Items.Count.ToString() + " Details";
|
||||
}
|
||||
return base.ConvertTo(context, culture, value, destType);
|
||||
}
|
||||
|
@ -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,15 +356,16 @@ 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;
|
||||
@ -369,7 +374,7 @@ namespace VEPROMS.CSLA.Library
|
||||
}
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
@ -37,13 +37,17 @@ namespace VEPROMS.CSLA.Library
|
||||
#endregion
|
||||
#region Collection
|
||||
protected static List<DocVersionInfo> _AllList = new List<DocVersionInfo>();
|
||||
private static Dictionary<string, DocVersionInfo> _AllByPrimaryKey = new Dictionary<string, DocVersionInfo>();
|
||||
private static Dictionary<string, List<DocVersionInfo>> _AllByPrimaryKey = new Dictionary<string, List<DocVersionInfo>>();
|
||||
private static void ConvertListToDictionary()
|
||||
{
|
||||
List<DocVersionInfo> remove = new List<DocVersionInfo>();
|
||||
foreach (DocVersionInfo tmp in _AllList)
|
||||
{
|
||||
_AllByPrimaryKey[tmp.VersionID.ToString()]=tmp; // Primary Key
|
||||
if (!_AllByPrimaryKey.ContainsKey(tmp.VersionID.ToString()))
|
||||
{
|
||||
_AllByPrimaryKey[tmp.VersionID.ToString()] = new List<DocVersionInfo>(); // Add new list for PrimaryKey
|
||||
}
|
||||
_AllByPrimaryKey[tmp.VersionID.ToString()].Add(tmp); // Add to Primary Key list
|
||||
remove.Add(tmp);
|
||||
}
|
||||
foreach (DocVersionInfo tmp in remove)
|
||||
@ -57,7 +61,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
|
||||
@ -85,7 +89,7 @@ namespace VEPROMS.CSLA.Library
|
||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||
get
|
||||
{
|
||||
CanReadProperty("VersionID",true);
|
||||
CanReadProperty("VersionID", true);
|
||||
return _VersionID;
|
||||
}
|
||||
}
|
||||
@ -95,7 +99,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;
|
||||
}
|
||||
@ -106,7 +110,7 @@ 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 = FolderInfo.Get(_FolderID);
|
||||
return _MyFolder;
|
||||
}
|
||||
@ -120,7 +124,7 @@ namespace VEPROMS.CSLA.Library
|
||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||
get
|
||||
{
|
||||
CanReadProperty("VersionType",true);
|
||||
CanReadProperty("VersionType", true);
|
||||
return _VersionType;
|
||||
}
|
||||
}
|
||||
@ -130,7 +134,7 @@ namespace VEPROMS.CSLA.Library
|
||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||
get
|
||||
{
|
||||
CanReadProperty("Name",true);
|
||||
CanReadProperty("Name", true);
|
||||
return _Name;
|
||||
}
|
||||
}
|
||||
@ -140,7 +144,7 @@ namespace VEPROMS.CSLA.Library
|
||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||
get
|
||||
{
|
||||
CanReadProperty("Title",true);
|
||||
CanReadProperty("Title", true);
|
||||
return _Title;
|
||||
}
|
||||
}
|
||||
@ -150,7 +154,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;
|
||||
}
|
||||
@ -161,7 +165,7 @@ 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 = ItemInfo.Get((int)_ItemID);
|
||||
return _MyItem;
|
||||
}
|
||||
@ -172,7 +176,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;
|
||||
}
|
||||
@ -183,7 +187,7 @@ 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 = FormatInfo.Get((int)_FormatID);
|
||||
return _MyFormat;
|
||||
}
|
||||
@ -194,7 +198,7 @@ namespace VEPROMS.CSLA.Library
|
||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||
get
|
||||
{
|
||||
CanReadProperty("Config",true);
|
||||
CanReadProperty("Config", true);
|
||||
return _Config;
|
||||
}
|
||||
}
|
||||
@ -204,7 +208,7 @@ namespace VEPROMS.CSLA.Library
|
||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||
get
|
||||
{
|
||||
CanReadProperty("DTS",true);
|
||||
CanReadProperty("DTS", true);
|
||||
return _DTS;
|
||||
}
|
||||
}
|
||||
@ -214,7 +218,7 @@ namespace VEPROMS.CSLA.Library
|
||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||
get
|
||||
{
|
||||
CanReadProperty("UserID",true);
|
||||
CanReadProperty("UserID", true);
|
||||
return _UserID;
|
||||
}
|
||||
}
|
||||
@ -238,14 +242,25 @@ namespace VEPROMS.CSLA.Library
|
||||
}
|
||||
#endregion
|
||||
#region Factory Methods
|
||||
private static int _DocVersionInfoUnique = 0;
|
||||
private int _MyDocVersionInfoUnique;
|
||||
public int MyDocVersionInfoUnique
|
||||
{
|
||||
get { return _MyDocVersionInfoUnique; }
|
||||
}
|
||||
private DocVersionInfo()
|
||||
{/* require use of factory methods */
|
||||
_MyDocVersionInfoUnique = ++_DocVersionInfoUnique;
|
||||
_AllList.Add(this);
|
||||
}
|
||||
public void Dispose()
|
||||
{
|
||||
_AllList.Remove(this);
|
||||
_AllByPrimaryKey.Remove(VersionID.ToString());
|
||||
if (!_AllByPrimaryKey.ContainsKey(VersionID.ToString())) return;
|
||||
List<DocVersionInfo> listDocVersionInfo = _AllByPrimaryKey[VersionID.ToString()]; // Get the list of items
|
||||
listDocVersionInfo.Remove(this); // Remove the item from the list
|
||||
if (listDocVersionInfo.Count == 0) // If there are no items left in the list
|
||||
_AllByPrimaryKey.Remove(VersionID.ToString()); // remove the list
|
||||
}
|
||||
public virtual DocVersion Get()
|
||||
{
|
||||
@ -253,8 +268,10 @@ namespace VEPROMS.CSLA.Library
|
||||
}
|
||||
public static void Refresh(DocVersion tmp)
|
||||
{
|
||||
DocVersionInfo tmpInfo = GetExistingByPrimaryKey(tmp.VersionID);
|
||||
if (tmpInfo == null) return;
|
||||
string key = tmp.VersionID.ToString();
|
||||
ConvertListToDictionary();
|
||||
if (_AllByPrimaryKey.ContainsKey(key))
|
||||
foreach (DocVersionInfo tmpInfo in _AllByPrimaryKey[key])
|
||||
tmpInfo.RefreshFields(tmp);
|
||||
}
|
||||
private void RefreshFields(DocVersion tmp)
|
||||
@ -263,9 +280,9 @@ namespace VEPROMS.CSLA.Library
|
||||
{
|
||||
MyFolder.RefreshFolderDocVersions(); // Update List for old value
|
||||
_FolderID = tmp.FolderID; // Update the value
|
||||
_MyFolder = null; // Reset list so that the next line gets a new list
|
||||
MyFolder.RefreshFolderDocVersions(); // Update List for new value
|
||||
}
|
||||
_MyFolder = null; // Reset list so that the next line gets a new list
|
||||
if (MyFolder != null) MyFolder.RefreshFolderDocVersions(); // Update List for new value
|
||||
_VersionType = tmp.VersionType;
|
||||
_Name = tmp.Name;
|
||||
_Title = tmp.Title;
|
||||
@ -273,16 +290,16 @@ namespace VEPROMS.CSLA.Library
|
||||
{
|
||||
MyItem.RefreshItemDocVersions(); // Update List for old value
|
||||
_ItemID = tmp.ItemID; // Update the value
|
||||
_MyItem = null; // Reset list so that the next line gets a new list
|
||||
MyItem.RefreshItemDocVersions(); // Update List for new value
|
||||
}
|
||||
_MyItem = null; // Reset list so that the next line gets a new list
|
||||
if (MyItem != null) MyItem.RefreshItemDocVersions(); // Update List for new value
|
||||
if (_FormatID != tmp.FormatID)
|
||||
{
|
||||
MyFormat.RefreshFormatDocVersions(); // Update List for old value
|
||||
_FormatID = tmp.FormatID; // Update the value
|
||||
_MyFormat = null; // Reset list so that the next line gets a new list
|
||||
MyFormat.RefreshFormatDocVersions(); // Update List for new value
|
||||
}
|
||||
_MyFormat = null; // Reset list so that the next line gets a new list
|
||||
if (MyFormat != null) MyFormat.RefreshFormatDocVersions(); // Update List for new value
|
||||
_Config = tmp.Config;
|
||||
_DTS = tmp.DTS;
|
||||
_UserID = tmp.UserID;
|
||||
@ -294,8 +311,10 @@ namespace VEPROMS.CSLA.Library
|
||||
}
|
||||
public static void Refresh(FolderDocVersion tmp)
|
||||
{
|
||||
DocVersionInfo tmpInfo = GetExistingByPrimaryKey(tmp.VersionID);
|
||||
if (tmpInfo == null) return;
|
||||
string key = tmp.VersionID.ToString();
|
||||
ConvertListToDictionary();
|
||||
if (_AllByPrimaryKey.ContainsKey(key))
|
||||
foreach (DocVersionInfo tmpInfo in _AllByPrimaryKey[key])
|
||||
tmpInfo.RefreshFields(tmp);
|
||||
}
|
||||
private void RefreshFields(FolderDocVersion tmp)
|
||||
@ -307,16 +326,16 @@ namespace VEPROMS.CSLA.Library
|
||||
{
|
||||
MyItem.RefreshItemDocVersions(); // Update List for old value
|
||||
_ItemID = tmp.ItemID; // Update the value
|
||||
_MyItem = null; // Reset list so that the next line gets a new list
|
||||
MyItem.RefreshItemDocVersions(); // Update List for new value
|
||||
}
|
||||
_MyItem = null; // Reset list so that the next line gets a new list
|
||||
if (MyItem != null) MyItem.RefreshItemDocVersions(); // Update List for new value
|
||||
if (_FormatID != tmp.FormatID)
|
||||
{
|
||||
MyFormat.RefreshFormatDocVersions(); // Update List for old value
|
||||
_FormatID = tmp.FormatID; // Update the value
|
||||
_MyFormat = null; // Reset list so that the next line gets a new list
|
||||
MyFormat.RefreshFormatDocVersions(); // Update List for new value
|
||||
}
|
||||
_MyFormat = null; // Reset list so that the next line gets a new list
|
||||
if (MyFormat != null) MyFormat.RefreshFormatDocVersions(); // Update List for new value
|
||||
_Config = tmp.Config;
|
||||
_DTS = tmp.DTS;
|
||||
_UserID = tmp.UserID;
|
||||
@ -328,8 +347,10 @@ namespace VEPROMS.CSLA.Library
|
||||
}
|
||||
public static void Refresh(FormatDocVersion tmp)
|
||||
{
|
||||
DocVersionInfo tmpInfo = GetExistingByPrimaryKey(tmp.VersionID);
|
||||
if (tmpInfo == null) return;
|
||||
string key = tmp.VersionID.ToString();
|
||||
ConvertListToDictionary();
|
||||
if (_AllByPrimaryKey.ContainsKey(key))
|
||||
foreach (DocVersionInfo tmpInfo in _AllByPrimaryKey[key])
|
||||
tmpInfo.RefreshFields(tmp);
|
||||
}
|
||||
private void RefreshFields(FormatDocVersion tmp)
|
||||
@ -338,9 +359,9 @@ namespace VEPROMS.CSLA.Library
|
||||
{
|
||||
MyFolder.RefreshFolderDocVersions(); // Update List for old value
|
||||
_FolderID = tmp.FolderID; // Update the value
|
||||
_MyFolder = null; // Reset list so that the next line gets a new list
|
||||
MyFolder.RefreshFolderDocVersions(); // Update List for new value
|
||||
}
|
||||
_MyFolder = null; // Reset list so that the next line gets a new list
|
||||
if (MyFolder != null) MyFolder.RefreshFolderDocVersions(); // Update List for new value
|
||||
_VersionType = tmp.VersionType;
|
||||
_Name = tmp.Name;
|
||||
_Title = tmp.Title;
|
||||
@ -348,9 +369,9 @@ namespace VEPROMS.CSLA.Library
|
||||
{
|
||||
MyItem.RefreshItemDocVersions(); // Update List for old value
|
||||
_ItemID = tmp.ItemID; // Update the value
|
||||
_MyItem = null; // Reset list so that the next line gets a new list
|
||||
MyItem.RefreshItemDocVersions(); // Update List for new value
|
||||
}
|
||||
_MyItem = null; // Reset list so that the next line gets a new list
|
||||
if (MyItem != null) MyItem.RefreshItemDocVersions(); // Update List for new value
|
||||
_Config = tmp.Config;
|
||||
_DTS = tmp.DTS;
|
||||
_UserID = tmp.UserID;
|
||||
@ -362,8 +383,10 @@ namespace VEPROMS.CSLA.Library
|
||||
}
|
||||
public static void Refresh(ItemDocVersion tmp)
|
||||
{
|
||||
DocVersionInfo tmpInfo = GetExistingByPrimaryKey(tmp.VersionID);
|
||||
if (tmpInfo == null) return;
|
||||
string key = tmp.VersionID.ToString();
|
||||
ConvertListToDictionary();
|
||||
if (_AllByPrimaryKey.ContainsKey(key))
|
||||
foreach (DocVersionInfo tmpInfo in _AllByPrimaryKey[key])
|
||||
tmpInfo.RefreshFields(tmp);
|
||||
}
|
||||
private void RefreshFields(ItemDocVersion tmp)
|
||||
@ -372,9 +395,9 @@ namespace VEPROMS.CSLA.Library
|
||||
{
|
||||
MyFolder.RefreshFolderDocVersions(); // Update List for old value
|
||||
_FolderID = tmp.FolderID; // Update the value
|
||||
_MyFolder = null; // Reset list so that the next line gets a new list
|
||||
MyFolder.RefreshFolderDocVersions(); // Update List for new value
|
||||
}
|
||||
_MyFolder = null; // Reset list so that the next line gets a new list
|
||||
if (MyFolder != null) MyFolder.RefreshFolderDocVersions(); // Update List for new value
|
||||
_VersionType = tmp.VersionType;
|
||||
_Name = tmp.Name;
|
||||
_Title = tmp.Title;
|
||||
@ -382,9 +405,9 @@ namespace VEPROMS.CSLA.Library
|
||||
{
|
||||
MyFormat.RefreshFormatDocVersions(); // Update List for old value
|
||||
_FormatID = tmp.FormatID; // Update the value
|
||||
_MyFormat = null; // Reset list so that the next line gets a new list
|
||||
MyFormat.RefreshFormatDocVersions(); // Update List for new value
|
||||
}
|
||||
_MyFormat = null; // Reset list so that the next line gets a new list
|
||||
if (MyFormat != null) MyFormat.RefreshFormatDocVersions(); // Update List for new value
|
||||
_Config = tmp.Config;
|
||||
_DTS = tmp.DTS;
|
||||
_UserID = tmp.UserID;
|
||||
@ -404,7 +427,7 @@ namespace VEPROMS.CSLA.Library
|
||||
if (tmp == null)
|
||||
{
|
||||
tmp = DataPortal.Fetch<DocVersionInfo>(new PKCriteria(versionID));
|
||||
_AllList.Add(tmp);
|
||||
if (!_AllList.Contains(tmp)) _AllList.Add(tmp);
|
||||
}
|
||||
if (tmp.ErrorMessage == "No Record Found") tmp = null;
|
||||
return tmp;
|
||||
@ -418,14 +441,15 @@ namespace VEPROMS.CSLA.Library
|
||||
#region Data Access Portal
|
||||
internal DocVersionInfo(SafeDataReader dr)
|
||||
{
|
||||
if(_MyLog.IsDebugEnabled)_MyLog.DebugFormat("[{0}] DocVersionInfo.Constructor", GetHashCode());
|
||||
_MyDocVersionInfoUnique = ++_DocVersionInfoUnique;
|
||||
if (_MyLog.IsDebugEnabled) _MyLog.DebugFormat("[{0}] DocVersionInfo.Constructor", GetHashCode());
|
||||
try
|
||||
{
|
||||
ReadData(dr);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
if(_MyLog.IsErrorEnabled)_MyLog.Error("DocVersionInfo.Constructor", ex);
|
||||
if (_MyLog.IsErrorEnabled) _MyLog.Error("DocVersionInfo.Constructor", ex);
|
||||
throw new DbCslaException("DocVersionInfo.Constructor", ex);
|
||||
}
|
||||
}
|
||||
@ -442,7 +466,7 @@ namespace VEPROMS.CSLA.Library
|
||||
}
|
||||
private void ReadData(SafeDataReader dr)
|
||||
{
|
||||
if(_MyLog.IsDebugEnabled)_MyLog.DebugFormat("[{0}] DocVersionInfo.ReadData", GetHashCode());
|
||||
if (_MyLog.IsDebugEnabled) _MyLog.DebugFormat("[{0}] DocVersionInfo.ReadData", GetHashCode());
|
||||
try
|
||||
{
|
||||
_VersionID = dr.GetInt32("VersionID");
|
||||
@ -458,14 +482,14 @@ namespace VEPROMS.CSLA.Library
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
if(_MyLog.IsErrorEnabled)_MyLog.Error("DocVersionInfo.ReadData", ex);
|
||||
if (_MyLog.IsErrorEnabled) _MyLog.Error("DocVersionInfo.ReadData", ex);
|
||||
_ErrorMessage = ex.Message;
|
||||
throw new DbCslaException("DocVersionInfo.ReadData", ex);
|
||||
}
|
||||
}
|
||||
private void DataPortal_Fetch(PKCriteria criteria)
|
||||
{
|
||||
if(_MyLog.IsDebugEnabled)_MyLog.DebugFormat("[{0}] DocVersionInfo.DataPortal_Fetch", GetHashCode());
|
||||
if (_MyLog.IsDebugEnabled) _MyLog.DebugFormat("[{0}] DocVersionInfo.DataPortal_Fetch", GetHashCode());
|
||||
try
|
||||
{
|
||||
using (SqlConnection cn = Database.VEPROMS_SqlConnection)
|
||||
@ -493,7 +517,7 @@ namespace VEPROMS.CSLA.Library
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
if(_MyLog.IsErrorEnabled)_MyLog.Error("DocVersionInfo.DataPortal_Fetch", ex);
|
||||
if (_MyLog.IsErrorEnabled) _MyLog.Error("DocVersionInfo.DataPortal_Fetch", ex);
|
||||
_ErrorMessage = ex.Message;
|
||||
throw new DbCslaException("DocVersionInfo.DataPortal_Fetch", ex);
|
||||
}
|
||||
@ -503,7 +527,7 @@ namespace VEPROMS.CSLA.Library
|
||||
#region extension
|
||||
DocVersionInfoExtension _DocVersionInfoExtension = new DocVersionInfoExtension();
|
||||
[Serializable()]
|
||||
partial class DocVersionInfoExtension : extensionBase {}
|
||||
partial class DocVersionInfoExtension : extensionBase { }
|
||||
[Serializable()]
|
||||
class extensionBase
|
||||
{
|
||||
|
@ -138,7 +138,7 @@ namespace VEPROMS.CSLA.Library
|
||||
private void DataPortal_Fetch()
|
||||
{
|
||||
this.RaiseListChangedEvents = false;
|
||||
if(_MyLog.IsDebugEnabled)_MyLog.DebugFormat("[{0}] DocVersionInfoList.DataPortal_Fetch", GetHashCode());
|
||||
if (_MyLog.IsDebugEnabled) _MyLog.DebugFormat("[{0}] DocVersionInfoList.DataPortal_Fetch", GetHashCode());
|
||||
try
|
||||
{
|
||||
using (SqlConnection cn = Database.VEPROMS_SqlConnection)
|
||||
@ -158,7 +158,7 @@ namespace VEPROMS.CSLA.Library
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
if(_MyLog.IsErrorEnabled)_MyLog.Error("DocVersionInfoList.DataPortal_Fetch", ex);
|
||||
if (_MyLog.IsErrorEnabled) _MyLog.Error("DocVersionInfoList.DataPortal_Fetch", ex);
|
||||
throw new DbCslaException("DocVersionInfoList.DataPortal_Fetch", ex);
|
||||
}
|
||||
this.RaiseListChangedEvents = true;
|
||||
@ -180,7 +180,7 @@ namespace VEPROMS.CSLA.Library
|
||||
private void DataPortal_Fetch(FolderIDCriteria criteria)
|
||||
{
|
||||
this.RaiseListChangedEvents = false;
|
||||
if(_MyLog.IsDebugEnabled)_MyLog.DebugFormat("[{0}] DocVersionInfoList.DataPortal_FetchFolderID", GetHashCode());
|
||||
if (_MyLog.IsDebugEnabled) _MyLog.DebugFormat("[{0}] DocVersionInfoList.DataPortal_FetchFolderID", GetHashCode());
|
||||
try
|
||||
{
|
||||
using (SqlConnection cn = Database.VEPROMS_SqlConnection)
|
||||
@ -201,7 +201,7 @@ namespace VEPROMS.CSLA.Library
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
if(_MyLog.IsErrorEnabled)_MyLog.Error("DocVersionInfoList.DataPortal_FetchFolderID", ex);
|
||||
if (_MyLog.IsErrorEnabled) _MyLog.Error("DocVersionInfoList.DataPortal_FetchFolderID", ex);
|
||||
throw new DbCslaException("DocVersionInfoList.DataPortal_Fetch", ex);
|
||||
}
|
||||
this.RaiseListChangedEvents = true;
|
||||
@ -223,7 +223,7 @@ namespace VEPROMS.CSLA.Library
|
||||
private void DataPortal_Fetch(FormatIDCriteria criteria)
|
||||
{
|
||||
this.RaiseListChangedEvents = false;
|
||||
if(_MyLog.IsDebugEnabled)_MyLog.DebugFormat("[{0}] DocVersionInfoList.DataPortal_FetchFormatID", GetHashCode());
|
||||
if (_MyLog.IsDebugEnabled) _MyLog.DebugFormat("[{0}] DocVersionInfoList.DataPortal_FetchFormatID", GetHashCode());
|
||||
try
|
||||
{
|
||||
using (SqlConnection cn = Database.VEPROMS_SqlConnection)
|
||||
@ -244,7 +244,7 @@ namespace VEPROMS.CSLA.Library
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
if(_MyLog.IsErrorEnabled)_MyLog.Error("DocVersionInfoList.DataPortal_FetchFormatID", ex);
|
||||
if (_MyLog.IsErrorEnabled) _MyLog.Error("DocVersionInfoList.DataPortal_FetchFormatID", ex);
|
||||
throw new DbCslaException("DocVersionInfoList.DataPortal_Fetch", ex);
|
||||
}
|
||||
this.RaiseListChangedEvents = true;
|
||||
@ -266,7 +266,7 @@ namespace VEPROMS.CSLA.Library
|
||||
private void DataPortal_Fetch(ItemIDCriteria criteria)
|
||||
{
|
||||
this.RaiseListChangedEvents = false;
|
||||
if(_MyLog.IsDebugEnabled)_MyLog.DebugFormat("[{0}] DocVersionInfoList.DataPortal_FetchItemID", GetHashCode());
|
||||
if (_MyLog.IsDebugEnabled) _MyLog.DebugFormat("[{0}] DocVersionInfoList.DataPortal_FetchItemID", GetHashCode());
|
||||
try
|
||||
{
|
||||
using (SqlConnection cn = Database.VEPROMS_SqlConnection)
|
||||
@ -287,7 +287,7 @@ namespace VEPROMS.CSLA.Library
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
if(_MyLog.IsErrorEnabled)_MyLog.Error("DocVersionInfoList.DataPortal_FetchItemID", ex);
|
||||
if (_MyLog.IsErrorEnabled) _MyLog.Error("DocVersionInfoList.DataPortal_FetchItemID", ex);
|
||||
throw new DbCslaException("DocVersionInfoList.DataPortal_Fetch", ex);
|
||||
}
|
||||
this.RaiseListChangedEvents = true;
|
||||
@ -348,8 +348,8 @@ namespace VEPROMS.CSLA.Library
|
||||
/// </summary>
|
||||
public partial class DocVersionInfoListPropertyDescriptor : vlnListPropertyDescriptor
|
||||
{
|
||||
private DocVersionInfo Item { get { return (DocVersionInfo) _Item;} }
|
||||
public DocVersionInfoListPropertyDescriptor(DocVersionInfoList collection, int index):base(collection, index){;}
|
||||
private DocVersionInfo Item { get { return (DocVersionInfo)_Item; } }
|
||||
public DocVersionInfoListPropertyDescriptor(DocVersionInfoList collection, int index) : base(collection, index) { ;}
|
||||
}
|
||||
#endregion
|
||||
#region Converter
|
||||
@ -360,7 +360,7 @@ namespace VEPROMS.CSLA.Library
|
||||
if (destType == typeof(string) && value is DocVersionInfoList)
|
||||
{
|
||||
// Return department and department role separated by comma.
|
||||
return ((DocVersionInfoList) value).Items.Count.ToString() + " DocVersions";
|
||||
return ((DocVersionInfoList)value).Items.Count.ToString() + " DocVersions";
|
||||
}
|
||||
return base.ConvertTo(context, culture, value, destType);
|
||||
}
|
||||
|
@ -41,7 +41,7 @@ namespace VEPROMS.CSLA.Library
|
||||
{
|
||||
foreach (DocumentEntry tmp in _DocumentEntries)
|
||||
{
|
||||
if(tmp.IsDirty)refreshDocumentEntries.Add(tmp);
|
||||
if (tmp.IsDirty) refreshDocumentEntries.Add(tmp);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -65,13 +65,17 @@ namespace VEPROMS.CSLA.Library
|
||||
#endregion
|
||||
#region Collection
|
||||
protected static List<Document> _AllList = new List<Document>();
|
||||
private static Dictionary<string, Document> _AllByPrimaryKey = new Dictionary<string, Document>();
|
||||
private static Dictionary<string, List<Document>> _AllByPrimaryKey = new Dictionary<string, List<Document>>();
|
||||
private static void ConvertListToDictionary()
|
||||
{
|
||||
List<Document> remove = new List<Document>();
|
||||
foreach (Document tmp in _AllList)
|
||||
{
|
||||
_AllByPrimaryKey[tmp.DocID.ToString()]=tmp; // Primary Key
|
||||
if (!_AllByPrimaryKey.ContainsKey(tmp.DocID.ToString()))
|
||||
{
|
||||
_AllByPrimaryKey[tmp.DocID.ToString()] = new List<Document>(); // Add new list for PrimaryKey
|
||||
}
|
||||
_AllByPrimaryKey[tmp.DocID.ToString()].Add(tmp); // Add to Primary Key list
|
||||
remove.Add(tmp);
|
||||
}
|
||||
foreach (Document tmp in remove)
|
||||
@ -81,7 +85,7 @@ namespace VEPROMS.CSLA.Library
|
||||
{
|
||||
ConvertListToDictionary();
|
||||
string key = docID.ToString();
|
||||
if (_AllByPrimaryKey.ContainsKey(key)) return _AllByPrimaryKey[key];
|
||||
if (_AllByPrimaryKey.ContainsKey(key)) return _AllByPrimaryKey[key][0];
|
||||
return null;
|
||||
}
|
||||
#endregion
|
||||
@ -103,7 +107,7 @@ namespace VEPROMS.CSLA.Library
|
||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||
get
|
||||
{
|
||||
CanReadProperty("DocID",true);
|
||||
CanReadProperty("DocID", true);
|
||||
return _DocID;
|
||||
}
|
||||
}
|
||||
@ -113,13 +117,13 @@ namespace VEPROMS.CSLA.Library
|
||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||
get
|
||||
{
|
||||
CanReadProperty("LibTitle",true);
|
||||
CanReadProperty("LibTitle", true);
|
||||
return _LibTitle;
|
||||
}
|
||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||
set
|
||||
{
|
||||
CanWriteProperty("LibTitle",true);
|
||||
CanWriteProperty("LibTitle", true);
|
||||
if (value == null) value = string.Empty;
|
||||
if (_LibTitle != value)
|
||||
{
|
||||
@ -137,13 +141,13 @@ namespace VEPROMS.CSLA.Library
|
||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||
get
|
||||
{
|
||||
CanReadProperty("DocContent",true);
|
||||
CanReadProperty("DocContent", true);
|
||||
return _DocContent;
|
||||
}
|
||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||
set
|
||||
{
|
||||
CanWriteProperty("DocContent",true);
|
||||
CanWriteProperty("DocContent", true);
|
||||
if (_DocContent != value)
|
||||
{
|
||||
_DocContent = value;
|
||||
@ -160,13 +164,13 @@ namespace VEPROMS.CSLA.Library
|
||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||
get
|
||||
{
|
||||
CanReadProperty("DocAscii",true);
|
||||
CanReadProperty("DocAscii", true);
|
||||
return _DocAscii;
|
||||
}
|
||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||
set
|
||||
{
|
||||
CanWriteProperty("DocAscii",true);
|
||||
CanWriteProperty("DocAscii", true);
|
||||
if (value == null) value = string.Empty;
|
||||
if (_DocAscii != value)
|
||||
{
|
||||
@ -181,13 +185,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)
|
||||
{
|
||||
@ -202,13 +206,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;
|
||||
@ -222,13 +226,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)
|
||||
{
|
||||
@ -247,7 +251,7 @@ namespace VEPROMS.CSLA.Library
|
||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||
get
|
||||
{
|
||||
CanReadProperty("DocumentEntryCount",true);
|
||||
CanReadProperty("DocumentEntryCount", true);
|
||||
return _DocumentEntryCount;
|
||||
}
|
||||
}
|
||||
@ -261,21 +265,21 @@ namespace VEPROMS.CSLA.Library
|
||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||
get
|
||||
{
|
||||
CanReadProperty("DocumentEntries",true);
|
||||
if(_DocumentEntryCount > 0 && _DocumentEntries == null)
|
||||
CanReadProperty("DocumentEntries", true);
|
||||
if (_DocumentEntryCount > 0 && _DocumentEntries == null)
|
||||
_DocumentEntries = DocumentEntries.GetByDocID(DocID);
|
||||
else if(_DocumentEntries == null)
|
||||
else if (_DocumentEntries == null)
|
||||
_DocumentEntries = DocumentEntries.New();
|
||||
return _DocumentEntries;
|
||||
}
|
||||
}
|
||||
public override bool IsDirty
|
||||
{
|
||||
get { return base.IsDirty || (_DocumentEntries == null? false : _DocumentEntries.IsDirty); }
|
||||
get { return base.IsDirty || (_DocumentEntries == null ? false : _DocumentEntries.IsDirty); }
|
||||
}
|
||||
public override bool IsValid
|
||||
{
|
||||
get { return (IsNew && !IsDirty ? true : base.IsValid) && (_DocumentEntries == null? true : _DocumentEntries.IsValid); }
|
||||
get { return (IsNew && !IsDirty ? true : base.IsValid) && (_DocumentEntries == null ? true : _DocumentEntries.IsValid); }
|
||||
}
|
||||
// TODO: Replace base Document.ToString function as necessary
|
||||
/// <summary>
|
||||
@ -298,22 +302,23 @@ 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 (_DocumentEntries != null && (hasBrokenRules = _DocumentEntries.HasBrokenRules) != null) return hasBrokenRules;
|
||||
return hasBrokenRules;
|
||||
}
|
||||
finally
|
||||
{
|
||||
_CheckingBrokenRules=false;
|
||||
_CheckingBrokenRules = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -430,14 +435,25 @@ namespace VEPROMS.CSLA.Library
|
||||
#region Factory Methods
|
||||
public int CurrentEditLevel
|
||||
{ get { return EditLevel; } }
|
||||
private static int _DocumentUnique = 0;
|
||||
private int _MyDocumentUnique;
|
||||
public int MyDocumentUnique
|
||||
{
|
||||
get { return _MyDocumentUnique; }
|
||||
}
|
||||
protected Document()
|
||||
{/* require use of factory methods */
|
||||
_MyDocumentUnique = ++_DocumentUnique;
|
||||
_AllList.Add(this);
|
||||
}
|
||||
public void Dispose()
|
||||
{
|
||||
_AllList.Remove(this);
|
||||
_AllByPrimaryKey.Remove(DocID.ToString());
|
||||
if (!_AllByPrimaryKey.ContainsKey(DocID.ToString())) return;
|
||||
List<Document> listDocument = _AllByPrimaryKey[DocID.ToString()]; // Get the list of items
|
||||
listDocument.Remove(this); // Remove the item from the list
|
||||
if (listDocument.Count == 0) //If there are no items left in the list
|
||||
_AllByPrimaryKey.Remove(DocID.ToString()); // remove the list
|
||||
}
|
||||
public static Document New()
|
||||
{
|
||||
@ -514,7 +530,7 @@ namespace VEPROMS.CSLA.Library
|
||||
if (tmp == null)
|
||||
{
|
||||
tmp = DataPortal.Fetch<Document>(new PKCriteria(docID));
|
||||
_AllList.Add(tmp);
|
||||
if (!_AllList.Contains(tmp)) _AllList.Add(tmp);
|
||||
}
|
||||
if (tmp.ErrorMessage == "No Record Found") tmp = null;
|
||||
return tmp;
|
||||
@ -593,7 +609,7 @@ namespace VEPROMS.CSLA.Library
|
||||
}
|
||||
private void ReadData(SafeDataReader dr)
|
||||
{
|
||||
if(_MyLog.IsDebugEnabled)_MyLog.DebugFormat("[{0}] Document.ReadData", GetHashCode());
|
||||
if (_MyLog.IsDebugEnabled) _MyLog.DebugFormat("[{0}] Document.ReadData", GetHashCode());
|
||||
try
|
||||
{
|
||||
_DocID = dr.GetInt32("DocID");
|
||||
@ -609,14 +625,14 @@ namespace VEPROMS.CSLA.Library
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
if(_MyLog.IsErrorEnabled)_MyLog.Error("Document.ReadData", ex);
|
||||
if (_MyLog.IsErrorEnabled) _MyLog.Error("Document.ReadData", ex);
|
||||
_ErrorMessage = ex.Message;
|
||||
throw new DbCslaException("Document.ReadData", ex);
|
||||
}
|
||||
}
|
||||
private void DataPortal_Fetch(PKCriteria criteria)
|
||||
{
|
||||
if(_MyLog.IsDebugEnabled)_MyLog.DebugFormat("[{0}] Document.DataPortal_Fetch", GetHashCode());
|
||||
if (_MyLog.IsDebugEnabled) _MyLog.DebugFormat("[{0}] Document.DataPortal_Fetch", GetHashCode());
|
||||
try
|
||||
{
|
||||
using (SqlConnection cn = Database.VEPROMS_SqlConnection)
|
||||
@ -647,7 +663,7 @@ namespace VEPROMS.CSLA.Library
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
if(_MyLog.IsErrorEnabled)_MyLog.Error("Document.DataPortal_Fetch", ex);
|
||||
if (_MyLog.IsErrorEnabled) _MyLog.Error("Document.DataPortal_Fetch", ex);
|
||||
_ErrorMessage = ex.Message;
|
||||
throw new DbCslaException("Document.DataPortal_Fetch", ex);
|
||||
}
|
||||
@ -668,13 +684,13 @@ namespace VEPROMS.CSLA.Library
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
if(_MyLog.IsErrorEnabled)_MyLog.Error("Document.DataPortal_Insert", ex);
|
||||
if (_MyLog.IsErrorEnabled) _MyLog.Error("Document.DataPortal_Insert", ex);
|
||||
_ErrorMessage = ex.Message;
|
||||
throw new DbCslaException("Document.DataPortal_Insert", ex);
|
||||
}
|
||||
finally
|
||||
{
|
||||
if(_MyLog.IsDebugEnabled)_MyLog.DebugFormat("[{0}] Document.DataPortal_Insert", GetHashCode());
|
||||
if (_MyLog.IsDebugEnabled) _MyLog.DebugFormat("[{0}] Document.DataPortal_Insert", GetHashCode());
|
||||
}
|
||||
}
|
||||
[Transactional(TransactionalTypes.TransactionScope)]
|
||||
@ -711,11 +727,11 @@ namespace VEPROMS.CSLA.Library
|
||||
MarkOld();
|
||||
// update child objects
|
||||
if (_DocumentEntries != null) _DocumentEntries.Update(this);
|
||||
if(_MyLog.IsDebugEnabled)_MyLog.DebugFormat("[{0}] Document.SQLInsert", GetHashCode());
|
||||
if (_MyLog.IsDebugEnabled) _MyLog.DebugFormat("[{0}] Document.SQLInsert", GetHashCode());
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
if(_MyLog.IsErrorEnabled)_MyLog.Error("Document.SQLInsert", ex);
|
||||
if (_MyLog.IsErrorEnabled) _MyLog.Error("Document.SQLInsert", ex);
|
||||
_ErrorMessage = ex.Message;
|
||||
throw new DbCslaException("Document.SQLInsert", ex);
|
||||
}
|
||||
@ -723,7 +739,7 @@ namespace VEPROMS.CSLA.Library
|
||||
[Transactional(TransactionalTypes.TransactionScope)]
|
||||
public static byte[] Add(SqlConnection cn, ref int docID, string libTitle, byte[] docContent, string docAscii, string config, DateTime dts, string userID)
|
||||
{
|
||||
if(_MyLog.IsDebugEnabled)_MyLog.DebugFormat("[{0}] Document.Add", 0);
|
||||
if (_MyLog.IsDebugEnabled) _MyLog.DebugFormat("[{0}] Document.Add", 0);
|
||||
try
|
||||
{
|
||||
using (SqlCommand cm = cn.CreateCommand())
|
||||
@ -753,7 +769,7 @@ namespace VEPROMS.CSLA.Library
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
if(_MyLog.IsErrorEnabled)_MyLog.Error("Document.Add", ex);
|
||||
if (_MyLog.IsErrorEnabled) _MyLog.Error("Document.Add", ex);
|
||||
throw new DbCslaException("Document.Add", ex);
|
||||
}
|
||||
}
|
||||
@ -761,7 +777,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}] Document.DataPortal_Update", GetHashCode());
|
||||
if (_MyLog.IsDebugEnabled) _MyLog.DebugFormat("[{0}] Document.DataPortal_Update", GetHashCode());
|
||||
try
|
||||
{
|
||||
using (SqlConnection cn = Database.VEPROMS_SqlConnection)
|
||||
@ -775,7 +791,7 @@ namespace VEPROMS.CSLA.Library
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
if(_MyLog.IsErrorEnabled)_MyLog.Error("Document.DataPortal_Update", ex);
|
||||
if (_MyLog.IsErrorEnabled) _MyLog.Error("Document.DataPortal_Update", ex);
|
||||
_ErrorMessage = ex.Message;
|
||||
if (!ex.Message.EndsWith("has been edited by another user.")) throw ex;
|
||||
}
|
||||
@ -784,7 +800,7 @@ namespace VEPROMS.CSLA.Library
|
||||
internal void SQLUpdate()
|
||||
{
|
||||
if (!IsDirty) return; // If not dirty - nothing to do
|
||||
if(_MyLog.IsDebugEnabled)_MyLog.DebugFormat("[{0}] Document.SQLUpdate", GetHashCode());
|
||||
if (_MyLog.IsDebugEnabled) _MyLog.DebugFormat("[{0}] Document.SQLUpdate", GetHashCode());
|
||||
try
|
||||
{
|
||||
SqlConnection cn = (SqlConnection)ApplicationContext.LocalContext["cn"];
|
||||
@ -819,7 +835,7 @@ namespace VEPROMS.CSLA.Library
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
if(_MyLog.IsErrorEnabled)_MyLog.Error("Document.SQLUpdate", ex);
|
||||
if (_MyLog.IsErrorEnabled) _MyLog.Error("Document.SQLUpdate", ex);
|
||||
_ErrorMessage = ex.Message;
|
||||
if (!ex.Message.EndsWith("has been edited by another user.")) throw ex;
|
||||
}
|
||||
@ -841,7 +857,7 @@ namespace VEPROMS.CSLA.Library
|
||||
[Transactional(TransactionalTypes.TransactionScope)]
|
||||
public static byte[] Update(SqlConnection cn, ref int docID, string libTitle, byte[] docContent, string docAscii, string config, DateTime dts, string userID, ref byte[] lastChanged)
|
||||
{
|
||||
if(_MyLog.IsDebugEnabled)_MyLog.DebugFormat("[{0}] Document.Update", 0);
|
||||
if (_MyLog.IsDebugEnabled) _MyLog.DebugFormat("[{0}] Document.Update", 0);
|
||||
try
|
||||
{
|
||||
using (SqlCommand cm = cn.CreateCommand())
|
||||
@ -869,7 +885,7 @@ namespace VEPROMS.CSLA.Library
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
if(_MyLog.IsErrorEnabled)_MyLog.Error("Document.Update", ex);
|
||||
if (_MyLog.IsErrorEnabled) _MyLog.Error("Document.Update", ex);
|
||||
throw new DbCslaException("Document.Update", ex);
|
||||
}
|
||||
}
|
||||
@ -881,7 +897,7 @@ namespace VEPROMS.CSLA.Library
|
||||
[Transactional(TransactionalTypes.TransactionScope)]
|
||||
private void DataPortal_Delete(PKCriteria criteria)
|
||||
{
|
||||
if(_MyLog.IsDebugEnabled)_MyLog.DebugFormat("[{0}] Document.DataPortal_Delete", GetHashCode());
|
||||
if (_MyLog.IsDebugEnabled) _MyLog.DebugFormat("[{0}] Document.DataPortal_Delete", GetHashCode());
|
||||
try
|
||||
{
|
||||
using (SqlConnection cn = Database.VEPROMS_SqlConnection)
|
||||
@ -897,7 +913,7 @@ namespace VEPROMS.CSLA.Library
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
if(_MyLog.IsErrorEnabled)_MyLog.Error("Document.DataPortal_Delete", ex);
|
||||
if (_MyLog.IsErrorEnabled) _MyLog.Error("Document.DataPortal_Delete", ex);
|
||||
_ErrorMessage = ex.Message;
|
||||
throw new DbCslaException("Document.DataPortal_Delete", ex);
|
||||
}
|
||||
@ -905,7 +921,7 @@ namespace VEPROMS.CSLA.Library
|
||||
[Transactional(TransactionalTypes.TransactionScope)]
|
||||
public static void Remove(SqlConnection cn, int docID)
|
||||
{
|
||||
if(_MyLog.IsDebugEnabled)_MyLog.DebugFormat("[{0}] Document.Remove", 0);
|
||||
if (_MyLog.IsDebugEnabled) _MyLog.DebugFormat("[{0}] Document.Remove", 0);
|
||||
try
|
||||
{
|
||||
using (SqlCommand cm = cn.CreateCommand())
|
||||
@ -920,7 +936,7 @@ namespace VEPROMS.CSLA.Library
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
if(_MyLog.IsErrorEnabled)_MyLog.Error("Document.Remove", ex);
|
||||
if (_MyLog.IsErrorEnabled) _MyLog.Error("Document.Remove", ex);
|
||||
throw new DbCslaException("Document.Remove", ex);
|
||||
}
|
||||
}
|
||||
@ -954,7 +970,7 @@ namespace VEPROMS.CSLA.Library
|
||||
}
|
||||
protected override void DataPortal_Execute()
|
||||
{
|
||||
if(_MyLog.IsDebugEnabled)_MyLog.DebugFormat("[{0}] Document.DataPortal_Execute", GetHashCode());
|
||||
if (_MyLog.IsDebugEnabled) _MyLog.DebugFormat("[{0}] Document.DataPortal_Execute", GetHashCode());
|
||||
try
|
||||
{
|
||||
using (SqlConnection cn = Database.VEPROMS_SqlConnection)
|
||||
@ -972,7 +988,7 @@ namespace VEPROMS.CSLA.Library
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
if(_MyLog.IsErrorEnabled)_MyLog.Error("Document.DataPortal_Execute", ex);
|
||||
if (_MyLog.IsErrorEnabled) _MyLog.Error("Document.DataPortal_Execute", ex);
|
||||
throw new DbCslaException("Document.DataPortal_Execute", ex);
|
||||
}
|
||||
}
|
||||
|
@ -94,8 +94,8 @@ namespace VEPROMS.CSLA.Library
|
||||
{
|
||||
get
|
||||
{
|
||||
IVEHasBrokenRules hasBrokenRules=null;
|
||||
foreach(DocumentEntry documentEntry in this)
|
||||
IVEHasBrokenRules hasBrokenRules = null;
|
||||
foreach (DocumentEntry documentEntry in this)
|
||||
if ((hasBrokenRules = documentEntry.HasBrokenRules) != null) return hasBrokenRules;
|
||||
return hasBrokenRules;
|
||||
}
|
||||
@ -165,7 +165,7 @@ namespace VEPROMS.CSLA.Library
|
||||
private void DataPortal_Fetch(DocIDCriteria criteria)
|
||||
{
|
||||
this.RaiseListChangedEvents = false;
|
||||
if(_MyLog.IsDebugEnabled)_MyLog.DebugFormat("[{0}] DocumentEntries.DataPortal_FetchDocID", GetHashCode());
|
||||
if (_MyLog.IsDebugEnabled) _MyLog.DebugFormat("[{0}] DocumentEntries.DataPortal_FetchDocID", GetHashCode());
|
||||
try
|
||||
{
|
||||
using (SqlConnection cn = Database.VEPROMS_SqlConnection)
|
||||
@ -184,7 +184,7 @@ namespace VEPROMS.CSLA.Library
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
if(_MyLog.IsErrorEnabled)_MyLog.Error("DocumentEntries.DataPortal_FetchDocID", ex);
|
||||
if (_MyLog.IsErrorEnabled) _MyLog.Error("DocumentEntries.DataPortal_FetchDocID", ex);
|
||||
throw new DbCslaException("DocumentEntries.DataPortal_Fetch", ex);
|
||||
}
|
||||
this.RaiseListChangedEvents = true;
|
||||
@ -269,8 +269,8 @@ namespace VEPROMS.CSLA.Library
|
||||
/// </summary>
|
||||
public partial class DocumentEntriesPropertyDescriptor : vlnListPropertyDescriptor
|
||||
{
|
||||
private DocumentEntry Item { get { return (DocumentEntry) _Item;} }
|
||||
public DocumentEntriesPropertyDescriptor(DocumentEntries collection, int index):base(collection, index){;}
|
||||
private DocumentEntry Item { get { return (DocumentEntry)_Item; } }
|
||||
public DocumentEntriesPropertyDescriptor(DocumentEntries collection, int index) : base(collection, index) { ;}
|
||||
}
|
||||
#endregion
|
||||
#region Converter
|
||||
@ -281,7 +281,7 @@ namespace VEPROMS.CSLA.Library
|
||||
if (destType == typeof(string) && value is DocumentEntries)
|
||||
{
|
||||
// Return department and department role separated by comma.
|
||||
return ((DocumentEntries) value).Items.Count.ToString() + " Entries";
|
||||
return ((DocumentEntries)value).Items.Count.ToString() + " Entries";
|
||||
}
|
||||
return base.ConvertTo(context, culture, value, destType);
|
||||
}
|
||||
|
@ -42,7 +42,7 @@ namespace VEPROMS.CSLA.Library
|
||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||
get
|
||||
{
|
||||
CanReadProperty("ContentID",true);
|
||||
CanReadProperty("ContentID", true);
|
||||
if (_MyEntry != null) _ContentID = _MyEntry.ContentID;
|
||||
return _ContentID;
|
||||
}
|
||||
@ -54,7 +54,7 @@ namespace VEPROMS.CSLA.Library
|
||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||
get
|
||||
{
|
||||
CanReadProperty("MyEntry",true);
|
||||
CanReadProperty("MyEntry", true);
|
||||
if (_MyEntry == null && _ContentID != 0) _MyEntry = Entry.Get(_ContentID);
|
||||
return _MyEntry;
|
||||
}
|
||||
@ -65,13 +65,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;
|
||||
@ -85,13 +85,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)
|
||||
{
|
||||
@ -107,7 +107,7 @@ namespace VEPROMS.CSLA.Library
|
||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||
get
|
||||
{
|
||||
CanReadProperty("Content_Number",true);
|
||||
CanReadProperty("Content_Number", true);
|
||||
return _Content_Number;
|
||||
}
|
||||
}
|
||||
@ -117,7 +117,7 @@ namespace VEPROMS.CSLA.Library
|
||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||
get
|
||||
{
|
||||
CanReadProperty("Content_Text",true);
|
||||
CanReadProperty("Content_Text", true);
|
||||
return _Content_Text;
|
||||
}
|
||||
}
|
||||
@ -130,7 +130,7 @@ namespace VEPROMS.CSLA.Library
|
||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||
get
|
||||
{
|
||||
CanReadProperty("Content_Type",true);
|
||||
CanReadProperty("Content_Type", true);
|
||||
return _Content_Type;
|
||||
}
|
||||
}
|
||||
@ -140,7 +140,7 @@ namespace VEPROMS.CSLA.Library
|
||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||
get
|
||||
{
|
||||
CanReadProperty("Content_FormatID",true);
|
||||
CanReadProperty("Content_FormatID", true);
|
||||
return _Content_FormatID;
|
||||
}
|
||||
}
|
||||
@ -150,7 +150,7 @@ namespace VEPROMS.CSLA.Library
|
||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||
get
|
||||
{
|
||||
CanReadProperty("Content_Config",true);
|
||||
CanReadProperty("Content_Config", true);
|
||||
return _Content_Config;
|
||||
}
|
||||
}
|
||||
@ -160,7 +160,7 @@ namespace VEPROMS.CSLA.Library
|
||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||
get
|
||||
{
|
||||
CanReadProperty("Content_DTS",true);
|
||||
CanReadProperty("Content_DTS", true);
|
||||
return _Content_DTS;
|
||||
}
|
||||
}
|
||||
@ -170,7 +170,7 @@ namespace VEPROMS.CSLA.Library
|
||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||
get
|
||||
{
|
||||
CanReadProperty("Content_UserID",true);
|
||||
CanReadProperty("Content_UserID", true);
|
||||
return _Content_UserID;
|
||||
}
|
||||
}
|
||||
@ -195,22 +195,22 @@ namespace VEPROMS.CSLA.Library
|
||||
#endregion
|
||||
#region ValidationRules
|
||||
[NonSerialized]
|
||||
private bool _CheckingBrokenRules=false;
|
||||
private bool _CheckingBrokenRules = false;
|
||||
public IVEHasBrokenRules HasBrokenRules
|
||||
{
|
||||
get
|
||||
{
|
||||
if(_CheckingBrokenRules)return null;
|
||||
if (_CheckingBrokenRules) return null;
|
||||
if (BrokenRulesCollection.Count > 0) return this;
|
||||
try
|
||||
{
|
||||
_CheckingBrokenRules=true;
|
||||
_CheckingBrokenRules = true;
|
||||
IVEHasBrokenRules hasBrokenRules = null;
|
||||
return hasBrokenRules;
|
||||
}
|
||||
finally
|
||||
{
|
||||
_CheckingBrokenRules=false;
|
||||
_CheckingBrokenRules = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -318,7 +318,7 @@ namespace VEPROMS.CSLA.Library
|
||||
#region Data Access Portal
|
||||
private void Fetch(SafeDataReader dr)
|
||||
{
|
||||
if(_MyLog.IsDebugEnabled)_MyLog.DebugFormat("[{0}] DocumentEntry.FetchDR", GetHashCode());
|
||||
if (_MyLog.IsDebugEnabled) _MyLog.DebugFormat("[{0}] DocumentEntry.FetchDR", GetHashCode());
|
||||
try
|
||||
{
|
||||
_ContentID = dr.GetInt32("ContentID");
|
||||
@ -335,7 +335,7 @@ namespace VEPROMS.CSLA.Library
|
||||
}
|
||||
catch (Exception ex) // FKItem Fetch
|
||||
{
|
||||
if(_MyLog.IsErrorEnabled)_MyLog.Error("DocumentEntry.FetchDR", ex);
|
||||
if (_MyLog.IsErrorEnabled) _MyLog.Error("DocumentEntry.FetchDR", ex);
|
||||
throw new DbCslaException("DocumentEntry.Fetch", ex);
|
||||
}
|
||||
MarkOld();
|
||||
|
@ -37,13 +37,17 @@ namespace VEPROMS.CSLA.Library
|
||||
#endregion
|
||||
#region Collection
|
||||
protected static List<DocumentInfo> _AllList = new List<DocumentInfo>();
|
||||
private static Dictionary<string, DocumentInfo> _AllByPrimaryKey = new Dictionary<string, DocumentInfo>();
|
||||
private static Dictionary<string, List<DocumentInfo>> _AllByPrimaryKey = new Dictionary<string, List<DocumentInfo>>();
|
||||
private static void ConvertListToDictionary()
|
||||
{
|
||||
List<DocumentInfo> remove = new List<DocumentInfo>();
|
||||
foreach (DocumentInfo tmp in _AllList)
|
||||
{
|
||||
_AllByPrimaryKey[tmp.DocID.ToString()]=tmp; // Primary Key
|
||||
if (!_AllByPrimaryKey.ContainsKey(tmp.DocID.ToString()))
|
||||
{
|
||||
_AllByPrimaryKey[tmp.DocID.ToString()] = new List<DocumentInfo>(); // Add new list for PrimaryKey
|
||||
}
|
||||
_AllByPrimaryKey[tmp.DocID.ToString()].Add(tmp); // Add to Primary Key list
|
||||
remove.Add(tmp);
|
||||
}
|
||||
foreach (DocumentInfo tmp in remove)
|
||||
@ -57,7 +61,7 @@ namespace VEPROMS.CSLA.Library
|
||||
{
|
||||
ConvertListToDictionary();
|
||||
string key = docID.ToString();
|
||||
if (_AllByPrimaryKey.ContainsKey(key)) return _AllByPrimaryKey[key];
|
||||
if (_AllByPrimaryKey.ContainsKey(key)) return _AllByPrimaryKey[key][0];
|
||||
return null;
|
||||
}
|
||||
#endregion
|
||||
@ -85,7 +89,7 @@ namespace VEPROMS.CSLA.Library
|
||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||
get
|
||||
{
|
||||
CanReadProperty("DocID",true);
|
||||
CanReadProperty("DocID", true);
|
||||
return _DocID;
|
||||
}
|
||||
}
|
||||
@ -95,7 +99,7 @@ namespace VEPROMS.CSLA.Library
|
||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||
get
|
||||
{
|
||||
CanReadProperty("LibTitle",true);
|
||||
CanReadProperty("LibTitle", true);
|
||||
return _LibTitle;
|
||||
}
|
||||
}
|
||||
@ -108,7 +112,7 @@ namespace VEPROMS.CSLA.Library
|
||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||
get
|
||||
{
|
||||
CanReadProperty("DocContent",true);
|
||||
CanReadProperty("DocContent", true);
|
||||
return _DocContent;
|
||||
}
|
||||
}
|
||||
@ -121,7 +125,7 @@ namespace VEPROMS.CSLA.Library
|
||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||
get
|
||||
{
|
||||
CanReadProperty("DocAscii",true);
|
||||
CanReadProperty("DocAscii", true);
|
||||
return _DocAscii;
|
||||
}
|
||||
}
|
||||
@ -131,7 +135,7 @@ namespace VEPROMS.CSLA.Library
|
||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||
get
|
||||
{
|
||||
CanReadProperty("Config",true);
|
||||
CanReadProperty("Config", true);
|
||||
return _Config;
|
||||
}
|
||||
}
|
||||
@ -141,7 +145,7 @@ namespace VEPROMS.CSLA.Library
|
||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||
get
|
||||
{
|
||||
CanReadProperty("DTS",true);
|
||||
CanReadProperty("DTS", true);
|
||||
return _DTS;
|
||||
}
|
||||
}
|
||||
@ -151,7 +155,7 @@ namespace VEPROMS.CSLA.Library
|
||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||
get
|
||||
{
|
||||
CanReadProperty("UserID",true);
|
||||
CanReadProperty("UserID", true);
|
||||
return _UserID;
|
||||
}
|
||||
}
|
||||
@ -164,7 +168,7 @@ namespace VEPROMS.CSLA.Library
|
||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||
get
|
||||
{
|
||||
CanReadProperty("DocumentEntryCount",true);
|
||||
CanReadProperty("DocumentEntryCount", true);
|
||||
return _DocumentEntryCount;
|
||||
}
|
||||
}
|
||||
@ -175,7 +179,7 @@ namespace VEPROMS.CSLA.Library
|
||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||
get
|
||||
{
|
||||
CanReadProperty("DocumentEntries",true);
|
||||
CanReadProperty("DocumentEntries", true);
|
||||
if (_DocumentEntryCount < 0 || (_DocumentEntryCount > 0 && _DocumentEntries == null))
|
||||
_DocumentEntries = EntryInfoList.GetByDocID(_DocID);
|
||||
if (_DocumentEntryCount < 0)
|
||||
@ -185,7 +189,10 @@ namespace VEPROMS.CSLA.Library
|
||||
}
|
||||
internal void RefreshDocumentEntries()
|
||||
{
|
||||
_DocumentEntryCount = -1; // This will cause the data to be requeried
|
||||
ConvertListToDictionary();
|
||||
if (_AllByPrimaryKey.ContainsKey(_DocID.ToString()))
|
||||
foreach (DocumentInfo tmp in _AllByPrimaryKey[_DocID.ToString()])
|
||||
tmp._DocumentEntryCount = -1; // This will cause the data to be requeried
|
||||
}
|
||||
// TODO: Replace base DocumentInfo.ToString function as necessary
|
||||
/// <summary>
|
||||
@ -207,14 +214,25 @@ namespace VEPROMS.CSLA.Library
|
||||
}
|
||||
#endregion
|
||||
#region Factory Methods
|
||||
private static int _DocumentInfoUnique = 0;
|
||||
private int _MyDocumentInfoUnique;
|
||||
public int MyDocumentInfoUnique
|
||||
{
|
||||
get { return _MyDocumentInfoUnique; }
|
||||
}
|
||||
private DocumentInfo()
|
||||
{/* require use of factory methods */
|
||||
_MyDocumentInfoUnique = ++_DocumentInfoUnique;
|
||||
_AllList.Add(this);
|
||||
}
|
||||
public void Dispose()
|
||||
{
|
||||
_AllList.Remove(this);
|
||||
_AllByPrimaryKey.Remove(DocID.ToString());
|
||||
if (!_AllByPrimaryKey.ContainsKey(DocID.ToString())) return;
|
||||
List<DocumentInfo> listDocumentInfo = _AllByPrimaryKey[DocID.ToString()]; // Get the list of items
|
||||
listDocumentInfo.Remove(this); // Remove the item from the list
|
||||
if (listDocumentInfo.Count == 0) // If there are no items left in the list
|
||||
_AllByPrimaryKey.Remove(DocID.ToString()); // remove the list
|
||||
}
|
||||
public virtual Document Get()
|
||||
{
|
||||
@ -222,8 +240,10 @@ namespace VEPROMS.CSLA.Library
|
||||
}
|
||||
public static void Refresh(Document tmp)
|
||||
{
|
||||
DocumentInfo tmpInfo = GetExistingByPrimaryKey(tmp.DocID);
|
||||
if (tmpInfo == null) return;
|
||||
string key = tmp.DocID.ToString();
|
||||
ConvertListToDictionary();
|
||||
if (_AllByPrimaryKey.ContainsKey(key))
|
||||
foreach (DocumentInfo tmpInfo in _AllByPrimaryKey[key])
|
||||
tmpInfo.RefreshFields(tmp);
|
||||
}
|
||||
private void RefreshFields(Document tmp)
|
||||
@ -247,7 +267,7 @@ namespace VEPROMS.CSLA.Library
|
||||
if (tmp == null)
|
||||
{
|
||||
tmp = DataPortal.Fetch<DocumentInfo>(new PKCriteria(docID));
|
||||
_AllList.Add(tmp);
|
||||
if (!_AllList.Contains(tmp)) _AllList.Add(tmp);
|
||||
}
|
||||
if (tmp.ErrorMessage == "No Record Found") tmp = null;
|
||||
return tmp;
|
||||
@ -261,14 +281,15 @@ namespace VEPROMS.CSLA.Library
|
||||
#region Data Access Portal
|
||||
internal DocumentInfo(SafeDataReader dr)
|
||||
{
|
||||
if(_MyLog.IsDebugEnabled)_MyLog.DebugFormat("[{0}] DocumentInfo.Constructor", GetHashCode());
|
||||
_MyDocumentInfoUnique = ++_DocumentInfoUnique;
|
||||
if (_MyLog.IsDebugEnabled) _MyLog.DebugFormat("[{0}] DocumentInfo.Constructor", GetHashCode());
|
||||
try
|
||||
{
|
||||
ReadData(dr);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
if(_MyLog.IsErrorEnabled)_MyLog.Error("DocumentInfo.Constructor", ex);
|
||||
if (_MyLog.IsErrorEnabled) _MyLog.Error("DocumentInfo.Constructor", ex);
|
||||
throw new DbCslaException("DocumentInfo.Constructor", ex);
|
||||
}
|
||||
}
|
||||
@ -285,7 +306,7 @@ namespace VEPROMS.CSLA.Library
|
||||
}
|
||||
private void ReadData(SafeDataReader dr)
|
||||
{
|
||||
if(_MyLog.IsDebugEnabled)_MyLog.DebugFormat("[{0}] DocumentInfo.ReadData", GetHashCode());
|
||||
if (_MyLog.IsDebugEnabled) _MyLog.DebugFormat("[{0}] DocumentInfo.ReadData", GetHashCode());
|
||||
try
|
||||
{
|
||||
_DocID = dr.GetInt32("DocID");
|
||||
@ -299,14 +320,14 @@ namespace VEPROMS.CSLA.Library
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
if(_MyLog.IsErrorEnabled)_MyLog.Error("DocumentInfo.ReadData", ex);
|
||||
if (_MyLog.IsErrorEnabled) _MyLog.Error("DocumentInfo.ReadData", ex);
|
||||
_ErrorMessage = ex.Message;
|
||||
throw new DbCslaException("DocumentInfo.ReadData", ex);
|
||||
}
|
||||
}
|
||||
private void DataPortal_Fetch(PKCriteria criteria)
|
||||
{
|
||||
if(_MyLog.IsDebugEnabled)_MyLog.DebugFormat("[{0}] DocumentInfo.DataPortal_Fetch", GetHashCode());
|
||||
if (_MyLog.IsDebugEnabled) _MyLog.DebugFormat("[{0}] DocumentInfo.DataPortal_Fetch", GetHashCode());
|
||||
try
|
||||
{
|
||||
using (SqlConnection cn = Database.VEPROMS_SqlConnection)
|
||||
@ -334,7 +355,7 @@ namespace VEPROMS.CSLA.Library
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
if(_MyLog.IsErrorEnabled)_MyLog.Error("DocumentInfo.DataPortal_Fetch", ex);
|
||||
if (_MyLog.IsErrorEnabled) _MyLog.Error("DocumentInfo.DataPortal_Fetch", ex);
|
||||
_ErrorMessage = ex.Message;
|
||||
throw new DbCslaException("DocumentInfo.DataPortal_Fetch", ex);
|
||||
}
|
||||
@ -344,7 +365,7 @@ namespace VEPROMS.CSLA.Library
|
||||
#region extension
|
||||
DocumentInfoExtension _DocumentInfoExtension = new DocumentInfoExtension();
|
||||
[Serializable()]
|
||||
partial class DocumentInfoExtension : extensionBase {}
|
||||
partial class DocumentInfoExtension : extensionBase { }
|
||||
[Serializable()]
|
||||
class extensionBase
|
||||
{
|
||||
|
@ -96,7 +96,7 @@ namespace VEPROMS.CSLA.Library
|
||||
private void DataPortal_Fetch()
|
||||
{
|
||||
this.RaiseListChangedEvents = false;
|
||||
if(_MyLog.IsDebugEnabled)_MyLog.DebugFormat("[{0}] DocumentInfoList.DataPortal_Fetch", GetHashCode());
|
||||
if (_MyLog.IsDebugEnabled) _MyLog.DebugFormat("[{0}] DocumentInfoList.DataPortal_Fetch", GetHashCode());
|
||||
try
|
||||
{
|
||||
using (SqlConnection cn = Database.VEPROMS_SqlConnection)
|
||||
@ -116,7 +116,7 @@ namespace VEPROMS.CSLA.Library
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
if(_MyLog.IsErrorEnabled)_MyLog.Error("DocumentInfoList.DataPortal_Fetch", ex);
|
||||
if (_MyLog.IsErrorEnabled) _MyLog.Error("DocumentInfoList.DataPortal_Fetch", ex);
|
||||
throw new DbCslaException("DocumentInfoList.DataPortal_Fetch", ex);
|
||||
}
|
||||
this.RaiseListChangedEvents = true;
|
||||
@ -177,8 +177,8 @@ namespace VEPROMS.CSLA.Library
|
||||
/// </summary>
|
||||
public partial class DocumentInfoListPropertyDescriptor : vlnListPropertyDescriptor
|
||||
{
|
||||
private DocumentInfo Item { get { return (DocumentInfo) _Item;} }
|
||||
public DocumentInfoListPropertyDescriptor(DocumentInfoList collection, int index):base(collection, index){;}
|
||||
private DocumentInfo Item { get { return (DocumentInfo)_Item; } }
|
||||
public DocumentInfoListPropertyDescriptor(DocumentInfoList collection, int index) : base(collection, index) { ;}
|
||||
}
|
||||
#endregion
|
||||
#region Converter
|
||||
@ -189,7 +189,7 @@ namespace VEPROMS.CSLA.Library
|
||||
if (destType == typeof(string) && value is DocumentInfoList)
|
||||
{
|
||||
// Return department and department role separated by comma.
|
||||
return ((DocumentInfoList) value).Items.Count.ToString() + " Documents";
|
||||
return ((DocumentInfoList)value).Items.Count.ToString() + " Documents";
|
||||
}
|
||||
return base.ConvertTo(context, culture, value, destType);
|
||||
}
|
||||
|
@ -47,19 +47,23 @@ namespace VEPROMS.CSLA.Library
|
||||
foreach (Entry tmp in _RefreshEntries)
|
||||
{
|
||||
EntryInfo.Refresh(tmp);
|
||||
if(tmp._MyDocument != null) DocumentInfo.Refresh(tmp._MyDocument);
|
||||
if (tmp._MyDocument != null) DocumentInfo.Refresh(tmp._MyDocument);
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
#region Collection
|
||||
protected static List<Entry> _AllList = new List<Entry>();
|
||||
private static Dictionary<string, Entry> _AllByPrimaryKey = new Dictionary<string, Entry>();
|
||||
private static Dictionary<string, List<Entry>> _AllByPrimaryKey = new Dictionary<string, List<Entry>>();
|
||||
private static void ConvertListToDictionary()
|
||||
{
|
||||
List<Entry> remove = new List<Entry>();
|
||||
foreach (Entry tmp in _AllList)
|
||||
{
|
||||
_AllByPrimaryKey[tmp.ContentID.ToString()]=tmp; // Primary Key
|
||||
if (!_AllByPrimaryKey.ContainsKey(tmp.ContentID.ToString()))
|
||||
{
|
||||
_AllByPrimaryKey[tmp.ContentID.ToString()] = new List<Entry>(); // Add new list for PrimaryKey
|
||||
}
|
||||
_AllByPrimaryKey[tmp.ContentID.ToString()].Add(tmp); // Add to Primary Key list
|
||||
remove.Add(tmp);
|
||||
}
|
||||
foreach (Entry tmp in remove)
|
||||
@ -69,7 +73,7 @@ namespace VEPROMS.CSLA.Library
|
||||
{
|
||||
ConvertListToDictionary();
|
||||
string key = contentID.ToString();
|
||||
if (_AllByPrimaryKey.ContainsKey(key)) return _AllByPrimaryKey[key];
|
||||
if (_AllByPrimaryKey.ContainsKey(key)) return _AllByPrimaryKey[key][0];
|
||||
return null;
|
||||
}
|
||||
#endregion
|
||||
@ -86,7 +90,7 @@ namespace VEPROMS.CSLA.Library
|
||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||
get
|
||||
{
|
||||
CanReadProperty("ContentID",true);
|
||||
CanReadProperty("ContentID", true);
|
||||
if (_MyContent != null) _ContentID = _MyContent.ContentID;
|
||||
return _ContentID;
|
||||
}
|
||||
@ -98,7 +102,7 @@ namespace VEPROMS.CSLA.Library
|
||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||
get
|
||||
{
|
||||
CanReadProperty("MyContent",true);
|
||||
CanReadProperty("MyContent", true);
|
||||
if (_MyContent == null && _ContentID != 0) _MyContent = Content.Get(_ContentID);
|
||||
return _MyContent;
|
||||
}
|
||||
@ -109,7 +113,7 @@ namespace VEPROMS.CSLA.Library
|
||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||
get
|
||||
{
|
||||
CanReadProperty("DocID",true);
|
||||
CanReadProperty("DocID", true);
|
||||
if (_MyDocument != null) _DocID = _MyDocument.DocID;
|
||||
return _DocID;
|
||||
}
|
||||
@ -120,14 +124,14 @@ namespace VEPROMS.CSLA.Library
|
||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||
get
|
||||
{
|
||||
CanReadProperty("MyDocument",true);
|
||||
CanReadProperty("MyDocument", true);
|
||||
if (_MyDocument == null && _DocID != 0) _MyDocument = Document.Get(_DocID);
|
||||
return _MyDocument;
|
||||
}
|
||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||
set
|
||||
{
|
||||
CanWriteProperty("MyDocument",true);
|
||||
CanWriteProperty("MyDocument", true);
|
||||
if (_MyDocument != value)
|
||||
{
|
||||
_MyDocument = value;
|
||||
@ -141,13 +145,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;
|
||||
@ -161,13 +165,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)
|
||||
{
|
||||
@ -179,11 +183,11 @@ namespace VEPROMS.CSLA.Library
|
||||
private byte[] _LastChanged = new byte[8];//timestamp
|
||||
public override bool IsDirty
|
||||
{
|
||||
get { return base.IsDirty || (_MyDocument == null? false : _MyDocument.IsDirty); }
|
||||
get { return base.IsDirty || (_MyDocument == null ? false : _MyDocument.IsDirty); }
|
||||
}
|
||||
public override bool IsValid
|
||||
{
|
||||
get { return (IsNew && !IsDirty ? true : base.IsValid) && (_MyDocument == null? true : _MyDocument.IsValid); }
|
||||
get { return (IsNew && !IsDirty ? true : base.IsValid) && (_MyDocument == null ? true : _MyDocument.IsValid); }
|
||||
}
|
||||
// TODO: Replace base Entry.ToString function as necessary
|
||||
/// <summary>
|
||||
@ -206,22 +210,23 @@ 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 (_MyDocument != null && (hasBrokenRules = _MyDocument.HasBrokenRules) != null) return hasBrokenRules;
|
||||
return hasBrokenRules;
|
||||
}
|
||||
finally
|
||||
{
|
||||
_CheckingBrokenRules=false;
|
||||
_CheckingBrokenRules = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -320,14 +325,25 @@ namespace VEPROMS.CSLA.Library
|
||||
#region Factory Methods
|
||||
public int CurrentEditLevel
|
||||
{ get { return EditLevel; } }
|
||||
private static int _EntryUnique = 0;
|
||||
private int _MyEntryUnique;
|
||||
public int MyEntryUnique
|
||||
{
|
||||
get { return _MyEntryUnique; }
|
||||
}
|
||||
protected Entry()
|
||||
{/* require use of factory methods */
|
||||
_MyEntryUnique = ++_EntryUnique;
|
||||
_AllList.Add(this);
|
||||
}
|
||||
public void Dispose()
|
||||
{
|
||||
_AllList.Remove(this);
|
||||
_AllByPrimaryKey.Remove(ContentID.ToString());
|
||||
if (!_AllByPrimaryKey.ContainsKey(ContentID.ToString())) return;
|
||||
List<Entry> listEntry = _AllByPrimaryKey[ContentID.ToString()]; // Get the list of items
|
||||
listEntry.Remove(this); // Remove the item from the list
|
||||
if (listEntry.Count == 0) //If there are no items left in the list
|
||||
_AllByPrimaryKey.Remove(ContentID.ToString()); // remove the list
|
||||
}
|
||||
public static Entry New()
|
||||
{
|
||||
@ -392,7 +408,7 @@ namespace VEPROMS.CSLA.Library
|
||||
if (tmp == null)
|
||||
{
|
||||
tmp = DataPortal.Fetch<Entry>(new PKCriteria(contentID));
|
||||
_AllList.Add(tmp);
|
||||
if (!_AllList.Contains(tmp)) _AllList.Add(tmp);
|
||||
}
|
||||
if (tmp.ErrorMessage == "No Record Found") tmp = null;
|
||||
return tmp;
|
||||
@ -471,7 +487,7 @@ namespace VEPROMS.CSLA.Library
|
||||
}
|
||||
private void ReadData(SafeDataReader dr)
|
||||
{
|
||||
if(_MyLog.IsDebugEnabled)_MyLog.DebugFormat("[{0}] Entry.ReadData", GetHashCode());
|
||||
if (_MyLog.IsDebugEnabled) _MyLog.DebugFormat("[{0}] Entry.ReadData", GetHashCode());
|
||||
try
|
||||
{
|
||||
_ContentID = dr.GetInt32("ContentID");
|
||||
@ -483,14 +499,14 @@ namespace VEPROMS.CSLA.Library
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
if(_MyLog.IsErrorEnabled)_MyLog.Error("Entry.ReadData", ex);
|
||||
if (_MyLog.IsErrorEnabled) _MyLog.Error("Entry.ReadData", ex);
|
||||
_ErrorMessage = ex.Message;
|
||||
throw new DbCslaException("Entry.ReadData", ex);
|
||||
}
|
||||
}
|
||||
private void DataPortal_Fetch(PKCriteria criteria)
|
||||
{
|
||||
if(_MyLog.IsDebugEnabled)_MyLog.DebugFormat("[{0}] Entry.DataPortal_Fetch", GetHashCode());
|
||||
if (_MyLog.IsDebugEnabled) _MyLog.DebugFormat("[{0}] Entry.DataPortal_Fetch", GetHashCode());
|
||||
try
|
||||
{
|
||||
using (SqlConnection cn = Database.VEPROMS_SqlConnection)
|
||||
@ -518,7 +534,7 @@ namespace VEPROMS.CSLA.Library
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
if(_MyLog.IsErrorEnabled)_MyLog.Error("Entry.DataPortal_Fetch", ex);
|
||||
if (_MyLog.IsErrorEnabled) _MyLog.Error("Entry.DataPortal_Fetch", ex);
|
||||
_ErrorMessage = ex.Message;
|
||||
throw new DbCslaException("Entry.DataPortal_Fetch", ex);
|
||||
}
|
||||
@ -539,13 +555,13 @@ namespace VEPROMS.CSLA.Library
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
if(_MyLog.IsErrorEnabled)_MyLog.Error("Entry.DataPortal_Insert", ex);
|
||||
if (_MyLog.IsErrorEnabled) _MyLog.Error("Entry.DataPortal_Insert", ex);
|
||||
_ErrorMessage = ex.Message;
|
||||
throw new DbCslaException("Entry.DataPortal_Insert", ex);
|
||||
}
|
||||
finally
|
||||
{
|
||||
if(_MyLog.IsDebugEnabled)_MyLog.DebugFormat("[{0}] Entry.DataPortal_Insert", GetHashCode());
|
||||
if (_MyLog.IsDebugEnabled) _MyLog.DebugFormat("[{0}] Entry.DataPortal_Insert", GetHashCode());
|
||||
}
|
||||
}
|
||||
[Transactional(TransactionalTypes.TransactionScope)]
|
||||
@ -554,7 +570,7 @@ namespace VEPROMS.CSLA.Library
|
||||
if (!this.IsDirty) return;
|
||||
try
|
||||
{
|
||||
if(_MyDocument != null) _MyDocument.Update();
|
||||
if (_MyDocument != null) _MyDocument.Update();
|
||||
SqlConnection cn = (SqlConnection)ApplicationContext.LocalContext["cn"];
|
||||
using (SqlCommand cm = cn.CreateCommand())
|
||||
{
|
||||
@ -576,11 +592,11 @@ namespace VEPROMS.CSLA.Library
|
||||
}
|
||||
MarkOld();
|
||||
// update child objects
|
||||
if(_MyLog.IsDebugEnabled)_MyLog.DebugFormat("[{0}] Entry.SQLInsert", GetHashCode());
|
||||
if (_MyLog.IsDebugEnabled) _MyLog.DebugFormat("[{0}] Entry.SQLInsert", GetHashCode());
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
if(_MyLog.IsErrorEnabled)_MyLog.Error("Entry.SQLInsert", ex);
|
||||
if (_MyLog.IsErrorEnabled) _MyLog.Error("Entry.SQLInsert", ex);
|
||||
_ErrorMessage = ex.Message;
|
||||
throw new DbCslaException("Entry.SQLInsert", ex);
|
||||
}
|
||||
@ -588,7 +604,7 @@ namespace VEPROMS.CSLA.Library
|
||||
[Transactional(TransactionalTypes.TransactionScope)]
|
||||
public static byte[] Add(SqlConnection cn, Content myContent, Document myDocument, DateTime dts, string userID)
|
||||
{
|
||||
if(_MyLog.IsDebugEnabled)_MyLog.DebugFormat("[{0}] Entry.Add", 0);
|
||||
if (_MyLog.IsDebugEnabled) _MyLog.DebugFormat("[{0}] Entry.Add", 0);
|
||||
try
|
||||
{
|
||||
using (SqlCommand cm = cn.CreateCommand())
|
||||
@ -612,7 +628,7 @@ namespace VEPROMS.CSLA.Library
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
if(_MyLog.IsErrorEnabled)_MyLog.Error("Entry.Add", ex);
|
||||
if (_MyLog.IsErrorEnabled) _MyLog.Error("Entry.Add", ex);
|
||||
throw new DbCslaException("Entry.Add", ex);
|
||||
}
|
||||
}
|
||||
@ -620,7 +636,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}] Entry.DataPortal_Update", GetHashCode());
|
||||
if (_MyLog.IsDebugEnabled) _MyLog.DebugFormat("[{0}] Entry.DataPortal_Update", GetHashCode());
|
||||
try
|
||||
{
|
||||
using (SqlConnection cn = Database.VEPROMS_SqlConnection)
|
||||
@ -634,7 +650,7 @@ namespace VEPROMS.CSLA.Library
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
if(_MyLog.IsErrorEnabled)_MyLog.Error("Entry.DataPortal_Update", ex);
|
||||
if (_MyLog.IsErrorEnabled) _MyLog.Error("Entry.DataPortal_Update", ex);
|
||||
_ErrorMessage = ex.Message;
|
||||
if (!ex.Message.EndsWith("has been edited by another user.")) throw ex;
|
||||
}
|
||||
@ -643,10 +659,10 @@ namespace VEPROMS.CSLA.Library
|
||||
internal void SQLUpdate()
|
||||
{
|
||||
if (!IsDirty) return; // If not dirty - nothing to do
|
||||
if(_MyLog.IsDebugEnabled)_MyLog.DebugFormat("[{0}] Entry.SQLUpdate", GetHashCode());
|
||||
if (_MyLog.IsDebugEnabled) _MyLog.DebugFormat("[{0}] Entry.SQLUpdate", GetHashCode());
|
||||
try
|
||||
{
|
||||
if(_MyDocument != null) _MyDocument.Update();
|
||||
if (_MyDocument != null) _MyDocument.Update();
|
||||
SqlConnection cn = (SqlConnection)ApplicationContext.LocalContext["cn"];
|
||||
if (base.IsDirty)
|
||||
{
|
||||
@ -675,7 +691,7 @@ namespace VEPROMS.CSLA.Library
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
if(_MyLog.IsErrorEnabled)_MyLog.Error("Entry.SQLUpdate", ex);
|
||||
if (_MyLog.IsErrorEnabled) _MyLog.Error("Entry.SQLUpdate", ex);
|
||||
_ErrorMessage = ex.Message;
|
||||
if (!ex.Message.EndsWith("has been edited by another user.")) throw ex;
|
||||
}
|
||||
@ -696,7 +712,7 @@ namespace VEPROMS.CSLA.Library
|
||||
[Transactional(TransactionalTypes.TransactionScope)]
|
||||
public static byte[] Update(SqlConnection cn, Content myContent, Document myDocument, DateTime dts, string userID, ref byte[] lastChanged)
|
||||
{
|
||||
if(_MyLog.IsDebugEnabled)_MyLog.DebugFormat("[{0}] Entry.Update", 0);
|
||||
if (_MyLog.IsDebugEnabled) _MyLog.DebugFormat("[{0}] Entry.Update", 0);
|
||||
try
|
||||
{
|
||||
using (SqlCommand cm = cn.CreateCommand())
|
||||
@ -721,7 +737,7 @@ namespace VEPROMS.CSLA.Library
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
if(_MyLog.IsErrorEnabled)_MyLog.Error("Entry.Update", ex);
|
||||
if (_MyLog.IsErrorEnabled) _MyLog.Error("Entry.Update", ex);
|
||||
throw new DbCslaException("Entry.Update", ex);
|
||||
}
|
||||
}
|
||||
@ -733,7 +749,7 @@ namespace VEPROMS.CSLA.Library
|
||||
[Transactional(TransactionalTypes.TransactionScope)]
|
||||
private void DataPortal_Delete(PKCriteria criteria)
|
||||
{
|
||||
if(_MyLog.IsDebugEnabled)_MyLog.DebugFormat("[{0}] Entry.DataPortal_Delete", GetHashCode());
|
||||
if (_MyLog.IsDebugEnabled) _MyLog.DebugFormat("[{0}] Entry.DataPortal_Delete", GetHashCode());
|
||||
try
|
||||
{
|
||||
using (SqlConnection cn = Database.VEPROMS_SqlConnection)
|
||||
@ -749,7 +765,7 @@ namespace VEPROMS.CSLA.Library
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
if(_MyLog.IsErrorEnabled)_MyLog.Error("Entry.DataPortal_Delete", ex);
|
||||
if (_MyLog.IsErrorEnabled) _MyLog.Error("Entry.DataPortal_Delete", ex);
|
||||
_ErrorMessage = ex.Message;
|
||||
throw new DbCslaException("Entry.DataPortal_Delete", ex);
|
||||
}
|
||||
@ -757,7 +773,7 @@ namespace VEPROMS.CSLA.Library
|
||||
[Transactional(TransactionalTypes.TransactionScope)]
|
||||
public static void Remove(SqlConnection cn, int contentID)
|
||||
{
|
||||
if(_MyLog.IsDebugEnabled)_MyLog.DebugFormat("[{0}] Entry.Remove", 0);
|
||||
if (_MyLog.IsDebugEnabled) _MyLog.DebugFormat("[{0}] Entry.Remove", 0);
|
||||
try
|
||||
{
|
||||
using (SqlCommand cm = cn.CreateCommand())
|
||||
@ -772,7 +788,7 @@ namespace VEPROMS.CSLA.Library
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
if(_MyLog.IsErrorEnabled)_MyLog.Error("Entry.Remove", ex);
|
||||
if (_MyLog.IsErrorEnabled) _MyLog.Error("Entry.Remove", ex);
|
||||
throw new DbCslaException("Entry.Remove", ex);
|
||||
}
|
||||
}
|
||||
@ -806,7 +822,7 @@ namespace VEPROMS.CSLA.Library
|
||||
}
|
||||
protected override void DataPortal_Execute()
|
||||
{
|
||||
if(_MyLog.IsDebugEnabled)_MyLog.DebugFormat("[{0}] Entry.DataPortal_Execute", GetHashCode());
|
||||
if (_MyLog.IsDebugEnabled) _MyLog.DebugFormat("[{0}] Entry.DataPortal_Execute", GetHashCode());
|
||||
try
|
||||
{
|
||||
using (SqlConnection cn = Database.VEPROMS_SqlConnection)
|
||||
@ -824,7 +840,7 @@ namespace VEPROMS.CSLA.Library
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
if(_MyLog.IsErrorEnabled)_MyLog.Error("Entry.DataPortal_Execute", ex);
|
||||
if (_MyLog.IsErrorEnabled) _MyLog.Error("Entry.DataPortal_Execute", ex);
|
||||
throw new DbCslaException("Entry.DataPortal_Execute", ex);
|
||||
}
|
||||
}
|
||||
|
@ -37,13 +37,17 @@ namespace VEPROMS.CSLA.Library
|
||||
#endregion
|
||||
#region Collection
|
||||
protected static List<EntryInfo> _AllList = new List<EntryInfo>();
|
||||
private static Dictionary<string, EntryInfo> _AllByPrimaryKey = new Dictionary<string, EntryInfo>();
|
||||
private static Dictionary<string, List<EntryInfo>> _AllByPrimaryKey = new Dictionary<string, List<EntryInfo>>();
|
||||
private static void ConvertListToDictionary()
|
||||
{
|
||||
List<EntryInfo> remove = new List<EntryInfo>();
|
||||
foreach (EntryInfo tmp in _AllList)
|
||||
{
|
||||
_AllByPrimaryKey[tmp.ContentID.ToString()]=tmp; // Primary Key
|
||||
if (!_AllByPrimaryKey.ContainsKey(tmp.ContentID.ToString()))
|
||||
{
|
||||
_AllByPrimaryKey[tmp.ContentID.ToString()] = new List<EntryInfo>(); // Add new list for PrimaryKey
|
||||
}
|
||||
_AllByPrimaryKey[tmp.ContentID.ToString()].Add(tmp); // Add to Primary Key list
|
||||
remove.Add(tmp);
|
||||
}
|
||||
foreach (EntryInfo tmp in remove)
|
||||
@ -57,7 +61,7 @@ namespace VEPROMS.CSLA.Library
|
||||
{
|
||||
ConvertListToDictionary();
|
||||
string key = contentID.ToString();
|
||||
if (_AllByPrimaryKey.ContainsKey(key)) return _AllByPrimaryKey[key];
|
||||
if (_AllByPrimaryKey.ContainsKey(key)) return _AllByPrimaryKey[key][0];
|
||||
return null;
|
||||
}
|
||||
#endregion
|
||||
@ -85,7 +89,7 @@ namespace VEPROMS.CSLA.Library
|
||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||
get
|
||||
{
|
||||
CanReadProperty("ContentID",true);
|
||||
CanReadProperty("ContentID", true);
|
||||
if (_MyContent != null) _ContentID = _MyContent.ContentID;
|
||||
return _ContentID;
|
||||
}
|
||||
@ -97,7 +101,7 @@ namespace VEPROMS.CSLA.Library
|
||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||
get
|
||||
{
|
||||
CanReadProperty("MyContent",true);
|
||||
CanReadProperty("MyContent", true);
|
||||
if (_MyContent == null && _ContentID != 0) _MyContent = ContentInfo.Get(_ContentID);
|
||||
return _MyContent;
|
||||
}
|
||||
@ -108,7 +112,7 @@ namespace VEPROMS.CSLA.Library
|
||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||
get
|
||||
{
|
||||
CanReadProperty("DocID",true);
|
||||
CanReadProperty("DocID", true);
|
||||
if (_MyDocument != null) _DocID = _MyDocument.DocID;
|
||||
return _DocID;
|
||||
}
|
||||
@ -119,7 +123,7 @@ namespace VEPROMS.CSLA.Library
|
||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||
get
|
||||
{
|
||||
CanReadProperty("MyDocument",true);
|
||||
CanReadProperty("MyDocument", true);
|
||||
if (_MyDocument == null && _DocID != 0) _MyDocument = DocumentInfo.Get(_DocID);
|
||||
return _MyDocument;
|
||||
}
|
||||
@ -130,7 +134,7 @@ namespace VEPROMS.CSLA.Library
|
||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||
get
|
||||
{
|
||||
CanReadProperty("DTS",true);
|
||||
CanReadProperty("DTS", true);
|
||||
return _DTS;
|
||||
}
|
||||
}
|
||||
@ -140,7 +144,7 @@ namespace VEPROMS.CSLA.Library
|
||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||
get
|
||||
{
|
||||
CanReadProperty("UserID",true);
|
||||
CanReadProperty("UserID", true);
|
||||
return _UserID;
|
||||
}
|
||||
}
|
||||
@ -164,14 +168,25 @@ namespace VEPROMS.CSLA.Library
|
||||
}
|
||||
#endregion
|
||||
#region Factory Methods
|
||||
private static int _EntryInfoUnique = 0;
|
||||
private int _MyEntryInfoUnique;
|
||||
public int MyEntryInfoUnique
|
||||
{
|
||||
get { return _MyEntryInfoUnique; }
|
||||
}
|
||||
private EntryInfo()
|
||||
{/* require use of factory methods */
|
||||
_MyEntryInfoUnique = ++_EntryInfoUnique;
|
||||
_AllList.Add(this);
|
||||
}
|
||||
public void Dispose()
|
||||
{
|
||||
_AllList.Remove(this);
|
||||
_AllByPrimaryKey.Remove(ContentID.ToString());
|
||||
if (!_AllByPrimaryKey.ContainsKey(ContentID.ToString())) return;
|
||||
List<EntryInfo> listEntryInfo = _AllByPrimaryKey[ContentID.ToString()]; // Get the list of items
|
||||
listEntryInfo.Remove(this); // Remove the item from the list
|
||||
if (listEntryInfo.Count == 0) // If there are no items left in the list
|
||||
_AllByPrimaryKey.Remove(ContentID.ToString()); // remove the list
|
||||
}
|
||||
public virtual Entry Get()
|
||||
{
|
||||
@ -179,8 +194,10 @@ namespace VEPROMS.CSLA.Library
|
||||
}
|
||||
public static void Refresh(Entry tmp)
|
||||
{
|
||||
EntryInfo tmpInfo = GetExistingByPrimaryKey(tmp.ContentID);
|
||||
if (tmpInfo == null) return;
|
||||
string key = tmp.ContentID.ToString();
|
||||
ConvertListToDictionary();
|
||||
if (_AllByPrimaryKey.ContainsKey(key))
|
||||
foreach (EntryInfo tmpInfo in _AllByPrimaryKey[key])
|
||||
tmpInfo.RefreshFields(tmp);
|
||||
}
|
||||
private void RefreshFields(Entry tmp)
|
||||
@ -189,9 +206,9 @@ namespace VEPROMS.CSLA.Library
|
||||
{
|
||||
MyDocument.RefreshDocumentEntries(); // Update List for old value
|
||||
_DocID = tmp.DocID; // Update the value
|
||||
_MyDocument = null; // Reset list so that the next line gets a new list
|
||||
MyDocument.RefreshDocumentEntries(); // Update List for new value
|
||||
}
|
||||
_MyDocument = null; // Reset list so that the next line gets a new list
|
||||
if (MyDocument != null) MyDocument.RefreshDocumentEntries(); // Update List for new value
|
||||
_DTS = tmp.DTS;
|
||||
_UserID = tmp.UserID;
|
||||
_EntryInfoExtension.Refresh(this);
|
||||
@ -201,8 +218,10 @@ namespace VEPROMS.CSLA.Library
|
||||
}
|
||||
public static void Refresh(DocumentEntry tmp)
|
||||
{
|
||||
EntryInfo tmpInfo = GetExistingByPrimaryKey(tmp.ContentID);
|
||||
if (tmpInfo == null) return;
|
||||
string key = tmp.ContentID.ToString();
|
||||
ConvertListToDictionary();
|
||||
if (_AllByPrimaryKey.ContainsKey(key))
|
||||
foreach (EntryInfo tmpInfo in _AllByPrimaryKey[key])
|
||||
tmpInfo.RefreshFields(tmp);
|
||||
}
|
||||
private void RefreshFields(DocumentEntry tmp)
|
||||
@ -224,7 +243,7 @@ namespace VEPROMS.CSLA.Library
|
||||
if (tmp == null)
|
||||
{
|
||||
tmp = DataPortal.Fetch<EntryInfo>(new PKCriteria(contentID));
|
||||
_AllList.Add(tmp);
|
||||
if (!_AllList.Contains(tmp)) _AllList.Add(tmp);
|
||||
}
|
||||
if (tmp.ErrorMessage == "No Record Found")
|
||||
{
|
||||
@ -241,14 +260,15 @@ namespace VEPROMS.CSLA.Library
|
||||
#region Data Access Portal
|
||||
internal EntryInfo(SafeDataReader dr)
|
||||
{
|
||||
if(_MyLog.IsDebugEnabled)_MyLog.DebugFormat("[{0}] EntryInfo.Constructor", GetHashCode());
|
||||
_MyEntryInfoUnique = ++_EntryInfoUnique;
|
||||
if (_MyLog.IsDebugEnabled) _MyLog.DebugFormat("[{0}] EntryInfo.Constructor", GetHashCode());
|
||||
try
|
||||
{
|
||||
ReadData(dr);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
if(_MyLog.IsErrorEnabled)_MyLog.Error("EntryInfo.Constructor", ex);
|
||||
if (_MyLog.IsErrorEnabled) _MyLog.Error("EntryInfo.Constructor", ex);
|
||||
throw new DbCslaException("EntryInfo.Constructor", ex);
|
||||
}
|
||||
}
|
||||
@ -265,7 +285,7 @@ namespace VEPROMS.CSLA.Library
|
||||
}
|
||||
private void ReadData(SafeDataReader dr)
|
||||
{
|
||||
if(_MyLog.IsDebugEnabled)_MyLog.DebugFormat("[{0}] EntryInfo.ReadData", GetHashCode());
|
||||
if (_MyLog.IsDebugEnabled) _MyLog.DebugFormat("[{0}] EntryInfo.ReadData", GetHashCode());
|
||||
try
|
||||
{
|
||||
_ContentID = dr.GetInt32("ContentID");
|
||||
@ -275,14 +295,14 @@ namespace VEPROMS.CSLA.Library
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
if(_MyLog.IsErrorEnabled)_MyLog.Error("EntryInfo.ReadData", ex);
|
||||
if (_MyLog.IsErrorEnabled) _MyLog.Error("EntryInfo.ReadData", ex);
|
||||
_ErrorMessage = ex.Message;
|
||||
throw new DbCslaException("EntryInfo.ReadData", ex);
|
||||
}
|
||||
}
|
||||
private void DataPortal_Fetch(PKCriteria criteria)
|
||||
{
|
||||
if(_MyLog.IsDebugEnabled)_MyLog.DebugFormat("[{0}] EntryInfo.DataPortal_Fetch", GetHashCode());
|
||||
if (_MyLog.IsDebugEnabled) _MyLog.DebugFormat("[{0}] EntryInfo.DataPortal_Fetch", GetHashCode());
|
||||
try
|
||||
{
|
||||
using (SqlConnection cn = Database.VEPROMS_SqlConnection)
|
||||
@ -310,7 +330,7 @@ namespace VEPROMS.CSLA.Library
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
if(_MyLog.IsErrorEnabled)_MyLog.Error("EntryInfo.DataPortal_Fetch", ex);
|
||||
if (_MyLog.IsErrorEnabled) _MyLog.Error("EntryInfo.DataPortal_Fetch", ex);
|
||||
_ErrorMessage = ex.Message;
|
||||
throw new DbCslaException("EntryInfo.DataPortal_Fetch", ex);
|
||||
}
|
||||
@ -320,7 +340,7 @@ namespace VEPROMS.CSLA.Library
|
||||
#region extension
|
||||
EntryInfoExtension _EntryInfoExtension = new EntryInfoExtension();
|
||||
[Serializable()]
|
||||
partial class EntryInfoExtension : extensionBase {}
|
||||
partial class EntryInfoExtension : extensionBase { }
|
||||
[Serializable()]
|
||||
class extensionBase
|
||||
{
|
||||
|
@ -124,7 +124,7 @@ namespace VEPROMS.CSLA.Library
|
||||
private void DataPortal_Fetch()
|
||||
{
|
||||
this.RaiseListChangedEvents = false;
|
||||
if(_MyLog.IsDebugEnabled)_MyLog.DebugFormat("[{0}] EntryInfoList.DataPortal_Fetch", GetHashCode());
|
||||
if (_MyLog.IsDebugEnabled) _MyLog.DebugFormat("[{0}] EntryInfoList.DataPortal_Fetch", GetHashCode());
|
||||
try
|
||||
{
|
||||
using (SqlConnection cn = Database.VEPROMS_SqlConnection)
|
||||
@ -144,7 +144,7 @@ namespace VEPROMS.CSLA.Library
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
if(_MyLog.IsErrorEnabled)_MyLog.Error("EntryInfoList.DataPortal_Fetch", ex);
|
||||
if (_MyLog.IsErrorEnabled) _MyLog.Error("EntryInfoList.DataPortal_Fetch", ex);
|
||||
throw new DbCslaException("EntryInfoList.DataPortal_Fetch", ex);
|
||||
}
|
||||
this.RaiseListChangedEvents = true;
|
||||
@ -166,7 +166,7 @@ namespace VEPROMS.CSLA.Library
|
||||
private void DataPortal_Fetch(ContentIDCriteria criteria)
|
||||
{
|
||||
this.RaiseListChangedEvents = false;
|
||||
if(_MyLog.IsDebugEnabled)_MyLog.DebugFormat("[{0}] EntryInfoList.DataPortal_FetchContentID", GetHashCode());
|
||||
if (_MyLog.IsDebugEnabled) _MyLog.DebugFormat("[{0}] EntryInfoList.DataPortal_FetchContentID", GetHashCode());
|
||||
try
|
||||
{
|
||||
using (SqlConnection cn = Database.VEPROMS_SqlConnection)
|
||||
@ -187,7 +187,7 @@ namespace VEPROMS.CSLA.Library
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
if(_MyLog.IsErrorEnabled)_MyLog.Error("EntryInfoList.DataPortal_FetchContentID", ex);
|
||||
if (_MyLog.IsErrorEnabled) _MyLog.Error("EntryInfoList.DataPortal_FetchContentID", ex);
|
||||
throw new DbCslaException("EntryInfoList.DataPortal_Fetch", ex);
|
||||
}
|
||||
this.RaiseListChangedEvents = true;
|
||||
@ -209,7 +209,7 @@ namespace VEPROMS.CSLA.Library
|
||||
private void DataPortal_Fetch(DocIDCriteria criteria)
|
||||
{
|
||||
this.RaiseListChangedEvents = false;
|
||||
if(_MyLog.IsDebugEnabled)_MyLog.DebugFormat("[{0}] EntryInfoList.DataPortal_FetchDocID", GetHashCode());
|
||||
if (_MyLog.IsDebugEnabled) _MyLog.DebugFormat("[{0}] EntryInfoList.DataPortal_FetchDocID", GetHashCode());
|
||||
try
|
||||
{
|
||||
using (SqlConnection cn = Database.VEPROMS_SqlConnection)
|
||||
@ -230,7 +230,7 @@ namespace VEPROMS.CSLA.Library
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
if(_MyLog.IsErrorEnabled)_MyLog.Error("EntryInfoList.DataPortal_FetchDocID", ex);
|
||||
if (_MyLog.IsErrorEnabled) _MyLog.Error("EntryInfoList.DataPortal_FetchDocID", ex);
|
||||
throw new DbCslaException("EntryInfoList.DataPortal_Fetch", ex);
|
||||
}
|
||||
this.RaiseListChangedEvents = true;
|
||||
@ -291,8 +291,8 @@ namespace VEPROMS.CSLA.Library
|
||||
/// </summary>
|
||||
public partial class EntryInfoListPropertyDescriptor : vlnListPropertyDescriptor
|
||||
{
|
||||
private EntryInfo Item { get { return (EntryInfo) _Item;} }
|
||||
public EntryInfoListPropertyDescriptor(EntryInfoList collection, int index):base(collection, index){;}
|
||||
private EntryInfo Item { get { return (EntryInfo)_Item; } }
|
||||
public EntryInfoListPropertyDescriptor(EntryInfoList collection, int index) : base(collection, index) { ;}
|
||||
}
|
||||
#endregion
|
||||
#region Converter
|
||||
@ -303,7 +303,7 @@ namespace VEPROMS.CSLA.Library
|
||||
if (destType == typeof(string) && value is EntryInfoList)
|
||||
{
|
||||
// Return department and department role separated by comma.
|
||||
return ((EntryInfoList) value).Items.Count.ToString() + " Entries";
|
||||
return ((EntryInfoList)value).Items.Count.ToString() + " Entries";
|
||||
}
|
||||
return base.ConvertTo(context, culture, value, destType);
|
||||
}
|
||||
|
@ -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,15 +488,16 @@ 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;
|
||||
@ -502,7 +508,7 @@ namespace VEPROMS.CSLA.Library
|
||||
}
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
@ -42,7 +42,7 @@ namespace VEPROMS.CSLA.Library
|
||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||
get
|
||||
{
|
||||
CanReadProperty("AID",true);
|
||||
CanReadProperty("AID", true);
|
||||
if (_MyAssignment != null) _AID = _MyAssignment.AID;
|
||||
return _AID;
|
||||
}
|
||||
@ -54,7 +54,7 @@ namespace VEPROMS.CSLA.Library
|
||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||
get
|
||||
{
|
||||
CanReadProperty("MyAssignment",true);
|
||||
CanReadProperty("MyAssignment", true);
|
||||
if (_MyAssignment == null && _AID != 0) _MyAssignment = Assignment.Get(_AID);
|
||||
return _MyAssignment;
|
||||
}
|
||||
@ -65,7 +65,7 @@ namespace VEPROMS.CSLA.Library
|
||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||
get
|
||||
{
|
||||
CanReadProperty("GID",true);
|
||||
CanReadProperty("GID", true);
|
||||
if (_MyGroup != null) _GID = _MyGroup.GID;
|
||||
return _GID;
|
||||
}
|
||||
@ -76,14 +76,14 @@ namespace VEPROMS.CSLA.Library
|
||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||
get
|
||||
{
|
||||
CanReadProperty("MyGroup",true);
|
||||
CanReadProperty("MyGroup", true);
|
||||
if (_MyGroup == null && _GID != 0) _MyGroup = Group.Get(_GID);
|
||||
return _MyGroup;
|
||||
}
|
||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||
set
|
||||
{
|
||||
CanWriteProperty("MyGroup",true);
|
||||
CanWriteProperty("MyGroup", true);
|
||||
if (_MyGroup != value)
|
||||
{
|
||||
_MyGroup = value;
|
||||
@ -97,7 +97,7 @@ namespace VEPROMS.CSLA.Library
|
||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||
get
|
||||
{
|
||||
CanReadProperty("RID",true);
|
||||
CanReadProperty("RID", true);
|
||||
if (_MyRole != null) _RID = _MyRole.RID;
|
||||
return _RID;
|
||||
}
|
||||
@ -108,14 +108,14 @@ namespace VEPROMS.CSLA.Library
|
||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||
get
|
||||
{
|
||||
CanReadProperty("MyRole",true);
|
||||
CanReadProperty("MyRole", true);
|
||||
if (_MyRole == null && _RID != 0) _MyRole = Role.Get(_RID);
|
||||
return _MyRole;
|
||||
}
|
||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||
set
|
||||
{
|
||||
CanWriteProperty("MyRole",true);
|
||||
CanWriteProperty("MyRole", true);
|
||||
if (_MyRole != value)
|
||||
{
|
||||
_MyRole = value;
|
||||
@ -129,13 +129,13 @@ namespace VEPROMS.CSLA.Library
|
||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||
get
|
||||
{
|
||||
CanReadProperty("StartDate",true);
|
||||
CanReadProperty("StartDate", true);
|
||||
return _StartDate;
|
||||
}
|
||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||
set
|
||||
{
|
||||
CanWriteProperty("StartDate",true);
|
||||
CanWriteProperty("StartDate", true);
|
||||
if (value == null) value = string.Empty;
|
||||
_StartDate = value;
|
||||
try
|
||||
@ -159,13 +159,13 @@ namespace VEPROMS.CSLA.Library
|
||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||
get
|
||||
{
|
||||
CanReadProperty("EndDate",true);
|
||||
CanReadProperty("EndDate", true);
|
||||
return _EndDate;
|
||||
}
|
||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||
set
|
||||
{
|
||||
CanWriteProperty("EndDate",true);
|
||||
CanWriteProperty("EndDate", true);
|
||||
if (value == null) value = string.Empty;
|
||||
_EndDate = value;
|
||||
try
|
||||
@ -189,13 +189,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;
|
||||
@ -209,13 +209,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)
|
||||
{
|
||||
@ -231,7 +231,7 @@ namespace VEPROMS.CSLA.Library
|
||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||
get
|
||||
{
|
||||
CanReadProperty("Group_GroupName",true);
|
||||
CanReadProperty("Group_GroupName", true);
|
||||
return _Group_GroupName;
|
||||
}
|
||||
}
|
||||
@ -241,7 +241,7 @@ namespace VEPROMS.CSLA.Library
|
||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||
get
|
||||
{
|
||||
CanReadProperty("Group_GroupType",true);
|
||||
CanReadProperty("Group_GroupType", true);
|
||||
return _Group_GroupType;
|
||||
}
|
||||
}
|
||||
@ -251,7 +251,7 @@ namespace VEPROMS.CSLA.Library
|
||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||
get
|
||||
{
|
||||
CanReadProperty("Group_Config",true);
|
||||
CanReadProperty("Group_Config", true);
|
||||
return _Group_Config;
|
||||
}
|
||||
}
|
||||
@ -261,7 +261,7 @@ namespace VEPROMS.CSLA.Library
|
||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||
get
|
||||
{
|
||||
CanReadProperty("Group_DTS",true);
|
||||
CanReadProperty("Group_DTS", true);
|
||||
return _Group_DTS;
|
||||
}
|
||||
}
|
||||
@ -271,7 +271,7 @@ namespace VEPROMS.CSLA.Library
|
||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||
get
|
||||
{
|
||||
CanReadProperty("Group_UsrID",true);
|
||||
CanReadProperty("Group_UsrID", true);
|
||||
return _Group_UsrID;
|
||||
}
|
||||
}
|
||||
@ -281,7 +281,7 @@ namespace VEPROMS.CSLA.Library
|
||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||
get
|
||||
{
|
||||
CanReadProperty("Role_Name",true);
|
||||
CanReadProperty("Role_Name", true);
|
||||
return _Role_Name;
|
||||
}
|
||||
}
|
||||
@ -291,7 +291,7 @@ namespace VEPROMS.CSLA.Library
|
||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||
get
|
||||
{
|
||||
CanReadProperty("Role_Title",true);
|
||||
CanReadProperty("Role_Title", true);
|
||||
return _Role_Title;
|
||||
}
|
||||
}
|
||||
@ -301,7 +301,7 @@ namespace VEPROMS.CSLA.Library
|
||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||
get
|
||||
{
|
||||
CanReadProperty("Role_DTS",true);
|
||||
CanReadProperty("Role_DTS", true);
|
||||
return _Role_DTS;
|
||||
}
|
||||
}
|
||||
@ -311,7 +311,7 @@ namespace VEPROMS.CSLA.Library
|
||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||
get
|
||||
{
|
||||
CanReadProperty("Role_UsrID",true);
|
||||
CanReadProperty("Role_UsrID", true);
|
||||
return _Role_UsrID;
|
||||
}
|
||||
}
|
||||
@ -344,16 +344,16 @@ namespace VEPROMS.CSLA.Library
|
||||
#endregion
|
||||
#region ValidationRules
|
||||
[NonSerialized]
|
||||
private bool _CheckingBrokenRules=false;
|
||||
private bool _CheckingBrokenRules = false;
|
||||
public IVEHasBrokenRules HasBrokenRules
|
||||
{
|
||||
get
|
||||
{
|
||||
if(_CheckingBrokenRules)return null;
|
||||
if (_CheckingBrokenRules) return null;
|
||||
if (BrokenRulesCollection.Count > 0) return this;
|
||||
try
|
||||
{
|
||||
_CheckingBrokenRules=true;
|
||||
_CheckingBrokenRules = true;
|
||||
IVEHasBrokenRules hasBrokenRules = null;
|
||||
if (_MyGroup != null && (hasBrokenRules = _MyGroup.HasBrokenRules) != null) return hasBrokenRules;
|
||||
if (_MyRole != null && (hasBrokenRules = _MyRole.HasBrokenRules) != null) return hasBrokenRules;
|
||||
@ -361,7 +361,7 @@ namespace VEPROMS.CSLA.Library
|
||||
}
|
||||
finally
|
||||
{
|
||||
_CheckingBrokenRules=false;
|
||||
_CheckingBrokenRules = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -530,7 +530,7 @@ namespace VEPROMS.CSLA.Library
|
||||
#region Data Access Portal
|
||||
private void Fetch(SafeDataReader dr)
|
||||
{
|
||||
if(_MyLog.IsDebugEnabled)_MyLog.DebugFormat("[{0}] FolderAssignment.FetchDR", GetHashCode());
|
||||
if (_MyLog.IsDebugEnabled) _MyLog.DebugFormat("[{0}] FolderAssignment.FetchDR", GetHashCode());
|
||||
try
|
||||
{
|
||||
_AID = dr.GetInt32("AID");
|
||||
@ -553,7 +553,7 @@ namespace VEPROMS.CSLA.Library
|
||||
}
|
||||
catch (Exception ex) // FKItem Fetch
|
||||
{
|
||||
if(_MyLog.IsErrorEnabled)_MyLog.Error("FolderAssignment.FetchDR", ex);
|
||||
if (_MyLog.IsErrorEnabled) _MyLog.Error("FolderAssignment.FetchDR", ex);
|
||||
throw new DbCslaException("FolderAssignment.Fetch", ex);
|
||||
}
|
||||
MarkOld();
|
||||
|
@ -94,8 +94,8 @@ namespace VEPROMS.CSLA.Library
|
||||
{
|
||||
get
|
||||
{
|
||||
IVEHasBrokenRules hasBrokenRules=null;
|
||||
foreach(FolderAssignment folderAssignment in this)
|
||||
IVEHasBrokenRules hasBrokenRules = null;
|
||||
foreach (FolderAssignment folderAssignment in this)
|
||||
if ((hasBrokenRules = folderAssignment.HasBrokenRules) != null) return hasBrokenRules;
|
||||
return hasBrokenRules;
|
||||
}
|
||||
@ -165,7 +165,7 @@ namespace VEPROMS.CSLA.Library
|
||||
private void DataPortal_Fetch(FolderIDCriteria criteria)
|
||||
{
|
||||
this.RaiseListChangedEvents = false;
|
||||
if(_MyLog.IsDebugEnabled)_MyLog.DebugFormat("[{0}] FolderAssignments.DataPortal_FetchFolderID", GetHashCode());
|
||||
if (_MyLog.IsDebugEnabled) _MyLog.DebugFormat("[{0}] FolderAssignments.DataPortal_FetchFolderID", GetHashCode());
|
||||
try
|
||||
{
|
||||
using (SqlConnection cn = Database.VEPROMS_SqlConnection)
|
||||
@ -184,7 +184,7 @@ namespace VEPROMS.CSLA.Library
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
if(_MyLog.IsErrorEnabled)_MyLog.Error("FolderAssignments.DataPortal_FetchFolderID", ex);
|
||||
if (_MyLog.IsErrorEnabled) _MyLog.Error("FolderAssignments.DataPortal_FetchFolderID", ex);
|
||||
throw new DbCslaException("FolderAssignments.DataPortal_Fetch", ex);
|
||||
}
|
||||
this.RaiseListChangedEvents = true;
|
||||
@ -269,8 +269,8 @@ namespace VEPROMS.CSLA.Library
|
||||
/// </summary>
|
||||
public partial class FolderAssignmentsPropertyDescriptor : vlnListPropertyDescriptor
|
||||
{
|
||||
private FolderAssignment Item { get { return (FolderAssignment) _Item;} }
|
||||
public FolderAssignmentsPropertyDescriptor(FolderAssignments collection, int index):base(collection, index){;}
|
||||
private FolderAssignment Item { get { return (FolderAssignment)_Item; } }
|
||||
public FolderAssignmentsPropertyDescriptor(FolderAssignments collection, int index) : base(collection, index) { ;}
|
||||
}
|
||||
#endregion
|
||||
#region Converter
|
||||
@ -281,7 +281,7 @@ namespace VEPROMS.CSLA.Library
|
||||
if (destType == typeof(string) && value is FolderAssignments)
|
||||
{
|
||||
// Return department and department role separated by comma.
|
||||
return ((FolderAssignments) value).Items.Count.ToString() + " Assignments";
|
||||
return ((FolderAssignments)value).Items.Count.ToString() + " Assignments";
|
||||
}
|
||||
return base.ConvertTo(context, culture, value, destType);
|
||||
}
|
||||
|
@ -42,7 +42,7 @@ namespace VEPROMS.CSLA.Library
|
||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||
get
|
||||
{
|
||||
CanReadProperty("VersionID",true);
|
||||
CanReadProperty("VersionID", true);
|
||||
if (_MyDocVersion != null) _VersionID = _MyDocVersion.VersionID;
|
||||
return _VersionID;
|
||||
}
|
||||
@ -54,7 +54,7 @@ namespace VEPROMS.CSLA.Library
|
||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||
get
|
||||
{
|
||||
CanReadProperty("MyDocVersion",true);
|
||||
CanReadProperty("MyDocVersion", true);
|
||||
if (_MyDocVersion == null && _VersionID != 0) _MyDocVersion = DocVersion.Get(_VersionID);
|
||||
return _MyDocVersion;
|
||||
}
|
||||
@ -68,13 +68,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;
|
||||
@ -88,13 +88,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)
|
||||
{
|
||||
@ -109,13 +109,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)
|
||||
{
|
||||
@ -130,7 +130,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;
|
||||
}
|
||||
@ -141,18 +141,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();
|
||||
}
|
||||
}
|
||||
@ -163,7 +163,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;
|
||||
}
|
||||
@ -174,18 +174,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();
|
||||
}
|
||||
}
|
||||
@ -196,13 +196,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)
|
||||
{
|
||||
@ -217,13 +217,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;
|
||||
@ -237,13 +237,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)
|
||||
{
|
||||
@ -274,16 +274,16 @@ namespace VEPROMS.CSLA.Library
|
||||
#endregion
|
||||
#region ValidationRules
|
||||
[NonSerialized]
|
||||
private bool _CheckingBrokenRules=false;
|
||||
private bool _CheckingBrokenRules = false;
|
||||
public IVEHasBrokenRules HasBrokenRules
|
||||
{
|
||||
get
|
||||
{
|
||||
if(_CheckingBrokenRules)return null;
|
||||
if (_CheckingBrokenRules) return null;
|
||||
if (BrokenRulesCollection.Count > 0) return this;
|
||||
try
|
||||
{
|
||||
_CheckingBrokenRules=true;
|
||||
_CheckingBrokenRules = true;
|
||||
IVEHasBrokenRules hasBrokenRules = null;
|
||||
if (_MyItem != null && (hasBrokenRules = _MyItem.HasBrokenRules) != null) return hasBrokenRules;
|
||||
if (_MyFormat != null && (hasBrokenRules = _MyFormat.HasBrokenRules) != null) return hasBrokenRules;
|
||||
@ -291,7 +291,7 @@ namespace VEPROMS.CSLA.Library
|
||||
}
|
||||
finally
|
||||
{
|
||||
_CheckingBrokenRules=false;
|
||||
_CheckingBrokenRules = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -424,7 +424,7 @@ namespace VEPROMS.CSLA.Library
|
||||
#region Data Access Portal
|
||||
private void Fetch(SafeDataReader dr)
|
||||
{
|
||||
if(_MyLog.IsDebugEnabled)_MyLog.DebugFormat("[{0}] FolderDocVersion.FetchDR", GetHashCode());
|
||||
if (_MyLog.IsDebugEnabled) _MyLog.DebugFormat("[{0}] FolderDocVersion.FetchDR", GetHashCode());
|
||||
try
|
||||
{
|
||||
_VersionID = dr.GetInt32("VersionID");
|
||||
@ -440,7 +440,7 @@ namespace VEPROMS.CSLA.Library
|
||||
}
|
||||
catch (Exception ex) // FKItem Fetch
|
||||
{
|
||||
if(_MyLog.IsErrorEnabled)_MyLog.Error("FolderDocVersion.FetchDR", ex);
|
||||
if (_MyLog.IsErrorEnabled) _MyLog.Error("FolderDocVersion.FetchDR", ex);
|
||||
throw new DbCslaException("FolderDocVersion.Fetch", ex);
|
||||
}
|
||||
MarkOld();
|
||||
|
@ -94,8 +94,8 @@ namespace VEPROMS.CSLA.Library
|
||||
{
|
||||
get
|
||||
{
|
||||
IVEHasBrokenRules hasBrokenRules=null;
|
||||
foreach(FolderDocVersion folderDocVersion in this)
|
||||
IVEHasBrokenRules hasBrokenRules = null;
|
||||
foreach (FolderDocVersion folderDocVersion in this)
|
||||
if ((hasBrokenRules = folderDocVersion.HasBrokenRules) != null) return hasBrokenRules;
|
||||
return hasBrokenRules;
|
||||
}
|
||||
@ -165,7 +165,7 @@ namespace VEPROMS.CSLA.Library
|
||||
private void DataPortal_Fetch(FolderIDCriteria criteria)
|
||||
{
|
||||
this.RaiseListChangedEvents = false;
|
||||
if(_MyLog.IsDebugEnabled)_MyLog.DebugFormat("[{0}] FolderDocVersions.DataPortal_FetchFolderID", GetHashCode());
|
||||
if (_MyLog.IsDebugEnabled) _MyLog.DebugFormat("[{0}] FolderDocVersions.DataPortal_FetchFolderID", GetHashCode());
|
||||
try
|
||||
{
|
||||
using (SqlConnection cn = Database.VEPROMS_SqlConnection)
|
||||
@ -184,7 +184,7 @@ namespace VEPROMS.CSLA.Library
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
if(_MyLog.IsErrorEnabled)_MyLog.Error("FolderDocVersions.DataPortal_FetchFolderID", ex);
|
||||
if (_MyLog.IsErrorEnabled) _MyLog.Error("FolderDocVersions.DataPortal_FetchFolderID", ex);
|
||||
throw new DbCslaException("FolderDocVersions.DataPortal_Fetch", ex);
|
||||
}
|
||||
this.RaiseListChangedEvents = true;
|
||||
@ -269,8 +269,8 @@ namespace VEPROMS.CSLA.Library
|
||||
/// </summary>
|
||||
public partial class FolderDocVersionsPropertyDescriptor : vlnListPropertyDescriptor
|
||||
{
|
||||
private FolderDocVersion Item { get { return (FolderDocVersion) _Item;} }
|
||||
public FolderDocVersionsPropertyDescriptor(FolderDocVersions collection, int index):base(collection, index){;}
|
||||
private FolderDocVersion Item { get { return (FolderDocVersion)_Item; } }
|
||||
public FolderDocVersionsPropertyDescriptor(FolderDocVersions collection, int index) : base(collection, index) { ;}
|
||||
}
|
||||
#endregion
|
||||
#region Converter
|
||||
@ -281,7 +281,7 @@ namespace VEPROMS.CSLA.Library
|
||||
if (destType == typeof(string) && value is FolderDocVersions)
|
||||
{
|
||||
// Return department and department role separated by comma.
|
||||
return ((FolderDocVersions) value).Items.Count.ToString() + " DocVersions";
|
||||
return ((FolderDocVersions)value).Items.Count.ToString() + " DocVersions";
|
||||
}
|
||||
return base.ConvertTo(context, culture, value, destType);
|
||||
}
|
||||
|
@ -37,13 +37,17 @@ namespace VEPROMS.CSLA.Library
|
||||
#endregion
|
||||
#region Collection
|
||||
protected static List<FolderInfo> _AllList = new List<FolderInfo>();
|
||||
private static Dictionary<string, FolderInfo> _AllByPrimaryKey = new Dictionary<string, FolderInfo>();
|
||||
private static Dictionary<string, List<FolderInfo>> _AllByPrimaryKey = new Dictionary<string, List<FolderInfo>>();
|
||||
private static void ConvertListToDictionary()
|
||||
{
|
||||
List<FolderInfo> remove = new List<FolderInfo>();
|
||||
foreach (FolderInfo tmp in _AllList)
|
||||
{
|
||||
_AllByPrimaryKey[tmp.FolderID.ToString()]=tmp; // Primary Key
|
||||
if (!_AllByPrimaryKey.ContainsKey(tmp.FolderID.ToString()))
|
||||
{
|
||||
_AllByPrimaryKey[tmp.FolderID.ToString()] = new List<FolderInfo>(); // Add new list for PrimaryKey
|
||||
}
|
||||
_AllByPrimaryKey[tmp.FolderID.ToString()].Add(tmp); // Add to Primary Key list
|
||||
remove.Add(tmp);
|
||||
}
|
||||
foreach (FolderInfo tmp in remove)
|
||||
@ -57,7 +61,7 @@ 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;
|
||||
}
|
||||
#endregion
|
||||
@ -85,7 +89,7 @@ namespace VEPROMS.CSLA.Library
|
||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||
get
|
||||
{
|
||||
CanReadProperty("FolderID",true);
|
||||
CanReadProperty("FolderID", true);
|
||||
return _FolderID;
|
||||
}
|
||||
}
|
||||
@ -95,7 +99,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;
|
||||
}
|
||||
@ -106,7 +110,7 @@ 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 = FolderInfo.Get(_ParentID);
|
||||
return _MyParent;
|
||||
}
|
||||
@ -117,7 +121,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;
|
||||
}
|
||||
@ -128,7 +132,7 @@ 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 = ConnectionInfo.Get(_DBID);
|
||||
return _MyConnection;
|
||||
}
|
||||
@ -139,7 +143,7 @@ namespace VEPROMS.CSLA.Library
|
||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||
get
|
||||
{
|
||||
CanReadProperty("Name",true);
|
||||
CanReadProperty("Name", true);
|
||||
return _Name;
|
||||
}
|
||||
}
|
||||
@ -149,7 +153,7 @@ namespace VEPROMS.CSLA.Library
|
||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||
get
|
||||
{
|
||||
CanReadProperty("Title",true);
|
||||
CanReadProperty("Title", true);
|
||||
return _Title;
|
||||
}
|
||||
}
|
||||
@ -159,7 +163,7 @@ namespace VEPROMS.CSLA.Library
|
||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||
get
|
||||
{
|
||||
CanReadProperty("ShortName",true);
|
||||
CanReadProperty("ShortName", true);
|
||||
return _ShortName;
|
||||
}
|
||||
}
|
||||
@ -169,7 +173,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;
|
||||
}
|
||||
@ -180,7 +184,7 @@ 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 = FormatInfo.Get((int)_FormatID);
|
||||
return _MyFormat;
|
||||
}
|
||||
@ -191,7 +195,7 @@ namespace VEPROMS.CSLA.Library
|
||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||
get
|
||||
{
|
||||
CanReadProperty("Config",true);
|
||||
CanReadProperty("Config", true);
|
||||
return _Config;
|
||||
}
|
||||
}
|
||||
@ -201,7 +205,7 @@ namespace VEPROMS.CSLA.Library
|
||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||
get
|
||||
{
|
||||
CanReadProperty("DTS",true);
|
||||
CanReadProperty("DTS", true);
|
||||
return _DTS;
|
||||
}
|
||||
}
|
||||
@ -211,7 +215,7 @@ namespace VEPROMS.CSLA.Library
|
||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||
get
|
||||
{
|
||||
CanReadProperty("UsrID",true);
|
||||
CanReadProperty("UsrID", true);
|
||||
return _UsrID;
|
||||
}
|
||||
}
|
||||
@ -224,7 +228,7 @@ namespace VEPROMS.CSLA.Library
|
||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||
get
|
||||
{
|
||||
CanReadProperty("FolderAssignmentCount",true);
|
||||
CanReadProperty("FolderAssignmentCount", true);
|
||||
return _FolderAssignmentCount;
|
||||
}
|
||||
}
|
||||
@ -235,7 +239,7 @@ namespace VEPROMS.CSLA.Library
|
||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||
get
|
||||
{
|
||||
CanReadProperty("FolderAssignments",true);
|
||||
CanReadProperty("FolderAssignments", true);
|
||||
if (_FolderAssignmentCount < 0 || (_FolderAssignmentCount > 0 && _FolderAssignments == null))
|
||||
_FolderAssignments = AssignmentInfoList.GetByFolderID(_FolderID);
|
||||
if (_FolderAssignmentCount < 0)
|
||||
@ -245,7 +249,10 @@ namespace VEPROMS.CSLA.Library
|
||||
}
|
||||
internal void RefreshFolderAssignments()
|
||||
{
|
||||
_FolderAssignmentCount = -1; // This will cause the data to be requeried
|
||||
ConvertListToDictionary();
|
||||
if (_AllByPrimaryKey.ContainsKey(_FolderID.ToString()))
|
||||
foreach (FolderInfo tmp in _AllByPrimaryKey[_FolderID.ToString()])
|
||||
tmp._FolderAssignmentCount = -1; // This will cause the data to be requeried
|
||||
}
|
||||
private int _FolderDocVersionCount = 0;
|
||||
/// <summary>
|
||||
@ -256,7 +263,7 @@ namespace VEPROMS.CSLA.Library
|
||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||
get
|
||||
{
|
||||
CanReadProperty("FolderDocVersionCount",true);
|
||||
CanReadProperty("FolderDocVersionCount", true);
|
||||
return _FolderDocVersionCount;
|
||||
}
|
||||
}
|
||||
@ -267,7 +274,7 @@ namespace VEPROMS.CSLA.Library
|
||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||
get
|
||||
{
|
||||
CanReadProperty("FolderDocVersions",true);
|
||||
CanReadProperty("FolderDocVersions", true);
|
||||
if (_FolderDocVersionCount < 0 || (_FolderDocVersionCount > 0 && _FolderDocVersions == null))
|
||||
_FolderDocVersions = DocVersionInfoList.GetByFolderID(_FolderID);
|
||||
if (_FolderDocVersionCount < 0)
|
||||
@ -277,7 +284,10 @@ namespace VEPROMS.CSLA.Library
|
||||
}
|
||||
internal void RefreshFolderDocVersions()
|
||||
{
|
||||
_FolderDocVersionCount = -1; // This will cause the data to be requeried
|
||||
ConvertListToDictionary();
|
||||
if (_AllByPrimaryKey.ContainsKey(_FolderID.ToString()))
|
||||
foreach (FolderInfo tmp in _AllByPrimaryKey[_FolderID.ToString()])
|
||||
tmp._FolderDocVersionCount = -1; // This will cause the data to be requeried
|
||||
}
|
||||
private int _ChildFolderCount = 0;
|
||||
/// <summary>
|
||||
@ -288,7 +298,7 @@ namespace VEPROMS.CSLA.Library
|
||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||
get
|
||||
{
|
||||
CanReadProperty("ChildFolderCount",true);
|
||||
CanReadProperty("ChildFolderCount", true);
|
||||
return _ChildFolderCount;
|
||||
}
|
||||
}
|
||||
@ -299,7 +309,7 @@ namespace VEPROMS.CSLA.Library
|
||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||
get
|
||||
{
|
||||
CanReadProperty("ChildFolders",true);
|
||||
CanReadProperty("ChildFolders", true);
|
||||
if (_ChildFolderCount < 0 || (_ChildFolderCount > 0 && _ChildFolders == null))
|
||||
_ChildFolders = FolderInfoList.GetChildren(_FolderID);
|
||||
if (_ChildFolderCount < 0)
|
||||
@ -309,7 +319,10 @@ namespace VEPROMS.CSLA.Library
|
||||
}
|
||||
internal void RefreshChildFolders()
|
||||
{
|
||||
_ChildFolderCount = -1; // This will cause the data to be requeried
|
||||
ConvertListToDictionary();
|
||||
if (_AllByPrimaryKey.ContainsKey(_FolderID.ToString()))
|
||||
foreach (FolderInfo tmp in _AllByPrimaryKey[_FolderID.ToString()])
|
||||
tmp._ChildFolderCount = -1; // This will cause the data to be requeried
|
||||
}
|
||||
// TODO: Replace base FolderInfo.ToString function as necessary
|
||||
/// <summary>
|
||||
@ -331,14 +344,25 @@ namespace VEPROMS.CSLA.Library
|
||||
}
|
||||
#endregion
|
||||
#region Factory Methods
|
||||
private static int _FolderInfoUnique = 0;
|
||||
private int _MyFolderInfoUnique;
|
||||
public int MyFolderInfoUnique
|
||||
{
|
||||
get { return _MyFolderInfoUnique; }
|
||||
}
|
||||
private FolderInfo()
|
||||
{/* require use of factory methods */
|
||||
_MyFolderInfoUnique = ++_FolderInfoUnique;
|
||||
_AllList.Add(this);
|
||||
}
|
||||
public void Dispose()
|
||||
{
|
||||
_AllList.Remove(this);
|
||||
_AllByPrimaryKey.Remove(FolderID.ToString());
|
||||
if (!_AllByPrimaryKey.ContainsKey(FolderID.ToString())) return;
|
||||
List<FolderInfo> listFolderInfo = _AllByPrimaryKey[FolderID.ToString()]; // Get the list of items
|
||||
listFolderInfo.Remove(this); // Remove the item from the list
|
||||
if (listFolderInfo.Count == 0) // If there are no items left in the list
|
||||
_AllByPrimaryKey.Remove(FolderID.ToString()); // remove the list
|
||||
}
|
||||
public virtual Folder Get()
|
||||
{
|
||||
@ -346,8 +370,10 @@ namespace VEPROMS.CSLA.Library
|
||||
}
|
||||
public static void Refresh(Folder tmp)
|
||||
{
|
||||
FolderInfo tmpInfo = GetExistingByPrimaryKey(tmp.FolderID);
|
||||
if (tmpInfo == null) return;
|
||||
string key = tmp.FolderID.ToString();
|
||||
ConvertListToDictionary();
|
||||
if (_AllByPrimaryKey.ContainsKey(key))
|
||||
foreach (FolderInfo tmpInfo in _AllByPrimaryKey[key])
|
||||
tmpInfo.RefreshFields(tmp);
|
||||
}
|
||||
private void RefreshFields(Folder tmp)
|
||||
@ -356,16 +382,16 @@ namespace VEPROMS.CSLA.Library
|
||||
{
|
||||
MyParent.RefreshChildFolders(); // Update List for old value
|
||||
_ParentID = tmp.ParentID; // Update the value
|
||||
_MyParent = null; // Reset list so that the next line gets a new list
|
||||
MyParent.RefreshChildFolders(); // Update List for new value
|
||||
}
|
||||
_MyParent = null; // Reset list so that the next line gets a new list
|
||||
if (MyParent != null) MyParent.RefreshChildFolders(); // Update List for new value
|
||||
if (_DBID != tmp.DBID)
|
||||
{
|
||||
MyConnection.RefreshConnectionFolders(); // Update List for old value
|
||||
_DBID = tmp.DBID; // Update the value
|
||||
_MyConnection = null; // Reset list so that the next line gets a new list
|
||||
MyConnection.RefreshConnectionFolders(); // Update List for new value
|
||||
}
|
||||
_MyConnection = null; // Reset list so that the next line gets a new list
|
||||
if (MyConnection != null) MyConnection.RefreshConnectionFolders(); // Update List for new value
|
||||
_Name = tmp.Name;
|
||||
_Title = tmp.Title;
|
||||
_ShortName = tmp.ShortName;
|
||||
@ -373,9 +399,9 @@ namespace VEPROMS.CSLA.Library
|
||||
{
|
||||
MyFormat.RefreshFormatFolders(); // Update List for old value
|
||||
_FormatID = tmp.FormatID; // Update the value
|
||||
_MyFormat = null; // Reset list so that the next line gets a new list
|
||||
MyFormat.RefreshFormatFolders(); // Update List for new value
|
||||
}
|
||||
_MyFormat = null; // Reset list so that the next line gets a new list
|
||||
if (MyFormat != null) MyFormat.RefreshFormatFolders(); // Update List for new value
|
||||
_Config = tmp.Config;
|
||||
_DTS = tmp.DTS;
|
||||
_UsrID = tmp.UsrID;
|
||||
@ -387,8 +413,10 @@ namespace VEPROMS.CSLA.Library
|
||||
}
|
||||
public static void Refresh(ConnectionFolder tmp)
|
||||
{
|
||||
FolderInfo tmpInfo = GetExistingByPrimaryKey(tmp.FolderID);
|
||||
if (tmpInfo == null) return;
|
||||
string key = tmp.FolderID.ToString();
|
||||
ConvertListToDictionary();
|
||||
if (_AllByPrimaryKey.ContainsKey(key))
|
||||
foreach (FolderInfo tmpInfo in _AllByPrimaryKey[key])
|
||||
tmpInfo.RefreshFields(tmp);
|
||||
}
|
||||
private void RefreshFields(ConnectionFolder tmp)
|
||||
@ -397,9 +425,9 @@ namespace VEPROMS.CSLA.Library
|
||||
{
|
||||
MyParent.RefreshChildFolders(); // Update List for old value
|
||||
_ParentID = tmp.ParentID; // Update the value
|
||||
_MyParent = null; // Reset list so that the next line gets a new list
|
||||
MyParent.RefreshChildFolders(); // Update List for new value
|
||||
}
|
||||
_MyParent = null; // Reset list so that the next line gets a new list
|
||||
if (MyParent != null) MyParent.RefreshChildFolders(); // Update List for new value
|
||||
_Name = tmp.Name;
|
||||
_Title = tmp.Title;
|
||||
_ShortName = tmp.ShortName;
|
||||
@ -407,9 +435,9 @@ namespace VEPROMS.CSLA.Library
|
||||
{
|
||||
MyFormat.RefreshFormatFolders(); // Update List for old value
|
||||
_FormatID = tmp.FormatID; // Update the value
|
||||
_MyFormat = null; // Reset list so that the next line gets a new list
|
||||
MyFormat.RefreshFormatFolders(); // Update List for new value
|
||||
}
|
||||
_MyFormat = null; // Reset list so that the next line gets a new list
|
||||
if (MyFormat != null) MyFormat.RefreshFormatFolders(); // Update List for new value
|
||||
_Config = tmp.Config;
|
||||
_DTS = tmp.DTS;
|
||||
_UsrID = tmp.UsrID;
|
||||
@ -421,8 +449,10 @@ namespace VEPROMS.CSLA.Library
|
||||
}
|
||||
public static void Refresh(FormatFolder tmp)
|
||||
{
|
||||
FolderInfo tmpInfo = GetExistingByPrimaryKey(tmp.FolderID);
|
||||
if (tmpInfo == null) return;
|
||||
string key = tmp.FolderID.ToString();
|
||||
ConvertListToDictionary();
|
||||
if (_AllByPrimaryKey.ContainsKey(key))
|
||||
foreach (FolderInfo tmpInfo in _AllByPrimaryKey[key])
|
||||
tmpInfo.RefreshFields(tmp);
|
||||
}
|
||||
private void RefreshFields(FormatFolder tmp)
|
||||
@ -431,16 +461,16 @@ namespace VEPROMS.CSLA.Library
|
||||
{
|
||||
MyParent.RefreshChildFolders(); // Update List for old value
|
||||
_ParentID = tmp.ParentID; // Update the value
|
||||
_MyParent = null; // Reset list so that the next line gets a new list
|
||||
MyParent.RefreshChildFolders(); // Update List for new value
|
||||
}
|
||||
_MyParent = null; // Reset list so that the next line gets a new list
|
||||
if (MyParent != null) MyParent.RefreshChildFolders(); // Update List for new value
|
||||
if (_DBID != tmp.DBID)
|
||||
{
|
||||
MyConnection.RefreshConnectionFolders(); // Update List for old value
|
||||
_DBID = tmp.DBID; // Update the value
|
||||
_MyConnection = null; // Reset list so that the next line gets a new list
|
||||
MyConnection.RefreshConnectionFolders(); // Update List for new value
|
||||
}
|
||||
_MyConnection = null; // Reset list so that the next line gets a new list
|
||||
if (MyConnection != null) MyConnection.RefreshConnectionFolders(); // Update List for new value
|
||||
_Name = tmp.Name;
|
||||
_Title = tmp.Title;
|
||||
_ShortName = tmp.ShortName;
|
||||
@ -463,7 +493,7 @@ namespace VEPROMS.CSLA.Library
|
||||
if (tmp == null)
|
||||
{
|
||||
tmp = DataPortal.Fetch<FolderInfo>(new PKCriteria(folderID));
|
||||
_AllList.Add(tmp);
|
||||
if (!_AllList.Contains(tmp)) _AllList.Add(tmp);
|
||||
}
|
||||
if (tmp.ErrorMessage == "No Record Found") tmp = null;
|
||||
return tmp;
|
||||
@ -477,14 +507,15 @@ namespace VEPROMS.CSLA.Library
|
||||
#region Data Access Portal
|
||||
internal FolderInfo(SafeDataReader dr)
|
||||
{
|
||||
if(_MyLog.IsDebugEnabled)_MyLog.DebugFormat("[{0}] FolderInfo.Constructor", GetHashCode());
|
||||
_MyFolderInfoUnique = ++_FolderInfoUnique;
|
||||
if (_MyLog.IsDebugEnabled) _MyLog.DebugFormat("[{0}] FolderInfo.Constructor", GetHashCode());
|
||||
try
|
||||
{
|
||||
ReadData(dr);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
if(_MyLog.IsErrorEnabled)_MyLog.Error("FolderInfo.Constructor", ex);
|
||||
if (_MyLog.IsErrorEnabled) _MyLog.Error("FolderInfo.Constructor", ex);
|
||||
throw new DbCslaException("FolderInfo.Constructor", ex);
|
||||
}
|
||||
}
|
||||
@ -501,7 +532,7 @@ namespace VEPROMS.CSLA.Library
|
||||
}
|
||||
private void ReadData(SafeDataReader dr)
|
||||
{
|
||||
if(_MyLog.IsDebugEnabled)_MyLog.DebugFormat("[{0}] FolderInfo.ReadData", GetHashCode());
|
||||
if (_MyLog.IsDebugEnabled) _MyLog.DebugFormat("[{0}] FolderInfo.ReadData", GetHashCode());
|
||||
try
|
||||
{
|
||||
_FolderID = dr.GetInt32("FolderID");
|
||||
@ -520,14 +551,14 @@ namespace VEPROMS.CSLA.Library
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
if(_MyLog.IsErrorEnabled)_MyLog.Error("FolderInfo.ReadData", ex);
|
||||
if (_MyLog.IsErrorEnabled) _MyLog.Error("FolderInfo.ReadData", ex);
|
||||
_ErrorMessage = ex.Message;
|
||||
throw new DbCslaException("FolderInfo.ReadData", ex);
|
||||
}
|
||||
}
|
||||
private void DataPortal_Fetch(PKCriteria criteria)
|
||||
{
|
||||
if(_MyLog.IsDebugEnabled)_MyLog.DebugFormat("[{0}] FolderInfo.DataPortal_Fetch", GetHashCode());
|
||||
if (_MyLog.IsDebugEnabled) _MyLog.DebugFormat("[{0}] FolderInfo.DataPortal_Fetch", GetHashCode());
|
||||
try
|
||||
{
|
||||
using (SqlConnection cn = Database.VEPROMS_SqlConnection)
|
||||
@ -555,7 +586,7 @@ namespace VEPROMS.CSLA.Library
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
if(_MyLog.IsErrorEnabled)_MyLog.Error("FolderInfo.DataPortal_Fetch", ex);
|
||||
if (_MyLog.IsErrorEnabled) _MyLog.Error("FolderInfo.DataPortal_Fetch", ex);
|
||||
_ErrorMessage = ex.Message;
|
||||
throw new DbCslaException("FolderInfo.DataPortal_Fetch", ex);
|
||||
}
|
||||
@ -565,7 +596,7 @@ namespace VEPROMS.CSLA.Library
|
||||
#region extension
|
||||
FolderInfoExtension _FolderInfoExtension = new FolderInfoExtension();
|
||||
[Serializable()]
|
||||
partial class FolderInfoExtension : extensionBase {}
|
||||
partial class FolderInfoExtension : extensionBase { }
|
||||
[Serializable()]
|
||||
class extensionBase
|
||||
{
|
||||
|
@ -138,7 +138,7 @@ namespace VEPROMS.CSLA.Library
|
||||
private void DataPortal_Fetch()
|
||||
{
|
||||
this.RaiseListChangedEvents = false;
|
||||
if(_MyLog.IsDebugEnabled)_MyLog.DebugFormat("[{0}] FolderInfoList.DataPortal_Fetch", GetHashCode());
|
||||
if (_MyLog.IsDebugEnabled) _MyLog.DebugFormat("[{0}] FolderInfoList.DataPortal_Fetch", GetHashCode());
|
||||
try
|
||||
{
|
||||
using (SqlConnection cn = Database.VEPROMS_SqlConnection)
|
||||
@ -158,7 +158,7 @@ namespace VEPROMS.CSLA.Library
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
if(_MyLog.IsErrorEnabled)_MyLog.Error("FolderInfoList.DataPortal_Fetch", ex);
|
||||
if (_MyLog.IsErrorEnabled) _MyLog.Error("FolderInfoList.DataPortal_Fetch", ex);
|
||||
throw new DbCslaException("FolderInfoList.DataPortal_Fetch", ex);
|
||||
}
|
||||
this.RaiseListChangedEvents = true;
|
||||
@ -180,7 +180,7 @@ namespace VEPROMS.CSLA.Library
|
||||
private void DataPortal_Fetch(ParentIDCriteria criteria)
|
||||
{
|
||||
this.RaiseListChangedEvents = false;
|
||||
if(_MyLog.IsDebugEnabled)_MyLog.DebugFormat("[{0}] FolderInfoList.DataPortal_FetchParentID", GetHashCode());
|
||||
if (_MyLog.IsDebugEnabled) _MyLog.DebugFormat("[{0}] FolderInfoList.DataPortal_FetchParentID", GetHashCode());
|
||||
try
|
||||
{
|
||||
using (SqlConnection cn = Database.VEPROMS_SqlConnection)
|
||||
@ -201,7 +201,7 @@ namespace VEPROMS.CSLA.Library
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
if(_MyLog.IsErrorEnabled)_MyLog.Error("FolderInfoList.DataPortal_FetchParentID", ex);
|
||||
if (_MyLog.IsErrorEnabled) _MyLog.Error("FolderInfoList.DataPortal_FetchParentID", ex);
|
||||
throw new DbCslaException("FolderInfoList.DataPortal_Fetch", ex);
|
||||
}
|
||||
this.RaiseListChangedEvents = true;
|
||||
@ -223,7 +223,7 @@ namespace VEPROMS.CSLA.Library
|
||||
private void DataPortal_Fetch(DBIDCriteria criteria)
|
||||
{
|
||||
this.RaiseListChangedEvents = false;
|
||||
if(_MyLog.IsDebugEnabled)_MyLog.DebugFormat("[{0}] FolderInfoList.DataPortal_FetchDBID", GetHashCode());
|
||||
if (_MyLog.IsDebugEnabled) _MyLog.DebugFormat("[{0}] FolderInfoList.DataPortal_FetchDBID", GetHashCode());
|
||||
try
|
||||
{
|
||||
using (SqlConnection cn = Database.VEPROMS_SqlConnection)
|
||||
@ -244,7 +244,7 @@ namespace VEPROMS.CSLA.Library
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
if(_MyLog.IsErrorEnabled)_MyLog.Error("FolderInfoList.DataPortal_FetchDBID", ex);
|
||||
if (_MyLog.IsErrorEnabled) _MyLog.Error("FolderInfoList.DataPortal_FetchDBID", ex);
|
||||
throw new DbCslaException("FolderInfoList.DataPortal_Fetch", ex);
|
||||
}
|
||||
this.RaiseListChangedEvents = true;
|
||||
@ -266,7 +266,7 @@ namespace VEPROMS.CSLA.Library
|
||||
private void DataPortal_Fetch(FormatIDCriteria criteria)
|
||||
{
|
||||
this.RaiseListChangedEvents = false;
|
||||
if(_MyLog.IsDebugEnabled)_MyLog.DebugFormat("[{0}] FolderInfoList.DataPortal_FetchFormatID", GetHashCode());
|
||||
if (_MyLog.IsDebugEnabled) _MyLog.DebugFormat("[{0}] FolderInfoList.DataPortal_FetchFormatID", GetHashCode());
|
||||
try
|
||||
{
|
||||
using (SqlConnection cn = Database.VEPROMS_SqlConnection)
|
||||
@ -287,7 +287,7 @@ namespace VEPROMS.CSLA.Library
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
if(_MyLog.IsErrorEnabled)_MyLog.Error("FolderInfoList.DataPortal_FetchFormatID", ex);
|
||||
if (_MyLog.IsErrorEnabled) _MyLog.Error("FolderInfoList.DataPortal_FetchFormatID", ex);
|
||||
throw new DbCslaException("FolderInfoList.DataPortal_Fetch", ex);
|
||||
}
|
||||
this.RaiseListChangedEvents = true;
|
||||
@ -348,8 +348,8 @@ namespace VEPROMS.CSLA.Library
|
||||
/// </summary>
|
||||
public partial class FolderInfoListPropertyDescriptor : vlnListPropertyDescriptor
|
||||
{
|
||||
private FolderInfo Item { get { return (FolderInfo) _Item;} }
|
||||
public FolderInfoListPropertyDescriptor(FolderInfoList collection, int index):base(collection, index){;}
|
||||
private FolderInfo Item { get { return (FolderInfo)_Item; } }
|
||||
public FolderInfoListPropertyDescriptor(FolderInfoList collection, int index) : base(collection, index) { ;}
|
||||
}
|
||||
#endregion
|
||||
#region Converter
|
||||
@ -360,7 +360,7 @@ namespace VEPROMS.CSLA.Library
|
||||
if (destType == typeof(string) && value is FolderInfoList)
|
||||
{
|
||||
// Return department and department role separated by comma.
|
||||
return ((FolderInfoList) value).Items.Count.ToString() + " Folders";
|
||||
return ((FolderInfoList)value).Items.Count.ToString() + " Folders";
|
||||
}
|
||||
return base.ConvertTo(context, culture, value, destType);
|
||||
}
|
||||
|
@ -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,15 +465,16 @@ 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;
|
||||
@ -478,7 +484,7 @@ namespace VEPROMS.CSLA.Library
|
||||
}
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
@ -42,7 +42,7 @@ namespace VEPROMS.CSLA.Library
|
||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||
get
|
||||
{
|
||||
CanReadProperty("ContentID",true);
|
||||
CanReadProperty("ContentID", true);
|
||||
if (_MyContent != null) _ContentID = _MyContent.ContentID;
|
||||
return _ContentID;
|
||||
}
|
||||
@ -54,7 +54,7 @@ namespace VEPROMS.CSLA.Library
|
||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||
get
|
||||
{
|
||||
CanReadProperty("MyContent",true);
|
||||
CanReadProperty("MyContent", true);
|
||||
if (_MyContent == null && _ContentID != 0) _MyContent = Content.Get(_ContentID);
|
||||
return _MyContent;
|
||||
}
|
||||
@ -65,13 +65,13 @@ namespace VEPROMS.CSLA.Library
|
||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||
get
|
||||
{
|
||||
CanReadProperty("Number",true);
|
||||
CanReadProperty("Number", true);
|
||||
return _Number;
|
||||
}
|
||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||
set
|
||||
{
|
||||
CanWriteProperty("Number",true);
|
||||
CanWriteProperty("Number", true);
|
||||
if (value == null) value = string.Empty;
|
||||
if (_Number != value)
|
||||
{
|
||||
@ -86,13 +86,13 @@ namespace VEPROMS.CSLA.Library
|
||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||
get
|
||||
{
|
||||
CanReadProperty("Text",true);
|
||||
CanReadProperty("Text", true);
|
||||
return _Text;
|
||||
}
|
||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||
set
|
||||
{
|
||||
CanWriteProperty("Text",true);
|
||||
CanWriteProperty("Text", true);
|
||||
if (value == null) value = string.Empty;
|
||||
if (_Text != value)
|
||||
{
|
||||
@ -110,13 +110,13 @@ namespace VEPROMS.CSLA.Library
|
||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||
get
|
||||
{
|
||||
CanReadProperty("Type",true);
|
||||
CanReadProperty("Type", true);
|
||||
return _Type;
|
||||
}
|
||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||
set
|
||||
{
|
||||
CanWriteProperty("Type",true);
|
||||
CanWriteProperty("Type", true);
|
||||
if (_Type != value)
|
||||
{
|
||||
_Type = value;
|
||||
@ -130,13 +130,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)
|
||||
{
|
||||
@ -151,13 +151,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;
|
||||
@ -171,13 +171,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)
|
||||
{
|
||||
@ -208,22 +208,22 @@ namespace VEPROMS.CSLA.Library
|
||||
#endregion
|
||||
#region ValidationRules
|
||||
[NonSerialized]
|
||||
private bool _CheckingBrokenRules=false;
|
||||
private bool _CheckingBrokenRules = false;
|
||||
public IVEHasBrokenRules HasBrokenRules
|
||||
{
|
||||
get
|
||||
{
|
||||
if(_CheckingBrokenRules)return null;
|
||||
if (_CheckingBrokenRules) return null;
|
||||
if (BrokenRulesCollection.Count > 0) return this;
|
||||
try
|
||||
{
|
||||
_CheckingBrokenRules=true;
|
||||
_CheckingBrokenRules = true;
|
||||
IVEHasBrokenRules hasBrokenRules = null;
|
||||
return hasBrokenRules;
|
||||
}
|
||||
finally
|
||||
{
|
||||
_CheckingBrokenRules=false;
|
||||
_CheckingBrokenRules = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -339,7 +339,7 @@ namespace VEPROMS.CSLA.Library
|
||||
#region Data Access Portal
|
||||
private void Fetch(SafeDataReader dr)
|
||||
{
|
||||
if(_MyLog.IsDebugEnabled)_MyLog.DebugFormat("[{0}] FormatContent.FetchDR", GetHashCode());
|
||||
if (_MyLog.IsDebugEnabled) _MyLog.DebugFormat("[{0}] FormatContent.FetchDR", GetHashCode());
|
||||
try
|
||||
{
|
||||
_ContentID = dr.GetInt32("ContentID");
|
||||
@ -353,7 +353,7 @@ namespace VEPROMS.CSLA.Library
|
||||
}
|
||||
catch (Exception ex) // FKItem Fetch
|
||||
{
|
||||
if(_MyLog.IsErrorEnabled)_MyLog.Error("FormatContent.FetchDR", ex);
|
||||
if (_MyLog.IsErrorEnabled) _MyLog.Error("FormatContent.FetchDR", ex);
|
||||
throw new DbCslaException("FormatContent.Fetch", ex);
|
||||
}
|
||||
MarkOld();
|
||||
|
@ -94,8 +94,8 @@ namespace VEPROMS.CSLA.Library
|
||||
{
|
||||
get
|
||||
{
|
||||
IVEHasBrokenRules hasBrokenRules=null;
|
||||
foreach(FormatContent formatContent in this)
|
||||
IVEHasBrokenRules hasBrokenRules = null;
|
||||
foreach (FormatContent formatContent in this)
|
||||
if ((hasBrokenRules = formatContent.HasBrokenRules) != null) return hasBrokenRules;
|
||||
return hasBrokenRules;
|
||||
}
|
||||
@ -165,7 +165,7 @@ namespace VEPROMS.CSLA.Library
|
||||
private void DataPortal_Fetch(FormatIDCriteria criteria)
|
||||
{
|
||||
this.RaiseListChangedEvents = false;
|
||||
if(_MyLog.IsDebugEnabled)_MyLog.DebugFormat("[{0}] FormatContents.DataPortal_FetchFormatID", GetHashCode());
|
||||
if (_MyLog.IsDebugEnabled) _MyLog.DebugFormat("[{0}] FormatContents.DataPortal_FetchFormatID", GetHashCode());
|
||||
try
|
||||
{
|
||||
using (SqlConnection cn = Database.VEPROMS_SqlConnection)
|
||||
@ -184,7 +184,7 @@ namespace VEPROMS.CSLA.Library
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
if(_MyLog.IsErrorEnabled)_MyLog.Error("FormatContents.DataPortal_FetchFormatID", ex);
|
||||
if (_MyLog.IsErrorEnabled) _MyLog.Error("FormatContents.DataPortal_FetchFormatID", ex);
|
||||
throw new DbCslaException("FormatContents.DataPortal_Fetch", ex);
|
||||
}
|
||||
this.RaiseListChangedEvents = true;
|
||||
@ -269,8 +269,8 @@ namespace VEPROMS.CSLA.Library
|
||||
/// </summary>
|
||||
public partial class FormatContentsPropertyDescriptor : vlnListPropertyDescriptor
|
||||
{
|
||||
private FormatContent Item { get { return (FormatContent) _Item;} }
|
||||
public FormatContentsPropertyDescriptor(FormatContents collection, int index):base(collection, index){;}
|
||||
private FormatContent Item { get { return (FormatContent)_Item; } }
|
||||
public FormatContentsPropertyDescriptor(FormatContents collection, int index) : base(collection, index) { ;}
|
||||
}
|
||||
#endregion
|
||||
#region Converter
|
||||
@ -281,7 +281,7 @@ namespace VEPROMS.CSLA.Library
|
||||
if (destType == typeof(string) && value is FormatContents)
|
||||
{
|
||||
// Return department and department role separated by comma.
|
||||
return ((FormatContents) value).Items.Count.ToString() + " Contents";
|
||||
return ((FormatContents)value).Items.Count.ToString() + " Contents";
|
||||
}
|
||||
return base.ConvertTo(context, culture, value, destType);
|
||||
}
|
||||
|
@ -42,7 +42,7 @@ namespace VEPROMS.CSLA.Library
|
||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||
get
|
||||
{
|
||||
CanReadProperty("VersionID",true);
|
||||
CanReadProperty("VersionID", true);
|
||||
if (_MyDocVersion != null) _VersionID = _MyDocVersion.VersionID;
|
||||
return _VersionID;
|
||||
}
|
||||
@ -54,7 +54,7 @@ namespace VEPROMS.CSLA.Library
|
||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||
get
|
||||
{
|
||||
CanReadProperty("MyDocVersion",true);
|
||||
CanReadProperty("MyDocVersion", true);
|
||||
if (_MyDocVersion == null && _VersionID != 0) _MyDocVersion = DocVersion.Get(_VersionID);
|
||||
return _MyDocVersion;
|
||||
}
|
||||
@ -65,7 +65,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;
|
||||
}
|
||||
@ -76,14 +76,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;
|
||||
@ -100,13 +100,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;
|
||||
@ -120,13 +120,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)
|
||||
{
|
||||
@ -141,13 +141,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)
|
||||
{
|
||||
@ -162,7 +162,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;
|
||||
}
|
||||
@ -173,18 +173,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();
|
||||
}
|
||||
}
|
||||
@ -195,13 +195,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)
|
||||
{
|
||||
@ -216,13 +216,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;
|
||||
@ -236,13 +236,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)
|
||||
{
|
||||
@ -258,7 +258,7 @@ namespace VEPROMS.CSLA.Library
|
||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||
get
|
||||
{
|
||||
CanReadProperty("Folder_ParentID",true);
|
||||
CanReadProperty("Folder_ParentID", true);
|
||||
return _Folder_ParentID;
|
||||
}
|
||||
}
|
||||
@ -268,7 +268,7 @@ namespace VEPROMS.CSLA.Library
|
||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||
get
|
||||
{
|
||||
CanReadProperty("Folder_DBID",true);
|
||||
CanReadProperty("Folder_DBID", true);
|
||||
return _Folder_DBID;
|
||||
}
|
||||
}
|
||||
@ -278,7 +278,7 @@ namespace VEPROMS.CSLA.Library
|
||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||
get
|
||||
{
|
||||
CanReadProperty("Folder_Name",true);
|
||||
CanReadProperty("Folder_Name", true);
|
||||
return _Folder_Name;
|
||||
}
|
||||
}
|
||||
@ -288,7 +288,7 @@ namespace VEPROMS.CSLA.Library
|
||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||
get
|
||||
{
|
||||
CanReadProperty("Folder_Title",true);
|
||||
CanReadProperty("Folder_Title", true);
|
||||
return _Folder_Title;
|
||||
}
|
||||
}
|
||||
@ -298,7 +298,7 @@ namespace VEPROMS.CSLA.Library
|
||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||
get
|
||||
{
|
||||
CanReadProperty("Folder_ShortName",true);
|
||||
CanReadProperty("Folder_ShortName", true);
|
||||
return _Folder_ShortName;
|
||||
}
|
||||
}
|
||||
@ -308,7 +308,7 @@ namespace VEPROMS.CSLA.Library
|
||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||
get
|
||||
{
|
||||
CanReadProperty("Folder_FormatID",true);
|
||||
CanReadProperty("Folder_FormatID", true);
|
||||
return _Folder_FormatID;
|
||||
}
|
||||
}
|
||||
@ -318,7 +318,7 @@ namespace VEPROMS.CSLA.Library
|
||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||
get
|
||||
{
|
||||
CanReadProperty("Folder_Config",true);
|
||||
CanReadProperty("Folder_Config", true);
|
||||
return _Folder_Config;
|
||||
}
|
||||
}
|
||||
@ -328,7 +328,7 @@ namespace VEPROMS.CSLA.Library
|
||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||
get
|
||||
{
|
||||
CanReadProperty("Folder_DTS",true);
|
||||
CanReadProperty("Folder_DTS", true);
|
||||
return _Folder_DTS;
|
||||
}
|
||||
}
|
||||
@ -338,7 +338,7 @@ namespace VEPROMS.CSLA.Library
|
||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||
get
|
||||
{
|
||||
CanReadProperty("Folder_UsrID",true);
|
||||
CanReadProperty("Folder_UsrID", true);
|
||||
return _Folder_UsrID;
|
||||
}
|
||||
}
|
||||
@ -371,16 +371,16 @@ namespace VEPROMS.CSLA.Library
|
||||
#endregion
|
||||
#region ValidationRules
|
||||
[NonSerialized]
|
||||
private bool _CheckingBrokenRules=false;
|
||||
private bool _CheckingBrokenRules = false;
|
||||
public IVEHasBrokenRules HasBrokenRules
|
||||
{
|
||||
get
|
||||
{
|
||||
if(_CheckingBrokenRules)return null;
|
||||
if (_CheckingBrokenRules) return null;
|
||||
if (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;
|
||||
@ -388,7 +388,7 @@ namespace VEPROMS.CSLA.Library
|
||||
}
|
||||
finally
|
||||
{
|
||||
_CheckingBrokenRules=false;
|
||||
_CheckingBrokenRules = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -532,7 +532,7 @@ namespace VEPROMS.CSLA.Library
|
||||
#region Data Access Portal
|
||||
private void Fetch(SafeDataReader dr)
|
||||
{
|
||||
if(_MyLog.IsDebugEnabled)_MyLog.DebugFormat("[{0}] FormatDocVersion.FetchDR", GetHashCode());
|
||||
if (_MyLog.IsDebugEnabled) _MyLog.DebugFormat("[{0}] FormatDocVersion.FetchDR", GetHashCode());
|
||||
try
|
||||
{
|
||||
_VersionID = dr.GetInt32("VersionID");
|
||||
@ -557,7 +557,7 @@ namespace VEPROMS.CSLA.Library
|
||||
}
|
||||
catch (Exception ex) // FKItem Fetch
|
||||
{
|
||||
if(_MyLog.IsErrorEnabled)_MyLog.Error("FormatDocVersion.FetchDR", ex);
|
||||
if (_MyLog.IsErrorEnabled) _MyLog.Error("FormatDocVersion.FetchDR", ex);
|
||||
throw new DbCslaException("FormatDocVersion.Fetch", ex);
|
||||
}
|
||||
MarkOld();
|
||||
|
@ -94,8 +94,8 @@ namespace VEPROMS.CSLA.Library
|
||||
{
|
||||
get
|
||||
{
|
||||
IVEHasBrokenRules hasBrokenRules=null;
|
||||
foreach(FormatDocVersion formatDocVersion in this)
|
||||
IVEHasBrokenRules hasBrokenRules = null;
|
||||
foreach (FormatDocVersion formatDocVersion in this)
|
||||
if ((hasBrokenRules = formatDocVersion.HasBrokenRules) != null) return hasBrokenRules;
|
||||
return hasBrokenRules;
|
||||
}
|
||||
@ -165,7 +165,7 @@ namespace VEPROMS.CSLA.Library
|
||||
private void DataPortal_Fetch(FormatIDCriteria criteria)
|
||||
{
|
||||
this.RaiseListChangedEvents = false;
|
||||
if(_MyLog.IsDebugEnabled)_MyLog.DebugFormat("[{0}] FormatDocVersions.DataPortal_FetchFormatID", GetHashCode());
|
||||
if (_MyLog.IsDebugEnabled) _MyLog.DebugFormat("[{0}] FormatDocVersions.DataPortal_FetchFormatID", GetHashCode());
|
||||
try
|
||||
{
|
||||
using (SqlConnection cn = Database.VEPROMS_SqlConnection)
|
||||
@ -184,7 +184,7 @@ namespace VEPROMS.CSLA.Library
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
if(_MyLog.IsErrorEnabled)_MyLog.Error("FormatDocVersions.DataPortal_FetchFormatID", ex);
|
||||
if (_MyLog.IsErrorEnabled) _MyLog.Error("FormatDocVersions.DataPortal_FetchFormatID", ex);
|
||||
throw new DbCslaException("FormatDocVersions.DataPortal_Fetch", ex);
|
||||
}
|
||||
this.RaiseListChangedEvents = true;
|
||||
@ -269,8 +269,8 @@ namespace VEPROMS.CSLA.Library
|
||||
/// </summary>
|
||||
public partial class FormatDocVersionsPropertyDescriptor : vlnListPropertyDescriptor
|
||||
{
|
||||
private FormatDocVersion Item { get { return (FormatDocVersion) _Item;} }
|
||||
public FormatDocVersionsPropertyDescriptor(FormatDocVersions collection, int index):base(collection, index){;}
|
||||
private FormatDocVersion Item { get { return (FormatDocVersion)_Item; } }
|
||||
public FormatDocVersionsPropertyDescriptor(FormatDocVersions collection, int index) : base(collection, index) { ;}
|
||||
}
|
||||
#endregion
|
||||
#region Converter
|
||||
@ -281,7 +281,7 @@ namespace VEPROMS.CSLA.Library
|
||||
if (destType == typeof(string) && value is FormatDocVersions)
|
||||
{
|
||||
// Return department and department role separated by comma.
|
||||
return ((FormatDocVersions) value).Items.Count.ToString() + " DocVersions";
|
||||
return ((FormatDocVersions)value).Items.Count.ToString() + " DocVersions";
|
||||
}
|
||||
return base.ConvertTo(context, culture, value, destType);
|
||||
}
|
||||
|
@ -42,7 +42,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;
|
||||
}
|
||||
@ -54,7 +54,7 @@ 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;
|
||||
}
|
||||
@ -65,7 +65,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;
|
||||
}
|
||||
@ -76,14 +76,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;
|
||||
@ -97,7 +97,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;
|
||||
}
|
||||
@ -108,14 +108,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;
|
||||
@ -129,13 +129,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)
|
||||
{
|
||||
@ -150,13 +150,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)
|
||||
{
|
||||
@ -171,13 +171,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)
|
||||
{
|
||||
@ -192,13 +192,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)
|
||||
{
|
||||
@ -213,13 +213,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;
|
||||
@ -233,13 +233,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)
|
||||
{
|
||||
@ -255,7 +255,7 @@ namespace VEPROMS.CSLA.Library
|
||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||
get
|
||||
{
|
||||
CanReadProperty("Connection_Name",true);
|
||||
CanReadProperty("Connection_Name", true);
|
||||
return _Connection_Name;
|
||||
}
|
||||
}
|
||||
@ -265,7 +265,7 @@ namespace VEPROMS.CSLA.Library
|
||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||
get
|
||||
{
|
||||
CanReadProperty("Connection_Title",true);
|
||||
CanReadProperty("Connection_Title", true);
|
||||
return _Connection_Title;
|
||||
}
|
||||
}
|
||||
@ -275,7 +275,7 @@ namespace VEPROMS.CSLA.Library
|
||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||
get
|
||||
{
|
||||
CanReadProperty("Connection_ConnectionString",true);
|
||||
CanReadProperty("Connection_ConnectionString", true);
|
||||
return _Connection_ConnectionString;
|
||||
}
|
||||
}
|
||||
@ -288,7 +288,7 @@ namespace VEPROMS.CSLA.Library
|
||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||
get
|
||||
{
|
||||
CanReadProperty("Connection_ServerType",true);
|
||||
CanReadProperty("Connection_ServerType", true);
|
||||
return _Connection_ServerType;
|
||||
}
|
||||
}
|
||||
@ -298,7 +298,7 @@ namespace VEPROMS.CSLA.Library
|
||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||
get
|
||||
{
|
||||
CanReadProperty("Connection_Config",true);
|
||||
CanReadProperty("Connection_Config", true);
|
||||
return _Connection_Config;
|
||||
}
|
||||
}
|
||||
@ -308,7 +308,7 @@ namespace VEPROMS.CSLA.Library
|
||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||
get
|
||||
{
|
||||
CanReadProperty("Connection_DTS",true);
|
||||
CanReadProperty("Connection_DTS", true);
|
||||
return _Connection_DTS;
|
||||
}
|
||||
}
|
||||
@ -318,7 +318,7 @@ namespace VEPROMS.CSLA.Library
|
||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||
get
|
||||
{
|
||||
CanReadProperty("Connection_UsrID",true);
|
||||
CanReadProperty("Connection_UsrID", true);
|
||||
return _Connection_UsrID;
|
||||
}
|
||||
}
|
||||
@ -351,16 +351,16 @@ namespace VEPROMS.CSLA.Library
|
||||
#endregion
|
||||
#region ValidationRules
|
||||
[NonSerialized]
|
||||
private bool _CheckingBrokenRules=false;
|
||||
private bool _CheckingBrokenRules = false;
|
||||
public IVEHasBrokenRules HasBrokenRules
|
||||
{
|
||||
get
|
||||
{
|
||||
if(_CheckingBrokenRules)return null;
|
||||
if (_CheckingBrokenRules) return null;
|
||||
if (BrokenRulesCollection.Count > 0) return this;
|
||||
try
|
||||
{
|
||||
_CheckingBrokenRules=true;
|
||||
_CheckingBrokenRules = true;
|
||||
IVEHasBrokenRules hasBrokenRules = null;
|
||||
if (_MyFolder != null && (hasBrokenRules = _MyFolder.HasBrokenRules) != null) return hasBrokenRules;
|
||||
if (_MyConnection != null && (hasBrokenRules = _MyConnection.HasBrokenRules) != null) return hasBrokenRules;
|
||||
@ -368,7 +368,7 @@ namespace VEPROMS.CSLA.Library
|
||||
}
|
||||
finally
|
||||
{
|
||||
_CheckingBrokenRules=false;
|
||||
_CheckingBrokenRules = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -530,7 +530,7 @@ namespace VEPROMS.CSLA.Library
|
||||
#region Data Access Portal
|
||||
private void Fetch(SafeDataReader dr)
|
||||
{
|
||||
if(_MyLog.IsDebugEnabled)_MyLog.DebugFormat("[{0}] FormatFolder.FetchDR", GetHashCode());
|
||||
if (_MyLog.IsDebugEnabled) _MyLog.DebugFormat("[{0}] FormatFolder.FetchDR", GetHashCode());
|
||||
try
|
||||
{
|
||||
_FolderID = dr.GetInt32("FolderID");
|
||||
@ -553,7 +553,7 @@ namespace VEPROMS.CSLA.Library
|
||||
}
|
||||
catch (Exception ex) // FKItem Fetch
|
||||
{
|
||||
if(_MyLog.IsErrorEnabled)_MyLog.Error("FormatFolder.FetchDR", ex);
|
||||
if (_MyLog.IsErrorEnabled) _MyLog.Error("FormatFolder.FetchDR", ex);
|
||||
throw new DbCslaException("FormatFolder.Fetch", ex);
|
||||
}
|
||||
MarkOld();
|
||||
|
@ -94,8 +94,8 @@ namespace VEPROMS.CSLA.Library
|
||||
{
|
||||
get
|
||||
{
|
||||
IVEHasBrokenRules hasBrokenRules=null;
|
||||
foreach(FormatFolder formatFolder in this)
|
||||
IVEHasBrokenRules hasBrokenRules = null;
|
||||
foreach (FormatFolder formatFolder in this)
|
||||
if ((hasBrokenRules = formatFolder.HasBrokenRules) != null) return hasBrokenRules;
|
||||
return hasBrokenRules;
|
||||
}
|
||||
@ -165,7 +165,7 @@ namespace VEPROMS.CSLA.Library
|
||||
private void DataPortal_Fetch(FormatIDCriteria criteria)
|
||||
{
|
||||
this.RaiseListChangedEvents = false;
|
||||
if(_MyLog.IsDebugEnabled)_MyLog.DebugFormat("[{0}] FormatFolders.DataPortal_FetchFormatID", GetHashCode());
|
||||
if (_MyLog.IsDebugEnabled) _MyLog.DebugFormat("[{0}] FormatFolders.DataPortal_FetchFormatID", GetHashCode());
|
||||
try
|
||||
{
|
||||
using (SqlConnection cn = Database.VEPROMS_SqlConnection)
|
||||
@ -184,7 +184,7 @@ namespace VEPROMS.CSLA.Library
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
if(_MyLog.IsErrorEnabled)_MyLog.Error("FormatFolders.DataPortal_FetchFormatID", ex);
|
||||
if (_MyLog.IsErrorEnabled) _MyLog.Error("FormatFolders.DataPortal_FetchFormatID", ex);
|
||||
throw new DbCslaException("FormatFolders.DataPortal_Fetch", ex);
|
||||
}
|
||||
this.RaiseListChangedEvents = true;
|
||||
@ -269,8 +269,8 @@ namespace VEPROMS.CSLA.Library
|
||||
/// </summary>
|
||||
public partial class FormatFoldersPropertyDescriptor : vlnListPropertyDescriptor
|
||||
{
|
||||
private FormatFolder Item { get { return (FormatFolder) _Item;} }
|
||||
public FormatFoldersPropertyDescriptor(FormatFolders collection, int index):base(collection, index){;}
|
||||
private FormatFolder Item { get { return (FormatFolder)_Item; } }
|
||||
public FormatFoldersPropertyDescriptor(FormatFolders collection, int index) : base(collection, index) { ;}
|
||||
}
|
||||
#endregion
|
||||
#region Converter
|
||||
@ -281,7 +281,7 @@ namespace VEPROMS.CSLA.Library
|
||||
if (destType == typeof(string) && value is FormatFolders)
|
||||
{
|
||||
// Return department and department role separated by comma.
|
||||
return ((FormatFolders) value).Items.Count.ToString() + " Folders";
|
||||
return ((FormatFolders)value).Items.Count.ToString() + " Folders";
|
||||
}
|
||||
return base.ConvertTo(context, culture, value, destType);
|
||||
}
|
||||
|
@ -37,13 +37,17 @@ namespace VEPROMS.CSLA.Library
|
||||
#endregion
|
||||
#region Collection
|
||||
protected static List<FormatInfo> _AllList = new List<FormatInfo>();
|
||||
private static Dictionary<string, FormatInfo> _AllByPrimaryKey = new Dictionary<string, FormatInfo>();
|
||||
private static Dictionary<string, List<FormatInfo>> _AllByPrimaryKey = new Dictionary<string, List<FormatInfo>>();
|
||||
private static void ConvertListToDictionary()
|
||||
{
|
||||
List<FormatInfo> remove = new List<FormatInfo>();
|
||||
foreach (FormatInfo tmp in _AllList)
|
||||
{
|
||||
_AllByPrimaryKey[tmp.FormatID.ToString()]=tmp; // Primary Key
|
||||
if (!_AllByPrimaryKey.ContainsKey(tmp.FormatID.ToString()))
|
||||
{
|
||||
_AllByPrimaryKey[tmp.FormatID.ToString()] = new List<FormatInfo>(); // Add new list for PrimaryKey
|
||||
}
|
||||
_AllByPrimaryKey[tmp.FormatID.ToString()].Add(tmp); // Add to Primary Key list
|
||||
remove.Add(tmp);
|
||||
}
|
||||
foreach (FormatInfo tmp in remove)
|
||||
@ -57,7 +61,7 @@ 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;
|
||||
}
|
||||
#endregion
|
||||
@ -85,7 +89,7 @@ namespace VEPROMS.CSLA.Library
|
||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||
get
|
||||
{
|
||||
CanReadProperty("FormatID",true);
|
||||
CanReadProperty("FormatID", true);
|
||||
return _FormatID;
|
||||
}
|
||||
}
|
||||
@ -95,7 +99,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;
|
||||
}
|
||||
@ -106,7 +110,7 @@ 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 = FormatInfo.Get(_ParentID);
|
||||
return _MyParent;
|
||||
}
|
||||
@ -117,7 +121,7 @@ namespace VEPROMS.CSLA.Library
|
||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||
get
|
||||
{
|
||||
CanReadProperty("Name",true);
|
||||
CanReadProperty("Name", true);
|
||||
return _Name;
|
||||
}
|
||||
}
|
||||
@ -127,7 +131,7 @@ namespace VEPROMS.CSLA.Library
|
||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||
get
|
||||
{
|
||||
CanReadProperty("Description",true);
|
||||
CanReadProperty("Description", true);
|
||||
return _Description;
|
||||
}
|
||||
}
|
||||
@ -137,7 +141,7 @@ namespace VEPROMS.CSLA.Library
|
||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||
get
|
||||
{
|
||||
CanReadProperty("Data",true);
|
||||
CanReadProperty("Data", true);
|
||||
return _Data;
|
||||
}
|
||||
}
|
||||
@ -147,7 +151,7 @@ namespace VEPROMS.CSLA.Library
|
||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||
get
|
||||
{
|
||||
CanReadProperty("GenMac",true);
|
||||
CanReadProperty("GenMac", true);
|
||||
return _GenMac;
|
||||
}
|
||||
}
|
||||
@ -157,7 +161,7 @@ namespace VEPROMS.CSLA.Library
|
||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||
get
|
||||
{
|
||||
CanReadProperty("DTS",true);
|
||||
CanReadProperty("DTS", true);
|
||||
return _DTS;
|
||||
}
|
||||
}
|
||||
@ -167,7 +171,7 @@ namespace VEPROMS.CSLA.Library
|
||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||
get
|
||||
{
|
||||
CanReadProperty("UserID",true);
|
||||
CanReadProperty("UserID", true);
|
||||
return _UserID;
|
||||
}
|
||||
}
|
||||
@ -180,7 +184,7 @@ namespace VEPROMS.CSLA.Library
|
||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||
get
|
||||
{
|
||||
CanReadProperty("FormatContentCount",true);
|
||||
CanReadProperty("FormatContentCount", true);
|
||||
return _FormatContentCount;
|
||||
}
|
||||
}
|
||||
@ -191,7 +195,7 @@ namespace VEPROMS.CSLA.Library
|
||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||
get
|
||||
{
|
||||
CanReadProperty("FormatContents",true);
|
||||
CanReadProperty("FormatContents", true);
|
||||
if (_FormatContentCount < 0 || (_FormatContentCount > 0 && _FormatContents == null))
|
||||
_FormatContents = ContentInfoList.GetByFormatID(_FormatID);
|
||||
if (_FormatContentCount < 0)
|
||||
@ -201,7 +205,10 @@ namespace VEPROMS.CSLA.Library
|
||||
}
|
||||
internal void RefreshFormatContents()
|
||||
{
|
||||
_FormatContentCount = -1; // This will cause the data to be requeried
|
||||
ConvertListToDictionary();
|
||||
if (_AllByPrimaryKey.ContainsKey(_FormatID.ToString()))
|
||||
foreach (FormatInfo tmp in _AllByPrimaryKey[_FormatID.ToString()])
|
||||
tmp._FormatContentCount = -1; // This will cause the data to be requeried
|
||||
}
|
||||
private int _FormatDocVersionCount = 0;
|
||||
/// <summary>
|
||||
@ -212,7 +219,7 @@ namespace VEPROMS.CSLA.Library
|
||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||
get
|
||||
{
|
||||
CanReadProperty("FormatDocVersionCount",true);
|
||||
CanReadProperty("FormatDocVersionCount", true);
|
||||
return _FormatDocVersionCount;
|
||||
}
|
||||
}
|
||||
@ -223,7 +230,7 @@ namespace VEPROMS.CSLA.Library
|
||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||
get
|
||||
{
|
||||
CanReadProperty("FormatDocVersions",true);
|
||||
CanReadProperty("FormatDocVersions", true);
|
||||
if (_FormatDocVersionCount < 0 || (_FormatDocVersionCount > 0 && _FormatDocVersions == null))
|
||||
_FormatDocVersions = DocVersionInfoList.GetByFormatID(_FormatID);
|
||||
if (_FormatDocVersionCount < 0)
|
||||
@ -233,7 +240,10 @@ namespace VEPROMS.CSLA.Library
|
||||
}
|
||||
internal void RefreshFormatDocVersions()
|
||||
{
|
||||
_FormatDocVersionCount = -1; // This will cause the data to be requeried
|
||||
ConvertListToDictionary();
|
||||
if (_AllByPrimaryKey.ContainsKey(_FormatID.ToString()))
|
||||
foreach (FormatInfo tmp in _AllByPrimaryKey[_FormatID.ToString()])
|
||||
tmp._FormatDocVersionCount = -1; // This will cause the data to be requeried
|
||||
}
|
||||
private int _FormatFolderCount = 0;
|
||||
/// <summary>
|
||||
@ -244,7 +254,7 @@ namespace VEPROMS.CSLA.Library
|
||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||
get
|
||||
{
|
||||
CanReadProperty("FormatFolderCount",true);
|
||||
CanReadProperty("FormatFolderCount", true);
|
||||
return _FormatFolderCount;
|
||||
}
|
||||
}
|
||||
@ -255,7 +265,7 @@ namespace VEPROMS.CSLA.Library
|
||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||
get
|
||||
{
|
||||
CanReadProperty("FormatFolders",true);
|
||||
CanReadProperty("FormatFolders", true);
|
||||
if (_FormatFolderCount < 0 || (_FormatFolderCount > 0 && _FormatFolders == null))
|
||||
_FormatFolders = FolderInfoList.GetByFormatID(_FormatID);
|
||||
if (_FormatFolderCount < 0)
|
||||
@ -265,7 +275,10 @@ namespace VEPROMS.CSLA.Library
|
||||
}
|
||||
internal void RefreshFormatFolders()
|
||||
{
|
||||
_FormatFolderCount = -1; // This will cause the data to be requeried
|
||||
ConvertListToDictionary();
|
||||
if (_AllByPrimaryKey.ContainsKey(_FormatID.ToString()))
|
||||
foreach (FormatInfo tmp in _AllByPrimaryKey[_FormatID.ToString()])
|
||||
tmp._FormatFolderCount = -1; // This will cause the data to be requeried
|
||||
}
|
||||
private int _ChildFormatCount = 0;
|
||||
/// <summary>
|
||||
@ -276,7 +289,7 @@ namespace VEPROMS.CSLA.Library
|
||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||
get
|
||||
{
|
||||
CanReadProperty("ChildFormatCount",true);
|
||||
CanReadProperty("ChildFormatCount", true);
|
||||
return _ChildFormatCount;
|
||||
}
|
||||
}
|
||||
@ -287,7 +300,7 @@ namespace VEPROMS.CSLA.Library
|
||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||
get
|
||||
{
|
||||
CanReadProperty("ChildFormats",true);
|
||||
CanReadProperty("ChildFormats", true);
|
||||
if (_ChildFormatCount < 0 || (_ChildFormatCount > 0 && _ChildFormats == null))
|
||||
_ChildFormats = FormatInfoList.GetChildren(_FormatID);
|
||||
if (_ChildFormatCount < 0)
|
||||
@ -297,7 +310,10 @@ namespace VEPROMS.CSLA.Library
|
||||
}
|
||||
internal void RefreshChildFormats()
|
||||
{
|
||||
_ChildFormatCount = -1; // This will cause the data to be requeried
|
||||
ConvertListToDictionary();
|
||||
if (_AllByPrimaryKey.ContainsKey(_FormatID.ToString()))
|
||||
foreach (FormatInfo tmp in _AllByPrimaryKey[_FormatID.ToString()])
|
||||
tmp._ChildFormatCount = -1; // This will cause the data to be requeried
|
||||
}
|
||||
// TODO: Replace base FormatInfo.ToString function as necessary
|
||||
/// <summary>
|
||||
@ -319,14 +335,25 @@ namespace VEPROMS.CSLA.Library
|
||||
}
|
||||
#endregion
|
||||
#region Factory Methods
|
||||
private static int _FormatInfoUnique = 0;
|
||||
private int _MyFormatInfoUnique;
|
||||
public int MyFormatInfoUnique
|
||||
{
|
||||
get { return _MyFormatInfoUnique; }
|
||||
}
|
||||
private FormatInfo()
|
||||
{/* require use of factory methods */
|
||||
_MyFormatInfoUnique = ++_FormatInfoUnique;
|
||||
_AllList.Add(this);
|
||||
}
|
||||
public void Dispose()
|
||||
{
|
||||
_AllList.Remove(this);
|
||||
_AllByPrimaryKey.Remove(FormatID.ToString());
|
||||
if (!_AllByPrimaryKey.ContainsKey(FormatID.ToString())) return;
|
||||
List<FormatInfo> listFormatInfo = _AllByPrimaryKey[FormatID.ToString()]; // Get the list of items
|
||||
listFormatInfo.Remove(this); // Remove the item from the list
|
||||
if (listFormatInfo.Count == 0) // If there are no items left in the list
|
||||
_AllByPrimaryKey.Remove(FormatID.ToString()); // remove the list
|
||||
}
|
||||
public virtual Format Get()
|
||||
{
|
||||
@ -334,8 +361,10 @@ namespace VEPROMS.CSLA.Library
|
||||
}
|
||||
public static void Refresh(Format tmp)
|
||||
{
|
||||
FormatInfo tmpInfo = GetExistingByPrimaryKey(tmp.FormatID);
|
||||
if (tmpInfo == null) return;
|
||||
string key = tmp.FormatID.ToString();
|
||||
ConvertListToDictionary();
|
||||
if (_AllByPrimaryKey.ContainsKey(key))
|
||||
foreach (FormatInfo tmpInfo in _AllByPrimaryKey[key])
|
||||
tmpInfo.RefreshFields(tmp);
|
||||
}
|
||||
private void RefreshFields(Format tmp)
|
||||
@ -344,9 +373,9 @@ namespace VEPROMS.CSLA.Library
|
||||
{
|
||||
MyParent.RefreshChildFormats(); // Update List for old value
|
||||
_ParentID = tmp.ParentID; // Update the value
|
||||
_MyParent = null; // Reset list so that the next line gets a new list
|
||||
MyParent.RefreshChildFormats(); // Update List for new value
|
||||
}
|
||||
_MyParent = null; // Reset list so that the next line gets a new list
|
||||
if (MyParent != null) MyParent.RefreshChildFormats(); // Update List for new value
|
||||
_Name = tmp.Name;
|
||||
_Description = tmp.Description;
|
||||
_Data = tmp.Data;
|
||||
@ -367,7 +396,7 @@ namespace VEPROMS.CSLA.Library
|
||||
if (tmp == null)
|
||||
{
|
||||
tmp = DataPortal.Fetch<FormatInfo>(new PKCriteria(formatID));
|
||||
_AllList.Add(tmp);
|
||||
if (!_AllList.Contains(tmp)) _AllList.Add(tmp);
|
||||
}
|
||||
if (tmp.ErrorMessage == "No Record Found") tmp = null;
|
||||
return tmp;
|
||||
@ -381,14 +410,15 @@ namespace VEPROMS.CSLA.Library
|
||||
#region Data Access Portal
|
||||
internal FormatInfo(SafeDataReader dr)
|
||||
{
|
||||
if(_MyLog.IsDebugEnabled)_MyLog.DebugFormat("[{0}] FormatInfo.Constructor", GetHashCode());
|
||||
_MyFormatInfoUnique = ++_FormatInfoUnique;
|
||||
if (_MyLog.IsDebugEnabled) _MyLog.DebugFormat("[{0}] FormatInfo.Constructor", GetHashCode());
|
||||
try
|
||||
{
|
||||
ReadData(dr);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
if(_MyLog.IsErrorEnabled)_MyLog.Error("FormatInfo.Constructor", ex);
|
||||
if (_MyLog.IsErrorEnabled) _MyLog.Error("FormatInfo.Constructor", ex);
|
||||
throw new DbCslaException("FormatInfo.Constructor", ex);
|
||||
}
|
||||
}
|
||||
@ -405,7 +435,7 @@ namespace VEPROMS.CSLA.Library
|
||||
}
|
||||
private void ReadData(SafeDataReader dr)
|
||||
{
|
||||
if(_MyLog.IsDebugEnabled)_MyLog.DebugFormat("[{0}] FormatInfo.ReadData", GetHashCode());
|
||||
if (_MyLog.IsDebugEnabled) _MyLog.DebugFormat("[{0}] FormatInfo.ReadData", GetHashCode());
|
||||
try
|
||||
{
|
||||
_FormatID = dr.GetInt32("FormatID");
|
||||
@ -423,14 +453,14 @@ namespace VEPROMS.CSLA.Library
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
if(_MyLog.IsErrorEnabled)_MyLog.Error("FormatInfo.ReadData", ex);
|
||||
if (_MyLog.IsErrorEnabled) _MyLog.Error("FormatInfo.ReadData", ex);
|
||||
_ErrorMessage = ex.Message;
|
||||
throw new DbCslaException("FormatInfo.ReadData", ex);
|
||||
}
|
||||
}
|
||||
private void DataPortal_Fetch(PKCriteria criteria)
|
||||
{
|
||||
if(_MyLog.IsDebugEnabled)_MyLog.DebugFormat("[{0}] FormatInfo.DataPortal_Fetch", GetHashCode());
|
||||
if (_MyLog.IsDebugEnabled) _MyLog.DebugFormat("[{0}] FormatInfo.DataPortal_Fetch", GetHashCode());
|
||||
try
|
||||
{
|
||||
using (SqlConnection cn = Database.VEPROMS_SqlConnection)
|
||||
@ -458,7 +488,7 @@ namespace VEPROMS.CSLA.Library
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
if(_MyLog.IsErrorEnabled)_MyLog.Error("FormatInfo.DataPortal_Fetch", ex);
|
||||
if (_MyLog.IsErrorEnabled) _MyLog.Error("FormatInfo.DataPortal_Fetch", ex);
|
||||
_ErrorMessage = ex.Message;
|
||||
throw new DbCslaException("FormatInfo.DataPortal_Fetch", ex);
|
||||
}
|
||||
@ -468,7 +498,7 @@ namespace VEPROMS.CSLA.Library
|
||||
#region extension
|
||||
FormatInfoExtension _FormatInfoExtension = new FormatInfoExtension();
|
||||
[Serializable()]
|
||||
partial class FormatInfoExtension : extensionBase {}
|
||||
partial class FormatInfoExtension : extensionBase { }
|
||||
[Serializable()]
|
||||
class extensionBase
|
||||
{
|
||||
|
@ -110,7 +110,7 @@ namespace VEPROMS.CSLA.Library
|
||||
private void DataPortal_Fetch()
|
||||
{
|
||||
this.RaiseListChangedEvents = false;
|
||||
if(_MyLog.IsDebugEnabled)_MyLog.DebugFormat("[{0}] FormatInfoList.DataPortal_Fetch", GetHashCode());
|
||||
if (_MyLog.IsDebugEnabled) _MyLog.DebugFormat("[{0}] FormatInfoList.DataPortal_Fetch", GetHashCode());
|
||||
try
|
||||
{
|
||||
using (SqlConnection cn = Database.VEPROMS_SqlConnection)
|
||||
@ -130,7 +130,7 @@ namespace VEPROMS.CSLA.Library
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
if(_MyLog.IsErrorEnabled)_MyLog.Error("FormatInfoList.DataPortal_Fetch", ex);
|
||||
if (_MyLog.IsErrorEnabled) _MyLog.Error("FormatInfoList.DataPortal_Fetch", ex);
|
||||
throw new DbCslaException("FormatInfoList.DataPortal_Fetch", ex);
|
||||
}
|
||||
this.RaiseListChangedEvents = true;
|
||||
@ -152,7 +152,7 @@ namespace VEPROMS.CSLA.Library
|
||||
private void DataPortal_Fetch(ParentIDCriteria criteria)
|
||||
{
|
||||
this.RaiseListChangedEvents = false;
|
||||
if(_MyLog.IsDebugEnabled)_MyLog.DebugFormat("[{0}] FormatInfoList.DataPortal_FetchParentID", GetHashCode());
|
||||
if (_MyLog.IsDebugEnabled) _MyLog.DebugFormat("[{0}] FormatInfoList.DataPortal_FetchParentID", GetHashCode());
|
||||
try
|
||||
{
|
||||
using (SqlConnection cn = Database.VEPROMS_SqlConnection)
|
||||
@ -173,7 +173,7 @@ namespace VEPROMS.CSLA.Library
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
if(_MyLog.IsErrorEnabled)_MyLog.Error("FormatInfoList.DataPortal_FetchParentID", ex);
|
||||
if (_MyLog.IsErrorEnabled) _MyLog.Error("FormatInfoList.DataPortal_FetchParentID", ex);
|
||||
throw new DbCslaException("FormatInfoList.DataPortal_Fetch", ex);
|
||||
}
|
||||
this.RaiseListChangedEvents = true;
|
||||
@ -234,8 +234,8 @@ namespace VEPROMS.CSLA.Library
|
||||
/// </summary>
|
||||
public partial class FormatInfoListPropertyDescriptor : vlnListPropertyDescriptor
|
||||
{
|
||||
private FormatInfo Item { get { return (FormatInfo) _Item;} }
|
||||
public FormatInfoListPropertyDescriptor(FormatInfoList collection, int index):base(collection, index){;}
|
||||
private FormatInfo Item { get { return (FormatInfo)_Item; } }
|
||||
public FormatInfoListPropertyDescriptor(FormatInfoList collection, int index) : base(collection, index) { ;}
|
||||
}
|
||||
#endregion
|
||||
#region Converter
|
||||
@ -246,7 +246,7 @@ namespace VEPROMS.CSLA.Library
|
||||
if (destType == typeof(string) && value is FormatInfoList)
|
||||
{
|
||||
// Return department and department role separated by comma.
|
||||
return ((FormatInfoList) value).Items.Count.ToString() + " Formats";
|
||||
return ((FormatInfoList)value).Items.Count.ToString() + " Formats";
|
||||
}
|
||||
return base.ConvertTo(context, culture, value, destType);
|
||||
}
|
||||
|
@ -42,14 +42,14 @@ namespace VEPROMS.CSLA.Library
|
||||
{
|
||||
foreach (GroupAssignment tmp in _GroupAssignments)
|
||||
{
|
||||
if(tmp.IsDirty)refreshGroupAssignments.Add(tmp);
|
||||
if (tmp.IsDirty) refreshGroupAssignments.Add(tmp);
|
||||
}
|
||||
}
|
||||
if (_GroupMemberships != null && _GroupMemberships.IsDirty)
|
||||
{
|
||||
foreach (GroupMembership tmp in _GroupMemberships)
|
||||
{
|
||||
if(tmp.IsDirty)refreshGroupMemberships.Add(tmp);
|
||||
if (tmp.IsDirty) refreshGroupMemberships.Add(tmp);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -78,15 +78,20 @@ namespace VEPROMS.CSLA.Library
|
||||
#endregion
|
||||
#region Collection
|
||||
protected static List<Group> _AllList = new List<Group>();
|
||||
private static Dictionary<string, Group> _AllByPrimaryKey = new Dictionary<string, Group>();
|
||||
private static Dictionary<string, Group> _AllByGroupName = new Dictionary<string, Group>();
|
||||
private static Dictionary<string, List<Group>> _AllByPrimaryKey = new Dictionary<string, List<Group>>();
|
||||
private static Dictionary<string, List<Group>> _AllByGroupName = new Dictionary<string, List<Group>>();
|
||||
private static void ConvertListToDictionary()
|
||||
{
|
||||
List<Group> remove = new List<Group>();
|
||||
foreach (Group tmp in _AllList)
|
||||
{
|
||||
_AllByPrimaryKey[tmp.GID.ToString()]=tmp; // Primary Key
|
||||
_AllByGroupName[tmp.GroupName.ToString()] = tmp; // Unique Index
|
||||
if (!_AllByPrimaryKey.ContainsKey(tmp.GID.ToString()))
|
||||
{
|
||||
_AllByPrimaryKey[tmp.GID.ToString()] = new List<Group>(); // Add new list for PrimaryKey
|
||||
_AllByGroupName[tmp.GroupName.ToString()] = new List<Group>(); // Add new list for GroupName
|
||||
}
|
||||
_AllByPrimaryKey[tmp.GID.ToString()].Add(tmp); // Add to Primary Key list
|
||||
_AllByGroupName[tmp.GroupName.ToString()].Add(tmp); // Unique Index
|
||||
remove.Add(tmp);
|
||||
}
|
||||
foreach (Group tmp in remove)
|
||||
@ -96,14 +101,14 @@ namespace VEPROMS.CSLA.Library
|
||||
{
|
||||
ConvertListToDictionary();
|
||||
string key = gid.ToString();
|
||||
if (_AllByPrimaryKey.ContainsKey(key)) return _AllByPrimaryKey[key];
|
||||
if (_AllByPrimaryKey.ContainsKey(key)) return _AllByPrimaryKey[key][0];
|
||||
return null;
|
||||
}
|
||||
public static Group GetExistingByGroupName(string groupName)
|
||||
{
|
||||
ConvertListToDictionary();
|
||||
string key = groupName.ToString();
|
||||
if (_AllByGroupName.ContainsKey(key)) return _AllByGroupName[key];
|
||||
if (_AllByGroupName.ContainsKey(key)) return _AllByGroupName[key][0];
|
||||
return null;
|
||||
}
|
||||
#endregion
|
||||
@ -125,7 +130,7 @@ namespace VEPROMS.CSLA.Library
|
||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||
get
|
||||
{
|
||||
CanReadProperty("GID",true);
|
||||
CanReadProperty("GID", true);
|
||||
return _GID;
|
||||
}
|
||||
}
|
||||
@ -135,13 +140,13 @@ namespace VEPROMS.CSLA.Library
|
||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||
get
|
||||
{
|
||||
CanReadProperty("GroupName",true);
|
||||
CanReadProperty("GroupName", true);
|
||||
return _GroupName;
|
||||
}
|
||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||
set
|
||||
{
|
||||
CanWriteProperty("GroupName",true);
|
||||
CanWriteProperty("GroupName", true);
|
||||
if (value == null) value = string.Empty;
|
||||
if (_GroupName != value)
|
||||
{
|
||||
@ -156,13 +161,13 @@ namespace VEPROMS.CSLA.Library
|
||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||
get
|
||||
{
|
||||
CanReadProperty("GroupType",true);
|
||||
CanReadProperty("GroupType", true);
|
||||
return _GroupType;
|
||||
}
|
||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||
set
|
||||
{
|
||||
CanWriteProperty("GroupType",true);
|
||||
CanWriteProperty("GroupType", true);
|
||||
if (_GroupType != value)
|
||||
{
|
||||
_GroupType = value;
|
||||
@ -176,13 +181,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)
|
||||
{
|
||||
@ -197,13 +202,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;
|
||||
@ -217,13 +222,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)
|
||||
{
|
||||
@ -242,7 +247,7 @@ namespace VEPROMS.CSLA.Library
|
||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||
get
|
||||
{
|
||||
CanReadProperty("GroupAssignmentCount",true);
|
||||
CanReadProperty("GroupAssignmentCount", true);
|
||||
return _GroupAssignmentCount;
|
||||
}
|
||||
}
|
||||
@ -256,10 +261,10 @@ namespace VEPROMS.CSLA.Library
|
||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||
get
|
||||
{
|
||||
CanReadProperty("GroupAssignments",true);
|
||||
if(_GroupAssignmentCount > 0 && _GroupAssignments == null)
|
||||
CanReadProperty("GroupAssignments", true);
|
||||
if (_GroupAssignmentCount > 0 && _GroupAssignments == null)
|
||||
_GroupAssignments = GroupAssignments.GetByGID(GID);
|
||||
else if(_GroupAssignments == null)
|
||||
else if (_GroupAssignments == null)
|
||||
_GroupAssignments = GroupAssignments.New();
|
||||
return _GroupAssignments;
|
||||
}
|
||||
@ -273,7 +278,7 @@ namespace VEPROMS.CSLA.Library
|
||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||
get
|
||||
{
|
||||
CanReadProperty("GroupMembershipCount",true);
|
||||
CanReadProperty("GroupMembershipCount", true);
|
||||
return _GroupMembershipCount;
|
||||
}
|
||||
}
|
||||
@ -287,21 +292,21 @@ namespace VEPROMS.CSLA.Library
|
||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||
get
|
||||
{
|
||||
CanReadProperty("GroupMemberships",true);
|
||||
if(_GroupMembershipCount > 0 && _GroupMemberships == null)
|
||||
CanReadProperty("GroupMemberships", true);
|
||||
if (_GroupMembershipCount > 0 && _GroupMemberships == null)
|
||||
_GroupMemberships = GroupMemberships.GetByGID(GID);
|
||||
else if(_GroupMemberships == null)
|
||||
else if (_GroupMemberships == null)
|
||||
_GroupMemberships = GroupMemberships.New();
|
||||
return _GroupMemberships;
|
||||
}
|
||||
}
|
||||
public override bool IsDirty
|
||||
{
|
||||
get { return base.IsDirty || (_GroupAssignments == null? false : _GroupAssignments.IsDirty) || (_GroupMemberships == null? false : _GroupMemberships.IsDirty); }
|
||||
get { return base.IsDirty || (_GroupAssignments == null ? false : _GroupAssignments.IsDirty) || (_GroupMemberships == null ? false : _GroupMemberships.IsDirty); }
|
||||
}
|
||||
public override bool IsValid
|
||||
{
|
||||
get { return (IsNew && !IsDirty ? true : base.IsValid) && (_GroupAssignments == null? true : _GroupAssignments.IsValid) && (_GroupMemberships == null? true : _GroupMemberships.IsValid); }
|
||||
get { return (IsNew && !IsDirty ? true : base.IsValid) && (_GroupAssignments == null ? true : _GroupAssignments.IsValid) && (_GroupMemberships == null ? true : _GroupMemberships.IsValid); }
|
||||
}
|
||||
// TODO: Replace base Group.ToString function as necessary
|
||||
/// <summary>
|
||||
@ -324,15 +329,16 @@ 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 (_GroupAssignments != null && (hasBrokenRules = _GroupAssignments.HasBrokenRules) != null) return hasBrokenRules;
|
||||
if (_GroupMemberships != null && (hasBrokenRules = _GroupMemberships.HasBrokenRules) != null) return hasBrokenRules;
|
||||
@ -340,7 +346,7 @@ namespace VEPROMS.CSLA.Library
|
||||
}
|
||||
finally
|
||||
{
|
||||
_CheckingBrokenRules=false;
|
||||
_CheckingBrokenRules = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -455,15 +461,29 @@ namespace VEPROMS.CSLA.Library
|
||||
#region Factory Methods
|
||||
public int CurrentEditLevel
|
||||
{ get { return EditLevel; } }
|
||||
private static int _GroupUnique = 0;
|
||||
private int _MyGroupUnique;
|
||||
public int MyGroupUnique
|
||||
{
|
||||
get { return _MyGroupUnique; }
|
||||
}
|
||||
protected Group()
|
||||
{/* require use of factory methods */
|
||||
_MyGroupUnique = ++_GroupUnique;
|
||||
_AllList.Add(this);
|
||||
}
|
||||
public void Dispose()
|
||||
{
|
||||
_AllList.Remove(this);
|
||||
_AllByPrimaryKey.Remove(GID.ToString());
|
||||
_AllByGroupName.Remove(GroupName.ToString());
|
||||
if (!_AllByPrimaryKey.ContainsKey(GID.ToString())) return;
|
||||
List<Group> listGroup = _AllByPrimaryKey[GID.ToString()]; // Get the list of items
|
||||
listGroup.Remove(this); // Remove the item from the list
|
||||
if (listGroup.Count == 0) //If there are no items left in the list
|
||||
_AllByPrimaryKey.Remove(GID.ToString()); // remove the list
|
||||
listGroup = _AllByGroupName[GID.ToString()]; // Get the list of items
|
||||
listGroup.Remove(this); // Remove the item from the list
|
||||
if (listGroup.Count == 0) //If there are no items left in the list
|
||||
_AllByGroupName.Remove(GID.ToString()); // remove the list
|
||||
}
|
||||
public static Group New()
|
||||
{
|
||||
@ -544,7 +564,7 @@ namespace VEPROMS.CSLA.Library
|
||||
if (tmp == null)
|
||||
{
|
||||
tmp = DataPortal.Fetch<Group>(new PKCriteria(gid));
|
||||
_AllList.Add(tmp);
|
||||
if (!_AllList.Contains(tmp)) _AllList.Add(tmp);
|
||||
}
|
||||
if (tmp.ErrorMessage == "No Record Found") tmp = null;
|
||||
return tmp;
|
||||
@ -563,8 +583,8 @@ namespace VEPROMS.CSLA.Library
|
||||
Group tmp = GetExistingByGroupName(groupName);
|
||||
if (tmp == null)
|
||||
{
|
||||
tmp=DataPortal.Fetch<Group>(new GroupNameCriteria(groupName));
|
||||
_AllList.Add(tmp);
|
||||
tmp = DataPortal.Fetch<Group>(new GroupNameCriteria(groupName));
|
||||
if (!_AllList.Contains(tmp)) _AllList.Add(tmp);
|
||||
}
|
||||
if (tmp.ErrorMessage == "No Record Found") tmp = null;
|
||||
return tmp;
|
||||
@ -654,7 +674,7 @@ namespace VEPROMS.CSLA.Library
|
||||
}
|
||||
private void ReadData(SafeDataReader dr)
|
||||
{
|
||||
if(_MyLog.IsDebugEnabled)_MyLog.DebugFormat("[{0}] Group.ReadData", GetHashCode());
|
||||
if (_MyLog.IsDebugEnabled) _MyLog.DebugFormat("[{0}] Group.ReadData", GetHashCode());
|
||||
try
|
||||
{
|
||||
_GID = dr.GetInt32("GID");
|
||||
@ -670,14 +690,14 @@ namespace VEPROMS.CSLA.Library
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
if(_MyLog.IsErrorEnabled)_MyLog.Error("Group.ReadData", ex);
|
||||
if (_MyLog.IsErrorEnabled) _MyLog.Error("Group.ReadData", ex);
|
||||
_ErrorMessage = ex.Message;
|
||||
throw new DbCslaException("Group.ReadData", ex);
|
||||
}
|
||||
}
|
||||
private void DataPortal_Fetch(PKCriteria criteria)
|
||||
{
|
||||
if(_MyLog.IsDebugEnabled)_MyLog.DebugFormat("[{0}] Group.DataPortal_Fetch", GetHashCode());
|
||||
if (_MyLog.IsDebugEnabled) _MyLog.DebugFormat("[{0}] Group.DataPortal_Fetch", GetHashCode());
|
||||
try
|
||||
{
|
||||
using (SqlConnection cn = Database.VEPROMS_SqlConnection)
|
||||
@ -711,14 +731,14 @@ namespace VEPROMS.CSLA.Library
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
if(_MyLog.IsErrorEnabled)_MyLog.Error("Group.DataPortal_Fetch", ex);
|
||||
if (_MyLog.IsErrorEnabled) _MyLog.Error("Group.DataPortal_Fetch", ex);
|
||||
_ErrorMessage = ex.Message;
|
||||
throw new DbCslaException("Group.DataPortal_Fetch", ex);
|
||||
}
|
||||
}
|
||||
private void DataPortal_Fetch(GroupNameCriteria criteria)
|
||||
{
|
||||
if(_MyLog.IsDebugEnabled)_MyLog.DebugFormat("[{0}] Group.DataPortal_Fetch", GetHashCode());
|
||||
if (_MyLog.IsDebugEnabled) _MyLog.DebugFormat("[{0}] Group.DataPortal_Fetch", GetHashCode());
|
||||
try
|
||||
{
|
||||
using (SqlConnection cn = Database.VEPROMS_SqlConnection)
|
||||
@ -746,7 +766,7 @@ namespace VEPROMS.CSLA.Library
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
if(_MyLog.IsErrorEnabled)_MyLog.Error("Group.DataPortal_Fetch", ex);
|
||||
if (_MyLog.IsErrorEnabled) _MyLog.Error("Group.DataPortal_Fetch", ex);
|
||||
_ErrorMessage = ex.Message;
|
||||
throw new DbCslaException("Group.DataPortal_Fetch", ex);
|
||||
}
|
||||
@ -767,13 +787,13 @@ namespace VEPROMS.CSLA.Library
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
if(_MyLog.IsErrorEnabled)_MyLog.Error("Group.DataPortal_Insert", ex);
|
||||
if (_MyLog.IsErrorEnabled) _MyLog.Error("Group.DataPortal_Insert", ex);
|
||||
_ErrorMessage = ex.Message;
|
||||
throw new DbCslaException("Group.DataPortal_Insert", ex);
|
||||
}
|
||||
finally
|
||||
{
|
||||
if(_MyLog.IsDebugEnabled)_MyLog.DebugFormat("[{0}] Group.DataPortal_Insert", GetHashCode());
|
||||
if (_MyLog.IsDebugEnabled) _MyLog.DebugFormat("[{0}] Group.DataPortal_Insert", GetHashCode());
|
||||
}
|
||||
}
|
||||
[Transactional(TransactionalTypes.TransactionScope)]
|
||||
@ -810,11 +830,11 @@ namespace VEPROMS.CSLA.Library
|
||||
// update child objects
|
||||
if (_GroupAssignments != null) _GroupAssignments.Update(this);
|
||||
if (_GroupMemberships != null) _GroupMemberships.Update(this);
|
||||
if(_MyLog.IsDebugEnabled)_MyLog.DebugFormat("[{0}] Group.SQLInsert", GetHashCode());
|
||||
if (_MyLog.IsDebugEnabled) _MyLog.DebugFormat("[{0}] Group.SQLInsert", GetHashCode());
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
if(_MyLog.IsErrorEnabled)_MyLog.Error("Group.SQLInsert", ex);
|
||||
if (_MyLog.IsErrorEnabled) _MyLog.Error("Group.SQLInsert", ex);
|
||||
_ErrorMessage = ex.Message;
|
||||
throw new DbCslaException("Group.SQLInsert", ex);
|
||||
}
|
||||
@ -822,7 +842,7 @@ namespace VEPROMS.CSLA.Library
|
||||
[Transactional(TransactionalTypes.TransactionScope)]
|
||||
public static byte[] Add(SqlConnection cn, ref int gid, string groupName, int? groupType, string config, DateTime dts, string usrID)
|
||||
{
|
||||
if(_MyLog.IsDebugEnabled)_MyLog.DebugFormat("[{0}] Group.Add", 0);
|
||||
if (_MyLog.IsDebugEnabled) _MyLog.DebugFormat("[{0}] Group.Add", 0);
|
||||
try
|
||||
{
|
||||
using (SqlCommand cm = cn.CreateCommand())
|
||||
@ -851,7 +871,7 @@ namespace VEPROMS.CSLA.Library
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
if(_MyLog.IsErrorEnabled)_MyLog.Error("Group.Add", ex);
|
||||
if (_MyLog.IsErrorEnabled) _MyLog.Error("Group.Add", ex);
|
||||
throw new DbCslaException("Group.Add", ex);
|
||||
}
|
||||
}
|
||||
@ -859,7 +879,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}] Group.DataPortal_Update", GetHashCode());
|
||||
if (_MyLog.IsDebugEnabled) _MyLog.DebugFormat("[{0}] Group.DataPortal_Update", GetHashCode());
|
||||
try
|
||||
{
|
||||
using (SqlConnection cn = Database.VEPROMS_SqlConnection)
|
||||
@ -873,7 +893,7 @@ namespace VEPROMS.CSLA.Library
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
if(_MyLog.IsErrorEnabled)_MyLog.Error("Group.DataPortal_Update", ex);
|
||||
if (_MyLog.IsErrorEnabled) _MyLog.Error("Group.DataPortal_Update", ex);
|
||||
_ErrorMessage = ex.Message;
|
||||
if (!ex.Message.EndsWith("has been edited by another user.")) throw ex;
|
||||
}
|
||||
@ -882,7 +902,7 @@ namespace VEPROMS.CSLA.Library
|
||||
internal void SQLUpdate()
|
||||
{
|
||||
if (!IsDirty) return; // If not dirty - nothing to do
|
||||
if(_MyLog.IsDebugEnabled)_MyLog.DebugFormat("[{0}] Group.SQLUpdate", GetHashCode());
|
||||
if (_MyLog.IsDebugEnabled) _MyLog.DebugFormat("[{0}] Group.SQLUpdate", GetHashCode());
|
||||
try
|
||||
{
|
||||
SqlConnection cn = (SqlConnection)ApplicationContext.LocalContext["cn"];
|
||||
@ -917,7 +937,7 @@ namespace VEPROMS.CSLA.Library
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
if(_MyLog.IsErrorEnabled)_MyLog.Error("Group.SQLUpdate", ex);
|
||||
if (_MyLog.IsErrorEnabled) _MyLog.Error("Group.SQLUpdate", ex);
|
||||
_ErrorMessage = ex.Message;
|
||||
if (!ex.Message.EndsWith("has been edited by another user.")) throw ex;
|
||||
}
|
||||
@ -940,7 +960,7 @@ namespace VEPROMS.CSLA.Library
|
||||
[Transactional(TransactionalTypes.TransactionScope)]
|
||||
public static byte[] Update(SqlConnection cn, ref int gid, string groupName, int? groupType, string config, DateTime dts, string usrID, ref byte[] lastChanged)
|
||||
{
|
||||
if(_MyLog.IsDebugEnabled)_MyLog.DebugFormat("[{0}] Group.Update", 0);
|
||||
if (_MyLog.IsDebugEnabled) _MyLog.DebugFormat("[{0}] Group.Update", 0);
|
||||
try
|
||||
{
|
||||
using (SqlCommand cm = cn.CreateCommand())
|
||||
@ -967,7 +987,7 @@ namespace VEPROMS.CSLA.Library
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
if(_MyLog.IsErrorEnabled)_MyLog.Error("Group.Update", ex);
|
||||
if (_MyLog.IsErrorEnabled) _MyLog.Error("Group.Update", ex);
|
||||
throw new DbCslaException("Group.Update", ex);
|
||||
}
|
||||
}
|
||||
@ -979,7 +999,7 @@ namespace VEPROMS.CSLA.Library
|
||||
[Transactional(TransactionalTypes.TransactionScope)]
|
||||
private void DataPortal_Delete(PKCriteria criteria)
|
||||
{
|
||||
if(_MyLog.IsDebugEnabled)_MyLog.DebugFormat("[{0}] Group.DataPortal_Delete", GetHashCode());
|
||||
if (_MyLog.IsDebugEnabled) _MyLog.DebugFormat("[{0}] Group.DataPortal_Delete", GetHashCode());
|
||||
try
|
||||
{
|
||||
using (SqlConnection cn = Database.VEPROMS_SqlConnection)
|
||||
@ -995,7 +1015,7 @@ namespace VEPROMS.CSLA.Library
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
if(_MyLog.IsErrorEnabled)_MyLog.Error("Group.DataPortal_Delete", ex);
|
||||
if (_MyLog.IsErrorEnabled) _MyLog.Error("Group.DataPortal_Delete", ex);
|
||||
_ErrorMessage = ex.Message;
|
||||
throw new DbCslaException("Group.DataPortal_Delete", ex);
|
||||
}
|
||||
@ -1003,7 +1023,7 @@ namespace VEPROMS.CSLA.Library
|
||||
[Transactional(TransactionalTypes.TransactionScope)]
|
||||
public static void Remove(SqlConnection cn, int gid)
|
||||
{
|
||||
if(_MyLog.IsDebugEnabled)_MyLog.DebugFormat("[{0}] Group.Remove", 0);
|
||||
if (_MyLog.IsDebugEnabled) _MyLog.DebugFormat("[{0}] Group.Remove", 0);
|
||||
try
|
||||
{
|
||||
using (SqlCommand cm = cn.CreateCommand())
|
||||
@ -1018,7 +1038,7 @@ namespace VEPROMS.CSLA.Library
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
if(_MyLog.IsErrorEnabled)_MyLog.Error("Group.Remove", ex);
|
||||
if (_MyLog.IsErrorEnabled) _MyLog.Error("Group.Remove", ex);
|
||||
throw new DbCslaException("Group.Remove", ex);
|
||||
}
|
||||
}
|
||||
@ -1052,7 +1072,7 @@ namespace VEPROMS.CSLA.Library
|
||||
}
|
||||
protected override void DataPortal_Execute()
|
||||
{
|
||||
if(_MyLog.IsDebugEnabled)_MyLog.DebugFormat("[{0}] Group.DataPortal_Execute", GetHashCode());
|
||||
if (_MyLog.IsDebugEnabled) _MyLog.DebugFormat("[{0}] Group.DataPortal_Execute", GetHashCode());
|
||||
try
|
||||
{
|
||||
using (SqlConnection cn = Database.VEPROMS_SqlConnection)
|
||||
@ -1070,7 +1090,7 @@ namespace VEPROMS.CSLA.Library
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
if(_MyLog.IsErrorEnabled)_MyLog.Error("Group.DataPortal_Execute", ex);
|
||||
if (_MyLog.IsErrorEnabled) _MyLog.Error("Group.DataPortal_Execute", ex);
|
||||
throw new DbCslaException("Group.DataPortal_Execute", ex);
|
||||
}
|
||||
}
|
||||
|
@ -42,7 +42,7 @@ namespace VEPROMS.CSLA.Library
|
||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||
get
|
||||
{
|
||||
CanReadProperty("AID",true);
|
||||
CanReadProperty("AID", true);
|
||||
if (_MyAssignment != null) _AID = _MyAssignment.AID;
|
||||
return _AID;
|
||||
}
|
||||
@ -54,7 +54,7 @@ namespace VEPROMS.CSLA.Library
|
||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||
get
|
||||
{
|
||||
CanReadProperty("MyAssignment",true);
|
||||
CanReadProperty("MyAssignment", true);
|
||||
if (_MyAssignment == null && _AID != 0) _MyAssignment = Assignment.Get(_AID);
|
||||
return _MyAssignment;
|
||||
}
|
||||
@ -65,7 +65,7 @@ namespace VEPROMS.CSLA.Library
|
||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||
get
|
||||
{
|
||||
CanReadProperty("RID",true);
|
||||
CanReadProperty("RID", true);
|
||||
if (_MyRole != null) _RID = _MyRole.RID;
|
||||
return _RID;
|
||||
}
|
||||
@ -76,14 +76,14 @@ namespace VEPROMS.CSLA.Library
|
||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||
get
|
||||
{
|
||||
CanReadProperty("MyRole",true);
|
||||
CanReadProperty("MyRole", true);
|
||||
if (_MyRole == null && _RID != 0) _MyRole = Role.Get(_RID);
|
||||
return _MyRole;
|
||||
}
|
||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||
set
|
||||
{
|
||||
CanWriteProperty("MyRole",true);
|
||||
CanWriteProperty("MyRole", true);
|
||||
if (_MyRole != value)
|
||||
{
|
||||
_MyRole = value;
|
||||
@ -97,7 +97,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;
|
||||
}
|
||||
@ -108,14 +108,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;
|
||||
@ -129,13 +129,13 @@ namespace VEPROMS.CSLA.Library
|
||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||
get
|
||||
{
|
||||
CanReadProperty("StartDate",true);
|
||||
CanReadProperty("StartDate", true);
|
||||
return _StartDate;
|
||||
}
|
||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||
set
|
||||
{
|
||||
CanWriteProperty("StartDate",true);
|
||||
CanWriteProperty("StartDate", true);
|
||||
if (value == null) value = string.Empty;
|
||||
_StartDate = value;
|
||||
try
|
||||
@ -159,13 +159,13 @@ namespace VEPROMS.CSLA.Library
|
||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||
get
|
||||
{
|
||||
CanReadProperty("EndDate",true);
|
||||
CanReadProperty("EndDate", true);
|
||||
return _EndDate;
|
||||
}
|
||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||
set
|
||||
{
|
||||
CanWriteProperty("EndDate",true);
|
||||
CanWriteProperty("EndDate", true);
|
||||
if (value == null) value = string.Empty;
|
||||
_EndDate = value;
|
||||
try
|
||||
@ -189,13 +189,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;
|
||||
@ -209,13 +209,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)
|
||||
{
|
||||
@ -231,7 +231,7 @@ namespace VEPROMS.CSLA.Library
|
||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||
get
|
||||
{
|
||||
CanReadProperty("Folder_ParentID",true);
|
||||
CanReadProperty("Folder_ParentID", true);
|
||||
return _Folder_ParentID;
|
||||
}
|
||||
}
|
||||
@ -241,7 +241,7 @@ namespace VEPROMS.CSLA.Library
|
||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||
get
|
||||
{
|
||||
CanReadProperty("Folder_DBID",true);
|
||||
CanReadProperty("Folder_DBID", true);
|
||||
return _Folder_DBID;
|
||||
}
|
||||
}
|
||||
@ -251,7 +251,7 @@ namespace VEPROMS.CSLA.Library
|
||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||
get
|
||||
{
|
||||
CanReadProperty("Folder_Name",true);
|
||||
CanReadProperty("Folder_Name", true);
|
||||
return _Folder_Name;
|
||||
}
|
||||
}
|
||||
@ -261,7 +261,7 @@ namespace VEPROMS.CSLA.Library
|
||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||
get
|
||||
{
|
||||
CanReadProperty("Folder_Title",true);
|
||||
CanReadProperty("Folder_Title", true);
|
||||
return _Folder_Title;
|
||||
}
|
||||
}
|
||||
@ -271,7 +271,7 @@ namespace VEPROMS.CSLA.Library
|
||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||
get
|
||||
{
|
||||
CanReadProperty("Folder_ShortName",true);
|
||||
CanReadProperty("Folder_ShortName", true);
|
||||
return _Folder_ShortName;
|
||||
}
|
||||
}
|
||||
@ -281,7 +281,7 @@ namespace VEPROMS.CSLA.Library
|
||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||
get
|
||||
{
|
||||
CanReadProperty("Folder_FormatID",true);
|
||||
CanReadProperty("Folder_FormatID", true);
|
||||
return _Folder_FormatID;
|
||||
}
|
||||
}
|
||||
@ -291,7 +291,7 @@ namespace VEPROMS.CSLA.Library
|
||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||
get
|
||||
{
|
||||
CanReadProperty("Folder_Config",true);
|
||||
CanReadProperty("Folder_Config", true);
|
||||
return _Folder_Config;
|
||||
}
|
||||
}
|
||||
@ -301,7 +301,7 @@ namespace VEPROMS.CSLA.Library
|
||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||
get
|
||||
{
|
||||
CanReadProperty("Folder_DTS",true);
|
||||
CanReadProperty("Folder_DTS", true);
|
||||
return _Folder_DTS;
|
||||
}
|
||||
}
|
||||
@ -311,7 +311,7 @@ namespace VEPROMS.CSLA.Library
|
||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||
get
|
||||
{
|
||||
CanReadProperty("Folder_UsrID",true);
|
||||
CanReadProperty("Folder_UsrID", true);
|
||||
return _Folder_UsrID;
|
||||
}
|
||||
}
|
||||
@ -321,7 +321,7 @@ namespace VEPROMS.CSLA.Library
|
||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||
get
|
||||
{
|
||||
CanReadProperty("Role_Name",true);
|
||||
CanReadProperty("Role_Name", true);
|
||||
return _Role_Name;
|
||||
}
|
||||
}
|
||||
@ -331,7 +331,7 @@ namespace VEPROMS.CSLA.Library
|
||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||
get
|
||||
{
|
||||
CanReadProperty("Role_Title",true);
|
||||
CanReadProperty("Role_Title", true);
|
||||
return _Role_Title;
|
||||
}
|
||||
}
|
||||
@ -341,7 +341,7 @@ namespace VEPROMS.CSLA.Library
|
||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||
get
|
||||
{
|
||||
CanReadProperty("Role_DTS",true);
|
||||
CanReadProperty("Role_DTS", true);
|
||||
return _Role_DTS;
|
||||
}
|
||||
}
|
||||
@ -351,7 +351,7 @@ namespace VEPROMS.CSLA.Library
|
||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||
get
|
||||
{
|
||||
CanReadProperty("Role_UsrID",true);
|
||||
CanReadProperty("Role_UsrID", true);
|
||||
return _Role_UsrID;
|
||||
}
|
||||
}
|
||||
@ -384,16 +384,16 @@ namespace VEPROMS.CSLA.Library
|
||||
#endregion
|
||||
#region ValidationRules
|
||||
[NonSerialized]
|
||||
private bool _CheckingBrokenRules=false;
|
||||
private bool _CheckingBrokenRules = false;
|
||||
public IVEHasBrokenRules HasBrokenRules
|
||||
{
|
||||
get
|
||||
{
|
||||
if(_CheckingBrokenRules)return null;
|
||||
if (_CheckingBrokenRules) return null;
|
||||
if (BrokenRulesCollection.Count > 0) return this;
|
||||
try
|
||||
{
|
||||
_CheckingBrokenRules=true;
|
||||
_CheckingBrokenRules = true;
|
||||
IVEHasBrokenRules hasBrokenRules = null;
|
||||
if (_MyRole != null && (hasBrokenRules = _MyRole.HasBrokenRules) != null) return hasBrokenRules;
|
||||
if (_MyFolder != null && (hasBrokenRules = _MyFolder.HasBrokenRules) != null) return hasBrokenRules;
|
||||
@ -401,7 +401,7 @@ namespace VEPROMS.CSLA.Library
|
||||
}
|
||||
finally
|
||||
{
|
||||
_CheckingBrokenRules=false;
|
||||
_CheckingBrokenRules = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -570,7 +570,7 @@ namespace VEPROMS.CSLA.Library
|
||||
#region Data Access Portal
|
||||
private void Fetch(SafeDataReader dr)
|
||||
{
|
||||
if(_MyLog.IsDebugEnabled)_MyLog.DebugFormat("[{0}] GroupAssignment.FetchDR", GetHashCode());
|
||||
if (_MyLog.IsDebugEnabled) _MyLog.DebugFormat("[{0}] GroupAssignment.FetchDR", GetHashCode());
|
||||
try
|
||||
{
|
||||
_AID = dr.GetInt32("AID");
|
||||
@ -597,7 +597,7 @@ namespace VEPROMS.CSLA.Library
|
||||
}
|
||||
catch (Exception ex) // FKItem Fetch
|
||||
{
|
||||
if(_MyLog.IsErrorEnabled)_MyLog.Error("GroupAssignment.FetchDR", ex);
|
||||
if (_MyLog.IsErrorEnabled) _MyLog.Error("GroupAssignment.FetchDR", ex);
|
||||
throw new DbCslaException("GroupAssignment.Fetch", ex);
|
||||
}
|
||||
MarkOld();
|
||||
|
@ -94,8 +94,8 @@ namespace VEPROMS.CSLA.Library
|
||||
{
|
||||
get
|
||||
{
|
||||
IVEHasBrokenRules hasBrokenRules=null;
|
||||
foreach(GroupAssignment groupAssignment in this)
|
||||
IVEHasBrokenRules hasBrokenRules = null;
|
||||
foreach (GroupAssignment groupAssignment in this)
|
||||
if ((hasBrokenRules = groupAssignment.HasBrokenRules) != null) return hasBrokenRules;
|
||||
return hasBrokenRules;
|
||||
}
|
||||
@ -165,7 +165,7 @@ namespace VEPROMS.CSLA.Library
|
||||
private void DataPortal_Fetch(GIDCriteria criteria)
|
||||
{
|
||||
this.RaiseListChangedEvents = false;
|
||||
if(_MyLog.IsDebugEnabled)_MyLog.DebugFormat("[{0}] GroupAssignments.DataPortal_FetchGID", GetHashCode());
|
||||
if (_MyLog.IsDebugEnabled) _MyLog.DebugFormat("[{0}] GroupAssignments.DataPortal_FetchGID", GetHashCode());
|
||||
try
|
||||
{
|
||||
using (SqlConnection cn = Database.VEPROMS_SqlConnection)
|
||||
@ -184,7 +184,7 @@ namespace VEPROMS.CSLA.Library
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
if(_MyLog.IsErrorEnabled)_MyLog.Error("GroupAssignments.DataPortal_FetchGID", ex);
|
||||
if (_MyLog.IsErrorEnabled) _MyLog.Error("GroupAssignments.DataPortal_FetchGID", ex);
|
||||
throw new DbCslaException("GroupAssignments.DataPortal_Fetch", ex);
|
||||
}
|
||||
this.RaiseListChangedEvents = true;
|
||||
@ -269,8 +269,8 @@ namespace VEPROMS.CSLA.Library
|
||||
/// </summary>
|
||||
public partial class GroupAssignmentsPropertyDescriptor : vlnListPropertyDescriptor
|
||||
{
|
||||
private GroupAssignment Item { get { return (GroupAssignment) _Item;} }
|
||||
public GroupAssignmentsPropertyDescriptor(GroupAssignments collection, int index):base(collection, index){;}
|
||||
private GroupAssignment Item { get { return (GroupAssignment)_Item; } }
|
||||
public GroupAssignmentsPropertyDescriptor(GroupAssignments collection, int index) : base(collection, index) { ;}
|
||||
}
|
||||
#endregion
|
||||
#region Converter
|
||||
@ -281,7 +281,7 @@ namespace VEPROMS.CSLA.Library
|
||||
if (destType == typeof(string) && value is GroupAssignments)
|
||||
{
|
||||
// Return department and department role separated by comma.
|
||||
return ((GroupAssignments) value).Items.Count.ToString() + " Assignments";
|
||||
return ((GroupAssignments)value).Items.Count.ToString() + " Assignments";
|
||||
}
|
||||
return base.ConvertTo(context, culture, value, destType);
|
||||
}
|
||||
|
@ -37,13 +37,17 @@ namespace VEPROMS.CSLA.Library
|
||||
#endregion
|
||||
#region Collection
|
||||
protected static List<GroupInfo> _AllList = new List<GroupInfo>();
|
||||
private static Dictionary<string, GroupInfo> _AllByPrimaryKey = new Dictionary<string, GroupInfo>();
|
||||
private static Dictionary<string, List<GroupInfo>> _AllByPrimaryKey = new Dictionary<string, List<GroupInfo>>();
|
||||
private static void ConvertListToDictionary()
|
||||
{
|
||||
List<GroupInfo> remove = new List<GroupInfo>();
|
||||
foreach (GroupInfo tmp in _AllList)
|
||||
{
|
||||
_AllByPrimaryKey[tmp.GID.ToString()]=tmp; // Primary Key
|
||||
if (!_AllByPrimaryKey.ContainsKey(tmp.GID.ToString()))
|
||||
{
|
||||
_AllByPrimaryKey[tmp.GID.ToString()] = new List<GroupInfo>(); // Add new list for PrimaryKey
|
||||
}
|
||||
_AllByPrimaryKey[tmp.GID.ToString()].Add(tmp); // Add to Primary Key list
|
||||
remove.Add(tmp);
|
||||
}
|
||||
foreach (GroupInfo tmp in remove)
|
||||
@ -57,7 +61,7 @@ namespace VEPROMS.CSLA.Library
|
||||
{
|
||||
ConvertListToDictionary();
|
||||
string key = gid.ToString();
|
||||
if (_AllByPrimaryKey.ContainsKey(key)) return _AllByPrimaryKey[key];
|
||||
if (_AllByPrimaryKey.ContainsKey(key)) return _AllByPrimaryKey[key][0];
|
||||
return null;
|
||||
}
|
||||
#endregion
|
||||
@ -85,7 +89,7 @@ namespace VEPROMS.CSLA.Library
|
||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||
get
|
||||
{
|
||||
CanReadProperty("GID",true);
|
||||
CanReadProperty("GID", true);
|
||||
return _GID;
|
||||
}
|
||||
}
|
||||
@ -95,7 +99,7 @@ namespace VEPROMS.CSLA.Library
|
||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||
get
|
||||
{
|
||||
CanReadProperty("GroupName",true);
|
||||
CanReadProperty("GroupName", true);
|
||||
return _GroupName;
|
||||
}
|
||||
}
|
||||
@ -105,7 +109,7 @@ namespace VEPROMS.CSLA.Library
|
||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||
get
|
||||
{
|
||||
CanReadProperty("GroupType",true);
|
||||
CanReadProperty("GroupType", true);
|
||||
return _GroupType;
|
||||
}
|
||||
}
|
||||
@ -115,7 +119,7 @@ namespace VEPROMS.CSLA.Library
|
||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||
get
|
||||
{
|
||||
CanReadProperty("Config",true);
|
||||
CanReadProperty("Config", true);
|
||||
return _Config;
|
||||
}
|
||||
}
|
||||
@ -125,7 +129,7 @@ namespace VEPROMS.CSLA.Library
|
||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||
get
|
||||
{
|
||||
CanReadProperty("DTS",true);
|
||||
CanReadProperty("DTS", true);
|
||||
return _DTS;
|
||||
}
|
||||
}
|
||||
@ -135,7 +139,7 @@ namespace VEPROMS.CSLA.Library
|
||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||
get
|
||||
{
|
||||
CanReadProperty("UsrID",true);
|
||||
CanReadProperty("UsrID", true);
|
||||
return _UsrID;
|
||||
}
|
||||
}
|
||||
@ -148,7 +152,7 @@ namespace VEPROMS.CSLA.Library
|
||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||
get
|
||||
{
|
||||
CanReadProperty("GroupAssignmentCount",true);
|
||||
CanReadProperty("GroupAssignmentCount", true);
|
||||
return _GroupAssignmentCount;
|
||||
}
|
||||
}
|
||||
@ -159,7 +163,7 @@ namespace VEPROMS.CSLA.Library
|
||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||
get
|
||||
{
|
||||
CanReadProperty("GroupAssignments",true);
|
||||
CanReadProperty("GroupAssignments", true);
|
||||
if (_GroupAssignmentCount < 0 || (_GroupAssignmentCount > 0 && _GroupAssignments == null))
|
||||
_GroupAssignments = AssignmentInfoList.GetByGID(_GID);
|
||||
if (_GroupAssignmentCount < 0)
|
||||
@ -169,7 +173,10 @@ namespace VEPROMS.CSLA.Library
|
||||
}
|
||||
internal void RefreshGroupAssignments()
|
||||
{
|
||||
_GroupAssignmentCount = -1; // This will cause the data to be requeried
|
||||
ConvertListToDictionary();
|
||||
if (_AllByPrimaryKey.ContainsKey(_GID.ToString()))
|
||||
foreach (GroupInfo tmp in _AllByPrimaryKey[_GID.ToString()])
|
||||
tmp._GroupAssignmentCount = -1; // This will cause the data to be requeried
|
||||
}
|
||||
private int _GroupMembershipCount = 0;
|
||||
/// <summary>
|
||||
@ -180,7 +187,7 @@ namespace VEPROMS.CSLA.Library
|
||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||
get
|
||||
{
|
||||
CanReadProperty("GroupMembershipCount",true);
|
||||
CanReadProperty("GroupMembershipCount", true);
|
||||
return _GroupMembershipCount;
|
||||
}
|
||||
}
|
||||
@ -191,7 +198,7 @@ namespace VEPROMS.CSLA.Library
|
||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||
get
|
||||
{
|
||||
CanReadProperty("GroupMemberships",true);
|
||||
CanReadProperty("GroupMemberships", true);
|
||||
if (_GroupMembershipCount < 0 || (_GroupMembershipCount > 0 && _GroupMemberships == null))
|
||||
_GroupMemberships = MembershipInfoList.GetByGID(_GID);
|
||||
if (_GroupMembershipCount < 0)
|
||||
@ -201,7 +208,10 @@ namespace VEPROMS.CSLA.Library
|
||||
}
|
||||
internal void RefreshGroupMemberships()
|
||||
{
|
||||
_GroupMembershipCount = -1; // This will cause the data to be requeried
|
||||
ConvertListToDictionary();
|
||||
if (_AllByPrimaryKey.ContainsKey(_GID.ToString()))
|
||||
foreach (GroupInfo tmp in _AllByPrimaryKey[_GID.ToString()])
|
||||
tmp._GroupMembershipCount = -1; // This will cause the data to be requeried
|
||||
}
|
||||
// TODO: Replace base GroupInfo.ToString function as necessary
|
||||
/// <summary>
|
||||
@ -223,14 +233,25 @@ namespace VEPROMS.CSLA.Library
|
||||
}
|
||||
#endregion
|
||||
#region Factory Methods
|
||||
private static int _GroupInfoUnique = 0;
|
||||
private int _MyGroupInfoUnique;
|
||||
public int MyGroupInfoUnique
|
||||
{
|
||||
get { return _MyGroupInfoUnique; }
|
||||
}
|
||||
private GroupInfo()
|
||||
{/* require use of factory methods */
|
||||
_MyGroupInfoUnique = ++_GroupInfoUnique;
|
||||
_AllList.Add(this);
|
||||
}
|
||||
public void Dispose()
|
||||
{
|
||||
_AllList.Remove(this);
|
||||
_AllByPrimaryKey.Remove(GID.ToString());
|
||||
if (!_AllByPrimaryKey.ContainsKey(GID.ToString())) return;
|
||||
List<GroupInfo> listGroupInfo = _AllByPrimaryKey[GID.ToString()]; // Get the list of items
|
||||
listGroupInfo.Remove(this); // Remove the item from the list
|
||||
if (listGroupInfo.Count == 0) // If there are no items left in the list
|
||||
_AllByPrimaryKey.Remove(GID.ToString()); // remove the list
|
||||
}
|
||||
public virtual Group Get()
|
||||
{
|
||||
@ -238,8 +259,10 @@ namespace VEPROMS.CSLA.Library
|
||||
}
|
||||
public static void Refresh(Group tmp)
|
||||
{
|
||||
GroupInfo tmpInfo = GetExistingByPrimaryKey(tmp.GID);
|
||||
if (tmpInfo == null) return;
|
||||
string key = tmp.GID.ToString();
|
||||
ConvertListToDictionary();
|
||||
if (_AllByPrimaryKey.ContainsKey(key))
|
||||
foreach (GroupInfo tmpInfo in _AllByPrimaryKey[key])
|
||||
tmpInfo.RefreshFields(tmp);
|
||||
}
|
||||
private void RefreshFields(Group tmp)
|
||||
@ -262,7 +285,7 @@ namespace VEPROMS.CSLA.Library
|
||||
if (tmp == null)
|
||||
{
|
||||
tmp = DataPortal.Fetch<GroupInfo>(new PKCriteria(gid));
|
||||
_AllList.Add(tmp);
|
||||
if (!_AllList.Contains(tmp)) _AllList.Add(tmp);
|
||||
}
|
||||
if (tmp.ErrorMessage == "No Record Found") tmp = null;
|
||||
return tmp;
|
||||
@ -276,14 +299,15 @@ namespace VEPROMS.CSLA.Library
|
||||
#region Data Access Portal
|
||||
internal GroupInfo(SafeDataReader dr)
|
||||
{
|
||||
if(_MyLog.IsDebugEnabled)_MyLog.DebugFormat("[{0}] GroupInfo.Constructor", GetHashCode());
|
||||
_MyGroupInfoUnique = ++_GroupInfoUnique;
|
||||
if (_MyLog.IsDebugEnabled) _MyLog.DebugFormat("[{0}] GroupInfo.Constructor", GetHashCode());
|
||||
try
|
||||
{
|
||||
ReadData(dr);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
if(_MyLog.IsErrorEnabled)_MyLog.Error("GroupInfo.Constructor", ex);
|
||||
if (_MyLog.IsErrorEnabled) _MyLog.Error("GroupInfo.Constructor", ex);
|
||||
throw new DbCslaException("GroupInfo.Constructor", ex);
|
||||
}
|
||||
}
|
||||
@ -300,7 +324,7 @@ namespace VEPROMS.CSLA.Library
|
||||
}
|
||||
private void ReadData(SafeDataReader dr)
|
||||
{
|
||||
if(_MyLog.IsDebugEnabled)_MyLog.DebugFormat("[{0}] GroupInfo.ReadData", GetHashCode());
|
||||
if (_MyLog.IsDebugEnabled) _MyLog.DebugFormat("[{0}] GroupInfo.ReadData", GetHashCode());
|
||||
try
|
||||
{
|
||||
_GID = dr.GetInt32("GID");
|
||||
@ -314,14 +338,14 @@ namespace VEPROMS.CSLA.Library
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
if(_MyLog.IsErrorEnabled)_MyLog.Error("GroupInfo.ReadData", ex);
|
||||
if (_MyLog.IsErrorEnabled) _MyLog.Error("GroupInfo.ReadData", ex);
|
||||
_ErrorMessage = ex.Message;
|
||||
throw new DbCslaException("GroupInfo.ReadData", ex);
|
||||
}
|
||||
}
|
||||
private void DataPortal_Fetch(PKCriteria criteria)
|
||||
{
|
||||
if(_MyLog.IsDebugEnabled)_MyLog.DebugFormat("[{0}] GroupInfo.DataPortal_Fetch", GetHashCode());
|
||||
if (_MyLog.IsDebugEnabled) _MyLog.DebugFormat("[{0}] GroupInfo.DataPortal_Fetch", GetHashCode());
|
||||
try
|
||||
{
|
||||
using (SqlConnection cn = Database.VEPROMS_SqlConnection)
|
||||
@ -349,7 +373,7 @@ namespace VEPROMS.CSLA.Library
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
if(_MyLog.IsErrorEnabled)_MyLog.Error("GroupInfo.DataPortal_Fetch", ex);
|
||||
if (_MyLog.IsErrorEnabled) _MyLog.Error("GroupInfo.DataPortal_Fetch", ex);
|
||||
_ErrorMessage = ex.Message;
|
||||
throw new DbCslaException("GroupInfo.DataPortal_Fetch", ex);
|
||||
}
|
||||
@ -359,7 +383,7 @@ namespace VEPROMS.CSLA.Library
|
||||
#region extension
|
||||
GroupInfoExtension _GroupInfoExtension = new GroupInfoExtension();
|
||||
[Serializable()]
|
||||
partial class GroupInfoExtension : extensionBase {}
|
||||
partial class GroupInfoExtension : extensionBase { }
|
||||
[Serializable()]
|
||||
class extensionBase
|
||||
{
|
||||
|
@ -96,7 +96,7 @@ namespace VEPROMS.CSLA.Library
|
||||
private void DataPortal_Fetch()
|
||||
{
|
||||
this.RaiseListChangedEvents = false;
|
||||
if(_MyLog.IsDebugEnabled)_MyLog.DebugFormat("[{0}] GroupInfoList.DataPortal_Fetch", GetHashCode());
|
||||
if (_MyLog.IsDebugEnabled) _MyLog.DebugFormat("[{0}] GroupInfoList.DataPortal_Fetch", GetHashCode());
|
||||
try
|
||||
{
|
||||
using (SqlConnection cn = Database.VEPROMS_SqlConnection)
|
||||
@ -116,7 +116,7 @@ namespace VEPROMS.CSLA.Library
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
if(_MyLog.IsErrorEnabled)_MyLog.Error("GroupInfoList.DataPortal_Fetch", ex);
|
||||
if (_MyLog.IsErrorEnabled) _MyLog.Error("GroupInfoList.DataPortal_Fetch", ex);
|
||||
throw new DbCslaException("GroupInfoList.DataPortal_Fetch", ex);
|
||||
}
|
||||
this.RaiseListChangedEvents = true;
|
||||
@ -177,8 +177,8 @@ namespace VEPROMS.CSLA.Library
|
||||
/// </summary>
|
||||
public partial class GroupInfoListPropertyDescriptor : vlnListPropertyDescriptor
|
||||
{
|
||||
private GroupInfo Item { get { return (GroupInfo) _Item;} }
|
||||
public GroupInfoListPropertyDescriptor(GroupInfoList collection, int index):base(collection, index){;}
|
||||
private GroupInfo Item { get { return (GroupInfo)_Item; } }
|
||||
public GroupInfoListPropertyDescriptor(GroupInfoList collection, int index) : base(collection, index) { ;}
|
||||
}
|
||||
#endregion
|
||||
#region Converter
|
||||
@ -189,7 +189,7 @@ namespace VEPROMS.CSLA.Library
|
||||
if (destType == typeof(string) && value is GroupInfoList)
|
||||
{
|
||||
// Return department and department role separated by comma.
|
||||
return ((GroupInfoList) value).Items.Count.ToString() + " Groups";
|
||||
return ((GroupInfoList)value).Items.Count.ToString() + " Groups";
|
||||
}
|
||||
return base.ConvertTo(context, culture, value, destType);
|
||||
}
|
||||
|
@ -42,7 +42,7 @@ namespace VEPROMS.CSLA.Library
|
||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||
get
|
||||
{
|
||||
CanReadProperty("UGID",true);
|
||||
CanReadProperty("UGID", true);
|
||||
if (_MyMembership != null) _UGID = _MyMembership.UGID;
|
||||
return _UGID;
|
||||
}
|
||||
@ -54,7 +54,7 @@ namespace VEPROMS.CSLA.Library
|
||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||
get
|
||||
{
|
||||
CanReadProperty("MyMembership",true);
|
||||
CanReadProperty("MyMembership", true);
|
||||
if (_MyMembership == null && _UGID != 0) _MyMembership = Membership.Get(_UGID);
|
||||
return _MyMembership;
|
||||
}
|
||||
@ -65,7 +65,7 @@ namespace VEPROMS.CSLA.Library
|
||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||
get
|
||||
{
|
||||
CanReadProperty("UID",true);
|
||||
CanReadProperty("UID", true);
|
||||
if (_MyUser != null) _UID = _MyUser.UID;
|
||||
return _UID;
|
||||
}
|
||||
@ -76,14 +76,14 @@ namespace VEPROMS.CSLA.Library
|
||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||
get
|
||||
{
|
||||
CanReadProperty("MyUser",true);
|
||||
CanReadProperty("MyUser", true);
|
||||
if (_MyUser == null && _UID != 0) _MyUser = User.Get(_UID);
|
||||
return _MyUser;
|
||||
}
|
||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||
set
|
||||
{
|
||||
CanWriteProperty("MyUser",true);
|
||||
CanWriteProperty("MyUser", true);
|
||||
if (_MyUser != value)
|
||||
{
|
||||
_MyUser = value;
|
||||
@ -97,13 +97,13 @@ namespace VEPROMS.CSLA.Library
|
||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||
get
|
||||
{
|
||||
CanReadProperty("StartDate",true);
|
||||
CanReadProperty("StartDate", true);
|
||||
return _StartDate;
|
||||
}
|
||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||
set
|
||||
{
|
||||
CanWriteProperty("StartDate",true);
|
||||
CanWriteProperty("StartDate", true);
|
||||
if (value == null) value = string.Empty;
|
||||
_StartDate = value;
|
||||
try
|
||||
@ -127,13 +127,13 @@ namespace VEPROMS.CSLA.Library
|
||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||
get
|
||||
{
|
||||
CanReadProperty("EndDate",true);
|
||||
CanReadProperty("EndDate", true);
|
||||
return _EndDate;
|
||||
}
|
||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||
set
|
||||
{
|
||||
CanWriteProperty("EndDate",true);
|
||||
CanWriteProperty("EndDate", true);
|
||||
if (value == null) value = string.Empty;
|
||||
_EndDate = value;
|
||||
try
|
||||
@ -157,13 +157,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)
|
||||
{
|
||||
@ -178,13 +178,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;
|
||||
@ -198,13 +198,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)
|
||||
{
|
||||
@ -220,7 +220,7 @@ namespace VEPROMS.CSLA.Library
|
||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||
get
|
||||
{
|
||||
CanReadProperty("User_UserID",true);
|
||||
CanReadProperty("User_UserID", true);
|
||||
return _User_UserID;
|
||||
}
|
||||
}
|
||||
@ -230,7 +230,7 @@ namespace VEPROMS.CSLA.Library
|
||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||
get
|
||||
{
|
||||
CanReadProperty("User_FirstName",true);
|
||||
CanReadProperty("User_FirstName", true);
|
||||
return _User_FirstName;
|
||||
}
|
||||
}
|
||||
@ -240,7 +240,7 @@ namespace VEPROMS.CSLA.Library
|
||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||
get
|
||||
{
|
||||
CanReadProperty("User_MiddleName",true);
|
||||
CanReadProperty("User_MiddleName", true);
|
||||
return _User_MiddleName;
|
||||
}
|
||||
}
|
||||
@ -250,7 +250,7 @@ namespace VEPROMS.CSLA.Library
|
||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||
get
|
||||
{
|
||||
CanReadProperty("User_LastName",true);
|
||||
CanReadProperty("User_LastName", true);
|
||||
return _User_LastName;
|
||||
}
|
||||
}
|
||||
@ -260,7 +260,7 @@ namespace VEPROMS.CSLA.Library
|
||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||
get
|
||||
{
|
||||
CanReadProperty("User_Suffix",true);
|
||||
CanReadProperty("User_Suffix", true);
|
||||
return _User_Suffix;
|
||||
}
|
||||
}
|
||||
@ -270,7 +270,7 @@ namespace VEPROMS.CSLA.Library
|
||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||
get
|
||||
{
|
||||
CanReadProperty("User_CourtesyTitle",true);
|
||||
CanReadProperty("User_CourtesyTitle", true);
|
||||
return _User_CourtesyTitle;
|
||||
}
|
||||
}
|
||||
@ -280,7 +280,7 @@ namespace VEPROMS.CSLA.Library
|
||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||
get
|
||||
{
|
||||
CanReadProperty("User_PhoneNumber",true);
|
||||
CanReadProperty("User_PhoneNumber", true);
|
||||
return _User_PhoneNumber;
|
||||
}
|
||||
}
|
||||
@ -290,7 +290,7 @@ namespace VEPROMS.CSLA.Library
|
||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||
get
|
||||
{
|
||||
CanReadProperty("User_CFGName",true);
|
||||
CanReadProperty("User_CFGName", true);
|
||||
return _User_CFGName;
|
||||
}
|
||||
}
|
||||
@ -300,7 +300,7 @@ namespace VEPROMS.CSLA.Library
|
||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||
get
|
||||
{
|
||||
CanReadProperty("User_UserLogin",true);
|
||||
CanReadProperty("User_UserLogin", true);
|
||||
return _User_UserLogin;
|
||||
}
|
||||
}
|
||||
@ -310,7 +310,7 @@ namespace VEPROMS.CSLA.Library
|
||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||
get
|
||||
{
|
||||
CanReadProperty("User_UserName",true);
|
||||
CanReadProperty("User_UserName", true);
|
||||
return _User_UserName;
|
||||
}
|
||||
}
|
||||
@ -320,7 +320,7 @@ namespace VEPROMS.CSLA.Library
|
||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||
get
|
||||
{
|
||||
CanReadProperty("User_Config",true);
|
||||
CanReadProperty("User_Config", true);
|
||||
return _User_Config;
|
||||
}
|
||||
}
|
||||
@ -330,7 +330,7 @@ namespace VEPROMS.CSLA.Library
|
||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||
get
|
||||
{
|
||||
CanReadProperty("User_DTS",true);
|
||||
CanReadProperty("User_DTS", true);
|
||||
return _User_DTS;
|
||||
}
|
||||
}
|
||||
@ -340,7 +340,7 @@ namespace VEPROMS.CSLA.Library
|
||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||
get
|
||||
{
|
||||
CanReadProperty("User_UsrID",true);
|
||||
CanReadProperty("User_UsrID", true);
|
||||
return _User_UsrID;
|
||||
}
|
||||
}
|
||||
@ -373,23 +373,23 @@ namespace VEPROMS.CSLA.Library
|
||||
#endregion
|
||||
#region ValidationRules
|
||||
[NonSerialized]
|
||||
private bool _CheckingBrokenRules=false;
|
||||
private bool _CheckingBrokenRules = false;
|
||||
public IVEHasBrokenRules HasBrokenRules
|
||||
{
|
||||
get
|
||||
{
|
||||
if(_CheckingBrokenRules)return null;
|
||||
if (_CheckingBrokenRules) return null;
|
||||
if (BrokenRulesCollection.Count > 0) return this;
|
||||
try
|
||||
{
|
||||
_CheckingBrokenRules=true;
|
||||
_CheckingBrokenRules = true;
|
||||
IVEHasBrokenRules hasBrokenRules = null;
|
||||
if (_MyUser != null && (hasBrokenRules = _MyUser.HasBrokenRules) != null) return hasBrokenRules;
|
||||
return hasBrokenRules;
|
||||
}
|
||||
finally
|
||||
{
|
||||
_CheckingBrokenRules=false;
|
||||
_CheckingBrokenRules = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -550,7 +550,7 @@ namespace VEPROMS.CSLA.Library
|
||||
#region Data Access Portal
|
||||
private void Fetch(SafeDataReader dr)
|
||||
{
|
||||
if(_MyLog.IsDebugEnabled)_MyLog.DebugFormat("[{0}] GroupMembership.FetchDR", GetHashCode());
|
||||
if (_MyLog.IsDebugEnabled) _MyLog.DebugFormat("[{0}] GroupMembership.FetchDR", GetHashCode());
|
||||
try
|
||||
{
|
||||
_UGID = dr.GetInt32("UGID");
|
||||
@ -577,7 +577,7 @@ namespace VEPROMS.CSLA.Library
|
||||
}
|
||||
catch (Exception ex) // FKItem Fetch
|
||||
{
|
||||
if(_MyLog.IsErrorEnabled)_MyLog.Error("GroupMembership.FetchDR", ex);
|
||||
if (_MyLog.IsErrorEnabled) _MyLog.Error("GroupMembership.FetchDR", ex);
|
||||
throw new DbCslaException("GroupMembership.Fetch", ex);
|
||||
}
|
||||
MarkOld();
|
||||
|
@ -94,8 +94,8 @@ namespace VEPROMS.CSLA.Library
|
||||
{
|
||||
get
|
||||
{
|
||||
IVEHasBrokenRules hasBrokenRules=null;
|
||||
foreach(GroupMembership groupMembership in this)
|
||||
IVEHasBrokenRules hasBrokenRules = null;
|
||||
foreach (GroupMembership groupMembership in this)
|
||||
if ((hasBrokenRules = groupMembership.HasBrokenRules) != null) return hasBrokenRules;
|
||||
return hasBrokenRules;
|
||||
}
|
||||
@ -165,7 +165,7 @@ namespace VEPROMS.CSLA.Library
|
||||
private void DataPortal_Fetch(GIDCriteria criteria)
|
||||
{
|
||||
this.RaiseListChangedEvents = false;
|
||||
if(_MyLog.IsDebugEnabled)_MyLog.DebugFormat("[{0}] GroupMemberships.DataPortal_FetchGID", GetHashCode());
|
||||
if (_MyLog.IsDebugEnabled) _MyLog.DebugFormat("[{0}] GroupMemberships.DataPortal_FetchGID", GetHashCode());
|
||||
try
|
||||
{
|
||||
using (SqlConnection cn = Database.VEPROMS_SqlConnection)
|
||||
@ -184,7 +184,7 @@ namespace VEPROMS.CSLA.Library
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
if(_MyLog.IsErrorEnabled)_MyLog.Error("GroupMemberships.DataPortal_FetchGID", ex);
|
||||
if (_MyLog.IsErrorEnabled) _MyLog.Error("GroupMemberships.DataPortal_FetchGID", ex);
|
||||
throw new DbCslaException("GroupMemberships.DataPortal_Fetch", ex);
|
||||
}
|
||||
this.RaiseListChangedEvents = true;
|
||||
@ -269,8 +269,8 @@ namespace VEPROMS.CSLA.Library
|
||||
/// </summary>
|
||||
public partial class GroupMembershipsPropertyDescriptor : vlnListPropertyDescriptor
|
||||
{
|
||||
private GroupMembership Item { get { return (GroupMembership) _Item;} }
|
||||
public GroupMembershipsPropertyDescriptor(GroupMemberships collection, int index):base(collection, index){;}
|
||||
private GroupMembership Item { get { return (GroupMembership)_Item; } }
|
||||
public GroupMembershipsPropertyDescriptor(GroupMemberships collection, int index) : base(collection, index) { ;}
|
||||
}
|
||||
#endregion
|
||||
#region Converter
|
||||
@ -281,7 +281,7 @@ namespace VEPROMS.CSLA.Library
|
||||
if (destType == typeof(string) && value is GroupMemberships)
|
||||
{
|
||||
// Return department and department role separated by comma.
|
||||
return ((GroupMemberships) value).Items.Count.ToString() + " Memberships";
|
||||
return ((GroupMemberships)value).Items.Count.ToString() + " Memberships";
|
||||
}
|
||||
return base.ConvertTo(context, culture, value, destType);
|
||||
}
|
||||
|
@ -45,14 +45,14 @@ namespace VEPROMS.CSLA.Library
|
||||
{
|
||||
foreach (ItemAnnotation tmp in _ItemAnnotations)
|
||||
{
|
||||
if(tmp.IsDirty)refreshItemAnnotations.Add(tmp);
|
||||
if (tmp.IsDirty) refreshItemAnnotations.Add(tmp);
|
||||
}
|
||||
}
|
||||
if (_ItemDocVersions != null && _ItemDocVersions.IsDirty)
|
||||
{
|
||||
foreach (ItemDocVersion tmp in _ItemDocVersions)
|
||||
{
|
||||
if(tmp.IsDirty)refreshItemDocVersions.Add(tmp);
|
||||
if (tmp.IsDirty) refreshItemDocVersions.Add(tmp);
|
||||
}
|
||||
}
|
||||
if (_NextItems != null && _NextItems.IsDirty)
|
||||
@ -66,21 +66,21 @@ namespace VEPROMS.CSLA.Library
|
||||
{
|
||||
foreach (ItemPart tmp in _ItemParts)
|
||||
{
|
||||
if(tmp.IsDirty)refreshItemParts.Add(tmp);
|
||||
if (tmp.IsDirty) refreshItemParts.Add(tmp);
|
||||
}
|
||||
}
|
||||
if (_ItemTransitions_RangeID != null && _ItemTransitions_RangeID.IsDirty)
|
||||
{
|
||||
foreach (ItemTransition_RangeID tmp in _ItemTransitions_RangeID)
|
||||
{
|
||||
if(tmp.IsDirty)refreshItemTransitions_RangeID.Add(tmp);
|
||||
if (tmp.IsDirty) refreshItemTransitions_RangeID.Add(tmp);
|
||||
}
|
||||
}
|
||||
if (_ItemTransitions_ToID != null && _ItemTransitions_ToID.IsDirty)
|
||||
{
|
||||
foreach (ItemTransition_ToID tmp in _ItemTransitions_ToID)
|
||||
{
|
||||
if(tmp.IsDirty)refreshItemTransitions_ToID.Add(tmp);
|
||||
if (tmp.IsDirty) refreshItemTransitions_ToID.Add(tmp);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -99,7 +99,7 @@ namespace VEPROMS.CSLA.Library
|
||||
foreach (Item tmp in _RefreshItems)
|
||||
{
|
||||
ItemInfo.Refresh(tmp);
|
||||
if(tmp._MyContent != null) ContentInfo.Refresh(tmp._MyContent);
|
||||
if (tmp._MyContent != null) ContentInfo.Refresh(tmp._MyContent);
|
||||
}
|
||||
foreach (ItemAnnotation tmp in _RefreshItemAnnotations)
|
||||
{
|
||||
@ -125,13 +125,17 @@ namespace VEPROMS.CSLA.Library
|
||||
#endregion
|
||||
#region Collection
|
||||
protected static List<Item> _AllList = new List<Item>();
|
||||
private static Dictionary<string, Item> _AllByPrimaryKey = new Dictionary<string, Item>();
|
||||
private static Dictionary<string, List<Item>> _AllByPrimaryKey = new Dictionary<string, List<Item>>();
|
||||
private static void ConvertListToDictionary()
|
||||
{
|
||||
List<Item> remove = new List<Item>();
|
||||
foreach (Item tmp in _AllList)
|
||||
{
|
||||
_AllByPrimaryKey[tmp.ItemID.ToString()]=tmp; // Primary Key
|
||||
if (!_AllByPrimaryKey.ContainsKey(tmp.ItemID.ToString()))
|
||||
{
|
||||
_AllByPrimaryKey[tmp.ItemID.ToString()] = new List<Item>(); // Add new list for PrimaryKey
|
||||
}
|
||||
_AllByPrimaryKey[tmp.ItemID.ToString()].Add(tmp); // Add to Primary Key list
|
||||
remove.Add(tmp);
|
||||
}
|
||||
foreach (Item tmp in remove)
|
||||
@ -141,7 +145,7 @@ namespace VEPROMS.CSLA.Library
|
||||
{
|
||||
ConvertListToDictionary();
|
||||
string key = itemID.ToString();
|
||||
if (_AllByPrimaryKey.ContainsKey(key)) return _AllByPrimaryKey[key];
|
||||
if (_AllByPrimaryKey.ContainsKey(key)) return _AllByPrimaryKey[key][0];
|
||||
return null;
|
||||
}
|
||||
#endregion
|
||||
@ -163,7 +167,7 @@ namespace VEPROMS.CSLA.Library
|
||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||
get
|
||||
{
|
||||
CanReadProperty("ItemID",true);
|
||||
CanReadProperty("ItemID", true);
|
||||
return _ItemID;
|
||||
}
|
||||
}
|
||||
@ -173,7 +177,7 @@ namespace VEPROMS.CSLA.Library
|
||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||
get
|
||||
{
|
||||
CanReadProperty("PreviousID",true);
|
||||
CanReadProperty("PreviousID", true);
|
||||
if (_MyPrevious != null) _PreviousID = _MyPrevious.ItemID;
|
||||
return _PreviousID;
|
||||
}
|
||||
@ -184,18 +188,18 @@ namespace VEPROMS.CSLA.Library
|
||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||
get
|
||||
{
|
||||
CanReadProperty("MyPrevious",true);
|
||||
CanReadProperty("MyPrevious", true);
|
||||
if (_MyPrevious == null && _PreviousID != null) _MyPrevious = Item.Get((int)_PreviousID);
|
||||
return _MyPrevious;
|
||||
}
|
||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||
set
|
||||
{
|
||||
CanWriteProperty("MyPrevious",true);
|
||||
CanWriteProperty("MyPrevious", true);
|
||||
if (_MyPrevious != value)
|
||||
{
|
||||
_MyPrevious = value;
|
||||
_PreviousID = (value == null ? null : (int?) value.ItemID);
|
||||
_PreviousID = (value == null ? null : (int?)value.ItemID);
|
||||
PropertyHasChanged();
|
||||
}
|
||||
}
|
||||
@ -206,7 +210,7 @@ namespace VEPROMS.CSLA.Library
|
||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||
get
|
||||
{
|
||||
CanReadProperty("ContentID",true);
|
||||
CanReadProperty("ContentID", true);
|
||||
if (_MyContent != null) _ContentID = _MyContent.ContentID;
|
||||
return _ContentID;
|
||||
}
|
||||
@ -217,14 +221,14 @@ namespace VEPROMS.CSLA.Library
|
||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||
get
|
||||
{
|
||||
CanReadProperty("MyContent",true);
|
||||
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);
|
||||
CanWriteProperty("MyContent", true);
|
||||
if (_MyContent != value)
|
||||
{
|
||||
_MyContent = value;
|
||||
@ -238,13 +242,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;
|
||||
@ -258,13 +262,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)
|
||||
{
|
||||
@ -283,7 +287,7 @@ namespace VEPROMS.CSLA.Library
|
||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||
get
|
||||
{
|
||||
CanReadProperty("ItemAnnotationCount",true);
|
||||
CanReadProperty("ItemAnnotationCount", true);
|
||||
return _ItemAnnotationCount;
|
||||
}
|
||||
}
|
||||
@ -297,10 +301,10 @@ namespace VEPROMS.CSLA.Library
|
||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||
get
|
||||
{
|
||||
CanReadProperty("ItemAnnotations",true);
|
||||
if(_ItemAnnotationCount > 0 && _ItemAnnotations == null)
|
||||
CanReadProperty("ItemAnnotations", true);
|
||||
if (_ItemAnnotationCount > 0 && _ItemAnnotations == null)
|
||||
_ItemAnnotations = ItemAnnotations.GetByItemID(ItemID);
|
||||
else if(_ItemAnnotations == null)
|
||||
else if (_ItemAnnotations == null)
|
||||
_ItemAnnotations = ItemAnnotations.New();
|
||||
return _ItemAnnotations;
|
||||
}
|
||||
@ -314,7 +318,7 @@ namespace VEPROMS.CSLA.Library
|
||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||
get
|
||||
{
|
||||
CanReadProperty("ItemDocVersionCount",true);
|
||||
CanReadProperty("ItemDocVersionCount", true);
|
||||
return _ItemDocVersionCount;
|
||||
}
|
||||
}
|
||||
@ -328,10 +332,10 @@ namespace VEPROMS.CSLA.Library
|
||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||
get
|
||||
{
|
||||
CanReadProperty("ItemDocVersions",true);
|
||||
if(_ItemDocVersionCount > 0 && _ItemDocVersions == null)
|
||||
CanReadProperty("ItemDocVersions", true);
|
||||
if (_ItemDocVersionCount > 0 && _ItemDocVersions == null)
|
||||
_ItemDocVersions = ItemDocVersions.GetByItemID(ItemID);
|
||||
else if(_ItemDocVersions == null)
|
||||
else if (_ItemDocVersions == null)
|
||||
_ItemDocVersions = ItemDocVersions.New();
|
||||
return _ItemDocVersions;
|
||||
}
|
||||
@ -345,7 +349,7 @@ namespace VEPROMS.CSLA.Library
|
||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||
get
|
||||
{
|
||||
CanReadProperty("NextItemCount",true);
|
||||
CanReadProperty("NextItemCount", true);
|
||||
return _NextItemCount;
|
||||
}
|
||||
}
|
||||
@ -359,10 +363,10 @@ namespace VEPROMS.CSLA.Library
|
||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||
get
|
||||
{
|
||||
CanReadProperty("NextItems",true);
|
||||
if(_NextItemCount > 0 && _NextItems == null)
|
||||
CanReadProperty("NextItems", true);
|
||||
if (_NextItemCount > 0 && _NextItems == null)
|
||||
_NextItems = NextItems.GetByPreviousID(ItemID);
|
||||
else if(_NextItems == null)
|
||||
else if (_NextItems == null)
|
||||
_NextItems = NextItems.New();
|
||||
return _NextItems;
|
||||
}
|
||||
@ -376,7 +380,7 @@ namespace VEPROMS.CSLA.Library
|
||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||
get
|
||||
{
|
||||
CanReadProperty("ItemPartCount",true);
|
||||
CanReadProperty("ItemPartCount", true);
|
||||
return _ItemPartCount;
|
||||
}
|
||||
}
|
||||
@ -390,10 +394,10 @@ namespace VEPROMS.CSLA.Library
|
||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||
get
|
||||
{
|
||||
CanReadProperty("ItemParts",true);
|
||||
if(_ItemPartCount > 0 && _ItemParts == null)
|
||||
CanReadProperty("ItemParts", true);
|
||||
if (_ItemPartCount > 0 && _ItemParts == null)
|
||||
_ItemParts = ItemParts.GetByItemID(ItemID);
|
||||
else if(_ItemParts == null)
|
||||
else if (_ItemParts == null)
|
||||
_ItemParts = ItemParts.New();
|
||||
return _ItemParts;
|
||||
}
|
||||
@ -407,7 +411,7 @@ namespace VEPROMS.CSLA.Library
|
||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||
get
|
||||
{
|
||||
CanReadProperty("ItemTransition_RangeIDCount",true);
|
||||
CanReadProperty("ItemTransition_RangeIDCount", true);
|
||||
return _ItemTransition_RangeIDCount;
|
||||
}
|
||||
}
|
||||
@ -421,10 +425,10 @@ namespace VEPROMS.CSLA.Library
|
||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||
get
|
||||
{
|
||||
CanReadProperty("ItemTransitions_RangeID",true);
|
||||
if(_ItemTransition_RangeIDCount > 0 && _ItemTransitions_RangeID == null)
|
||||
CanReadProperty("ItemTransitions_RangeID", true);
|
||||
if (_ItemTransition_RangeIDCount > 0 && _ItemTransitions_RangeID == null)
|
||||
_ItemTransitions_RangeID = ItemTransitions_RangeID.GetByRangeID(ItemID);
|
||||
else if(_ItemTransitions_RangeID == null)
|
||||
else if (_ItemTransitions_RangeID == null)
|
||||
_ItemTransitions_RangeID = ItemTransitions_RangeID.New();
|
||||
return _ItemTransitions_RangeID;
|
||||
}
|
||||
@ -438,7 +442,7 @@ namespace VEPROMS.CSLA.Library
|
||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||
get
|
||||
{
|
||||
CanReadProperty("ItemTransition_ToIDCount",true);
|
||||
CanReadProperty("ItemTransition_ToIDCount", true);
|
||||
return _ItemTransition_ToIDCount;
|
||||
}
|
||||
}
|
||||
@ -452,21 +456,21 @@ namespace VEPROMS.CSLA.Library
|
||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||
get
|
||||
{
|
||||
CanReadProperty("ItemTransitions_ToID",true);
|
||||
if(_ItemTransition_ToIDCount > 0 && _ItemTransitions_ToID == null)
|
||||
CanReadProperty("ItemTransitions_ToID", true);
|
||||
if (_ItemTransition_ToIDCount > 0 && _ItemTransitions_ToID == null)
|
||||
_ItemTransitions_ToID = ItemTransitions_ToID.GetByToID(ItemID);
|
||||
else if(_ItemTransitions_ToID == null)
|
||||
else if (_ItemTransitions_ToID == null)
|
||||
_ItemTransitions_ToID = ItemTransitions_ToID.New();
|
||||
return _ItemTransitions_ToID;
|
||||
}
|
||||
}
|
||||
public override bool IsDirty
|
||||
{
|
||||
get { return base.IsDirty || (_ItemAnnotations == null? false : _ItemAnnotations.IsDirty) || (_ItemDocVersions == null? false : _ItemDocVersions.IsDirty) || (_NextItems == null? false : _NextItems.IsDirty) || (_ItemParts == null? false : _ItemParts.IsDirty) || (_ItemTransitions_RangeID == null? false : _ItemTransitions_RangeID.IsDirty) || (_ItemTransitions_ToID == null? false : _ItemTransitions_ToID.IsDirty) || (_MyContent == null? false : _MyContent.IsDirty); }
|
||||
get { return base.IsDirty || (_ItemAnnotations == null ? false : _ItemAnnotations.IsDirty) || (_ItemDocVersions == null ? false : _ItemDocVersions.IsDirty) || (_NextItems == null ? false : _NextItems.IsDirty) || (_ItemParts == null ? false : _ItemParts.IsDirty) || (_ItemTransitions_RangeID == null ? false : _ItemTransitions_RangeID.IsDirty) || (_ItemTransitions_ToID == null ? false : _ItemTransitions_ToID.IsDirty) || (_MyContent == null ? false : _MyContent.IsDirty); }
|
||||
}
|
||||
public override bool IsValid
|
||||
{
|
||||
get { return (IsNew && !IsDirty ? true : base.IsValid) && (_ItemAnnotations == null? true : _ItemAnnotations.IsValid) && (_ItemDocVersions == null? true : _ItemDocVersions.IsValid) && (_NextItems == null? true : _NextItems.IsValid) && (_ItemParts == null? true : _ItemParts.IsValid) && (_ItemTransitions_RangeID == null? true : _ItemTransitions_RangeID.IsValid) && (_ItemTransitions_ToID == null? true : _ItemTransitions_ToID.IsValid) && (_MyContent == null? true : _MyContent.IsValid); }
|
||||
get { return (IsNew && !IsDirty ? true : base.IsValid) && (_ItemAnnotations == null ? true : _ItemAnnotations.IsValid) && (_ItemDocVersions == null ? true : _ItemDocVersions.IsValid) && (_NextItems == null ? true : _NextItems.IsValid) && (_ItemParts == null ? true : _ItemParts.IsValid) && (_ItemTransitions_RangeID == null ? true : _ItemTransitions_RangeID.IsValid) && (_ItemTransitions_ToID == null ? true : _ItemTransitions_ToID.IsValid) && (_MyContent == null ? true : _MyContent.IsValid); }
|
||||
}
|
||||
// TODO: Replace base Item.ToString function as necessary
|
||||
/// <summary>
|
||||
@ -489,15 +493,16 @@ 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 (_ItemAnnotations != null && (hasBrokenRules = _ItemAnnotations.HasBrokenRules) != null) return hasBrokenRules;
|
||||
if (_ItemDocVersions != null && (hasBrokenRules = _ItemDocVersions.HasBrokenRules) != null) return hasBrokenRules;
|
||||
@ -510,7 +515,7 @@ namespace VEPROMS.CSLA.Library
|
||||
}
|
||||
finally
|
||||
{
|
||||
_CheckingBrokenRules=false;
|
||||
_CheckingBrokenRules = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -629,14 +634,25 @@ namespace VEPROMS.CSLA.Library
|
||||
#region Factory Methods
|
||||
public int CurrentEditLevel
|
||||
{ get { return EditLevel; } }
|
||||
private static int _ItemUnique = 0;
|
||||
private int _MyItemUnique;
|
||||
public int MyItemUnique
|
||||
{
|
||||
get { return _MyItemUnique; }
|
||||
}
|
||||
protected Item()
|
||||
{/* require use of factory methods */
|
||||
_MyItemUnique = ++_ItemUnique;
|
||||
_AllList.Add(this);
|
||||
}
|
||||
public void Dispose()
|
||||
{
|
||||
_AllList.Remove(this);
|
||||
_AllByPrimaryKey.Remove(ItemID.ToString());
|
||||
if (!_AllByPrimaryKey.ContainsKey(ItemID.ToString())) return;
|
||||
List<Item> listItem = _AllByPrimaryKey[ItemID.ToString()]; // Get the list of items
|
||||
listItem.Remove(this); // Remove the item from the list
|
||||
if (listItem.Count == 0) //If there are no items left in the list
|
||||
_AllByPrimaryKey.Remove(ItemID.ToString()); // remove the list
|
||||
}
|
||||
public static Item New()
|
||||
{
|
||||
@ -715,7 +731,7 @@ namespace VEPROMS.CSLA.Library
|
||||
if (tmp == null)
|
||||
{
|
||||
tmp = DataPortal.Fetch<Item>(new PKCriteria(itemID));
|
||||
_AllList.Add(tmp);
|
||||
if (!_AllList.Contains(tmp)) _AllList.Add(tmp);
|
||||
}
|
||||
if (tmp.ErrorMessage == "No Record Found") tmp = null;
|
||||
return tmp;
|
||||
@ -804,7 +820,7 @@ namespace VEPROMS.CSLA.Library
|
||||
}
|
||||
private void ReadData(SafeDataReader dr)
|
||||
{
|
||||
if(_MyLog.IsDebugEnabled)_MyLog.DebugFormat("[{0}] Item.ReadData", GetHashCode());
|
||||
if (_MyLog.IsDebugEnabled) _MyLog.DebugFormat("[{0}] Item.ReadData", GetHashCode());
|
||||
try
|
||||
{
|
||||
_ItemID = dr.GetInt32("ItemID");
|
||||
@ -823,14 +839,14 @@ namespace VEPROMS.CSLA.Library
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
if(_MyLog.IsErrorEnabled)_MyLog.Error("Item.ReadData", ex);
|
||||
if (_MyLog.IsErrorEnabled) _MyLog.Error("Item.ReadData", ex);
|
||||
_ErrorMessage = ex.Message;
|
||||
throw new DbCslaException("Item.ReadData", ex);
|
||||
}
|
||||
}
|
||||
private void DataPortal_Fetch(PKCriteria criteria)
|
||||
{
|
||||
if(_MyLog.IsDebugEnabled)_MyLog.DebugFormat("[{0}] Item.DataPortal_Fetch", GetHashCode());
|
||||
if (_MyLog.IsDebugEnabled) _MyLog.DebugFormat("[{0}] Item.DataPortal_Fetch", GetHashCode());
|
||||
try
|
||||
{
|
||||
using (SqlConnection cn = Database.VEPROMS_SqlConnection)
|
||||
@ -873,7 +889,7 @@ namespace VEPROMS.CSLA.Library
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
if(_MyLog.IsErrorEnabled)_MyLog.Error("Item.DataPortal_Fetch", ex);
|
||||
if (_MyLog.IsErrorEnabled) _MyLog.Error("Item.DataPortal_Fetch", ex);
|
||||
_ErrorMessage = ex.Message;
|
||||
throw new DbCslaException("Item.DataPortal_Fetch", ex);
|
||||
}
|
||||
@ -894,13 +910,13 @@ namespace VEPROMS.CSLA.Library
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
if(_MyLog.IsErrorEnabled)_MyLog.Error("Item.DataPortal_Insert", ex);
|
||||
if (_MyLog.IsErrorEnabled) _MyLog.Error("Item.DataPortal_Insert", ex);
|
||||
_ErrorMessage = ex.Message;
|
||||
throw new DbCslaException("Item.DataPortal_Insert", ex);
|
||||
}
|
||||
finally
|
||||
{
|
||||
if(_MyLog.IsDebugEnabled)_MyLog.DebugFormat("[{0}] Item.DataPortal_Insert", GetHashCode());
|
||||
if (_MyLog.IsDebugEnabled) _MyLog.DebugFormat("[{0}] Item.DataPortal_Insert", GetHashCode());
|
||||
}
|
||||
}
|
||||
[Transactional(TransactionalTypes.TransactionScope)]
|
||||
@ -909,7 +925,7 @@ namespace VEPROMS.CSLA.Library
|
||||
if (!this.IsDirty) return;
|
||||
try
|
||||
{
|
||||
if(_MyContent != null) _MyContent.Update();
|
||||
if (_MyContent != null) _MyContent.Update();
|
||||
SqlConnection cn = (SqlConnection)ApplicationContext.LocalContext["cn"];
|
||||
using (SqlCommand cm = cn.CreateCommand())
|
||||
{
|
||||
@ -941,11 +957,11 @@ namespace VEPROMS.CSLA.Library
|
||||
if (_ItemParts != null) _ItemParts.Update(this);
|
||||
if (_ItemTransitions_RangeID != null) _ItemTransitions_RangeID.Update(this);
|
||||
if (_ItemTransitions_ToID != null) _ItemTransitions_ToID.Update(this);
|
||||
if(_MyLog.IsDebugEnabled)_MyLog.DebugFormat("[{0}] Item.SQLInsert", GetHashCode());
|
||||
if (_MyLog.IsDebugEnabled) _MyLog.DebugFormat("[{0}] Item.SQLInsert", GetHashCode());
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
if(_MyLog.IsErrorEnabled)_MyLog.Error("Item.SQLInsert", ex);
|
||||
if (_MyLog.IsErrorEnabled) _MyLog.Error("Item.SQLInsert", ex);
|
||||
_ErrorMessage = ex.Message;
|
||||
throw new DbCslaException("Item.SQLInsert", ex);
|
||||
}
|
||||
@ -953,7 +969,7 @@ namespace VEPROMS.CSLA.Library
|
||||
[Transactional(TransactionalTypes.TransactionScope)]
|
||||
public static byte[] Add(SqlConnection cn, ref int itemID, Item myPrevious, Content myContent, DateTime dts, string userID)
|
||||
{
|
||||
if(_MyLog.IsDebugEnabled)_MyLog.DebugFormat("[{0}] Item.Add", 0);
|
||||
if (_MyLog.IsDebugEnabled) _MyLog.DebugFormat("[{0}] Item.Add", 0);
|
||||
try
|
||||
{
|
||||
using (SqlCommand cm = cn.CreateCommand())
|
||||
@ -961,7 +977,7 @@ namespace VEPROMS.CSLA.Library
|
||||
cm.CommandType = CommandType.StoredProcedure;
|
||||
cm.CommandText = "addItem";
|
||||
// Input All Fields - Except Calculated Columns
|
||||
if(myPrevious != null)cm.Parameters.AddWithValue("@PreviousID", myPrevious.ItemID);
|
||||
if (myPrevious != null) cm.Parameters.AddWithValue("@PreviousID", myPrevious.ItemID);
|
||||
cm.Parameters.AddWithValue("@ContentID", myContent.ContentID);
|
||||
if (dts.Year >= 1753 && dts.Year <= 9999) cm.Parameters.AddWithValue("@DTS", dts);
|
||||
cm.Parameters.AddWithValue("@UserID", userID);
|
||||
@ -981,7 +997,7 @@ namespace VEPROMS.CSLA.Library
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
if(_MyLog.IsErrorEnabled)_MyLog.Error("Item.Add", ex);
|
||||
if (_MyLog.IsErrorEnabled) _MyLog.Error("Item.Add", ex);
|
||||
throw new DbCslaException("Item.Add", ex);
|
||||
}
|
||||
}
|
||||
@ -989,7 +1005,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}] Item.DataPortal_Update", GetHashCode());
|
||||
if (_MyLog.IsDebugEnabled) _MyLog.DebugFormat("[{0}] Item.DataPortal_Update", GetHashCode());
|
||||
try
|
||||
{
|
||||
using (SqlConnection cn = Database.VEPROMS_SqlConnection)
|
||||
@ -1003,7 +1019,7 @@ namespace VEPROMS.CSLA.Library
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
if(_MyLog.IsErrorEnabled)_MyLog.Error("Item.DataPortal_Update", ex);
|
||||
if (_MyLog.IsErrorEnabled) _MyLog.Error("Item.DataPortal_Update", ex);
|
||||
_ErrorMessage = ex.Message;
|
||||
if (!ex.Message.EndsWith("has been edited by another user.")) throw ex;
|
||||
}
|
||||
@ -1012,10 +1028,10 @@ namespace VEPROMS.CSLA.Library
|
||||
internal void SQLUpdate()
|
||||
{
|
||||
if (!IsDirty) return; // If not dirty - nothing to do
|
||||
if(_MyLog.IsDebugEnabled)_MyLog.DebugFormat("[{0}] Item.SQLUpdate", GetHashCode());
|
||||
if (_MyLog.IsDebugEnabled) _MyLog.DebugFormat("[{0}] Item.SQLUpdate", GetHashCode());
|
||||
try
|
||||
{
|
||||
if(_MyContent != null) _MyContent.Update();
|
||||
if (_MyContent != null) _MyContent.Update();
|
||||
SqlConnection cn = (SqlConnection)ApplicationContext.LocalContext["cn"];
|
||||
if (base.IsDirty)
|
||||
{
|
||||
@ -1051,7 +1067,7 @@ namespace VEPROMS.CSLA.Library
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
if(_MyLog.IsErrorEnabled)_MyLog.Error("Item.SQLUpdate", ex);
|
||||
if (_MyLog.IsErrorEnabled) _MyLog.Error("Item.SQLUpdate", ex);
|
||||
_ErrorMessage = ex.Message;
|
||||
if (!ex.Message.EndsWith("has been edited by another user.")) throw ex;
|
||||
}
|
||||
@ -1088,7 +1104,7 @@ namespace VEPROMS.CSLA.Library
|
||||
[Transactional(TransactionalTypes.TransactionScope)]
|
||||
public static byte[] Update(SqlConnection cn, ref int itemID, Item myPrevious, Content myContent, DateTime dts, string userID, ref byte[] lastChanged)
|
||||
{
|
||||
if(_MyLog.IsDebugEnabled)_MyLog.DebugFormat("[{0}] Item.Update", 0);
|
||||
if (_MyLog.IsDebugEnabled) _MyLog.DebugFormat("[{0}] Item.Update", 0);
|
||||
try
|
||||
{
|
||||
using (SqlCommand cm = cn.CreateCommand())
|
||||
@ -1097,7 +1113,7 @@ namespace VEPROMS.CSLA.Library
|
||||
cm.CommandText = "updateItem";
|
||||
// Input All Fields - Except Calculated Columns
|
||||
cm.Parameters.AddWithValue("@ItemID", itemID);
|
||||
if(myPrevious != null)cm.Parameters.AddWithValue("@PreviousID", myPrevious.ItemID);
|
||||
if (myPrevious != null) cm.Parameters.AddWithValue("@PreviousID", myPrevious.ItemID);
|
||||
cm.Parameters.AddWithValue("@ContentID", myContent.ContentID);
|
||||
if (dts.Year >= 1753 && dts.Year <= 9999) cm.Parameters.AddWithValue("@DTS", dts);
|
||||
cm.Parameters.AddWithValue("@UserID", userID);
|
||||
@ -1114,7 +1130,7 @@ namespace VEPROMS.CSLA.Library
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
if(_MyLog.IsErrorEnabled)_MyLog.Error("Item.Update", ex);
|
||||
if (_MyLog.IsErrorEnabled) _MyLog.Error("Item.Update", ex);
|
||||
throw new DbCslaException("Item.Update", ex);
|
||||
}
|
||||
}
|
||||
@ -1126,7 +1142,7 @@ namespace VEPROMS.CSLA.Library
|
||||
[Transactional(TransactionalTypes.TransactionScope)]
|
||||
private void DataPortal_Delete(PKCriteria criteria)
|
||||
{
|
||||
if(_MyLog.IsDebugEnabled)_MyLog.DebugFormat("[{0}] Item.DataPortal_Delete", GetHashCode());
|
||||
if (_MyLog.IsDebugEnabled) _MyLog.DebugFormat("[{0}] Item.DataPortal_Delete", GetHashCode());
|
||||
try
|
||||
{
|
||||
using (SqlConnection cn = Database.VEPROMS_SqlConnection)
|
||||
@ -1142,7 +1158,7 @@ namespace VEPROMS.CSLA.Library
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
if(_MyLog.IsErrorEnabled)_MyLog.Error("Item.DataPortal_Delete", ex);
|
||||
if (_MyLog.IsErrorEnabled) _MyLog.Error("Item.DataPortal_Delete", ex);
|
||||
_ErrorMessage = ex.Message;
|
||||
throw new DbCslaException("Item.DataPortal_Delete", ex);
|
||||
}
|
||||
@ -1150,7 +1166,7 @@ namespace VEPROMS.CSLA.Library
|
||||
[Transactional(TransactionalTypes.TransactionScope)]
|
||||
public static void Remove(SqlConnection cn, int itemID)
|
||||
{
|
||||
if(_MyLog.IsDebugEnabled)_MyLog.DebugFormat("[{0}] Item.Remove", 0);
|
||||
if (_MyLog.IsDebugEnabled) _MyLog.DebugFormat("[{0}] Item.Remove", 0);
|
||||
try
|
||||
{
|
||||
using (SqlCommand cm = cn.CreateCommand())
|
||||
@ -1165,7 +1181,7 @@ namespace VEPROMS.CSLA.Library
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
if(_MyLog.IsErrorEnabled)_MyLog.Error("Item.Remove", ex);
|
||||
if (_MyLog.IsErrorEnabled) _MyLog.Error("Item.Remove", ex);
|
||||
throw new DbCslaException("Item.Remove", ex);
|
||||
}
|
||||
}
|
||||
@ -1199,7 +1215,7 @@ namespace VEPROMS.CSLA.Library
|
||||
}
|
||||
protected override void DataPortal_Execute()
|
||||
{
|
||||
if(_MyLog.IsDebugEnabled)_MyLog.DebugFormat("[{0}] Item.DataPortal_Execute", GetHashCode());
|
||||
if (_MyLog.IsDebugEnabled) _MyLog.DebugFormat("[{0}] Item.DataPortal_Execute", GetHashCode());
|
||||
try
|
||||
{
|
||||
using (SqlConnection cn = Database.VEPROMS_SqlConnection)
|
||||
@ -1217,7 +1233,7 @@ namespace VEPROMS.CSLA.Library
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
if(_MyLog.IsErrorEnabled)_MyLog.Error("Item.DataPortal_Execute", ex);
|
||||
if (_MyLog.IsErrorEnabled) _MyLog.Error("Item.DataPortal_Execute", ex);
|
||||
throw new DbCslaException("Item.DataPortal_Execute", ex);
|
||||
}
|
||||
}
|
||||
|
@ -42,7 +42,7 @@ namespace VEPROMS.CSLA.Library
|
||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||
get
|
||||
{
|
||||
CanReadProperty("AnnotationID",true);
|
||||
CanReadProperty("AnnotationID", true);
|
||||
if (_MyAnnotation != null) _AnnotationID = _MyAnnotation.AnnotationID;
|
||||
return _AnnotationID;
|
||||
}
|
||||
@ -54,7 +54,7 @@ namespace VEPROMS.CSLA.Library
|
||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||
get
|
||||
{
|
||||
CanReadProperty("MyAnnotation",true);
|
||||
CanReadProperty("MyAnnotation", true);
|
||||
if (_MyAnnotation == null && _AnnotationID != 0) _MyAnnotation = Annotation.Get(_AnnotationID);
|
||||
return _MyAnnotation;
|
||||
}
|
||||
@ -65,7 +65,7 @@ namespace VEPROMS.CSLA.Library
|
||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||
get
|
||||
{
|
||||
CanReadProperty("TypeID",true);
|
||||
CanReadProperty("TypeID", true);
|
||||
if (_MyAnnotationType != null) _TypeID = _MyAnnotationType.TypeID;
|
||||
return _TypeID;
|
||||
}
|
||||
@ -76,14 +76,14 @@ namespace VEPROMS.CSLA.Library
|
||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||
get
|
||||
{
|
||||
CanReadProperty("MyAnnotationType",true);
|
||||
CanReadProperty("MyAnnotationType", true);
|
||||
if (_MyAnnotationType == null && _TypeID != 0) _MyAnnotationType = AnnotationType.Get(_TypeID);
|
||||
return _MyAnnotationType;
|
||||
}
|
||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||
set
|
||||
{
|
||||
CanWriteProperty("MyAnnotationType",true);
|
||||
CanWriteProperty("MyAnnotationType", true);
|
||||
if (_MyAnnotationType != value)
|
||||
{
|
||||
_MyAnnotationType = value;
|
||||
@ -97,13 +97,13 @@ namespace VEPROMS.CSLA.Library
|
||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||
get
|
||||
{
|
||||
CanReadProperty("RtfText",true);
|
||||
CanReadProperty("RtfText", true);
|
||||
return _RtfText;
|
||||
}
|
||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||
set
|
||||
{
|
||||
CanWriteProperty("RtfText",true);
|
||||
CanWriteProperty("RtfText", true);
|
||||
if (value == null) value = string.Empty;
|
||||
if (_RtfText != value)
|
||||
{
|
||||
@ -118,13 +118,13 @@ namespace VEPROMS.CSLA.Library
|
||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||
get
|
||||
{
|
||||
CanReadProperty("SearchText",true);
|
||||
CanReadProperty("SearchText", true);
|
||||
return _SearchText;
|
||||
}
|
||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||
set
|
||||
{
|
||||
CanWriteProperty("SearchText",true);
|
||||
CanWriteProperty("SearchText", true);
|
||||
if (value == null) value = string.Empty;
|
||||
if (_SearchText != value)
|
||||
{
|
||||
@ -139,13 +139,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)
|
||||
{
|
||||
@ -160,13 +160,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;
|
||||
@ -180,13 +180,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)
|
||||
{
|
||||
@ -202,7 +202,7 @@ namespace VEPROMS.CSLA.Library
|
||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||
get
|
||||
{
|
||||
CanReadProperty("AnnotationType_Name",true);
|
||||
CanReadProperty("AnnotationType_Name", true);
|
||||
return _AnnotationType_Name;
|
||||
}
|
||||
}
|
||||
@ -212,7 +212,7 @@ namespace VEPROMS.CSLA.Library
|
||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||
get
|
||||
{
|
||||
CanReadProperty("AnnotationType_Config",true);
|
||||
CanReadProperty("AnnotationType_Config", true);
|
||||
return _AnnotationType_Config;
|
||||
}
|
||||
}
|
||||
@ -222,7 +222,7 @@ namespace VEPROMS.CSLA.Library
|
||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||
get
|
||||
{
|
||||
CanReadProperty("AnnotationType_DTS",true);
|
||||
CanReadProperty("AnnotationType_DTS", true);
|
||||
return _AnnotationType_DTS;
|
||||
}
|
||||
}
|
||||
@ -232,7 +232,7 @@ namespace VEPROMS.CSLA.Library
|
||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||
get
|
||||
{
|
||||
CanReadProperty("AnnotationType_UserID",true);
|
||||
CanReadProperty("AnnotationType_UserID", true);
|
||||
return _AnnotationType_UserID;
|
||||
}
|
||||
}
|
||||
@ -265,23 +265,23 @@ namespace VEPROMS.CSLA.Library
|
||||
#endregion
|
||||
#region ValidationRules
|
||||
[NonSerialized]
|
||||
private bool _CheckingBrokenRules=false;
|
||||
private bool _CheckingBrokenRules = false;
|
||||
public IVEHasBrokenRules HasBrokenRules
|
||||
{
|
||||
get
|
||||
{
|
||||
if(_CheckingBrokenRules)return null;
|
||||
if (_CheckingBrokenRules) return null;
|
||||
if (BrokenRulesCollection.Count > 0) return this;
|
||||
try
|
||||
{
|
||||
_CheckingBrokenRules=true;
|
||||
_CheckingBrokenRules = true;
|
||||
IVEHasBrokenRules hasBrokenRules = null;
|
||||
if (_MyAnnotationType != null && (hasBrokenRules = _MyAnnotationType.HasBrokenRules) != null) return hasBrokenRules;
|
||||
return hasBrokenRules;
|
||||
}
|
||||
finally
|
||||
{
|
||||
_CheckingBrokenRules=false;
|
||||
_CheckingBrokenRules = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -416,7 +416,7 @@ namespace VEPROMS.CSLA.Library
|
||||
#region Data Access Portal
|
||||
private void Fetch(SafeDataReader dr)
|
||||
{
|
||||
if(_MyLog.IsDebugEnabled)_MyLog.DebugFormat("[{0}] ItemAnnotation.FetchDR", GetHashCode());
|
||||
if (_MyLog.IsDebugEnabled) _MyLog.DebugFormat("[{0}] ItemAnnotation.FetchDR", GetHashCode());
|
||||
try
|
||||
{
|
||||
_AnnotationID = dr.GetInt32("AnnotationID");
|
||||
@ -434,7 +434,7 @@ namespace VEPROMS.CSLA.Library
|
||||
}
|
||||
catch (Exception ex) // FKItem Fetch
|
||||
{
|
||||
if(_MyLog.IsErrorEnabled)_MyLog.Error("ItemAnnotation.FetchDR", ex);
|
||||
if (_MyLog.IsErrorEnabled) _MyLog.Error("ItemAnnotation.FetchDR", ex);
|
||||
throw new DbCslaException("ItemAnnotation.Fetch", ex);
|
||||
}
|
||||
MarkOld();
|
||||
|
@ -94,8 +94,8 @@ namespace VEPROMS.CSLA.Library
|
||||
{
|
||||
get
|
||||
{
|
||||
IVEHasBrokenRules hasBrokenRules=null;
|
||||
foreach(ItemAnnotation itemAnnotation in this)
|
||||
IVEHasBrokenRules hasBrokenRules = null;
|
||||
foreach (ItemAnnotation itemAnnotation in this)
|
||||
if ((hasBrokenRules = itemAnnotation.HasBrokenRules) != null) return hasBrokenRules;
|
||||
return hasBrokenRules;
|
||||
}
|
||||
@ -165,7 +165,7 @@ namespace VEPROMS.CSLA.Library
|
||||
private void DataPortal_Fetch(ItemIDCriteria criteria)
|
||||
{
|
||||
this.RaiseListChangedEvents = false;
|
||||
if(_MyLog.IsDebugEnabled)_MyLog.DebugFormat("[{0}] ItemAnnotations.DataPortal_FetchItemID", GetHashCode());
|
||||
if (_MyLog.IsDebugEnabled) _MyLog.DebugFormat("[{0}] ItemAnnotations.DataPortal_FetchItemID", GetHashCode());
|
||||
try
|
||||
{
|
||||
using (SqlConnection cn = Database.VEPROMS_SqlConnection)
|
||||
@ -184,7 +184,7 @@ namespace VEPROMS.CSLA.Library
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
if(_MyLog.IsErrorEnabled)_MyLog.Error("ItemAnnotations.DataPortal_FetchItemID", ex);
|
||||
if (_MyLog.IsErrorEnabled) _MyLog.Error("ItemAnnotations.DataPortal_FetchItemID", ex);
|
||||
throw new DbCslaException("ItemAnnotations.DataPortal_Fetch", ex);
|
||||
}
|
||||
this.RaiseListChangedEvents = true;
|
||||
@ -269,8 +269,8 @@ namespace VEPROMS.CSLA.Library
|
||||
/// </summary>
|
||||
public partial class ItemAnnotationsPropertyDescriptor : vlnListPropertyDescriptor
|
||||
{
|
||||
private ItemAnnotation Item { get { return (ItemAnnotation) _Item;} }
|
||||
public ItemAnnotationsPropertyDescriptor(ItemAnnotations collection, int index):base(collection, index){;}
|
||||
private ItemAnnotation Item { get { return (ItemAnnotation)_Item; } }
|
||||
public ItemAnnotationsPropertyDescriptor(ItemAnnotations collection, int index) : base(collection, index) { ;}
|
||||
}
|
||||
#endregion
|
||||
#region Converter
|
||||
@ -281,7 +281,7 @@ namespace VEPROMS.CSLA.Library
|
||||
if (destType == typeof(string) && value is ItemAnnotations)
|
||||
{
|
||||
// Return department and department role separated by comma.
|
||||
return ((ItemAnnotations) value).Items.Count.ToString() + " Annotations";
|
||||
return ((ItemAnnotations)value).Items.Count.ToString() + " Annotations";
|
||||
}
|
||||
return base.ConvertTo(context, culture, value, destType);
|
||||
}
|
||||
|
@ -42,7 +42,7 @@ namespace VEPROMS.CSLA.Library
|
||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||
get
|
||||
{
|
||||
CanReadProperty("VersionID",true);
|
||||
CanReadProperty("VersionID", true);
|
||||
if (_MyDocVersion != null) _VersionID = _MyDocVersion.VersionID;
|
||||
return _VersionID;
|
||||
}
|
||||
@ -54,7 +54,7 @@ namespace VEPROMS.CSLA.Library
|
||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||
get
|
||||
{
|
||||
CanReadProperty("MyDocVersion",true);
|
||||
CanReadProperty("MyDocVersion", true);
|
||||
if (_MyDocVersion == null && _VersionID != 0) _MyDocVersion = DocVersion.Get(_VersionID);
|
||||
return _MyDocVersion;
|
||||
}
|
||||
@ -65,7 +65,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;
|
||||
}
|
||||
@ -76,14 +76,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;
|
||||
@ -100,13 +100,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;
|
||||
@ -120,13 +120,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)
|
||||
{
|
||||
@ -141,13 +141,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)
|
||||
{
|
||||
@ -162,7 +162,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;
|
||||
}
|
||||
@ -173,18 +173,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();
|
||||
}
|
||||
}
|
||||
@ -195,13 +195,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)
|
||||
{
|
||||
@ -216,13 +216,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;
|
||||
@ -236,13 +236,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)
|
||||
{
|
||||
@ -258,7 +258,7 @@ namespace VEPROMS.CSLA.Library
|
||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||
get
|
||||
{
|
||||
CanReadProperty("Folder_ParentID",true);
|
||||
CanReadProperty("Folder_ParentID", true);
|
||||
return _Folder_ParentID;
|
||||
}
|
||||
}
|
||||
@ -268,7 +268,7 @@ namespace VEPROMS.CSLA.Library
|
||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||
get
|
||||
{
|
||||
CanReadProperty("Folder_DBID",true);
|
||||
CanReadProperty("Folder_DBID", true);
|
||||
return _Folder_DBID;
|
||||
}
|
||||
}
|
||||
@ -278,7 +278,7 @@ namespace VEPROMS.CSLA.Library
|
||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||
get
|
||||
{
|
||||
CanReadProperty("Folder_Name",true);
|
||||
CanReadProperty("Folder_Name", true);
|
||||
return _Folder_Name;
|
||||
}
|
||||
}
|
||||
@ -288,7 +288,7 @@ namespace VEPROMS.CSLA.Library
|
||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||
get
|
||||
{
|
||||
CanReadProperty("Folder_Title",true);
|
||||
CanReadProperty("Folder_Title", true);
|
||||
return _Folder_Title;
|
||||
}
|
||||
}
|
||||
@ -298,7 +298,7 @@ namespace VEPROMS.CSLA.Library
|
||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||
get
|
||||
{
|
||||
CanReadProperty("Folder_ShortName",true);
|
||||
CanReadProperty("Folder_ShortName", true);
|
||||
return _Folder_ShortName;
|
||||
}
|
||||
}
|
||||
@ -308,7 +308,7 @@ namespace VEPROMS.CSLA.Library
|
||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||
get
|
||||
{
|
||||
CanReadProperty("Folder_FormatID",true);
|
||||
CanReadProperty("Folder_FormatID", true);
|
||||
return _Folder_FormatID;
|
||||
}
|
||||
}
|
||||
@ -318,7 +318,7 @@ namespace VEPROMS.CSLA.Library
|
||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||
get
|
||||
{
|
||||
CanReadProperty("Folder_Config",true);
|
||||
CanReadProperty("Folder_Config", true);
|
||||
return _Folder_Config;
|
||||
}
|
||||
}
|
||||
@ -328,7 +328,7 @@ namespace VEPROMS.CSLA.Library
|
||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||
get
|
||||
{
|
||||
CanReadProperty("Folder_DTS",true);
|
||||
CanReadProperty("Folder_DTS", true);
|
||||
return _Folder_DTS;
|
||||
}
|
||||
}
|
||||
@ -338,7 +338,7 @@ namespace VEPROMS.CSLA.Library
|
||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||
get
|
||||
{
|
||||
CanReadProperty("Folder_UsrID",true);
|
||||
CanReadProperty("Folder_UsrID", true);
|
||||
return _Folder_UsrID;
|
||||
}
|
||||
}
|
||||
@ -371,16 +371,16 @@ namespace VEPROMS.CSLA.Library
|
||||
#endregion
|
||||
#region ValidationRules
|
||||
[NonSerialized]
|
||||
private bool _CheckingBrokenRules=false;
|
||||
private bool _CheckingBrokenRules = false;
|
||||
public IVEHasBrokenRules HasBrokenRules
|
||||
{
|
||||
get
|
||||
{
|
||||
if(_CheckingBrokenRules)return null;
|
||||
if (_CheckingBrokenRules) return null;
|
||||
if (BrokenRulesCollection.Count > 0) return this;
|
||||
try
|
||||
{
|
||||
_CheckingBrokenRules=true;
|
||||
_CheckingBrokenRules = true;
|
||||
IVEHasBrokenRules hasBrokenRules = null;
|
||||
if (_MyFolder != null && (hasBrokenRules = _MyFolder.HasBrokenRules) != null) return hasBrokenRules;
|
||||
if (_MyFormat != null && (hasBrokenRules = _MyFormat.HasBrokenRules) != null) return hasBrokenRules;
|
||||
@ -388,7 +388,7 @@ namespace VEPROMS.CSLA.Library
|
||||
}
|
||||
finally
|
||||
{
|
||||
_CheckingBrokenRules=false;
|
||||
_CheckingBrokenRules = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -532,7 +532,7 @@ namespace VEPROMS.CSLA.Library
|
||||
#region Data Access Portal
|
||||
private void Fetch(SafeDataReader dr)
|
||||
{
|
||||
if(_MyLog.IsDebugEnabled)_MyLog.DebugFormat("[{0}] ItemDocVersion.FetchDR", GetHashCode());
|
||||
if (_MyLog.IsDebugEnabled) _MyLog.DebugFormat("[{0}] ItemDocVersion.FetchDR", GetHashCode());
|
||||
try
|
||||
{
|
||||
_VersionID = dr.GetInt32("VersionID");
|
||||
@ -557,7 +557,7 @@ namespace VEPROMS.CSLA.Library
|
||||
}
|
||||
catch (Exception ex) // FKItem Fetch
|
||||
{
|
||||
if(_MyLog.IsErrorEnabled)_MyLog.Error("ItemDocVersion.FetchDR", ex);
|
||||
if (_MyLog.IsErrorEnabled) _MyLog.Error("ItemDocVersion.FetchDR", ex);
|
||||
throw new DbCslaException("ItemDocVersion.Fetch", ex);
|
||||
}
|
||||
MarkOld();
|
||||
|
@ -94,8 +94,8 @@ namespace VEPROMS.CSLA.Library
|
||||
{
|
||||
get
|
||||
{
|
||||
IVEHasBrokenRules hasBrokenRules=null;
|
||||
foreach(ItemDocVersion itemDocVersion in this)
|
||||
IVEHasBrokenRules hasBrokenRules = null;
|
||||
foreach (ItemDocVersion itemDocVersion in this)
|
||||
if ((hasBrokenRules = itemDocVersion.HasBrokenRules) != null) return hasBrokenRules;
|
||||
return hasBrokenRules;
|
||||
}
|
||||
@ -165,7 +165,7 @@ namespace VEPROMS.CSLA.Library
|
||||
private void DataPortal_Fetch(ItemIDCriteria criteria)
|
||||
{
|
||||
this.RaiseListChangedEvents = false;
|
||||
if(_MyLog.IsDebugEnabled)_MyLog.DebugFormat("[{0}] ItemDocVersions.DataPortal_FetchItemID", GetHashCode());
|
||||
if (_MyLog.IsDebugEnabled) _MyLog.DebugFormat("[{0}] ItemDocVersions.DataPortal_FetchItemID", GetHashCode());
|
||||
try
|
||||
{
|
||||
using (SqlConnection cn = Database.VEPROMS_SqlConnection)
|
||||
@ -184,7 +184,7 @@ namespace VEPROMS.CSLA.Library
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
if(_MyLog.IsErrorEnabled)_MyLog.Error("ItemDocVersions.DataPortal_FetchItemID", ex);
|
||||
if (_MyLog.IsErrorEnabled) _MyLog.Error("ItemDocVersions.DataPortal_FetchItemID", ex);
|
||||
throw new DbCslaException("ItemDocVersions.DataPortal_Fetch", ex);
|
||||
}
|
||||
this.RaiseListChangedEvents = true;
|
||||
@ -269,8 +269,8 @@ namespace VEPROMS.CSLA.Library
|
||||
/// </summary>
|
||||
public partial class ItemDocVersionsPropertyDescriptor : vlnListPropertyDescriptor
|
||||
{
|
||||
private ItemDocVersion Item { get { return (ItemDocVersion) _Item;} }
|
||||
public ItemDocVersionsPropertyDescriptor(ItemDocVersions collection, int index):base(collection, index){;}
|
||||
private ItemDocVersion Item { get { return (ItemDocVersion)_Item; } }
|
||||
public ItemDocVersionsPropertyDescriptor(ItemDocVersions collection, int index) : base(collection, index) { ;}
|
||||
}
|
||||
#endregion
|
||||
#region Converter
|
||||
@ -281,7 +281,7 @@ namespace VEPROMS.CSLA.Library
|
||||
if (destType == typeof(string) && value is ItemDocVersions)
|
||||
{
|
||||
// Return department and department role separated by comma.
|
||||
return ((ItemDocVersions) value).Items.Count.ToString() + " DocVersions";
|
||||
return ((ItemDocVersions)value).Items.Count.ToString() + " DocVersions";
|
||||
}
|
||||
return base.ConvertTo(context, culture, value, destType);
|
||||
}
|
||||
|
@ -37,13 +37,17 @@ namespace VEPROMS.CSLA.Library
|
||||
#endregion
|
||||
#region Collection
|
||||
protected static List<ItemInfo> _AllList = new List<ItemInfo>();
|
||||
private static Dictionary<string, ItemInfo> _AllByPrimaryKey = new Dictionary<string, ItemInfo>();
|
||||
private static Dictionary<string, List<ItemInfo>> _AllByPrimaryKey = new Dictionary<string, List<ItemInfo>>();
|
||||
private static void ConvertListToDictionary()
|
||||
{
|
||||
List<ItemInfo> remove = new List<ItemInfo>();
|
||||
foreach (ItemInfo tmp in _AllList)
|
||||
{
|
||||
_AllByPrimaryKey[tmp.ItemID.ToString()]=tmp; // Primary Key
|
||||
if (!_AllByPrimaryKey.ContainsKey(tmp.ItemID.ToString()))
|
||||
{
|
||||
_AllByPrimaryKey[tmp.ItemID.ToString()] = new List<ItemInfo>(); // Add new list for PrimaryKey
|
||||
}
|
||||
_AllByPrimaryKey[tmp.ItemID.ToString()].Add(tmp); // Add to Primary Key list
|
||||
remove.Add(tmp);
|
||||
}
|
||||
foreach (ItemInfo tmp in remove)
|
||||
@ -57,7 +61,7 @@ namespace VEPROMS.CSLA.Library
|
||||
{
|
||||
ConvertListToDictionary();
|
||||
string key = itemID.ToString();
|
||||
if (_AllByPrimaryKey.ContainsKey(key)) return _AllByPrimaryKey[key];
|
||||
if (_AllByPrimaryKey.ContainsKey(key)) return _AllByPrimaryKey[key][0];
|
||||
return null;
|
||||
}
|
||||
#endregion
|
||||
@ -85,7 +89,7 @@ namespace VEPROMS.CSLA.Library
|
||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||
get
|
||||
{
|
||||
CanReadProperty("ItemID",true);
|
||||
CanReadProperty("ItemID", true);
|
||||
return _ItemID;
|
||||
}
|
||||
}
|
||||
@ -95,7 +99,7 @@ namespace VEPROMS.CSLA.Library
|
||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||
get
|
||||
{
|
||||
CanReadProperty("PreviousID",true);
|
||||
CanReadProperty("PreviousID", true);
|
||||
if (_MyPrevious != null) _PreviousID = _MyPrevious.ItemID;
|
||||
return _PreviousID;
|
||||
}
|
||||
@ -106,7 +110,7 @@ namespace VEPROMS.CSLA.Library
|
||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||
get
|
||||
{
|
||||
CanReadProperty("MyPrevious",true);
|
||||
CanReadProperty("MyPrevious", true);
|
||||
if (_MyPrevious == null && _PreviousID != null) _MyPrevious = ItemInfo.Get((int)_PreviousID);
|
||||
return _MyPrevious;
|
||||
}
|
||||
@ -117,7 +121,7 @@ namespace VEPROMS.CSLA.Library
|
||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||
get
|
||||
{
|
||||
CanReadProperty("ContentID",true);
|
||||
CanReadProperty("ContentID", true);
|
||||
if (_MyContent != null) _ContentID = _MyContent.ContentID;
|
||||
return _ContentID;
|
||||
}
|
||||
@ -128,7 +132,7 @@ namespace VEPROMS.CSLA.Library
|
||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||
get
|
||||
{
|
||||
CanReadProperty("MyContent",true);
|
||||
CanReadProperty("MyContent", true);
|
||||
if (_MyContent == null && _ContentID != 0) _MyContent = ContentInfo.Get(_ContentID);
|
||||
return _MyContent;
|
||||
}
|
||||
@ -139,7 +143,7 @@ namespace VEPROMS.CSLA.Library
|
||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||
get
|
||||
{
|
||||
CanReadProperty("DTS",true);
|
||||
CanReadProperty("DTS", true);
|
||||
return _DTS;
|
||||
}
|
||||
}
|
||||
@ -149,7 +153,7 @@ namespace VEPROMS.CSLA.Library
|
||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||
get
|
||||
{
|
||||
CanReadProperty("UserID",true);
|
||||
CanReadProperty("UserID", true);
|
||||
return _UserID;
|
||||
}
|
||||
}
|
||||
@ -162,7 +166,7 @@ namespace VEPROMS.CSLA.Library
|
||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||
get
|
||||
{
|
||||
CanReadProperty("ItemAnnotationCount",true);
|
||||
CanReadProperty("ItemAnnotationCount", true);
|
||||
return _ItemAnnotationCount;
|
||||
}
|
||||
}
|
||||
@ -173,7 +177,7 @@ namespace VEPROMS.CSLA.Library
|
||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||
get
|
||||
{
|
||||
CanReadProperty("ItemAnnotations",true);
|
||||
CanReadProperty("ItemAnnotations", true);
|
||||
if (_ItemAnnotationCount < 0 || (_ItemAnnotationCount > 0 && _ItemAnnotations == null))
|
||||
_ItemAnnotations = AnnotationInfoList.GetByItemID(_ItemID);
|
||||
if (_ItemAnnotationCount < 0)
|
||||
@ -183,7 +187,10 @@ namespace VEPROMS.CSLA.Library
|
||||
}
|
||||
internal void RefreshItemAnnotations()
|
||||
{
|
||||
_ItemAnnotationCount = -1; // This will cause the data to be requeried
|
||||
ConvertListToDictionary();
|
||||
if (_AllByPrimaryKey.ContainsKey(_ItemID.ToString()))
|
||||
foreach (ItemInfo tmp in _AllByPrimaryKey[_ItemID.ToString()])
|
||||
tmp._ItemAnnotationCount = -1; // This will cause the data to be requeried
|
||||
}
|
||||
private int _ItemDocVersionCount = 0;
|
||||
/// <summary>
|
||||
@ -194,7 +201,7 @@ namespace VEPROMS.CSLA.Library
|
||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||
get
|
||||
{
|
||||
CanReadProperty("ItemDocVersionCount",true);
|
||||
CanReadProperty("ItemDocVersionCount", true);
|
||||
return _ItemDocVersionCount;
|
||||
}
|
||||
}
|
||||
@ -205,7 +212,7 @@ namespace VEPROMS.CSLA.Library
|
||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||
get
|
||||
{
|
||||
CanReadProperty("ItemDocVersions",true);
|
||||
CanReadProperty("ItemDocVersions", true);
|
||||
if (_ItemDocVersionCount < 0 || (_ItemDocVersionCount > 0 && _ItemDocVersions == null))
|
||||
_ItemDocVersions = DocVersionInfoList.GetByItemID(_ItemID);
|
||||
if (_ItemDocVersionCount < 0)
|
||||
@ -215,7 +222,10 @@ namespace VEPROMS.CSLA.Library
|
||||
}
|
||||
internal void RefreshItemDocVersions()
|
||||
{
|
||||
_ItemDocVersionCount = -1; // This will cause the data to be requeried
|
||||
ConvertListToDictionary();
|
||||
if (_AllByPrimaryKey.ContainsKey(_ItemID.ToString()))
|
||||
foreach (ItemInfo tmp in _AllByPrimaryKey[_ItemID.ToString()])
|
||||
tmp._ItemDocVersionCount = -1; // This will cause the data to be requeried
|
||||
}
|
||||
private int _NextItemCount = 0;
|
||||
/// <summary>
|
||||
@ -226,7 +236,7 @@ namespace VEPROMS.CSLA.Library
|
||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||
get
|
||||
{
|
||||
CanReadProperty("NextItemCount",true);
|
||||
CanReadProperty("NextItemCount", true);
|
||||
return _NextItemCount;
|
||||
}
|
||||
}
|
||||
@ -237,7 +247,7 @@ namespace VEPROMS.CSLA.Library
|
||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||
get
|
||||
{
|
||||
CanReadProperty("NextItems",true);
|
||||
CanReadProperty("NextItems", true);
|
||||
if (_NextItemCount < 0 || (_NextItemCount > 0 && _NextItems == null))
|
||||
_NextItems = ItemInfoList.GetNext(_ItemID);
|
||||
if (_NextItemCount < 0)
|
||||
@ -247,7 +257,10 @@ namespace VEPROMS.CSLA.Library
|
||||
}
|
||||
internal void RefreshNextItems()
|
||||
{
|
||||
_NextItemCount = -1; // This will cause the data to be requeried
|
||||
ConvertListToDictionary();
|
||||
if (_AllByPrimaryKey.ContainsKey(_ItemID.ToString()))
|
||||
foreach (ItemInfo tmp in _AllByPrimaryKey[_ItemID.ToString()])
|
||||
tmp._NextItemCount = -1; // This will cause the data to be requeried
|
||||
}
|
||||
private int _ItemPartCount = 0;
|
||||
/// <summary>
|
||||
@ -258,7 +271,7 @@ namespace VEPROMS.CSLA.Library
|
||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||
get
|
||||
{
|
||||
CanReadProperty("ItemPartCount",true);
|
||||
CanReadProperty("ItemPartCount", true);
|
||||
return _ItemPartCount;
|
||||
}
|
||||
}
|
||||
@ -269,7 +282,7 @@ namespace VEPROMS.CSLA.Library
|
||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||
get
|
||||
{
|
||||
CanReadProperty("ItemParts",true);
|
||||
CanReadProperty("ItemParts", true);
|
||||
if (_ItemPartCount < 0 || (_ItemPartCount > 0 && _ItemParts == null))
|
||||
_ItemParts = PartInfoList.GetByItemID(_ItemID);
|
||||
if (_ItemPartCount < 0)
|
||||
@ -279,7 +292,10 @@ namespace VEPROMS.CSLA.Library
|
||||
}
|
||||
internal void RefreshItemParts()
|
||||
{
|
||||
_ItemPartCount = -1; // This will cause the data to be requeried
|
||||
ConvertListToDictionary();
|
||||
if (_AllByPrimaryKey.ContainsKey(_ItemID.ToString()))
|
||||
foreach (ItemInfo tmp in _AllByPrimaryKey[_ItemID.ToString()])
|
||||
tmp._ItemPartCount = -1; // This will cause the data to be requeried
|
||||
}
|
||||
private int _ItemTransition_RangeIDCount = 0;
|
||||
/// <summary>
|
||||
@ -290,7 +306,7 @@ namespace VEPROMS.CSLA.Library
|
||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||
get
|
||||
{
|
||||
CanReadProperty("ItemTransition_RangeIDCount",true);
|
||||
CanReadProperty("ItemTransition_RangeIDCount", true);
|
||||
return _ItemTransition_RangeIDCount;
|
||||
}
|
||||
}
|
||||
@ -301,7 +317,7 @@ namespace VEPROMS.CSLA.Library
|
||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||
get
|
||||
{
|
||||
CanReadProperty("ItemTransitions_RangeID",true);
|
||||
CanReadProperty("ItemTransitions_RangeID", true);
|
||||
if (_ItemTransition_RangeIDCount < 0 || (_ItemTransition_RangeIDCount > 0 && _ItemTransitions_RangeID == null))
|
||||
_ItemTransitions_RangeID = TransitionInfoList.GetByRangeID(_ItemID);
|
||||
if (_ItemTransition_RangeIDCount < 0)
|
||||
@ -311,7 +327,10 @@ namespace VEPROMS.CSLA.Library
|
||||
}
|
||||
internal void RefreshItemTransitions_RangeID()
|
||||
{
|
||||
_ItemTransition_RangeIDCount = -1; // This will cause the data to be requeried
|
||||
ConvertListToDictionary();
|
||||
if (_AllByPrimaryKey.ContainsKey(_ItemID.ToString()))
|
||||
foreach (ItemInfo tmp in _AllByPrimaryKey[_ItemID.ToString()])
|
||||
tmp._ItemTransition_RangeIDCount = -1; // This will cause the data to be requeried
|
||||
}
|
||||
private int _ItemTransition_ToIDCount = 0;
|
||||
/// <summary>
|
||||
@ -322,7 +341,7 @@ namespace VEPROMS.CSLA.Library
|
||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||
get
|
||||
{
|
||||
CanReadProperty("ItemTransition_ToIDCount",true);
|
||||
CanReadProperty("ItemTransition_ToIDCount", true);
|
||||
return _ItemTransition_ToIDCount;
|
||||
}
|
||||
}
|
||||
@ -333,7 +352,7 @@ namespace VEPROMS.CSLA.Library
|
||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||
get
|
||||
{
|
||||
CanReadProperty("ItemTransitions_ToID",true);
|
||||
CanReadProperty("ItemTransitions_ToID", true);
|
||||
if (_ItemTransition_ToIDCount < 0 || (_ItemTransition_ToIDCount > 0 && _ItemTransitions_ToID == null))
|
||||
_ItemTransitions_ToID = TransitionInfoList.GetByToID(_ItemID);
|
||||
if (_ItemTransition_ToIDCount < 0)
|
||||
@ -343,7 +362,10 @@ namespace VEPROMS.CSLA.Library
|
||||
}
|
||||
internal void RefreshItemTransitions_ToID()
|
||||
{
|
||||
_ItemTransition_ToIDCount = -1; // This will cause the data to be requeried
|
||||
ConvertListToDictionary();
|
||||
if (_AllByPrimaryKey.ContainsKey(_ItemID.ToString()))
|
||||
foreach (ItemInfo tmp in _AllByPrimaryKey[_ItemID.ToString()])
|
||||
tmp._ItemTransition_ToIDCount = -1; // This will cause the data to be requeried
|
||||
}
|
||||
// TODO: Replace base ItemInfo.ToString function as necessary
|
||||
/// <summary>
|
||||
@ -365,14 +387,25 @@ namespace VEPROMS.CSLA.Library
|
||||
}
|
||||
#endregion
|
||||
#region Factory Methods
|
||||
private static int _ItemInfoUnique = 0;
|
||||
private int _MyItemInfoUnique;
|
||||
public int MyItemInfoUnique
|
||||
{
|
||||
get { return _MyItemInfoUnique; }
|
||||
}
|
||||
private ItemInfo()
|
||||
{/* require use of factory methods */
|
||||
_MyItemInfoUnique = ++_ItemInfoUnique;
|
||||
_AllList.Add(this);
|
||||
}
|
||||
public void Dispose()
|
||||
{
|
||||
_AllList.Remove(this);
|
||||
_AllByPrimaryKey.Remove(ItemID.ToString());
|
||||
if (!_AllByPrimaryKey.ContainsKey(ItemID.ToString())) return;
|
||||
List<ItemInfo> listItemInfo = _AllByPrimaryKey[ItemID.ToString()]; // Get the list of items
|
||||
listItemInfo.Remove(this); // Remove the item from the list
|
||||
if (listItemInfo.Count == 0) // If there are no items left in the list
|
||||
_AllByPrimaryKey.Remove(ItemID.ToString()); // remove the list
|
||||
}
|
||||
public virtual Item Get()
|
||||
{
|
||||
@ -380,8 +413,10 @@ namespace VEPROMS.CSLA.Library
|
||||
}
|
||||
public static void Refresh(Item tmp)
|
||||
{
|
||||
ItemInfo tmpInfo = GetExistingByPrimaryKey(tmp.ItemID);
|
||||
if (tmpInfo == null) return;
|
||||
string key = tmp.ItemID.ToString();
|
||||
ConvertListToDictionary();
|
||||
if (_AllByPrimaryKey.ContainsKey(key))
|
||||
foreach (ItemInfo tmpInfo in _AllByPrimaryKey[key])
|
||||
tmpInfo.RefreshFields(tmp);
|
||||
}
|
||||
private void RefreshFields(Item tmp)
|
||||
@ -390,16 +425,16 @@ namespace VEPROMS.CSLA.Library
|
||||
{
|
||||
MyPrevious.RefreshNextItems(); // Update List for old value
|
||||
_PreviousID = tmp.PreviousID; // Update the value
|
||||
_MyPrevious = null; // Reset list so that the next line gets a new list
|
||||
MyPrevious.RefreshNextItems(); // Update List for new value
|
||||
}
|
||||
_MyPrevious = null; // Reset list so that the next line gets a new list
|
||||
if (MyPrevious != null) MyPrevious.RefreshNextItems(); // Update List for new value
|
||||
if (_ContentID != tmp.ContentID)
|
||||
{
|
||||
MyContent.RefreshContentItems(); // Update List for old value
|
||||
_ContentID = tmp.ContentID; // Update the value
|
||||
_MyContent = null; // Reset list so that the next line gets a new list
|
||||
MyContent.RefreshContentItems(); // Update List for new value
|
||||
}
|
||||
_MyContent = null; // Reset list so that the next line gets a new list
|
||||
if (MyContent != null) MyContent.RefreshContentItems(); // Update List for new value
|
||||
_DTS = tmp.DTS;
|
||||
_UserID = tmp.UserID;
|
||||
_ItemInfoExtension.Refresh(this);
|
||||
@ -409,8 +444,10 @@ namespace VEPROMS.CSLA.Library
|
||||
}
|
||||
public static void Refresh(ContentItem tmp)
|
||||
{
|
||||
ItemInfo tmpInfo = GetExistingByPrimaryKey(tmp.ItemID);
|
||||
if (tmpInfo == null) return;
|
||||
string key = tmp.ItemID.ToString();
|
||||
ConvertListToDictionary();
|
||||
if (_AllByPrimaryKey.ContainsKey(key))
|
||||
foreach (ItemInfo tmpInfo in _AllByPrimaryKey[key])
|
||||
tmpInfo.RefreshFields(tmp);
|
||||
}
|
||||
private void RefreshFields(ContentItem tmp)
|
||||
@ -419,9 +456,9 @@ namespace VEPROMS.CSLA.Library
|
||||
{
|
||||
MyPrevious.RefreshNextItems(); // Update List for old value
|
||||
_PreviousID = tmp.PreviousID; // Update the value
|
||||
_MyPrevious = null; // Reset list so that the next line gets a new list
|
||||
MyPrevious.RefreshNextItems(); // Update List for new value
|
||||
}
|
||||
_MyPrevious = null; // Reset list so that the next line gets a new list
|
||||
if (MyPrevious != null) MyPrevious.RefreshNextItems(); // Update List for new value
|
||||
_DTS = tmp.DTS;
|
||||
_UserID = tmp.UserID;
|
||||
_ItemInfoExtension.Refresh(this);
|
||||
@ -439,7 +476,7 @@ namespace VEPROMS.CSLA.Library
|
||||
if (tmp == null)
|
||||
{
|
||||
tmp = DataPortal.Fetch<ItemInfo>(new PKCriteria(itemID));
|
||||
_AllList.Add(tmp);
|
||||
if (!_AllList.Contains(tmp)) _AllList.Add(tmp);
|
||||
}
|
||||
if (tmp.ErrorMessage == "No Record Found") tmp = null;
|
||||
return tmp;
|
||||
@ -453,14 +490,15 @@ namespace VEPROMS.CSLA.Library
|
||||
#region Data Access Portal
|
||||
internal ItemInfo(SafeDataReader dr)
|
||||
{
|
||||
if(_MyLog.IsDebugEnabled)_MyLog.DebugFormat("[{0}] ItemInfo.Constructor", GetHashCode());
|
||||
_MyItemInfoUnique = ++_ItemInfoUnique;
|
||||
if (_MyLog.IsDebugEnabled) _MyLog.DebugFormat("[{0}] ItemInfo.Constructor", GetHashCode());
|
||||
try
|
||||
{
|
||||
ReadData(dr);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
if(_MyLog.IsErrorEnabled)_MyLog.Error("ItemInfo.Constructor", ex);
|
||||
if (_MyLog.IsErrorEnabled) _MyLog.Error("ItemInfo.Constructor", ex);
|
||||
throw new DbCslaException("ItemInfo.Constructor", ex);
|
||||
}
|
||||
}
|
||||
@ -477,7 +515,7 @@ namespace VEPROMS.CSLA.Library
|
||||
}
|
||||
private void ReadData(SafeDataReader dr)
|
||||
{
|
||||
if(_MyLog.IsDebugEnabled)_MyLog.DebugFormat("[{0}] ItemInfo.ReadData", GetHashCode());
|
||||
if (_MyLog.IsDebugEnabled) _MyLog.DebugFormat("[{0}] ItemInfo.ReadData", GetHashCode());
|
||||
try
|
||||
{
|
||||
_ItemID = dr.GetInt32("ItemID");
|
||||
@ -494,14 +532,14 @@ namespace VEPROMS.CSLA.Library
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
if(_MyLog.IsErrorEnabled)_MyLog.Error("ItemInfo.ReadData", ex);
|
||||
if (_MyLog.IsErrorEnabled) _MyLog.Error("ItemInfo.ReadData", ex);
|
||||
_ErrorMessage = ex.Message;
|
||||
throw new DbCslaException("ItemInfo.ReadData", ex);
|
||||
}
|
||||
}
|
||||
private void DataPortal_Fetch(PKCriteria criteria)
|
||||
{
|
||||
if(_MyLog.IsDebugEnabled)_MyLog.DebugFormat("[{0}] ItemInfo.DataPortal_Fetch", GetHashCode());
|
||||
if (_MyLog.IsDebugEnabled) _MyLog.DebugFormat("[{0}] ItemInfo.DataPortal_Fetch", GetHashCode());
|
||||
try
|
||||
{
|
||||
using (SqlConnection cn = Database.VEPROMS_SqlConnection)
|
||||
@ -529,7 +567,7 @@ namespace VEPROMS.CSLA.Library
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
if(_MyLog.IsErrorEnabled)_MyLog.Error("ItemInfo.DataPortal_Fetch", ex);
|
||||
if (_MyLog.IsErrorEnabled) _MyLog.Error("ItemInfo.DataPortal_Fetch", ex);
|
||||
_ErrorMessage = ex.Message;
|
||||
throw new DbCslaException("ItemInfo.DataPortal_Fetch", ex);
|
||||
}
|
||||
@ -539,7 +577,7 @@ namespace VEPROMS.CSLA.Library
|
||||
#region extension
|
||||
ItemInfoExtension _ItemInfoExtension = new ItemInfoExtension();
|
||||
[Serializable()]
|
||||
partial class ItemInfoExtension : extensionBase {}
|
||||
partial class ItemInfoExtension : extensionBase { }
|
||||
[Serializable()]
|
||||
class extensionBase
|
||||
{
|
||||
|
@ -124,7 +124,7 @@ namespace VEPROMS.CSLA.Library
|
||||
private void DataPortal_Fetch()
|
||||
{
|
||||
this.RaiseListChangedEvents = false;
|
||||
if(_MyLog.IsDebugEnabled)_MyLog.DebugFormat("[{0}] ItemInfoList.DataPortal_Fetch", GetHashCode());
|
||||
if (_MyLog.IsDebugEnabled) _MyLog.DebugFormat("[{0}] ItemInfoList.DataPortal_Fetch", GetHashCode());
|
||||
try
|
||||
{
|
||||
using (SqlConnection cn = Database.VEPROMS_SqlConnection)
|
||||
@ -144,7 +144,7 @@ namespace VEPROMS.CSLA.Library
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
if(_MyLog.IsErrorEnabled)_MyLog.Error("ItemInfoList.DataPortal_Fetch", ex);
|
||||
if (_MyLog.IsErrorEnabled) _MyLog.Error("ItemInfoList.DataPortal_Fetch", ex);
|
||||
throw new DbCslaException("ItemInfoList.DataPortal_Fetch", ex);
|
||||
}
|
||||
this.RaiseListChangedEvents = true;
|
||||
@ -166,7 +166,7 @@ namespace VEPROMS.CSLA.Library
|
||||
private void DataPortal_Fetch(PreviousIDCriteria criteria)
|
||||
{
|
||||
this.RaiseListChangedEvents = false;
|
||||
if(_MyLog.IsDebugEnabled)_MyLog.DebugFormat("[{0}] ItemInfoList.DataPortal_FetchPreviousID", GetHashCode());
|
||||
if (_MyLog.IsDebugEnabled) _MyLog.DebugFormat("[{0}] ItemInfoList.DataPortal_FetchPreviousID", GetHashCode());
|
||||
try
|
||||
{
|
||||
using (SqlConnection cn = Database.VEPROMS_SqlConnection)
|
||||
@ -187,7 +187,7 @@ namespace VEPROMS.CSLA.Library
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
if(_MyLog.IsErrorEnabled)_MyLog.Error("ItemInfoList.DataPortal_FetchPreviousID", ex);
|
||||
if (_MyLog.IsErrorEnabled) _MyLog.Error("ItemInfoList.DataPortal_FetchPreviousID", ex);
|
||||
throw new DbCslaException("ItemInfoList.DataPortal_Fetch", ex);
|
||||
}
|
||||
this.RaiseListChangedEvents = true;
|
||||
@ -209,7 +209,7 @@ namespace VEPROMS.CSLA.Library
|
||||
private void DataPortal_Fetch(ContentIDCriteria criteria)
|
||||
{
|
||||
this.RaiseListChangedEvents = false;
|
||||
if(_MyLog.IsDebugEnabled)_MyLog.DebugFormat("[{0}] ItemInfoList.DataPortal_FetchContentID", GetHashCode());
|
||||
if (_MyLog.IsDebugEnabled) _MyLog.DebugFormat("[{0}] ItemInfoList.DataPortal_FetchContentID", GetHashCode());
|
||||
try
|
||||
{
|
||||
using (SqlConnection cn = Database.VEPROMS_SqlConnection)
|
||||
@ -230,7 +230,7 @@ namespace VEPROMS.CSLA.Library
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
if(_MyLog.IsErrorEnabled)_MyLog.Error("ItemInfoList.DataPortal_FetchContentID", ex);
|
||||
if (_MyLog.IsErrorEnabled) _MyLog.Error("ItemInfoList.DataPortal_FetchContentID", ex);
|
||||
throw new DbCslaException("ItemInfoList.DataPortal_Fetch", ex);
|
||||
}
|
||||
this.RaiseListChangedEvents = true;
|
||||
@ -291,8 +291,8 @@ namespace VEPROMS.CSLA.Library
|
||||
/// </summary>
|
||||
public partial class ItemInfoListPropertyDescriptor : vlnListPropertyDescriptor
|
||||
{
|
||||
private ItemInfo Item { get { return (ItemInfo) _Item;} }
|
||||
public ItemInfoListPropertyDescriptor(ItemInfoList collection, int index):base(collection, index){;}
|
||||
private ItemInfo Item { get { return (ItemInfo)_Item; } }
|
||||
public ItemInfoListPropertyDescriptor(ItemInfoList collection, int index) : base(collection, index) { ;}
|
||||
}
|
||||
#endregion
|
||||
#region Converter
|
||||
@ -303,7 +303,7 @@ namespace VEPROMS.CSLA.Library
|
||||
if (destType == typeof(string) && value is ItemInfoList)
|
||||
{
|
||||
// Return department and department role separated by comma.
|
||||
return ((ItemInfoList) value).Items.Count.ToString() + " Items";
|
||||
return ((ItemInfoList)value).Items.Count.ToString() + " Items";
|
||||
}
|
||||
return base.ConvertTo(context, culture, value, destType);
|
||||
}
|
||||
|
@ -42,7 +42,7 @@ namespace VEPROMS.CSLA.Library
|
||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||
get
|
||||
{
|
||||
CanReadProperty("ContentID",true);
|
||||
CanReadProperty("ContentID", true);
|
||||
if (_MyContent != null) _ContentID = _MyContent.ContentID;
|
||||
return _ContentID;
|
||||
}
|
||||
@ -54,7 +54,7 @@ namespace VEPROMS.CSLA.Library
|
||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||
get
|
||||
{
|
||||
CanReadProperty("MyContent",true);
|
||||
CanReadProperty("MyContent", true);
|
||||
if (_MyContent == null && _ContentID != 0) _MyContent = Content.Get(_ContentID);
|
||||
return _MyContent;
|
||||
}
|
||||
@ -66,7 +66,7 @@ namespace VEPROMS.CSLA.Library
|
||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||
get
|
||||
{
|
||||
CanReadProperty("FromType",true);
|
||||
CanReadProperty("FromType", true);
|
||||
return _FromType;
|
||||
}
|
||||
}
|
||||
@ -76,13 +76,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;
|
||||
@ -96,13 +96,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)
|
||||
{
|
||||
@ -118,7 +118,7 @@ namespace VEPROMS.CSLA.Library
|
||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||
get
|
||||
{
|
||||
CanReadProperty("Content_Number",true);
|
||||
CanReadProperty("Content_Number", true);
|
||||
return _Content_Number;
|
||||
}
|
||||
}
|
||||
@ -128,7 +128,7 @@ namespace VEPROMS.CSLA.Library
|
||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||
get
|
||||
{
|
||||
CanReadProperty("Content_Text",true);
|
||||
CanReadProperty("Content_Text", true);
|
||||
return _Content_Text;
|
||||
}
|
||||
}
|
||||
@ -141,7 +141,7 @@ namespace VEPROMS.CSLA.Library
|
||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||
get
|
||||
{
|
||||
CanReadProperty("Content_Type",true);
|
||||
CanReadProperty("Content_Type", true);
|
||||
return _Content_Type;
|
||||
}
|
||||
}
|
||||
@ -151,7 +151,7 @@ namespace VEPROMS.CSLA.Library
|
||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||
get
|
||||
{
|
||||
CanReadProperty("Content_FormatID",true);
|
||||
CanReadProperty("Content_FormatID", true);
|
||||
return _Content_FormatID;
|
||||
}
|
||||
}
|
||||
@ -161,7 +161,7 @@ namespace VEPROMS.CSLA.Library
|
||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||
get
|
||||
{
|
||||
CanReadProperty("Content_Config",true);
|
||||
CanReadProperty("Content_Config", true);
|
||||
return _Content_Config;
|
||||
}
|
||||
}
|
||||
@ -171,7 +171,7 @@ namespace VEPROMS.CSLA.Library
|
||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||
get
|
||||
{
|
||||
CanReadProperty("Content_DTS",true);
|
||||
CanReadProperty("Content_DTS", true);
|
||||
return _Content_DTS;
|
||||
}
|
||||
}
|
||||
@ -181,7 +181,7 @@ namespace VEPROMS.CSLA.Library
|
||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||
get
|
||||
{
|
||||
CanReadProperty("Content_UserID",true);
|
||||
CanReadProperty("Content_UserID", true);
|
||||
return _Content_UserID;
|
||||
}
|
||||
}
|
||||
@ -206,22 +206,22 @@ namespace VEPROMS.CSLA.Library
|
||||
#endregion
|
||||
#region ValidationRules
|
||||
[NonSerialized]
|
||||
private bool _CheckingBrokenRules=false;
|
||||
private bool _CheckingBrokenRules = false;
|
||||
public IVEHasBrokenRules HasBrokenRules
|
||||
{
|
||||
get
|
||||
{
|
||||
if(_CheckingBrokenRules)return null;
|
||||
if (_CheckingBrokenRules) return null;
|
||||
if (BrokenRulesCollection.Count > 0) return this;
|
||||
try
|
||||
{
|
||||
_CheckingBrokenRules=true;
|
||||
_CheckingBrokenRules = true;
|
||||
IVEHasBrokenRules hasBrokenRules = null;
|
||||
return hasBrokenRules;
|
||||
}
|
||||
finally
|
||||
{
|
||||
_CheckingBrokenRules=false;
|
||||
_CheckingBrokenRules = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -331,7 +331,7 @@ namespace VEPROMS.CSLA.Library
|
||||
#region Data Access Portal
|
||||
private void Fetch(SafeDataReader dr)
|
||||
{
|
||||
if(_MyLog.IsDebugEnabled)_MyLog.DebugFormat("[{0}] ItemPart.FetchDR", GetHashCode());
|
||||
if (_MyLog.IsDebugEnabled) _MyLog.DebugFormat("[{0}] ItemPart.FetchDR", GetHashCode());
|
||||
try
|
||||
{
|
||||
_ContentID = dr.GetInt32("ContentID");
|
||||
@ -349,7 +349,7 @@ namespace VEPROMS.CSLA.Library
|
||||
}
|
||||
catch (Exception ex) // FKItem Fetch
|
||||
{
|
||||
if(_MyLog.IsErrorEnabled)_MyLog.Error("ItemPart.FetchDR", ex);
|
||||
if (_MyLog.IsErrorEnabled) _MyLog.Error("ItemPart.FetchDR", ex);
|
||||
throw new DbCslaException("ItemPart.Fetch", ex);
|
||||
}
|
||||
MarkOld();
|
||||
|
@ -94,8 +94,8 @@ namespace VEPROMS.CSLA.Library
|
||||
{
|
||||
get
|
||||
{
|
||||
IVEHasBrokenRules hasBrokenRules=null;
|
||||
foreach(ItemPart itemPart in this)
|
||||
IVEHasBrokenRules hasBrokenRules = null;
|
||||
foreach (ItemPart itemPart in this)
|
||||
if ((hasBrokenRules = itemPart.HasBrokenRules) != null) return hasBrokenRules;
|
||||
return hasBrokenRules;
|
||||
}
|
||||
@ -165,7 +165,7 @@ namespace VEPROMS.CSLA.Library
|
||||
private void DataPortal_Fetch(ItemIDCriteria criteria)
|
||||
{
|
||||
this.RaiseListChangedEvents = false;
|
||||
if(_MyLog.IsDebugEnabled)_MyLog.DebugFormat("[{0}] ItemParts.DataPortal_FetchItemID", GetHashCode());
|
||||
if (_MyLog.IsDebugEnabled) _MyLog.DebugFormat("[{0}] ItemParts.DataPortal_FetchItemID", GetHashCode());
|
||||
try
|
||||
{
|
||||
using (SqlConnection cn = Database.VEPROMS_SqlConnection)
|
||||
@ -184,7 +184,7 @@ namespace VEPROMS.CSLA.Library
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
if(_MyLog.IsErrorEnabled)_MyLog.Error("ItemParts.DataPortal_FetchItemID", ex);
|
||||
if (_MyLog.IsErrorEnabled) _MyLog.Error("ItemParts.DataPortal_FetchItemID", ex);
|
||||
throw new DbCslaException("ItemParts.DataPortal_Fetch", ex);
|
||||
}
|
||||
this.RaiseListChangedEvents = true;
|
||||
@ -269,8 +269,8 @@ namespace VEPROMS.CSLA.Library
|
||||
/// </summary>
|
||||
public partial class ItemPartsPropertyDescriptor : vlnListPropertyDescriptor
|
||||
{
|
||||
private ItemPart Item { get { return (ItemPart) _Item;} }
|
||||
public ItemPartsPropertyDescriptor(ItemParts collection, int index):base(collection, index){;}
|
||||
private ItemPart Item { get { return (ItemPart)_Item; } }
|
||||
public ItemPartsPropertyDescriptor(ItemParts collection, int index) : base(collection, index) { ;}
|
||||
}
|
||||
#endregion
|
||||
#region Converter
|
||||
@ -281,7 +281,7 @@ namespace VEPROMS.CSLA.Library
|
||||
if (destType == typeof(string) && value is ItemParts)
|
||||
{
|
||||
// Return department and department role separated by comma.
|
||||
return ((ItemParts) value).Items.Count.ToString() + " Parts";
|
||||
return ((ItemParts)value).Items.Count.ToString() + " Parts";
|
||||
}
|
||||
return base.ConvertTo(context, culture, value, destType);
|
||||
}
|
||||
|
@ -42,7 +42,7 @@ namespace VEPROMS.CSLA.Library
|
||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||
get
|
||||
{
|
||||
CanReadProperty("TransitionID",true);
|
||||
CanReadProperty("TransitionID", true);
|
||||
if (_MyTransition != null) _TransitionID = _MyTransition.TransitionID;
|
||||
return _TransitionID;
|
||||
}
|
||||
@ -54,7 +54,7 @@ namespace VEPROMS.CSLA.Library
|
||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||
get
|
||||
{
|
||||
CanReadProperty("MyTransition",true);
|
||||
CanReadProperty("MyTransition", true);
|
||||
if (_MyTransition == null && _TransitionID != 0) _MyTransition = Transition.Get(_TransitionID);
|
||||
return _MyTransition;
|
||||
}
|
||||
@ -65,7 +65,7 @@ namespace VEPROMS.CSLA.Library
|
||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||
get
|
||||
{
|
||||
CanReadProperty("FromID",true);
|
||||
CanReadProperty("FromID", true);
|
||||
if (_MyContent != null) _FromID = _MyContent.ContentID;
|
||||
return _FromID;
|
||||
}
|
||||
@ -76,14 +76,14 @@ namespace VEPROMS.CSLA.Library
|
||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||
get
|
||||
{
|
||||
CanReadProperty("MyContent",true);
|
||||
CanReadProperty("MyContent", true);
|
||||
if (_MyContent == null && _FromID != 0) _MyContent = Content.Get(_FromID);
|
||||
return _MyContent;
|
||||
}
|
||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||
set
|
||||
{
|
||||
CanWriteProperty("MyContent",true);
|
||||
CanWriteProperty("MyContent", true);
|
||||
if (_MyContent != value)
|
||||
{
|
||||
_MyContent = value;
|
||||
@ -100,7 +100,7 @@ namespace VEPROMS.CSLA.Library
|
||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||
get
|
||||
{
|
||||
CanReadProperty("ToID",true);
|
||||
CanReadProperty("ToID", true);
|
||||
if (_MyItemToID != null) _ToID = _MyItemToID.ItemID;
|
||||
return _ToID;
|
||||
}
|
||||
@ -111,14 +111,14 @@ namespace VEPROMS.CSLA.Library
|
||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||
get
|
||||
{
|
||||
CanReadProperty("MyItemToID",true);
|
||||
CanReadProperty("MyItemToID", true);
|
||||
if (_MyItemToID == null && _ToID != 0) _MyItemToID = Item.Get(_ToID);
|
||||
return _MyItemToID;
|
||||
}
|
||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||
set
|
||||
{
|
||||
CanWriteProperty("MyItemToID",true);
|
||||
CanWriteProperty("MyItemToID", true);
|
||||
if (_MyItemToID != value)
|
||||
{
|
||||
_MyItemToID = value;
|
||||
@ -132,13 +132,13 @@ namespace VEPROMS.CSLA.Library
|
||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||
get
|
||||
{
|
||||
CanReadProperty("TranType",true);
|
||||
CanReadProperty("TranType", true);
|
||||
return _TranType;
|
||||
}
|
||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||
set
|
||||
{
|
||||
CanWriteProperty("TranType",true);
|
||||
CanWriteProperty("TranType", true);
|
||||
if (_TranType != value)
|
||||
{
|
||||
_TranType = value;
|
||||
@ -152,13 +152,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)
|
||||
{
|
||||
@ -173,13 +173,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;
|
||||
@ -193,13 +193,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)
|
||||
{
|
||||
@ -215,7 +215,7 @@ namespace VEPROMS.CSLA.Library
|
||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||
get
|
||||
{
|
||||
CanReadProperty("Content_Number",true);
|
||||
CanReadProperty("Content_Number", true);
|
||||
return _Content_Number;
|
||||
}
|
||||
}
|
||||
@ -225,7 +225,7 @@ namespace VEPROMS.CSLA.Library
|
||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||
get
|
||||
{
|
||||
CanReadProperty("Content_Text",true);
|
||||
CanReadProperty("Content_Text", true);
|
||||
return _Content_Text;
|
||||
}
|
||||
}
|
||||
@ -238,7 +238,7 @@ namespace VEPROMS.CSLA.Library
|
||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||
get
|
||||
{
|
||||
CanReadProperty("Content_Type",true);
|
||||
CanReadProperty("Content_Type", true);
|
||||
return _Content_Type;
|
||||
}
|
||||
}
|
||||
@ -248,7 +248,7 @@ namespace VEPROMS.CSLA.Library
|
||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||
get
|
||||
{
|
||||
CanReadProperty("Content_FormatID",true);
|
||||
CanReadProperty("Content_FormatID", true);
|
||||
return _Content_FormatID;
|
||||
}
|
||||
}
|
||||
@ -258,7 +258,7 @@ namespace VEPROMS.CSLA.Library
|
||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||
get
|
||||
{
|
||||
CanReadProperty("Content_Config",true);
|
||||
CanReadProperty("Content_Config", true);
|
||||
return _Content_Config;
|
||||
}
|
||||
}
|
||||
@ -268,7 +268,7 @@ namespace VEPROMS.CSLA.Library
|
||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||
get
|
||||
{
|
||||
CanReadProperty("Content_DTS",true);
|
||||
CanReadProperty("Content_DTS", true);
|
||||
return _Content_DTS;
|
||||
}
|
||||
}
|
||||
@ -278,7 +278,7 @@ namespace VEPROMS.CSLA.Library
|
||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||
get
|
||||
{
|
||||
CanReadProperty("Content_UserID",true);
|
||||
CanReadProperty("Content_UserID", true);
|
||||
return _Content_UserID;
|
||||
}
|
||||
}
|
||||
@ -311,23 +311,23 @@ namespace VEPROMS.CSLA.Library
|
||||
#endregion
|
||||
#region ValidationRules
|
||||
[NonSerialized]
|
||||
private bool _CheckingBrokenRules=false;
|
||||
private bool _CheckingBrokenRules = false;
|
||||
public IVEHasBrokenRules HasBrokenRules
|
||||
{
|
||||
get
|
||||
{
|
||||
if(_CheckingBrokenRules)return null;
|
||||
if (_CheckingBrokenRules) return null;
|
||||
if (BrokenRulesCollection.Count > 0) return this;
|
||||
try
|
||||
{
|
||||
_CheckingBrokenRules=true;
|
||||
_CheckingBrokenRules = true;
|
||||
IVEHasBrokenRules hasBrokenRules = null;
|
||||
if (_MyContent != null && (hasBrokenRules = _MyContent.HasBrokenRules) != null) return hasBrokenRules;
|
||||
return hasBrokenRules;
|
||||
}
|
||||
finally
|
||||
{
|
||||
_CheckingBrokenRules=false;
|
||||
_CheckingBrokenRules = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -459,7 +459,7 @@ namespace VEPROMS.CSLA.Library
|
||||
#region Data Access Portal
|
||||
private void Fetch(SafeDataReader dr)
|
||||
{
|
||||
if(_MyLog.IsDebugEnabled)_MyLog.DebugFormat("[{0}] ItemTransition_RangeID.FetchDR", GetHashCode());
|
||||
if (_MyLog.IsDebugEnabled) _MyLog.DebugFormat("[{0}] ItemTransition_RangeID.FetchDR", GetHashCode());
|
||||
try
|
||||
{
|
||||
_TransitionID = dr.GetInt32("TransitionID");
|
||||
@ -480,7 +480,7 @@ namespace VEPROMS.CSLA.Library
|
||||
}
|
||||
catch (Exception ex) // FKItem Fetch
|
||||
{
|
||||
if(_MyLog.IsErrorEnabled)_MyLog.Error("ItemTransition_RangeID.FetchDR", ex);
|
||||
if (_MyLog.IsErrorEnabled) _MyLog.Error("ItemTransition_RangeID.FetchDR", ex);
|
||||
throw new DbCslaException("ItemTransition_RangeID.Fetch", ex);
|
||||
}
|
||||
MarkOld();
|
||||
|
@ -42,7 +42,7 @@ namespace VEPROMS.CSLA.Library
|
||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||
get
|
||||
{
|
||||
CanReadProperty("TransitionID",true);
|
||||
CanReadProperty("TransitionID", true);
|
||||
if (_MyTransition != null) _TransitionID = _MyTransition.TransitionID;
|
||||
return _TransitionID;
|
||||
}
|
||||
@ -54,7 +54,7 @@ namespace VEPROMS.CSLA.Library
|
||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||
get
|
||||
{
|
||||
CanReadProperty("MyTransition",true);
|
||||
CanReadProperty("MyTransition", true);
|
||||
if (_MyTransition == null && _TransitionID != 0) _MyTransition = Transition.Get(_TransitionID);
|
||||
return _MyTransition;
|
||||
}
|
||||
@ -65,7 +65,7 @@ namespace VEPROMS.CSLA.Library
|
||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||
get
|
||||
{
|
||||
CanReadProperty("FromID",true);
|
||||
CanReadProperty("FromID", true);
|
||||
if (_MyContent != null) _FromID = _MyContent.ContentID;
|
||||
return _FromID;
|
||||
}
|
||||
@ -76,14 +76,14 @@ namespace VEPROMS.CSLA.Library
|
||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||
get
|
||||
{
|
||||
CanReadProperty("MyContent",true);
|
||||
CanReadProperty("MyContent", true);
|
||||
if (_MyContent == null && _FromID != 0) _MyContent = Content.Get(_FromID);
|
||||
return _MyContent;
|
||||
}
|
||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||
set
|
||||
{
|
||||
CanWriteProperty("MyContent",true);
|
||||
CanWriteProperty("MyContent", true);
|
||||
if (_MyContent != value)
|
||||
{
|
||||
_MyContent = value;
|
||||
@ -97,7 +97,7 @@ namespace VEPROMS.CSLA.Library
|
||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||
get
|
||||
{
|
||||
CanReadProperty("RangeID",true);
|
||||
CanReadProperty("RangeID", true);
|
||||
if (_MyItemRangeID != null) _RangeID = _MyItemRangeID.ItemID;
|
||||
return _RangeID;
|
||||
}
|
||||
@ -108,14 +108,14 @@ namespace VEPROMS.CSLA.Library
|
||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||
get
|
||||
{
|
||||
CanReadProperty("MyItemRangeID",true);
|
||||
CanReadProperty("MyItemRangeID", true);
|
||||
if (_MyItemRangeID == null && _RangeID != 0) _MyItemRangeID = Item.Get(_RangeID);
|
||||
return _MyItemRangeID;
|
||||
}
|
||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||
set
|
||||
{
|
||||
CanWriteProperty("MyItemRangeID",true);
|
||||
CanWriteProperty("MyItemRangeID", true);
|
||||
if (_MyItemRangeID != value)
|
||||
{
|
||||
_MyItemRangeID = value;
|
||||
@ -129,13 +129,13 @@ namespace VEPROMS.CSLA.Library
|
||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||
get
|
||||
{
|
||||
CanReadProperty("TranType",true);
|
||||
CanReadProperty("TranType", true);
|
||||
return _TranType;
|
||||
}
|
||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||
set
|
||||
{
|
||||
CanWriteProperty("TranType",true);
|
||||
CanWriteProperty("TranType", true);
|
||||
if (_TranType != value)
|
||||
{
|
||||
_TranType = value;
|
||||
@ -149,13 +149,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)
|
||||
{
|
||||
@ -170,13 +170,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;
|
||||
@ -190,13 +190,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)
|
||||
{
|
||||
@ -212,7 +212,7 @@ namespace VEPROMS.CSLA.Library
|
||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||
get
|
||||
{
|
||||
CanReadProperty("Content_Number",true);
|
||||
CanReadProperty("Content_Number", true);
|
||||
return _Content_Number;
|
||||
}
|
||||
}
|
||||
@ -222,7 +222,7 @@ namespace VEPROMS.CSLA.Library
|
||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||
get
|
||||
{
|
||||
CanReadProperty("Content_Text",true);
|
||||
CanReadProperty("Content_Text", true);
|
||||
return _Content_Text;
|
||||
}
|
||||
}
|
||||
@ -235,7 +235,7 @@ namespace VEPROMS.CSLA.Library
|
||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||
get
|
||||
{
|
||||
CanReadProperty("Content_Type",true);
|
||||
CanReadProperty("Content_Type", true);
|
||||
return _Content_Type;
|
||||
}
|
||||
}
|
||||
@ -245,7 +245,7 @@ namespace VEPROMS.CSLA.Library
|
||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||
get
|
||||
{
|
||||
CanReadProperty("Content_FormatID",true);
|
||||
CanReadProperty("Content_FormatID", true);
|
||||
return _Content_FormatID;
|
||||
}
|
||||
}
|
||||
@ -255,7 +255,7 @@ namespace VEPROMS.CSLA.Library
|
||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||
get
|
||||
{
|
||||
CanReadProperty("Content_Config",true);
|
||||
CanReadProperty("Content_Config", true);
|
||||
return _Content_Config;
|
||||
}
|
||||
}
|
||||
@ -265,7 +265,7 @@ namespace VEPROMS.CSLA.Library
|
||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||
get
|
||||
{
|
||||
CanReadProperty("Content_DTS",true);
|
||||
CanReadProperty("Content_DTS", true);
|
||||
return _Content_DTS;
|
||||
}
|
||||
}
|
||||
@ -275,7 +275,7 @@ namespace VEPROMS.CSLA.Library
|
||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||
get
|
||||
{
|
||||
CanReadProperty("Content_UserID",true);
|
||||
CanReadProperty("Content_UserID", true);
|
||||
return _Content_UserID;
|
||||
}
|
||||
}
|
||||
@ -308,23 +308,23 @@ namespace VEPROMS.CSLA.Library
|
||||
#endregion
|
||||
#region ValidationRules
|
||||
[NonSerialized]
|
||||
private bool _CheckingBrokenRules=false;
|
||||
private bool _CheckingBrokenRules = false;
|
||||
public IVEHasBrokenRules HasBrokenRules
|
||||
{
|
||||
get
|
||||
{
|
||||
if(_CheckingBrokenRules)return null;
|
||||
if (_CheckingBrokenRules) return null;
|
||||
if (BrokenRulesCollection.Count > 0) return this;
|
||||
try
|
||||
{
|
||||
_CheckingBrokenRules=true;
|
||||
_CheckingBrokenRules = true;
|
||||
IVEHasBrokenRules hasBrokenRules = null;
|
||||
if (_MyContent != null && (hasBrokenRules = _MyContent.HasBrokenRules) != null) return hasBrokenRules;
|
||||
return hasBrokenRules;
|
||||
}
|
||||
finally
|
||||
{
|
||||
_CheckingBrokenRules=false;
|
||||
_CheckingBrokenRules = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -456,7 +456,7 @@ namespace VEPROMS.CSLA.Library
|
||||
#region Data Access Portal
|
||||
private void Fetch(SafeDataReader dr)
|
||||
{
|
||||
if(_MyLog.IsDebugEnabled)_MyLog.DebugFormat("[{0}] ItemTransition_ToID.FetchDR", GetHashCode());
|
||||
if (_MyLog.IsDebugEnabled) _MyLog.DebugFormat("[{0}] ItemTransition_ToID.FetchDR", GetHashCode());
|
||||
try
|
||||
{
|
||||
_TransitionID = dr.GetInt32("TransitionID");
|
||||
@ -477,7 +477,7 @@ namespace VEPROMS.CSLA.Library
|
||||
}
|
||||
catch (Exception ex) // FKItem Fetch
|
||||
{
|
||||
if(_MyLog.IsErrorEnabled)_MyLog.Error("ItemTransition_ToID.FetchDR", ex);
|
||||
if (_MyLog.IsErrorEnabled) _MyLog.Error("ItemTransition_ToID.FetchDR", ex);
|
||||
throw new DbCslaException("ItemTransition_ToID.Fetch", ex);
|
||||
}
|
||||
MarkOld();
|
||||
|
@ -94,8 +94,8 @@ namespace VEPROMS.CSLA.Library
|
||||
{
|
||||
get
|
||||
{
|
||||
IVEHasBrokenRules hasBrokenRules=null;
|
||||
foreach(ItemTransition_RangeID itemTransitionRangeID in this)
|
||||
IVEHasBrokenRules hasBrokenRules = null;
|
||||
foreach (ItemTransition_RangeID itemTransitionRangeID in this)
|
||||
if ((hasBrokenRules = itemTransitionRangeID.HasBrokenRules) != null) return hasBrokenRules;
|
||||
return hasBrokenRules;
|
||||
}
|
||||
@ -165,7 +165,7 @@ namespace VEPROMS.CSLA.Library
|
||||
private void DataPortal_Fetch(RangeIDCriteria criteria)
|
||||
{
|
||||
this.RaiseListChangedEvents = false;
|
||||
if(_MyLog.IsDebugEnabled)_MyLog.DebugFormat("[{0}] ItemTransitions_RangeID.DataPortal_FetchRangeID", GetHashCode());
|
||||
if (_MyLog.IsDebugEnabled) _MyLog.DebugFormat("[{0}] ItemTransitions_RangeID.DataPortal_FetchRangeID", GetHashCode());
|
||||
try
|
||||
{
|
||||
using (SqlConnection cn = Database.VEPROMS_SqlConnection)
|
||||
@ -184,7 +184,7 @@ namespace VEPROMS.CSLA.Library
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
if(_MyLog.IsErrorEnabled)_MyLog.Error("ItemTransitions_RangeID.DataPortal_FetchRangeID", ex);
|
||||
if (_MyLog.IsErrorEnabled) _MyLog.Error("ItemTransitions_RangeID.DataPortal_FetchRangeID", ex);
|
||||
throw new DbCslaException("ItemTransitions_RangeID.DataPortal_Fetch", ex);
|
||||
}
|
||||
this.RaiseListChangedEvents = true;
|
||||
@ -269,8 +269,8 @@ namespace VEPROMS.CSLA.Library
|
||||
/// </summary>
|
||||
public partial class ItemTransitions_RangeIDPropertyDescriptor : vlnListPropertyDescriptor
|
||||
{
|
||||
private ItemTransition_RangeID Item { get { return (ItemTransition_RangeID) _Item;} }
|
||||
public ItemTransitions_RangeIDPropertyDescriptor(ItemTransitions_RangeID collection, int index):base(collection, index){;}
|
||||
private ItemTransition_RangeID Item { get { return (ItemTransition_RangeID)_Item; } }
|
||||
public ItemTransitions_RangeIDPropertyDescriptor(ItemTransitions_RangeID collection, int index) : base(collection, index) { ;}
|
||||
}
|
||||
#endregion
|
||||
#region Converter
|
||||
@ -281,7 +281,7 @@ namespace VEPROMS.CSLA.Library
|
||||
if (destType == typeof(string) && value is ItemTransitions_RangeID)
|
||||
{
|
||||
// Return department and department role separated by comma.
|
||||
return ((ItemTransitions_RangeID) value).Items.Count.ToString() + " Transitions_RangeID";
|
||||
return ((ItemTransitions_RangeID)value).Items.Count.ToString() + " Transitions_RangeID";
|
||||
}
|
||||
return base.ConvertTo(context, culture, value, destType);
|
||||
}
|
||||
|
@ -94,8 +94,8 @@ namespace VEPROMS.CSLA.Library
|
||||
{
|
||||
get
|
||||
{
|
||||
IVEHasBrokenRules hasBrokenRules=null;
|
||||
foreach(ItemTransition_ToID itemTransitionToID in this)
|
||||
IVEHasBrokenRules hasBrokenRules = null;
|
||||
foreach (ItemTransition_ToID itemTransitionToID in this)
|
||||
if ((hasBrokenRules = itemTransitionToID.HasBrokenRules) != null) return hasBrokenRules;
|
||||
return hasBrokenRules;
|
||||
}
|
||||
@ -165,7 +165,7 @@ namespace VEPROMS.CSLA.Library
|
||||
private void DataPortal_Fetch(ToIDCriteria criteria)
|
||||
{
|
||||
this.RaiseListChangedEvents = false;
|
||||
if(_MyLog.IsDebugEnabled)_MyLog.DebugFormat("[{0}] ItemTransitions_ToID.DataPortal_FetchToID", GetHashCode());
|
||||
if (_MyLog.IsDebugEnabled) _MyLog.DebugFormat("[{0}] ItemTransitions_ToID.DataPortal_FetchToID", GetHashCode());
|
||||
try
|
||||
{
|
||||
using (SqlConnection cn = Database.VEPROMS_SqlConnection)
|
||||
@ -184,7 +184,7 @@ namespace VEPROMS.CSLA.Library
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
if(_MyLog.IsErrorEnabled)_MyLog.Error("ItemTransitions_ToID.DataPortal_FetchToID", ex);
|
||||
if (_MyLog.IsErrorEnabled) _MyLog.Error("ItemTransitions_ToID.DataPortal_FetchToID", ex);
|
||||
throw new DbCslaException("ItemTransitions_ToID.DataPortal_Fetch", ex);
|
||||
}
|
||||
this.RaiseListChangedEvents = true;
|
||||
@ -269,8 +269,8 @@ namespace VEPROMS.CSLA.Library
|
||||
/// </summary>
|
||||
public partial class ItemTransitions_ToIDPropertyDescriptor : vlnListPropertyDescriptor
|
||||
{
|
||||
private ItemTransition_ToID Item { get { return (ItemTransition_ToID) _Item;} }
|
||||
public ItemTransitions_ToIDPropertyDescriptor(ItemTransitions_ToID collection, int index):base(collection, index){;}
|
||||
private ItemTransition_ToID Item { get { return (ItemTransition_ToID)_Item; } }
|
||||
public ItemTransitions_ToIDPropertyDescriptor(ItemTransitions_ToID collection, int index) : base(collection, index) { ;}
|
||||
}
|
||||
#endregion
|
||||
#region Converter
|
||||
@ -281,7 +281,7 @@ namespace VEPROMS.CSLA.Library
|
||||
if (destType == typeof(string) && value is ItemTransitions_ToID)
|
||||
{
|
||||
// Return department and department role separated by comma.
|
||||
return ((ItemTransitions_ToID) value).Items.Count.ToString() + " Transitions_ToID";
|
||||
return ((ItemTransitions_ToID)value).Items.Count.ToString() + " Transitions_ToID";
|
||||
}
|
||||
return base.ConvertTo(context, culture, value, destType);
|
||||
}
|
||||
|
@ -47,20 +47,24 @@ namespace VEPROMS.CSLA.Library
|
||||
foreach (Membership tmp in _RefreshMemberships)
|
||||
{
|
||||
MembershipInfo.Refresh(tmp);
|
||||
if(tmp._MyGroup != null) GroupInfo.Refresh(tmp._MyGroup);
|
||||
if(tmp._MyUser != null) UserInfo.Refresh(tmp._MyUser);
|
||||
if (tmp._MyGroup != null) GroupInfo.Refresh(tmp._MyGroup);
|
||||
if (tmp._MyUser != null) UserInfo.Refresh(tmp._MyUser);
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
#region Collection
|
||||
protected static List<Membership> _AllList = new List<Membership>();
|
||||
private static Dictionary<string, Membership> _AllByPrimaryKey = new Dictionary<string, Membership>();
|
||||
private static Dictionary<string, List<Membership>> _AllByPrimaryKey = new Dictionary<string, List<Membership>>();
|
||||
private static void ConvertListToDictionary()
|
||||
{
|
||||
List<Membership> remove = new List<Membership>();
|
||||
foreach (Membership tmp in _AllList)
|
||||
{
|
||||
_AllByPrimaryKey[tmp.UGID.ToString()]=tmp; // Primary Key
|
||||
if (!_AllByPrimaryKey.ContainsKey(tmp.UGID.ToString()))
|
||||
{
|
||||
_AllByPrimaryKey[tmp.UGID.ToString()] = new List<Membership>(); // Add new list for PrimaryKey
|
||||
}
|
||||
_AllByPrimaryKey[tmp.UGID.ToString()].Add(tmp); // Add to Primary Key list
|
||||
remove.Add(tmp);
|
||||
}
|
||||
foreach (Membership tmp in remove)
|
||||
@ -70,7 +74,7 @@ namespace VEPROMS.CSLA.Library
|
||||
{
|
||||
ConvertListToDictionary();
|
||||
string key = ugid.ToString();
|
||||
if (_AllByPrimaryKey.ContainsKey(key)) return _AllByPrimaryKey[key];
|
||||
if (_AllByPrimaryKey.ContainsKey(key)) return _AllByPrimaryKey[key][0];
|
||||
return null;
|
||||
}
|
||||
#endregion
|
||||
@ -92,7 +96,7 @@ namespace VEPROMS.CSLA.Library
|
||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||
get
|
||||
{
|
||||
CanReadProperty("UGID",true);
|
||||
CanReadProperty("UGID", true);
|
||||
return _UGID;
|
||||
}
|
||||
}
|
||||
@ -102,7 +106,7 @@ namespace VEPROMS.CSLA.Library
|
||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||
get
|
||||
{
|
||||
CanReadProperty("UID",true);
|
||||
CanReadProperty("UID", true);
|
||||
if (_MyUser != null) _UID = _MyUser.UID;
|
||||
return _UID;
|
||||
}
|
||||
@ -113,14 +117,14 @@ namespace VEPROMS.CSLA.Library
|
||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||
get
|
||||
{
|
||||
CanReadProperty("MyUser",true);
|
||||
CanReadProperty("MyUser", true);
|
||||
if (_MyUser == null && _UID != 0) _MyUser = User.Get(_UID);
|
||||
return _MyUser;
|
||||
}
|
||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||
set
|
||||
{
|
||||
CanWriteProperty("MyUser",true);
|
||||
CanWriteProperty("MyUser", true);
|
||||
if (_MyUser != value)
|
||||
{
|
||||
_MyUser = value;
|
||||
@ -134,7 +138,7 @@ namespace VEPROMS.CSLA.Library
|
||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||
get
|
||||
{
|
||||
CanReadProperty("GID",true);
|
||||
CanReadProperty("GID", true);
|
||||
if (_MyGroup != null) _GID = _MyGroup.GID;
|
||||
return _GID;
|
||||
}
|
||||
@ -145,14 +149,14 @@ namespace VEPROMS.CSLA.Library
|
||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||
get
|
||||
{
|
||||
CanReadProperty("MyGroup",true);
|
||||
CanReadProperty("MyGroup", true);
|
||||
if (_MyGroup == null && _GID != 0) _MyGroup = Group.Get(_GID);
|
||||
return _MyGroup;
|
||||
}
|
||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||
set
|
||||
{
|
||||
CanWriteProperty("MyGroup",true);
|
||||
CanWriteProperty("MyGroup", true);
|
||||
if (_MyGroup != value)
|
||||
{
|
||||
_MyGroup = value;
|
||||
@ -166,13 +170,13 @@ namespace VEPROMS.CSLA.Library
|
||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||
get
|
||||
{
|
||||
CanReadProperty("StartDate",true);
|
||||
CanReadProperty("StartDate", true);
|
||||
return _StartDate;
|
||||
}
|
||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||
set
|
||||
{
|
||||
CanWriteProperty("StartDate",true);
|
||||
CanWriteProperty("StartDate", true);
|
||||
if (value == null) value = string.Empty;
|
||||
_StartDate = value;
|
||||
try
|
||||
@ -196,13 +200,13 @@ namespace VEPROMS.CSLA.Library
|
||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||
get
|
||||
{
|
||||
CanReadProperty("EndDate",true);
|
||||
CanReadProperty("EndDate", true);
|
||||
return _EndDate;
|
||||
}
|
||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||
set
|
||||
{
|
||||
CanWriteProperty("EndDate",true);
|
||||
CanWriteProperty("EndDate", true);
|
||||
if (value == null) value = string.Empty;
|
||||
_EndDate = value;
|
||||
try
|
||||
@ -226,13 +230,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)
|
||||
{
|
||||
@ -247,13 +251,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;
|
||||
@ -267,13 +271,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)
|
||||
{
|
||||
@ -285,11 +289,11 @@ namespace VEPROMS.CSLA.Library
|
||||
private byte[] _LastChanged = new byte[8];//timestamp
|
||||
public override bool IsDirty
|
||||
{
|
||||
get { return base.IsDirty || (_MyGroup == null? false : _MyGroup.IsDirty) || (_MyUser == null? false : _MyUser.IsDirty); }
|
||||
get { return base.IsDirty || (_MyGroup == null ? false : _MyGroup.IsDirty) || (_MyUser == null ? false : _MyUser.IsDirty); }
|
||||
}
|
||||
public override bool IsValid
|
||||
{
|
||||
get { return (IsNew && !IsDirty ? true : base.IsValid) && (_MyGroup == null? true : _MyGroup.IsValid) && (_MyUser == null? true : _MyUser.IsValid); }
|
||||
get { return (IsNew && !IsDirty ? true : base.IsValid) && (_MyGroup == null ? true : _MyGroup.IsValid) && (_MyUser == null ? true : _MyUser.IsValid); }
|
||||
}
|
||||
// TODO: Replace base Membership.ToString function as necessary
|
||||
/// <summary>
|
||||
@ -312,15 +316,16 @@ 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 (_MyUser != null && (hasBrokenRules = _MyUser.HasBrokenRules) != null) return hasBrokenRules;
|
||||
if (_MyGroup != null && (hasBrokenRules = _MyGroup.HasBrokenRules) != null) return hasBrokenRules;
|
||||
@ -328,7 +333,7 @@ namespace VEPROMS.CSLA.Library
|
||||
}
|
||||
finally
|
||||
{
|
||||
_CheckingBrokenRules=false;
|
||||
_CheckingBrokenRules = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -478,14 +483,25 @@ namespace VEPROMS.CSLA.Library
|
||||
#region Factory Methods
|
||||
public int CurrentEditLevel
|
||||
{ get { return EditLevel; } }
|
||||
private static int _MembershipUnique = 0;
|
||||
private int _MyMembershipUnique;
|
||||
public int MyMembershipUnique
|
||||
{
|
||||
get { return _MyMembershipUnique; }
|
||||
}
|
||||
protected Membership()
|
||||
{/* require use of factory methods */
|
||||
_MyMembershipUnique = ++_MembershipUnique;
|
||||
_AllList.Add(this);
|
||||
}
|
||||
public void Dispose()
|
||||
{
|
||||
_AllList.Remove(this);
|
||||
_AllByPrimaryKey.Remove(UGID.ToString());
|
||||
if (!_AllByPrimaryKey.ContainsKey(UGID.ToString())) return;
|
||||
List<Membership> listMembership = _AllByPrimaryKey[UGID.ToString()]; // Get the list of items
|
||||
listMembership.Remove(this); // Remove the item from the list
|
||||
if (listMembership.Count == 0) //If there are no items left in the list
|
||||
_AllByPrimaryKey.Remove(UGID.ToString()); // remove the list
|
||||
}
|
||||
public static Membership New()
|
||||
{
|
||||
@ -570,7 +586,7 @@ namespace VEPROMS.CSLA.Library
|
||||
if (tmp == null)
|
||||
{
|
||||
tmp = DataPortal.Fetch<Membership>(new PKCriteria(ugid));
|
||||
_AllList.Add(tmp);
|
||||
if (!_AllList.Contains(tmp)) _AllList.Add(tmp);
|
||||
}
|
||||
if (tmp.ErrorMessage == "No Record Found") tmp = null;
|
||||
return tmp;
|
||||
@ -650,7 +666,7 @@ namespace VEPROMS.CSLA.Library
|
||||
}
|
||||
private void ReadData(SafeDataReader dr)
|
||||
{
|
||||
if(_MyLog.IsDebugEnabled)_MyLog.DebugFormat("[{0}] Membership.ReadData", GetHashCode());
|
||||
if (_MyLog.IsDebugEnabled) _MyLog.DebugFormat("[{0}] Membership.ReadData", GetHashCode());
|
||||
try
|
||||
{
|
||||
_UGID = dr.GetInt32("UGID");
|
||||
@ -666,14 +682,14 @@ namespace VEPROMS.CSLA.Library
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
if(_MyLog.IsErrorEnabled)_MyLog.Error("Membership.ReadData", ex);
|
||||
if (_MyLog.IsErrorEnabled) _MyLog.Error("Membership.ReadData", ex);
|
||||
_ErrorMessage = ex.Message;
|
||||
throw new DbCslaException("Membership.ReadData", ex);
|
||||
}
|
||||
}
|
||||
private void DataPortal_Fetch(PKCriteria criteria)
|
||||
{
|
||||
if(_MyLog.IsDebugEnabled)_MyLog.DebugFormat("[{0}] Membership.DataPortal_Fetch", GetHashCode());
|
||||
if (_MyLog.IsDebugEnabled) _MyLog.DebugFormat("[{0}] Membership.DataPortal_Fetch", GetHashCode());
|
||||
try
|
||||
{
|
||||
using (SqlConnection cn = Database.VEPROMS_SqlConnection)
|
||||
@ -701,7 +717,7 @@ namespace VEPROMS.CSLA.Library
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
if(_MyLog.IsErrorEnabled)_MyLog.Error("Membership.DataPortal_Fetch", ex);
|
||||
if (_MyLog.IsErrorEnabled) _MyLog.Error("Membership.DataPortal_Fetch", ex);
|
||||
_ErrorMessage = ex.Message;
|
||||
throw new DbCslaException("Membership.DataPortal_Fetch", ex);
|
||||
}
|
||||
@ -722,13 +738,13 @@ namespace VEPROMS.CSLA.Library
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
if(_MyLog.IsErrorEnabled)_MyLog.Error("Membership.DataPortal_Insert", ex);
|
||||
if (_MyLog.IsErrorEnabled) _MyLog.Error("Membership.DataPortal_Insert", ex);
|
||||
_ErrorMessage = ex.Message;
|
||||
throw new DbCslaException("Membership.DataPortal_Insert", ex);
|
||||
}
|
||||
finally
|
||||
{
|
||||
if(_MyLog.IsDebugEnabled)_MyLog.DebugFormat("[{0}] Membership.DataPortal_Insert", GetHashCode());
|
||||
if (_MyLog.IsDebugEnabled) _MyLog.DebugFormat("[{0}] Membership.DataPortal_Insert", GetHashCode());
|
||||
}
|
||||
}
|
||||
[Transactional(TransactionalTypes.TransactionScope)]
|
||||
@ -737,8 +753,8 @@ namespace VEPROMS.CSLA.Library
|
||||
if (!this.IsDirty) return;
|
||||
try
|
||||
{
|
||||
if(_MyGroup != null) _MyGroup.Update();
|
||||
if(_MyUser != null) _MyUser.Update();
|
||||
if (_MyGroup != null) _MyGroup.Update();
|
||||
if (_MyUser != null) _MyUser.Update();
|
||||
SqlConnection cn = (SqlConnection)ApplicationContext.LocalContext["cn"];
|
||||
using (SqlCommand cm = cn.CreateCommand())
|
||||
{
|
||||
@ -767,11 +783,11 @@ namespace VEPROMS.CSLA.Library
|
||||
}
|
||||
MarkOld();
|
||||
// update child objects
|
||||
if(_MyLog.IsDebugEnabled)_MyLog.DebugFormat("[{0}] Membership.SQLInsert", GetHashCode());
|
||||
if (_MyLog.IsDebugEnabled) _MyLog.DebugFormat("[{0}] Membership.SQLInsert", GetHashCode());
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
if(_MyLog.IsErrorEnabled)_MyLog.Error("Membership.SQLInsert", ex);
|
||||
if (_MyLog.IsErrorEnabled) _MyLog.Error("Membership.SQLInsert", ex);
|
||||
_ErrorMessage = ex.Message;
|
||||
throw new DbCslaException("Membership.SQLInsert", ex);
|
||||
}
|
||||
@ -779,7 +795,7 @@ namespace VEPROMS.CSLA.Library
|
||||
[Transactional(TransactionalTypes.TransactionScope)]
|
||||
public static byte[] Add(SqlConnection cn, ref int ugid, User myUser, Group myGroup, SmartDate startDate, SmartDate endDate, string config, DateTime dts, string usrID)
|
||||
{
|
||||
if(_MyLog.IsDebugEnabled)_MyLog.DebugFormat("[{0}] Membership.Add", 0);
|
||||
if (_MyLog.IsDebugEnabled) _MyLog.DebugFormat("[{0}] Membership.Add", 0);
|
||||
try
|
||||
{
|
||||
using (SqlCommand cm = cn.CreateCommand())
|
||||
@ -810,7 +826,7 @@ namespace VEPROMS.CSLA.Library
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
if(_MyLog.IsErrorEnabled)_MyLog.Error("Membership.Add", ex);
|
||||
if (_MyLog.IsErrorEnabled) _MyLog.Error("Membership.Add", ex);
|
||||
throw new DbCslaException("Membership.Add", ex);
|
||||
}
|
||||
}
|
||||
@ -818,7 +834,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}] Membership.DataPortal_Update", GetHashCode());
|
||||
if (_MyLog.IsDebugEnabled) _MyLog.DebugFormat("[{0}] Membership.DataPortal_Update", GetHashCode());
|
||||
try
|
||||
{
|
||||
using (SqlConnection cn = Database.VEPROMS_SqlConnection)
|
||||
@ -832,7 +848,7 @@ namespace VEPROMS.CSLA.Library
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
if(_MyLog.IsErrorEnabled)_MyLog.Error("Membership.DataPortal_Update", ex);
|
||||
if (_MyLog.IsErrorEnabled) _MyLog.Error("Membership.DataPortal_Update", ex);
|
||||
_ErrorMessage = ex.Message;
|
||||
if (!ex.Message.EndsWith("has been edited by another user.")) throw ex;
|
||||
}
|
||||
@ -841,11 +857,11 @@ namespace VEPROMS.CSLA.Library
|
||||
internal void SQLUpdate()
|
||||
{
|
||||
if (!IsDirty) return; // If not dirty - nothing to do
|
||||
if(_MyLog.IsDebugEnabled)_MyLog.DebugFormat("[{0}] Membership.SQLUpdate", GetHashCode());
|
||||
if (_MyLog.IsDebugEnabled) _MyLog.DebugFormat("[{0}] Membership.SQLUpdate", GetHashCode());
|
||||
try
|
||||
{
|
||||
if(_MyGroup != null) _MyGroup.Update();
|
||||
if(_MyUser != null) _MyUser.Update();
|
||||
if (_MyGroup != null) _MyGroup.Update();
|
||||
if (_MyUser != null) _MyUser.Update();
|
||||
SqlConnection cn = (SqlConnection)ApplicationContext.LocalContext["cn"];
|
||||
if (base.IsDirty)
|
||||
{
|
||||
@ -878,7 +894,7 @@ namespace VEPROMS.CSLA.Library
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
if(_MyLog.IsErrorEnabled)_MyLog.Error("Membership.SQLUpdate", ex);
|
||||
if (_MyLog.IsErrorEnabled) _MyLog.Error("Membership.SQLUpdate", ex);
|
||||
_ErrorMessage = ex.Message;
|
||||
if (!ex.Message.EndsWith("has been edited by another user.")) throw ex;
|
||||
}
|
||||
@ -899,7 +915,7 @@ namespace VEPROMS.CSLA.Library
|
||||
[Transactional(TransactionalTypes.TransactionScope)]
|
||||
public static byte[] Update(SqlConnection cn, ref int ugid, User myUser, Group myGroup, SmartDate startDate, SmartDate endDate, string config, DateTime dts, string usrID, ref byte[] lastChanged)
|
||||
{
|
||||
if(_MyLog.IsDebugEnabled)_MyLog.DebugFormat("[{0}] Membership.Update", 0);
|
||||
if (_MyLog.IsDebugEnabled) _MyLog.DebugFormat("[{0}] Membership.Update", 0);
|
||||
try
|
||||
{
|
||||
using (SqlCommand cm = cn.CreateCommand())
|
||||
@ -928,7 +944,7 @@ namespace VEPROMS.CSLA.Library
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
if(_MyLog.IsErrorEnabled)_MyLog.Error("Membership.Update", ex);
|
||||
if (_MyLog.IsErrorEnabled) _MyLog.Error("Membership.Update", ex);
|
||||
throw new DbCslaException("Membership.Update", ex);
|
||||
}
|
||||
}
|
||||
@ -940,7 +956,7 @@ namespace VEPROMS.CSLA.Library
|
||||
[Transactional(TransactionalTypes.TransactionScope)]
|
||||
private void DataPortal_Delete(PKCriteria criteria)
|
||||
{
|
||||
if(_MyLog.IsDebugEnabled)_MyLog.DebugFormat("[{0}] Membership.DataPortal_Delete", GetHashCode());
|
||||
if (_MyLog.IsDebugEnabled) _MyLog.DebugFormat("[{0}] Membership.DataPortal_Delete", GetHashCode());
|
||||
try
|
||||
{
|
||||
using (SqlConnection cn = Database.VEPROMS_SqlConnection)
|
||||
@ -956,7 +972,7 @@ namespace VEPROMS.CSLA.Library
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
if(_MyLog.IsErrorEnabled)_MyLog.Error("Membership.DataPortal_Delete", ex);
|
||||
if (_MyLog.IsErrorEnabled) _MyLog.Error("Membership.DataPortal_Delete", ex);
|
||||
_ErrorMessage = ex.Message;
|
||||
throw new DbCslaException("Membership.DataPortal_Delete", ex);
|
||||
}
|
||||
@ -964,7 +980,7 @@ namespace VEPROMS.CSLA.Library
|
||||
[Transactional(TransactionalTypes.TransactionScope)]
|
||||
public static void Remove(SqlConnection cn, int ugid)
|
||||
{
|
||||
if(_MyLog.IsDebugEnabled)_MyLog.DebugFormat("[{0}] Membership.Remove", 0);
|
||||
if (_MyLog.IsDebugEnabled) _MyLog.DebugFormat("[{0}] Membership.Remove", 0);
|
||||
try
|
||||
{
|
||||
using (SqlCommand cm = cn.CreateCommand())
|
||||
@ -979,7 +995,7 @@ namespace VEPROMS.CSLA.Library
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
if(_MyLog.IsErrorEnabled)_MyLog.Error("Membership.Remove", ex);
|
||||
if (_MyLog.IsErrorEnabled) _MyLog.Error("Membership.Remove", ex);
|
||||
throw new DbCslaException("Membership.Remove", ex);
|
||||
}
|
||||
}
|
||||
@ -1013,7 +1029,7 @@ namespace VEPROMS.CSLA.Library
|
||||
}
|
||||
protected override void DataPortal_Execute()
|
||||
{
|
||||
if(_MyLog.IsDebugEnabled)_MyLog.DebugFormat("[{0}] Membership.DataPortal_Execute", GetHashCode());
|
||||
if (_MyLog.IsDebugEnabled) _MyLog.DebugFormat("[{0}] Membership.DataPortal_Execute", GetHashCode());
|
||||
try
|
||||
{
|
||||
using (SqlConnection cn = Database.VEPROMS_SqlConnection)
|
||||
@ -1031,7 +1047,7 @@ namespace VEPROMS.CSLA.Library
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
if(_MyLog.IsErrorEnabled)_MyLog.Error("Membership.DataPortal_Execute", ex);
|
||||
if (_MyLog.IsErrorEnabled) _MyLog.Error("Membership.DataPortal_Execute", ex);
|
||||
throw new DbCslaException("Membership.DataPortal_Execute", ex);
|
||||
}
|
||||
}
|
||||
|
@ -37,13 +37,17 @@ namespace VEPROMS.CSLA.Library
|
||||
#endregion
|
||||
#region Collection
|
||||
protected static List<MembershipInfo> _AllList = new List<MembershipInfo>();
|
||||
private static Dictionary<string, MembershipInfo> _AllByPrimaryKey = new Dictionary<string, MembershipInfo>();
|
||||
private static Dictionary<string, List<MembershipInfo>> _AllByPrimaryKey = new Dictionary<string, List<MembershipInfo>>();
|
||||
private static void ConvertListToDictionary()
|
||||
{
|
||||
List<MembershipInfo> remove = new List<MembershipInfo>();
|
||||
foreach (MembershipInfo tmp in _AllList)
|
||||
{
|
||||
_AllByPrimaryKey[tmp.UGID.ToString()]=tmp; // Primary Key
|
||||
if (!_AllByPrimaryKey.ContainsKey(tmp.UGID.ToString()))
|
||||
{
|
||||
_AllByPrimaryKey[tmp.UGID.ToString()] = new List<MembershipInfo>(); // Add new list for PrimaryKey
|
||||
}
|
||||
_AllByPrimaryKey[tmp.UGID.ToString()].Add(tmp); // Add to Primary Key list
|
||||
remove.Add(tmp);
|
||||
}
|
||||
foreach (MembershipInfo tmp in remove)
|
||||
@ -57,7 +61,7 @@ namespace VEPROMS.CSLA.Library
|
||||
{
|
||||
ConvertListToDictionary();
|
||||
string key = ugid.ToString();
|
||||
if (_AllByPrimaryKey.ContainsKey(key)) return _AllByPrimaryKey[key];
|
||||
if (_AllByPrimaryKey.ContainsKey(key)) return _AllByPrimaryKey[key][0];
|
||||
return null;
|
||||
}
|
||||
#endregion
|
||||
@ -85,7 +89,7 @@ namespace VEPROMS.CSLA.Library
|
||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||
get
|
||||
{
|
||||
CanReadProperty("UGID",true);
|
||||
CanReadProperty("UGID", true);
|
||||
return _UGID;
|
||||
}
|
||||
}
|
||||
@ -95,7 +99,7 @@ namespace VEPROMS.CSLA.Library
|
||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||
get
|
||||
{
|
||||
CanReadProperty("UID",true);
|
||||
CanReadProperty("UID", true);
|
||||
if (_MyUser != null) _UID = _MyUser.UID;
|
||||
return _UID;
|
||||
}
|
||||
@ -106,7 +110,7 @@ namespace VEPROMS.CSLA.Library
|
||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||
get
|
||||
{
|
||||
CanReadProperty("MyUser",true);
|
||||
CanReadProperty("MyUser", true);
|
||||
if (_MyUser == null && _UID != 0) _MyUser = UserInfo.Get(_UID);
|
||||
return _MyUser;
|
||||
}
|
||||
@ -117,7 +121,7 @@ namespace VEPROMS.CSLA.Library
|
||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||
get
|
||||
{
|
||||
CanReadProperty("GID",true);
|
||||
CanReadProperty("GID", true);
|
||||
if (_MyGroup != null) _GID = _MyGroup.GID;
|
||||
return _GID;
|
||||
}
|
||||
@ -128,7 +132,7 @@ namespace VEPROMS.CSLA.Library
|
||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||
get
|
||||
{
|
||||
CanReadProperty("MyGroup",true);
|
||||
CanReadProperty("MyGroup", true);
|
||||
if (_MyGroup == null && _GID != 0) _MyGroup = GroupInfo.Get(_GID);
|
||||
return _MyGroup;
|
||||
}
|
||||
@ -139,7 +143,7 @@ namespace VEPROMS.CSLA.Library
|
||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||
get
|
||||
{
|
||||
CanReadProperty("StartDate",true);
|
||||
CanReadProperty("StartDate", true);
|
||||
return _StartDate;
|
||||
}
|
||||
}
|
||||
@ -149,7 +153,7 @@ namespace VEPROMS.CSLA.Library
|
||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||
get
|
||||
{
|
||||
CanReadProperty("EndDate",true);
|
||||
CanReadProperty("EndDate", true);
|
||||
return _EndDate;
|
||||
}
|
||||
}
|
||||
@ -159,7 +163,7 @@ namespace VEPROMS.CSLA.Library
|
||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||
get
|
||||
{
|
||||
CanReadProperty("Config",true);
|
||||
CanReadProperty("Config", true);
|
||||
return _Config;
|
||||
}
|
||||
}
|
||||
@ -169,7 +173,7 @@ namespace VEPROMS.CSLA.Library
|
||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||
get
|
||||
{
|
||||
CanReadProperty("DTS",true);
|
||||
CanReadProperty("DTS", true);
|
||||
return _DTS;
|
||||
}
|
||||
}
|
||||
@ -179,7 +183,7 @@ namespace VEPROMS.CSLA.Library
|
||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||
get
|
||||
{
|
||||
CanReadProperty("UsrID",true);
|
||||
CanReadProperty("UsrID", true);
|
||||
return _UsrID;
|
||||
}
|
||||
}
|
||||
@ -203,14 +207,25 @@ namespace VEPROMS.CSLA.Library
|
||||
}
|
||||
#endregion
|
||||
#region Factory Methods
|
||||
private static int _MembershipInfoUnique = 0;
|
||||
private int _MyMembershipInfoUnique;
|
||||
public int MyMembershipInfoUnique
|
||||
{
|
||||
get { return _MyMembershipInfoUnique; }
|
||||
}
|
||||
private MembershipInfo()
|
||||
{/* require use of factory methods */
|
||||
_MyMembershipInfoUnique = ++_MembershipInfoUnique;
|
||||
_AllList.Add(this);
|
||||
}
|
||||
public void Dispose()
|
||||
{
|
||||
_AllList.Remove(this);
|
||||
_AllByPrimaryKey.Remove(UGID.ToString());
|
||||
if (!_AllByPrimaryKey.ContainsKey(UGID.ToString())) return;
|
||||
List<MembershipInfo> listMembershipInfo = _AllByPrimaryKey[UGID.ToString()]; // Get the list of items
|
||||
listMembershipInfo.Remove(this); // Remove the item from the list
|
||||
if (listMembershipInfo.Count == 0) // If there are no items left in the list
|
||||
_AllByPrimaryKey.Remove(UGID.ToString()); // remove the list
|
||||
}
|
||||
public virtual Membership Get()
|
||||
{
|
||||
@ -218,8 +233,10 @@ namespace VEPROMS.CSLA.Library
|
||||
}
|
||||
public static void Refresh(Membership tmp)
|
||||
{
|
||||
MembershipInfo tmpInfo = GetExistingByPrimaryKey(tmp.UGID);
|
||||
if (tmpInfo == null) return;
|
||||
string key = tmp.UGID.ToString();
|
||||
ConvertListToDictionary();
|
||||
if (_AllByPrimaryKey.ContainsKey(key))
|
||||
foreach (MembershipInfo tmpInfo in _AllByPrimaryKey[key])
|
||||
tmpInfo.RefreshFields(tmp);
|
||||
}
|
||||
private void RefreshFields(Membership tmp)
|
||||
@ -228,16 +245,16 @@ namespace VEPROMS.CSLA.Library
|
||||
{
|
||||
MyUser.RefreshUserMemberships(); // Update List for old value
|
||||
_UID = tmp.UID; // Update the value
|
||||
_MyUser = null; // Reset list so that the next line gets a new list
|
||||
MyUser.RefreshUserMemberships(); // Update List for new value
|
||||
}
|
||||
_MyUser = null; // Reset list so that the next line gets a new list
|
||||
if (MyUser != null) MyUser.RefreshUserMemberships(); // Update List for new value
|
||||
if (_GID != tmp.GID)
|
||||
{
|
||||
MyGroup.RefreshGroupMemberships(); // Update List for old value
|
||||
_GID = tmp.GID; // Update the value
|
||||
_MyGroup = null; // Reset list so that the next line gets a new list
|
||||
MyGroup.RefreshGroupMemberships(); // Update List for new value
|
||||
}
|
||||
_MyGroup = null; // Reset list so that the next line gets a new list
|
||||
if (MyGroup != null) MyGroup.RefreshGroupMemberships(); // Update List for new value
|
||||
_StartDate = tmp.StartDate;
|
||||
_EndDate = tmp.EndDate;
|
||||
_Config = tmp.Config;
|
||||
@ -250,8 +267,10 @@ namespace VEPROMS.CSLA.Library
|
||||
}
|
||||
public static void Refresh(GroupMembership tmp)
|
||||
{
|
||||
MembershipInfo tmpInfo = GetExistingByPrimaryKey(tmp.UGID);
|
||||
if (tmpInfo == null) return;
|
||||
string key = tmp.UGID.ToString();
|
||||
ConvertListToDictionary();
|
||||
if (_AllByPrimaryKey.ContainsKey(key))
|
||||
foreach (MembershipInfo tmpInfo in _AllByPrimaryKey[key])
|
||||
tmpInfo.RefreshFields(tmp);
|
||||
}
|
||||
private void RefreshFields(GroupMembership tmp)
|
||||
@ -260,9 +279,9 @@ namespace VEPROMS.CSLA.Library
|
||||
{
|
||||
MyUser.RefreshUserMemberships(); // Update List for old value
|
||||
_UID = tmp.UID; // Update the value
|
||||
_MyUser = null; // Reset list so that the next line gets a new list
|
||||
MyUser.RefreshUserMemberships(); // Update List for new value
|
||||
}
|
||||
_MyUser = null; // Reset list so that the next line gets a new list
|
||||
if (MyUser != null) MyUser.RefreshUserMemberships(); // Update List for new value
|
||||
_StartDate = tmp.StartDate;
|
||||
_EndDate = tmp.EndDate;
|
||||
_Config = tmp.Config;
|
||||
@ -275,8 +294,10 @@ namespace VEPROMS.CSLA.Library
|
||||
}
|
||||
public static void Refresh(UserMembership tmp)
|
||||
{
|
||||
MembershipInfo tmpInfo = GetExistingByPrimaryKey(tmp.UGID);
|
||||
if (tmpInfo == null) return;
|
||||
string key = tmp.UGID.ToString();
|
||||
ConvertListToDictionary();
|
||||
if (_AllByPrimaryKey.ContainsKey(key))
|
||||
foreach (MembershipInfo tmpInfo in _AllByPrimaryKey[key])
|
||||
tmpInfo.RefreshFields(tmp);
|
||||
}
|
||||
private void RefreshFields(UserMembership tmp)
|
||||
@ -285,9 +306,9 @@ namespace VEPROMS.CSLA.Library
|
||||
{
|
||||
MyGroup.RefreshGroupMemberships(); // Update List for old value
|
||||
_GID = tmp.GID; // Update the value
|
||||
_MyGroup = null; // Reset list so that the next line gets a new list
|
||||
MyGroup.RefreshGroupMemberships(); // Update List for new value
|
||||
}
|
||||
_MyGroup = null; // Reset list so that the next line gets a new list
|
||||
if (MyGroup != null) MyGroup.RefreshGroupMemberships(); // Update List for new value
|
||||
_StartDate = tmp.StartDate;
|
||||
_EndDate = tmp.EndDate;
|
||||
_Config = tmp.Config;
|
||||
@ -308,7 +329,7 @@ namespace VEPROMS.CSLA.Library
|
||||
if (tmp == null)
|
||||
{
|
||||
tmp = DataPortal.Fetch<MembershipInfo>(new PKCriteria(ugid));
|
||||
_AllList.Add(tmp);
|
||||
if (!_AllList.Contains(tmp)) _AllList.Add(tmp);
|
||||
}
|
||||
if (tmp.ErrorMessage == "No Record Found") tmp = null;
|
||||
return tmp;
|
||||
@ -322,14 +343,15 @@ namespace VEPROMS.CSLA.Library
|
||||
#region Data Access Portal
|
||||
internal MembershipInfo(SafeDataReader dr)
|
||||
{
|
||||
if(_MyLog.IsDebugEnabled)_MyLog.DebugFormat("[{0}] MembershipInfo.Constructor", GetHashCode());
|
||||
_MyMembershipInfoUnique = ++_MembershipInfoUnique;
|
||||
if (_MyLog.IsDebugEnabled) _MyLog.DebugFormat("[{0}] MembershipInfo.Constructor", GetHashCode());
|
||||
try
|
||||
{
|
||||
ReadData(dr);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
if(_MyLog.IsErrorEnabled)_MyLog.Error("MembershipInfo.Constructor", ex);
|
||||
if (_MyLog.IsErrorEnabled) _MyLog.Error("MembershipInfo.Constructor", ex);
|
||||
throw new DbCslaException("MembershipInfo.Constructor", ex);
|
||||
}
|
||||
}
|
||||
@ -346,7 +368,7 @@ namespace VEPROMS.CSLA.Library
|
||||
}
|
||||
private void ReadData(SafeDataReader dr)
|
||||
{
|
||||
if(_MyLog.IsDebugEnabled)_MyLog.DebugFormat("[{0}] MembershipInfo.ReadData", GetHashCode());
|
||||
if (_MyLog.IsDebugEnabled) _MyLog.DebugFormat("[{0}] MembershipInfo.ReadData", GetHashCode());
|
||||
try
|
||||
{
|
||||
_UGID = dr.GetInt32("UGID");
|
||||
@ -360,14 +382,14 @@ namespace VEPROMS.CSLA.Library
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
if(_MyLog.IsErrorEnabled)_MyLog.Error("MembershipInfo.ReadData", ex);
|
||||
if (_MyLog.IsErrorEnabled) _MyLog.Error("MembershipInfo.ReadData", ex);
|
||||
_ErrorMessage = ex.Message;
|
||||
throw new DbCslaException("MembershipInfo.ReadData", ex);
|
||||
}
|
||||
}
|
||||
private void DataPortal_Fetch(PKCriteria criteria)
|
||||
{
|
||||
if(_MyLog.IsDebugEnabled)_MyLog.DebugFormat("[{0}] MembershipInfo.DataPortal_Fetch", GetHashCode());
|
||||
if (_MyLog.IsDebugEnabled) _MyLog.DebugFormat("[{0}] MembershipInfo.DataPortal_Fetch", GetHashCode());
|
||||
try
|
||||
{
|
||||
using (SqlConnection cn = Database.VEPROMS_SqlConnection)
|
||||
@ -395,7 +417,7 @@ namespace VEPROMS.CSLA.Library
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
if(_MyLog.IsErrorEnabled)_MyLog.Error("MembershipInfo.DataPortal_Fetch", ex);
|
||||
if (_MyLog.IsErrorEnabled) _MyLog.Error("MembershipInfo.DataPortal_Fetch", ex);
|
||||
_ErrorMessage = ex.Message;
|
||||
throw new DbCslaException("MembershipInfo.DataPortal_Fetch", ex);
|
||||
}
|
||||
@ -405,7 +427,7 @@ namespace VEPROMS.CSLA.Library
|
||||
#region extension
|
||||
MembershipInfoExtension _MembershipInfoExtension = new MembershipInfoExtension();
|
||||
[Serializable()]
|
||||
partial class MembershipInfoExtension : extensionBase {}
|
||||
partial class MembershipInfoExtension : extensionBase { }
|
||||
[Serializable()]
|
||||
class extensionBase
|
||||
{
|
||||
|
@ -124,7 +124,7 @@ namespace VEPROMS.CSLA.Library
|
||||
private void DataPortal_Fetch()
|
||||
{
|
||||
this.RaiseListChangedEvents = false;
|
||||
if(_MyLog.IsDebugEnabled)_MyLog.DebugFormat("[{0}] MembershipInfoList.DataPortal_Fetch", GetHashCode());
|
||||
if (_MyLog.IsDebugEnabled) _MyLog.DebugFormat("[{0}] MembershipInfoList.DataPortal_Fetch", GetHashCode());
|
||||
try
|
||||
{
|
||||
using (SqlConnection cn = Database.VEPROMS_SqlConnection)
|
||||
@ -144,7 +144,7 @@ namespace VEPROMS.CSLA.Library
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
if(_MyLog.IsErrorEnabled)_MyLog.Error("MembershipInfoList.DataPortal_Fetch", ex);
|
||||
if (_MyLog.IsErrorEnabled) _MyLog.Error("MembershipInfoList.DataPortal_Fetch", ex);
|
||||
throw new DbCslaException("MembershipInfoList.DataPortal_Fetch", ex);
|
||||
}
|
||||
this.RaiseListChangedEvents = true;
|
||||
@ -166,7 +166,7 @@ namespace VEPROMS.CSLA.Library
|
||||
private void DataPortal_Fetch(GIDCriteria criteria)
|
||||
{
|
||||
this.RaiseListChangedEvents = false;
|
||||
if(_MyLog.IsDebugEnabled)_MyLog.DebugFormat("[{0}] MembershipInfoList.DataPortal_FetchGID", GetHashCode());
|
||||
if (_MyLog.IsDebugEnabled) _MyLog.DebugFormat("[{0}] MembershipInfoList.DataPortal_FetchGID", GetHashCode());
|
||||
try
|
||||
{
|
||||
using (SqlConnection cn = Database.VEPROMS_SqlConnection)
|
||||
@ -187,7 +187,7 @@ namespace VEPROMS.CSLA.Library
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
if(_MyLog.IsErrorEnabled)_MyLog.Error("MembershipInfoList.DataPortal_FetchGID", ex);
|
||||
if (_MyLog.IsErrorEnabled) _MyLog.Error("MembershipInfoList.DataPortal_FetchGID", ex);
|
||||
throw new DbCslaException("MembershipInfoList.DataPortal_Fetch", ex);
|
||||
}
|
||||
this.RaiseListChangedEvents = true;
|
||||
@ -209,7 +209,7 @@ namespace VEPROMS.CSLA.Library
|
||||
private void DataPortal_Fetch(UIDCriteria criteria)
|
||||
{
|
||||
this.RaiseListChangedEvents = false;
|
||||
if(_MyLog.IsDebugEnabled)_MyLog.DebugFormat("[{0}] MembershipInfoList.DataPortal_FetchUID", GetHashCode());
|
||||
if (_MyLog.IsDebugEnabled) _MyLog.DebugFormat("[{0}] MembershipInfoList.DataPortal_FetchUID", GetHashCode());
|
||||
try
|
||||
{
|
||||
using (SqlConnection cn = Database.VEPROMS_SqlConnection)
|
||||
@ -230,7 +230,7 @@ namespace VEPROMS.CSLA.Library
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
if(_MyLog.IsErrorEnabled)_MyLog.Error("MembershipInfoList.DataPortal_FetchUID", ex);
|
||||
if (_MyLog.IsErrorEnabled) _MyLog.Error("MembershipInfoList.DataPortal_FetchUID", ex);
|
||||
throw new DbCslaException("MembershipInfoList.DataPortal_Fetch", ex);
|
||||
}
|
||||
this.RaiseListChangedEvents = true;
|
||||
@ -291,8 +291,8 @@ namespace VEPROMS.CSLA.Library
|
||||
/// </summary>
|
||||
public partial class MembershipInfoListPropertyDescriptor : vlnListPropertyDescriptor
|
||||
{
|
||||
private MembershipInfo Item { get { return (MembershipInfo) _Item;} }
|
||||
public MembershipInfoListPropertyDescriptor(MembershipInfoList collection, int index):base(collection, index){;}
|
||||
private MembershipInfo Item { get { return (MembershipInfo)_Item; } }
|
||||
public MembershipInfoListPropertyDescriptor(MembershipInfoList collection, int index) : base(collection, index) { ;}
|
||||
}
|
||||
#endregion
|
||||
#region Converter
|
||||
@ -303,7 +303,7 @@ namespace VEPROMS.CSLA.Library
|
||||
if (destType == typeof(string) && value is MembershipInfoList)
|
||||
{
|
||||
// Return department and department role separated by comma.
|
||||
return ((MembershipInfoList) value).Items.Count.ToString() + " Memberships";
|
||||
return ((MembershipInfoList)value).Items.Count.ToString() + " Memberships";
|
||||
}
|
||||
return base.ConvertTo(context, culture, value, destType);
|
||||
}
|
||||
|
@ -94,8 +94,8 @@ namespace VEPROMS.CSLA.Library
|
||||
{
|
||||
get
|
||||
{
|
||||
IVEHasBrokenRules hasBrokenRules=null;
|
||||
foreach(Item item in this)
|
||||
IVEHasBrokenRules hasBrokenRules = null;
|
||||
foreach (Item item in this)
|
||||
if ((hasBrokenRules = item.HasBrokenRules) != null) return hasBrokenRules;
|
||||
return hasBrokenRules;
|
||||
}
|
||||
@ -165,7 +165,7 @@ namespace VEPROMS.CSLA.Library
|
||||
private void DataPortal_Fetch(PreviousIDCriteria criteria)
|
||||
{
|
||||
this.RaiseListChangedEvents = false;
|
||||
if(_MyLog.IsDebugEnabled)_MyLog.DebugFormat("[{0}] NextItems.DataPortal_FetchPreviousID", GetHashCode());
|
||||
if (_MyLog.IsDebugEnabled) _MyLog.DebugFormat("[{0}] NextItems.DataPortal_FetchPreviousID", GetHashCode());
|
||||
try
|
||||
{
|
||||
using (SqlConnection cn = Database.VEPROMS_SqlConnection)
|
||||
@ -184,7 +184,7 @@ namespace VEPROMS.CSLA.Library
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
if(_MyLog.IsErrorEnabled)_MyLog.Error("NextItems.DataPortal_FetchPreviousID", ex);
|
||||
if (_MyLog.IsErrorEnabled) _MyLog.Error("NextItems.DataPortal_FetchPreviousID", ex);
|
||||
throw new DbCslaException("NextItems.DataPortal_Fetch", ex);
|
||||
}
|
||||
this.RaiseListChangedEvents = true;
|
||||
@ -269,8 +269,8 @@ namespace VEPROMS.CSLA.Library
|
||||
/// </summary>
|
||||
public partial class NextItemsPropertyDescriptor : vlnListPropertyDescriptor
|
||||
{
|
||||
private Item Item { get { return (Item) _Item;} }
|
||||
public NextItemsPropertyDescriptor(NextItems collection, int index):base(collection, index){;}
|
||||
private Item Item { get { return (Item)_Item; } }
|
||||
public NextItemsPropertyDescriptor(NextItems collection, int index) : base(collection, index) { ;}
|
||||
}
|
||||
#endregion
|
||||
#region Converter
|
||||
@ -281,7 +281,7 @@ namespace VEPROMS.CSLA.Library
|
||||
if (destType == typeof(string) && value is NextItems)
|
||||
{
|
||||
// Return department and department role separated by comma.
|
||||
return ((NextItems) value).Items.Count.ToString() + " Items";
|
||||
return ((NextItems)value).Items.Count.ToString() + " Items";
|
||||
}
|
||||
return base.ConvertTo(context, culture, value, destType);
|
||||
}
|
||||
|
@ -47,20 +47,24 @@ namespace VEPROMS.CSLA.Library
|
||||
foreach (Part tmp in _RefreshParts)
|
||||
{
|
||||
PartInfo.Refresh(tmp);
|
||||
if(tmp._MyContent != null) ContentInfo.Refresh(tmp._MyContent);
|
||||
if(tmp._MyItem != null) ItemInfo.Refresh(tmp._MyItem);
|
||||
if (tmp._MyContent != null) ContentInfo.Refresh(tmp._MyContent);
|
||||
if (tmp._MyItem != null) ItemInfo.Refresh(tmp._MyItem);
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
#region Collection
|
||||
protected static List<Part> _AllList = new List<Part>();
|
||||
private static Dictionary<string, Part> _AllByPrimaryKey = new Dictionary<string, Part>();
|
||||
private static Dictionary<string, List<Part>> _AllByPrimaryKey = new Dictionary<string, List<Part>>();
|
||||
private static void ConvertListToDictionary()
|
||||
{
|
||||
List<Part> remove = new List<Part>();
|
||||
foreach (Part tmp in _AllList)
|
||||
{
|
||||
_AllByPrimaryKey[tmp.ContentID.ToString() + "_" + tmp.FromType.ToString()]=tmp; // Primary Key
|
||||
if (!_AllByPrimaryKey.ContainsKey(tmp.ContentID.ToString() + "_" + tmp.FromType.ToString()))
|
||||
{
|
||||
_AllByPrimaryKey[tmp.ContentID.ToString() + "_" + tmp.FromType.ToString()] = new List<Part>(); // Add new list for PrimaryKey
|
||||
}
|
||||
_AllByPrimaryKey[tmp.ContentID.ToString() + "_" + tmp.FromType.ToString()].Add(tmp); // Add to Primary Key list
|
||||
remove.Add(tmp);
|
||||
}
|
||||
foreach (Part tmp in remove)
|
||||
@ -70,7 +74,7 @@ namespace VEPROMS.CSLA.Library
|
||||
{
|
||||
ConvertListToDictionary();
|
||||
string key = contentID.ToString() + "_" + fromType.ToString();
|
||||
if (_AllByPrimaryKey.ContainsKey(key)) return _AllByPrimaryKey[key];
|
||||
if (_AllByPrimaryKey.ContainsKey(key)) return _AllByPrimaryKey[key][0];
|
||||
return null;
|
||||
}
|
||||
#endregion
|
||||
@ -87,7 +91,7 @@ namespace VEPROMS.CSLA.Library
|
||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||
get
|
||||
{
|
||||
CanReadProperty("ContentID",true);
|
||||
CanReadProperty("ContentID", true);
|
||||
if (_MyContent != null) _ContentID = _MyContent.ContentID;
|
||||
return _ContentID;
|
||||
}
|
||||
@ -99,7 +103,7 @@ namespace VEPROMS.CSLA.Library
|
||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||
get
|
||||
{
|
||||
CanReadProperty("MyContent",true);
|
||||
CanReadProperty("MyContent", true);
|
||||
if (_MyContent == null && _ContentID != 0) _MyContent = Content.Get(_ContentID);
|
||||
return _MyContent;
|
||||
}
|
||||
@ -111,7 +115,7 @@ namespace VEPROMS.CSLA.Library
|
||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||
get
|
||||
{
|
||||
CanReadProperty("FromType",true);
|
||||
CanReadProperty("FromType", true);
|
||||
return _FromType;
|
||||
}
|
||||
}
|
||||
@ -121,7 +125,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;
|
||||
}
|
||||
@ -132,14 +136,14 @@ namespace VEPROMS.CSLA.Library
|
||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||
get
|
||||
{
|
||||
CanReadProperty("MyItem",true);
|
||||
CanReadProperty("MyItem", true);
|
||||
if (_MyItem == null && _ItemID != 0) _MyItem = Item.Get(_ItemID);
|
||||
return _MyItem;
|
||||
}
|
||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||
set
|
||||
{
|
||||
CanWriteProperty("MyItem",true);
|
||||
CanWriteProperty("MyItem", true);
|
||||
if (_MyItem != value)
|
||||
{
|
||||
_MyItem = value;
|
||||
@ -153,13 +157,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;
|
||||
@ -173,13 +177,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)
|
||||
{
|
||||
@ -191,11 +195,11 @@ namespace VEPROMS.CSLA.Library
|
||||
private byte[] _LastChanged = new byte[8];//timestamp
|
||||
public override bool IsDirty
|
||||
{
|
||||
get { return base.IsDirty || (_MyContent == null? false : _MyContent.IsDirty) || (_MyItem == null? false : _MyItem.IsDirty); }
|
||||
get { return base.IsDirty || (_MyContent == null ? false : _MyContent.IsDirty) || (_MyItem == null ? false : _MyItem.IsDirty); }
|
||||
}
|
||||
public override bool IsValid
|
||||
{
|
||||
get { return (IsNew && !IsDirty ? true : base.IsValid) && (_MyContent == null? true : _MyContent.IsValid) && (_MyItem == null? true : _MyItem.IsValid); }
|
||||
get { return (IsNew && !IsDirty ? true : base.IsValid) && (_MyContent == null ? true : _MyContent.IsValid) && (_MyItem == null ? true : _MyItem.IsValid); }
|
||||
}
|
||||
// TODO: Replace base Part.ToString function as necessary
|
||||
/// <summary>
|
||||
@ -213,27 +217,28 @@ namespace VEPROMS.CSLA.Library
|
||||
/// <returns>A Unique ID for the current Part</returns>
|
||||
protected override object GetIdValue()
|
||||
{
|
||||
return (_ContentID.ToString()+"."+_FromType.ToString()).GetHashCode();
|
||||
return (_ContentID.ToString() + "." + _FromType.ToString()).GetHashCode();
|
||||
}
|
||||
#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 (_MyItem != null && (hasBrokenRules = _MyItem.HasBrokenRules) != null) return hasBrokenRules;
|
||||
return hasBrokenRules;
|
||||
}
|
||||
finally
|
||||
{
|
||||
_CheckingBrokenRules=false;
|
||||
_CheckingBrokenRules = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -333,14 +338,25 @@ namespace VEPROMS.CSLA.Library
|
||||
#region Factory Methods
|
||||
public int CurrentEditLevel
|
||||
{ get { return EditLevel; } }
|
||||
private static int _PartUnique = 0;
|
||||
private int _MyPartUnique;
|
||||
public int MyPartUnique
|
||||
{
|
||||
get { return _MyPartUnique; }
|
||||
}
|
||||
protected Part()
|
||||
{/* require use of factory methods */
|
||||
_MyPartUnique = ++_PartUnique;
|
||||
_AllList.Add(this);
|
||||
}
|
||||
public void Dispose()
|
||||
{
|
||||
_AllList.Remove(this);
|
||||
_AllByPrimaryKey.Remove(ContentID.ToString() + "_" + FromType.ToString());
|
||||
if (!_AllByPrimaryKey.ContainsKey(ContentID.ToString() + "_" + FromType.ToString())) return;
|
||||
List<Part> listPart = _AllByPrimaryKey[ContentID.ToString() + "_" + FromType.ToString()]; // Get the list of items
|
||||
listPart.Remove(this); // Remove the item from the list
|
||||
if (listPart.Count == 0) //If there are no items left in the list
|
||||
_AllByPrimaryKey.Remove(ContentID.ToString() + "_" + FromType.ToString()); // remove the list
|
||||
}
|
||||
public static Part New()
|
||||
{
|
||||
@ -399,7 +415,7 @@ namespace VEPROMS.CSLA.Library
|
||||
if (tmp == null)
|
||||
{
|
||||
tmp = DataPortal.Fetch<Part>(new PKCriteria(contentID, fromType));
|
||||
_AllList.Add(tmp);
|
||||
if (!_AllList.Contains(tmp)) _AllList.Add(tmp);
|
||||
}
|
||||
if (tmp.ErrorMessage == "No Record Found") tmp = null;
|
||||
return tmp;
|
||||
@ -482,7 +498,7 @@ namespace VEPROMS.CSLA.Library
|
||||
}
|
||||
private void ReadData(SafeDataReader dr)
|
||||
{
|
||||
if(_MyLog.IsDebugEnabled)_MyLog.DebugFormat("[{0}] Part.ReadData", GetHashCode());
|
||||
if (_MyLog.IsDebugEnabled) _MyLog.DebugFormat("[{0}] Part.ReadData", GetHashCode());
|
||||
try
|
||||
{
|
||||
_ContentID = dr.GetInt32("ContentID");
|
||||
@ -495,14 +511,14 @@ namespace VEPROMS.CSLA.Library
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
if(_MyLog.IsErrorEnabled)_MyLog.Error("Part.ReadData", ex);
|
||||
if (_MyLog.IsErrorEnabled) _MyLog.Error("Part.ReadData", ex);
|
||||
_ErrorMessage = ex.Message;
|
||||
throw new DbCslaException("Part.ReadData", ex);
|
||||
}
|
||||
}
|
||||
private void DataPortal_Fetch(PKCriteria criteria)
|
||||
{
|
||||
if(_MyLog.IsDebugEnabled)_MyLog.DebugFormat("[{0}] Part.DataPortal_Fetch", GetHashCode());
|
||||
if (_MyLog.IsDebugEnabled) _MyLog.DebugFormat("[{0}] Part.DataPortal_Fetch", GetHashCode());
|
||||
try
|
||||
{
|
||||
using (SqlConnection cn = Database.VEPROMS_SqlConnection)
|
||||
@ -531,7 +547,7 @@ namespace VEPROMS.CSLA.Library
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
if(_MyLog.IsErrorEnabled)_MyLog.Error("Part.DataPortal_Fetch", ex);
|
||||
if (_MyLog.IsErrorEnabled) _MyLog.Error("Part.DataPortal_Fetch", ex);
|
||||
_ErrorMessage = ex.Message;
|
||||
throw new DbCslaException("Part.DataPortal_Fetch", ex);
|
||||
}
|
||||
@ -552,13 +568,13 @@ namespace VEPROMS.CSLA.Library
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
if(_MyLog.IsErrorEnabled)_MyLog.Error("Part.DataPortal_Insert", ex);
|
||||
if (_MyLog.IsErrorEnabled) _MyLog.Error("Part.DataPortal_Insert", ex);
|
||||
_ErrorMessage = ex.Message;
|
||||
throw new DbCslaException("Part.DataPortal_Insert", ex);
|
||||
}
|
||||
finally
|
||||
{
|
||||
if(_MyLog.IsDebugEnabled)_MyLog.DebugFormat("[{0}] Part.DataPortal_Insert", GetHashCode());
|
||||
if (_MyLog.IsDebugEnabled) _MyLog.DebugFormat("[{0}] Part.DataPortal_Insert", GetHashCode());
|
||||
}
|
||||
}
|
||||
[Transactional(TransactionalTypes.TransactionScope)]
|
||||
@ -567,8 +583,8 @@ namespace VEPROMS.CSLA.Library
|
||||
if (!this.IsDirty) return;
|
||||
try
|
||||
{
|
||||
if(_MyContent != null) _MyContent.Update();
|
||||
if(_MyItem != null) _MyItem.Update();
|
||||
if (_MyContent != null) _MyContent.Update();
|
||||
if (_MyItem != null) _MyItem.Update();
|
||||
SqlConnection cn = (SqlConnection)ApplicationContext.LocalContext["cn"];
|
||||
using (SqlCommand cm = cn.CreateCommand())
|
||||
{
|
||||
@ -591,11 +607,11 @@ namespace VEPROMS.CSLA.Library
|
||||
}
|
||||
MarkOld();
|
||||
// update child objects
|
||||
if(_MyLog.IsDebugEnabled)_MyLog.DebugFormat("[{0}] Part.SQLInsert", GetHashCode());
|
||||
if (_MyLog.IsDebugEnabled) _MyLog.DebugFormat("[{0}] Part.SQLInsert", GetHashCode());
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
if(_MyLog.IsErrorEnabled)_MyLog.Error("Part.SQLInsert", ex);
|
||||
if (_MyLog.IsErrorEnabled) _MyLog.Error("Part.SQLInsert", ex);
|
||||
_ErrorMessage = ex.Message;
|
||||
throw new DbCslaException("Part.SQLInsert", ex);
|
||||
}
|
||||
@ -603,7 +619,7 @@ namespace VEPROMS.CSLA.Library
|
||||
[Transactional(TransactionalTypes.TransactionScope)]
|
||||
public static byte[] Add(SqlConnection cn, Content myContent, int fromType, Item myItem, DateTime dts, string userID)
|
||||
{
|
||||
if(_MyLog.IsDebugEnabled)_MyLog.DebugFormat("[{0}] Part.Add", 0);
|
||||
if (_MyLog.IsDebugEnabled) _MyLog.DebugFormat("[{0}] Part.Add", 0);
|
||||
try
|
||||
{
|
||||
using (SqlCommand cm = cn.CreateCommand())
|
||||
@ -628,7 +644,7 @@ namespace VEPROMS.CSLA.Library
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
if(_MyLog.IsErrorEnabled)_MyLog.Error("Part.Add", ex);
|
||||
if (_MyLog.IsErrorEnabled) _MyLog.Error("Part.Add", ex);
|
||||
throw new DbCslaException("Part.Add", ex);
|
||||
}
|
||||
}
|
||||
@ -636,7 +652,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}] Part.DataPortal_Update", GetHashCode());
|
||||
if (_MyLog.IsDebugEnabled) _MyLog.DebugFormat("[{0}] Part.DataPortal_Update", GetHashCode());
|
||||
try
|
||||
{
|
||||
using (SqlConnection cn = Database.VEPROMS_SqlConnection)
|
||||
@ -650,7 +666,7 @@ namespace VEPROMS.CSLA.Library
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
if(_MyLog.IsErrorEnabled)_MyLog.Error("Part.DataPortal_Update", ex);
|
||||
if (_MyLog.IsErrorEnabled) _MyLog.Error("Part.DataPortal_Update", ex);
|
||||
_ErrorMessage = ex.Message;
|
||||
if (!ex.Message.EndsWith("has been edited by another user.")) throw ex;
|
||||
}
|
||||
@ -659,11 +675,11 @@ namespace VEPROMS.CSLA.Library
|
||||
internal void SQLUpdate()
|
||||
{
|
||||
if (!IsDirty) return; // If not dirty - nothing to do
|
||||
if(_MyLog.IsDebugEnabled)_MyLog.DebugFormat("[{0}] Part.SQLUpdate", GetHashCode());
|
||||
if (_MyLog.IsDebugEnabled) _MyLog.DebugFormat("[{0}] Part.SQLUpdate", GetHashCode());
|
||||
try
|
||||
{
|
||||
if(_MyContent != null) _MyContent.Update();
|
||||
if(_MyItem != null) _MyItem.Update();
|
||||
if (_MyContent != null) _MyContent.Update();
|
||||
if (_MyItem != null) _MyItem.Update();
|
||||
SqlConnection cn = (SqlConnection)ApplicationContext.LocalContext["cn"];
|
||||
if (base.IsDirty)
|
||||
{
|
||||
@ -693,7 +709,7 @@ namespace VEPROMS.CSLA.Library
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
if(_MyLog.IsErrorEnabled)_MyLog.Error("Part.SQLUpdate", ex);
|
||||
if (_MyLog.IsErrorEnabled) _MyLog.Error("Part.SQLUpdate", ex);
|
||||
_ErrorMessage = ex.Message;
|
||||
if (!ex.Message.EndsWith("has been edited by another user.")) throw ex;
|
||||
}
|
||||
@ -714,7 +730,7 @@ namespace VEPROMS.CSLA.Library
|
||||
[Transactional(TransactionalTypes.TransactionScope)]
|
||||
public static byte[] Update(SqlConnection cn, Content myContent, int fromType, Item myItem, DateTime dts, string userID, ref byte[] lastChanged)
|
||||
{
|
||||
if(_MyLog.IsDebugEnabled)_MyLog.DebugFormat("[{0}] Part.Update", 0);
|
||||
if (_MyLog.IsDebugEnabled) _MyLog.DebugFormat("[{0}] Part.Update", 0);
|
||||
try
|
||||
{
|
||||
using (SqlCommand cm = cn.CreateCommand())
|
||||
@ -740,7 +756,7 @@ namespace VEPROMS.CSLA.Library
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
if(_MyLog.IsErrorEnabled)_MyLog.Error("Part.Update", ex);
|
||||
if (_MyLog.IsErrorEnabled) _MyLog.Error("Part.Update", ex);
|
||||
throw new DbCslaException("Part.Update", ex);
|
||||
}
|
||||
}
|
||||
@ -752,7 +768,7 @@ namespace VEPROMS.CSLA.Library
|
||||
[Transactional(TransactionalTypes.TransactionScope)]
|
||||
private void DataPortal_Delete(PKCriteria criteria)
|
||||
{
|
||||
if(_MyLog.IsDebugEnabled)_MyLog.DebugFormat("[{0}] Part.DataPortal_Delete", GetHashCode());
|
||||
if (_MyLog.IsDebugEnabled) _MyLog.DebugFormat("[{0}] Part.DataPortal_Delete", GetHashCode());
|
||||
try
|
||||
{
|
||||
using (SqlConnection cn = Database.VEPROMS_SqlConnection)
|
||||
@ -769,7 +785,7 @@ namespace VEPROMS.CSLA.Library
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
if(_MyLog.IsErrorEnabled)_MyLog.Error("Part.DataPortal_Delete", ex);
|
||||
if (_MyLog.IsErrorEnabled) _MyLog.Error("Part.DataPortal_Delete", ex);
|
||||
_ErrorMessage = ex.Message;
|
||||
throw new DbCslaException("Part.DataPortal_Delete", ex);
|
||||
}
|
||||
@ -777,7 +793,7 @@ namespace VEPROMS.CSLA.Library
|
||||
[Transactional(TransactionalTypes.TransactionScope)]
|
||||
public static void Remove(SqlConnection cn, int contentID, int fromType)
|
||||
{
|
||||
if(_MyLog.IsDebugEnabled)_MyLog.DebugFormat("[{0}] Part.Remove", 0);
|
||||
if (_MyLog.IsDebugEnabled) _MyLog.DebugFormat("[{0}] Part.Remove", 0);
|
||||
try
|
||||
{
|
||||
using (SqlCommand cm = cn.CreateCommand())
|
||||
@ -793,7 +809,7 @@ namespace VEPROMS.CSLA.Library
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
if(_MyLog.IsErrorEnabled)_MyLog.Error("Part.Remove", ex);
|
||||
if (_MyLog.IsErrorEnabled) _MyLog.Error("Part.Remove", ex);
|
||||
throw new DbCslaException("Part.Remove", ex);
|
||||
}
|
||||
}
|
||||
@ -829,7 +845,7 @@ namespace VEPROMS.CSLA.Library
|
||||
}
|
||||
protected override void DataPortal_Execute()
|
||||
{
|
||||
if(_MyLog.IsDebugEnabled)_MyLog.DebugFormat("[{0}] Part.DataPortal_Execute", GetHashCode());
|
||||
if (_MyLog.IsDebugEnabled) _MyLog.DebugFormat("[{0}] Part.DataPortal_Execute", GetHashCode());
|
||||
try
|
||||
{
|
||||
using (SqlConnection cn = Database.VEPROMS_SqlConnection)
|
||||
@ -848,7 +864,7 @@ namespace VEPROMS.CSLA.Library
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
if(_MyLog.IsErrorEnabled)_MyLog.Error("Part.DataPortal_Execute", ex);
|
||||
if (_MyLog.IsErrorEnabled) _MyLog.Error("Part.DataPortal_Execute", ex);
|
||||
throw new DbCslaException("Part.DataPortal_Execute", ex);
|
||||
}
|
||||
}
|
||||
|
@ -37,13 +37,17 @@ namespace VEPROMS.CSLA.Library
|
||||
#endregion
|
||||
#region Collection
|
||||
protected static List<PartInfo> _AllList = new List<PartInfo>();
|
||||
private static Dictionary<string, PartInfo> _AllByPrimaryKey = new Dictionary<string, PartInfo>();
|
||||
private static Dictionary<string, List<PartInfo>> _AllByPrimaryKey = new Dictionary<string, List<PartInfo>>();
|
||||
private static void ConvertListToDictionary()
|
||||
{
|
||||
List<PartInfo> remove = new List<PartInfo>();
|
||||
foreach (PartInfo tmp in _AllList)
|
||||
{
|
||||
_AllByPrimaryKey[tmp.ContentID.ToString() + "_" + tmp.FromType.ToString()]=tmp; // Primary Key
|
||||
if (!_AllByPrimaryKey.ContainsKey(tmp.ContentID.ToString() + "_" + tmp.FromType.ToString()))
|
||||
{
|
||||
_AllByPrimaryKey[tmp.ContentID.ToString() + "_" + tmp.FromType.ToString()] = new List<PartInfo>(); // Add new list for PrimaryKey
|
||||
}
|
||||
_AllByPrimaryKey[tmp.ContentID.ToString() + "_" + tmp.FromType.ToString()].Add(tmp); // Add to Primary Key list
|
||||
remove.Add(tmp);
|
||||
}
|
||||
foreach (PartInfo tmp in remove)
|
||||
@ -57,7 +61,7 @@ namespace VEPROMS.CSLA.Library
|
||||
{
|
||||
ConvertListToDictionary();
|
||||
string key = contentID.ToString() + "_" + fromType.ToString();
|
||||
if (_AllByPrimaryKey.ContainsKey(key)) return _AllByPrimaryKey[key];
|
||||
if (_AllByPrimaryKey.ContainsKey(key)) return _AllByPrimaryKey[key][0];
|
||||
return null;
|
||||
}
|
||||
#endregion
|
||||
@ -85,7 +89,7 @@ namespace VEPROMS.CSLA.Library
|
||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||
get
|
||||
{
|
||||
CanReadProperty("ContentID",true);
|
||||
CanReadProperty("ContentID", true);
|
||||
if (_MyContent != null) _ContentID = _MyContent.ContentID;
|
||||
return _ContentID;
|
||||
}
|
||||
@ -97,7 +101,7 @@ namespace VEPROMS.CSLA.Library
|
||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||
get
|
||||
{
|
||||
CanReadProperty("MyContent",true);
|
||||
CanReadProperty("MyContent", true);
|
||||
if (_MyContent == null && _ContentID != 0) _MyContent = ContentInfo.Get(_ContentID);
|
||||
return _MyContent;
|
||||
}
|
||||
@ -109,7 +113,7 @@ namespace VEPROMS.CSLA.Library
|
||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||
get
|
||||
{
|
||||
CanReadProperty("FromType",true);
|
||||
CanReadProperty("FromType", true);
|
||||
return _FromType;
|
||||
}
|
||||
}
|
||||
@ -119,7 +123,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;
|
||||
}
|
||||
@ -130,7 +134,7 @@ namespace VEPROMS.CSLA.Library
|
||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||
get
|
||||
{
|
||||
CanReadProperty("MyItem",true);
|
||||
CanReadProperty("MyItem", true);
|
||||
if (_MyItem == null && _ItemID != 0) _MyItem = ItemInfo.Get(_ItemID);
|
||||
return _MyItem;
|
||||
}
|
||||
@ -141,7 +145,7 @@ namespace VEPROMS.CSLA.Library
|
||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||
get
|
||||
{
|
||||
CanReadProperty("DTS",true);
|
||||
CanReadProperty("DTS", true);
|
||||
return _DTS;
|
||||
}
|
||||
}
|
||||
@ -151,7 +155,7 @@ namespace VEPROMS.CSLA.Library
|
||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||
get
|
||||
{
|
||||
CanReadProperty("UserID",true);
|
||||
CanReadProperty("UserID", true);
|
||||
return _UserID;
|
||||
}
|
||||
}
|
||||
@ -171,18 +175,29 @@ namespace VEPROMS.CSLA.Library
|
||||
/// <returns>A Unique ID for the current PartInfo</returns>
|
||||
protected override object GetIdValue()
|
||||
{
|
||||
return (_ContentID.ToString()+"."+_FromType.ToString()).GetHashCode();
|
||||
return (_ContentID.ToString() + "." + _FromType.ToString()).GetHashCode();
|
||||
}
|
||||
#endregion
|
||||
#region Factory Methods
|
||||
private static int _PartInfoUnique = 0;
|
||||
private int _MyPartInfoUnique;
|
||||
public int MyPartInfoUnique
|
||||
{
|
||||
get { return _MyPartInfoUnique; }
|
||||
}
|
||||
private PartInfo()
|
||||
{/* require use of factory methods */
|
||||
_MyPartInfoUnique = ++_PartInfoUnique;
|
||||
_AllList.Add(this);
|
||||
}
|
||||
public void Dispose()
|
||||
{
|
||||
_AllList.Remove(this);
|
||||
_AllByPrimaryKey.Remove(ContentID.ToString() + "_" + FromType.ToString());
|
||||
if (!_AllByPrimaryKey.ContainsKey(ContentID.ToString() + "_" + FromType.ToString())) return;
|
||||
List<PartInfo> listPartInfo = _AllByPrimaryKey[ContentID.ToString() + "_" + FromType.ToString()]; // Get the list of items
|
||||
listPartInfo.Remove(this); // Remove the item from the list
|
||||
if (listPartInfo.Count == 0) // If there are no items left in the list
|
||||
_AllByPrimaryKey.Remove(ContentID.ToString() + "_" + FromType.ToString()); // remove the list
|
||||
}
|
||||
public virtual Part Get()
|
||||
{
|
||||
@ -190,8 +205,10 @@ namespace VEPROMS.CSLA.Library
|
||||
}
|
||||
public static void Refresh(Part tmp)
|
||||
{
|
||||
PartInfo tmpInfo = GetExistingByPrimaryKey(tmp.ContentID, tmp.FromType);
|
||||
if (tmpInfo == null) return;
|
||||
string key = tmp.ContentID.ToString() + "_" + tmp.FromType.ToString();
|
||||
ConvertListToDictionary();
|
||||
if (_AllByPrimaryKey.ContainsKey(key))
|
||||
foreach (PartInfo tmpInfo in _AllByPrimaryKey[key])
|
||||
tmpInfo.RefreshFields(tmp);
|
||||
}
|
||||
private void RefreshFields(Part tmp)
|
||||
@ -200,9 +217,9 @@ namespace VEPROMS.CSLA.Library
|
||||
{
|
||||
MyItem.RefreshItemParts(); // Update List for old value
|
||||
_ItemID = tmp.ItemID; // Update the value
|
||||
_MyItem = null; // Reset list so that the next line gets a new list
|
||||
MyItem.RefreshItemParts(); // Update List for new value
|
||||
}
|
||||
_MyItem = null; // Reset list so that the next line gets a new list
|
||||
if (MyItem != null) MyItem.RefreshItemParts(); // Update List for new value
|
||||
_DTS = tmp.DTS;
|
||||
_UserID = tmp.UserID;
|
||||
_PartInfoExtension.Refresh(this);
|
||||
@ -212,8 +229,10 @@ namespace VEPROMS.CSLA.Library
|
||||
}
|
||||
public static void Refresh(Content myContent, ContentPart tmp)
|
||||
{
|
||||
PartInfo tmpInfo = GetExistingByPrimaryKey(myContent.ContentID, tmp.FromType);
|
||||
if (tmpInfo == null) return;
|
||||
string key = myContent.ContentID.ToString() + "_" + tmp.FromType.ToString();
|
||||
ConvertListToDictionary();
|
||||
if (_AllByPrimaryKey.ContainsKey(key))
|
||||
foreach (PartInfo tmpInfo in _AllByPrimaryKey[key])
|
||||
tmpInfo.RefreshFields(tmp);
|
||||
}
|
||||
private void RefreshFields(ContentPart tmp)
|
||||
@ -222,9 +241,9 @@ namespace VEPROMS.CSLA.Library
|
||||
{
|
||||
MyItem.RefreshItemParts(); // Update List for old value
|
||||
_ItemID = tmp.ItemID; // Update the value
|
||||
_MyItem = null; // Reset list so that the next line gets a new list
|
||||
MyItem.RefreshItemParts(); // Update List for new value
|
||||
}
|
||||
_MyItem = null; // Reset list so that the next line gets a new list
|
||||
if (MyItem != null) MyItem.RefreshItemParts(); // Update List for new value
|
||||
_DTS = tmp.DTS;
|
||||
_UserID = tmp.UserID;
|
||||
_PartInfoExtension.Refresh(this);
|
||||
@ -234,8 +253,10 @@ namespace VEPROMS.CSLA.Library
|
||||
}
|
||||
public static void Refresh(ItemPart tmp)
|
||||
{
|
||||
PartInfo tmpInfo = GetExistingByPrimaryKey(tmp.ContentID, tmp.FromType);
|
||||
if (tmpInfo == null) return;
|
||||
string key = tmp.ContentID.ToString() + "_" + tmp.FromType.ToString();
|
||||
ConvertListToDictionary();
|
||||
if (_AllByPrimaryKey.ContainsKey(key))
|
||||
foreach (PartInfo tmpInfo in _AllByPrimaryKey[key])
|
||||
tmpInfo.RefreshFields(tmp);
|
||||
}
|
||||
private void RefreshFields(ItemPart tmp)
|
||||
@ -257,7 +278,7 @@ namespace VEPROMS.CSLA.Library
|
||||
if (tmp == null)
|
||||
{
|
||||
tmp = DataPortal.Fetch<PartInfo>(new PKCriteria(contentID, fromType));
|
||||
_AllList.Add(tmp);
|
||||
if (!_AllList.Contains(tmp)) _AllList.Add(tmp);
|
||||
}
|
||||
if (tmp.ErrorMessage == "No Record Found") tmp = null;
|
||||
return tmp;
|
||||
@ -271,14 +292,15 @@ namespace VEPROMS.CSLA.Library
|
||||
#region Data Access Portal
|
||||
internal PartInfo(SafeDataReader dr)
|
||||
{
|
||||
if(_MyLog.IsDebugEnabled)_MyLog.DebugFormat("[{0}] PartInfo.Constructor", GetHashCode());
|
||||
_MyPartInfoUnique = ++_PartInfoUnique;
|
||||
if (_MyLog.IsDebugEnabled) _MyLog.DebugFormat("[{0}] PartInfo.Constructor", GetHashCode());
|
||||
try
|
||||
{
|
||||
ReadData(dr);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
if(_MyLog.IsErrorEnabled)_MyLog.Error("PartInfo.Constructor", ex);
|
||||
if (_MyLog.IsErrorEnabled) _MyLog.Error("PartInfo.Constructor", ex);
|
||||
throw new DbCslaException("PartInfo.Constructor", ex);
|
||||
}
|
||||
}
|
||||
@ -299,7 +321,7 @@ namespace VEPROMS.CSLA.Library
|
||||
}
|
||||
private void ReadData(SafeDataReader dr)
|
||||
{
|
||||
if(_MyLog.IsDebugEnabled)_MyLog.DebugFormat("[{0}] PartInfo.ReadData", GetHashCode());
|
||||
if (_MyLog.IsDebugEnabled) _MyLog.DebugFormat("[{0}] PartInfo.ReadData", GetHashCode());
|
||||
try
|
||||
{
|
||||
_ContentID = dr.GetInt32("ContentID");
|
||||
@ -310,14 +332,14 @@ namespace VEPROMS.CSLA.Library
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
if(_MyLog.IsErrorEnabled)_MyLog.Error("PartInfo.ReadData", ex);
|
||||
if (_MyLog.IsErrorEnabled) _MyLog.Error("PartInfo.ReadData", ex);
|
||||
_ErrorMessage = ex.Message;
|
||||
throw new DbCslaException("PartInfo.ReadData", ex);
|
||||
}
|
||||
}
|
||||
private void DataPortal_Fetch(PKCriteria criteria)
|
||||
{
|
||||
if(_MyLog.IsDebugEnabled)_MyLog.DebugFormat("[{0}] PartInfo.DataPortal_Fetch", GetHashCode());
|
||||
if (_MyLog.IsDebugEnabled) _MyLog.DebugFormat("[{0}] PartInfo.DataPortal_Fetch", GetHashCode());
|
||||
try
|
||||
{
|
||||
using (SqlConnection cn = Database.VEPROMS_SqlConnection)
|
||||
@ -346,7 +368,7 @@ namespace VEPROMS.CSLA.Library
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
if(_MyLog.IsErrorEnabled)_MyLog.Error("PartInfo.DataPortal_Fetch", ex);
|
||||
if (_MyLog.IsErrorEnabled) _MyLog.Error("PartInfo.DataPortal_Fetch", ex);
|
||||
_ErrorMessage = ex.Message;
|
||||
throw new DbCslaException("PartInfo.DataPortal_Fetch", ex);
|
||||
}
|
||||
@ -356,7 +378,7 @@ namespace VEPROMS.CSLA.Library
|
||||
#region extension
|
||||
PartInfoExtension _PartInfoExtension = new PartInfoExtension();
|
||||
[Serializable()]
|
||||
partial class PartInfoExtension : extensionBase {}
|
||||
partial class PartInfoExtension : extensionBase { }
|
||||
[Serializable()]
|
||||
class extensionBase
|
||||
{
|
||||
|
@ -124,7 +124,7 @@ namespace VEPROMS.CSLA.Library
|
||||
private void DataPortal_Fetch()
|
||||
{
|
||||
this.RaiseListChangedEvents = false;
|
||||
if(_MyLog.IsDebugEnabled)_MyLog.DebugFormat("[{0}] PartInfoList.DataPortal_Fetch", GetHashCode());
|
||||
if (_MyLog.IsDebugEnabled) _MyLog.DebugFormat("[{0}] PartInfoList.DataPortal_Fetch", GetHashCode());
|
||||
try
|
||||
{
|
||||
using (SqlConnection cn = Database.VEPROMS_SqlConnection)
|
||||
@ -144,7 +144,7 @@ namespace VEPROMS.CSLA.Library
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
if(_MyLog.IsErrorEnabled)_MyLog.Error("PartInfoList.DataPortal_Fetch", ex);
|
||||
if (_MyLog.IsErrorEnabled) _MyLog.Error("PartInfoList.DataPortal_Fetch", ex);
|
||||
throw new DbCslaException("PartInfoList.DataPortal_Fetch", ex);
|
||||
}
|
||||
this.RaiseListChangedEvents = true;
|
||||
@ -166,7 +166,7 @@ namespace VEPROMS.CSLA.Library
|
||||
private void DataPortal_Fetch(ContentIDCriteria criteria)
|
||||
{
|
||||
this.RaiseListChangedEvents = false;
|
||||
if(_MyLog.IsDebugEnabled)_MyLog.DebugFormat("[{0}] PartInfoList.DataPortal_FetchContentID", GetHashCode());
|
||||
if (_MyLog.IsDebugEnabled) _MyLog.DebugFormat("[{0}] PartInfoList.DataPortal_FetchContentID", GetHashCode());
|
||||
try
|
||||
{
|
||||
using (SqlConnection cn = Database.VEPROMS_SqlConnection)
|
||||
@ -187,7 +187,7 @@ namespace VEPROMS.CSLA.Library
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
if(_MyLog.IsErrorEnabled)_MyLog.Error("PartInfoList.DataPortal_FetchContentID", ex);
|
||||
if (_MyLog.IsErrorEnabled) _MyLog.Error("PartInfoList.DataPortal_FetchContentID", ex);
|
||||
throw new DbCslaException("PartInfoList.DataPortal_Fetch", ex);
|
||||
}
|
||||
this.RaiseListChangedEvents = true;
|
||||
@ -209,7 +209,7 @@ namespace VEPROMS.CSLA.Library
|
||||
private void DataPortal_Fetch(ItemIDCriteria criteria)
|
||||
{
|
||||
this.RaiseListChangedEvents = false;
|
||||
if(_MyLog.IsDebugEnabled)_MyLog.DebugFormat("[{0}] PartInfoList.DataPortal_FetchItemID", GetHashCode());
|
||||
if (_MyLog.IsDebugEnabled) _MyLog.DebugFormat("[{0}] PartInfoList.DataPortal_FetchItemID", GetHashCode());
|
||||
try
|
||||
{
|
||||
using (SqlConnection cn = Database.VEPROMS_SqlConnection)
|
||||
@ -230,7 +230,7 @@ namespace VEPROMS.CSLA.Library
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
if(_MyLog.IsErrorEnabled)_MyLog.Error("PartInfoList.DataPortal_FetchItemID", ex);
|
||||
if (_MyLog.IsErrorEnabled) _MyLog.Error("PartInfoList.DataPortal_FetchItemID", ex);
|
||||
throw new DbCslaException("PartInfoList.DataPortal_Fetch", ex);
|
||||
}
|
||||
this.RaiseListChangedEvents = true;
|
||||
@ -291,8 +291,8 @@ namespace VEPROMS.CSLA.Library
|
||||
/// </summary>
|
||||
public partial class PartInfoListPropertyDescriptor : vlnListPropertyDescriptor
|
||||
{
|
||||
private PartInfo Item { get { return (PartInfo) _Item;} }
|
||||
public PartInfoListPropertyDescriptor(PartInfoList collection, int index):base(collection, index){;}
|
||||
private PartInfo Item { get { return (PartInfo)_Item; } }
|
||||
public PartInfoListPropertyDescriptor(PartInfoList collection, int index) : base(collection, index) { ;}
|
||||
}
|
||||
#endregion
|
||||
#region Converter
|
||||
@ -303,7 +303,7 @@ namespace VEPROMS.CSLA.Library
|
||||
if (destType == typeof(string) && value is PartInfoList)
|
||||
{
|
||||
// Return department and department role separated by comma.
|
||||
return ((PartInfoList) value).Items.Count.ToString() + " Parts";
|
||||
return ((PartInfoList)value).Items.Count.ToString() + " Parts";
|
||||
}
|
||||
return base.ConvertTo(context, culture, value, destType);
|
||||
}
|
||||
|
@ -47,19 +47,23 @@ namespace VEPROMS.CSLA.Library
|
||||
foreach (Permission tmp in _RefreshPermissions)
|
||||
{
|
||||
PermissionInfo.Refresh(tmp);
|
||||
if(tmp._MyRole != null) RoleInfo.Refresh(tmp._MyRole);
|
||||
if (tmp._MyRole != null) RoleInfo.Refresh(tmp._MyRole);
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
#region Collection
|
||||
protected static List<Permission> _AllList = new List<Permission>();
|
||||
private static Dictionary<string, Permission> _AllByPrimaryKey = new Dictionary<string, Permission>();
|
||||
private static Dictionary<string, List<Permission>> _AllByPrimaryKey = new Dictionary<string, List<Permission>>();
|
||||
private static void ConvertListToDictionary()
|
||||
{
|
||||
List<Permission> remove = new List<Permission>();
|
||||
foreach (Permission tmp in _AllList)
|
||||
{
|
||||
_AllByPrimaryKey[tmp.PID.ToString()]=tmp; // Primary Key
|
||||
if (!_AllByPrimaryKey.ContainsKey(tmp.PID.ToString()))
|
||||
{
|
||||
_AllByPrimaryKey[tmp.PID.ToString()] = new List<Permission>(); // Add new list for PrimaryKey
|
||||
}
|
||||
_AllByPrimaryKey[tmp.PID.ToString()].Add(tmp); // Add to Primary Key list
|
||||
remove.Add(tmp);
|
||||
}
|
||||
foreach (Permission tmp in remove)
|
||||
@ -69,7 +73,7 @@ namespace VEPROMS.CSLA.Library
|
||||
{
|
||||
ConvertListToDictionary();
|
||||
string key = pid.ToString();
|
||||
if (_AllByPrimaryKey.ContainsKey(key)) return _AllByPrimaryKey[key];
|
||||
if (_AllByPrimaryKey.ContainsKey(key)) return _AllByPrimaryKey[key][0];
|
||||
return null;
|
||||
}
|
||||
#endregion
|
||||
@ -91,7 +95,7 @@ namespace VEPROMS.CSLA.Library
|
||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||
get
|
||||
{
|
||||
CanReadProperty("PID",true);
|
||||
CanReadProperty("PID", true);
|
||||
return _PID;
|
||||
}
|
||||
}
|
||||
@ -101,7 +105,7 @@ namespace VEPROMS.CSLA.Library
|
||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||
get
|
||||
{
|
||||
CanReadProperty("RID",true);
|
||||
CanReadProperty("RID", true);
|
||||
if (_MyRole != null) _RID = _MyRole.RID;
|
||||
return _RID;
|
||||
}
|
||||
@ -112,14 +116,14 @@ namespace VEPROMS.CSLA.Library
|
||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||
get
|
||||
{
|
||||
CanReadProperty("MyRole",true);
|
||||
CanReadProperty("MyRole", true);
|
||||
if (_MyRole == null && _RID != 0) _MyRole = Role.Get(_RID);
|
||||
return _MyRole;
|
||||
}
|
||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||
set
|
||||
{
|
||||
CanWriteProperty("MyRole",true);
|
||||
CanWriteProperty("MyRole", true);
|
||||
if (_MyRole != value)
|
||||
{
|
||||
_MyRole = value;
|
||||
@ -136,13 +140,13 @@ namespace VEPROMS.CSLA.Library
|
||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||
get
|
||||
{
|
||||
CanReadProperty("PermLevel",true);
|
||||
CanReadProperty("PermLevel", true);
|
||||
return _PermLevel;
|
||||
}
|
||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||
set
|
||||
{
|
||||
CanWriteProperty("PermLevel",true);
|
||||
CanWriteProperty("PermLevel", true);
|
||||
if (_PermLevel != value)
|
||||
{
|
||||
_PermLevel = value;
|
||||
@ -159,13 +163,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;
|
||||
@ -182,13 +186,13 @@ namespace VEPROMS.CSLA.Library
|
||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||
get
|
||||
{
|
||||
CanReadProperty("PermValue",true);
|
||||
CanReadProperty("PermValue", true);
|
||||
return _PermValue;
|
||||
}
|
||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||
set
|
||||
{
|
||||
CanWriteProperty("PermValue",true);
|
||||
CanWriteProperty("PermValue", true);
|
||||
if (_PermValue != value)
|
||||
{
|
||||
_PermValue = value;
|
||||
@ -205,13 +209,13 @@ namespace VEPROMS.CSLA.Library
|
||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||
get
|
||||
{
|
||||
CanReadProperty("PermAD",true);
|
||||
CanReadProperty("PermAD", true);
|
||||
return _PermAD;
|
||||
}
|
||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||
set
|
||||
{
|
||||
CanWriteProperty("PermAD",true);
|
||||
CanWriteProperty("PermAD", true);
|
||||
if (_PermAD != value)
|
||||
{
|
||||
_PermAD = value;
|
||||
@ -225,13 +229,13 @@ namespace VEPROMS.CSLA.Library
|
||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||
get
|
||||
{
|
||||
CanReadProperty("StartDate",true);
|
||||
CanReadProperty("StartDate", true);
|
||||
return _StartDate;
|
||||
}
|
||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||
set
|
||||
{
|
||||
CanWriteProperty("StartDate",true);
|
||||
CanWriteProperty("StartDate", true);
|
||||
if (value == null) value = string.Empty;
|
||||
_StartDate = value;
|
||||
try
|
||||
@ -255,13 +259,13 @@ namespace VEPROMS.CSLA.Library
|
||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||
get
|
||||
{
|
||||
CanReadProperty("EndDate",true);
|
||||
CanReadProperty("EndDate", true);
|
||||
return _EndDate;
|
||||
}
|
||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||
set
|
||||
{
|
||||
CanWriteProperty("EndDate",true);
|
||||
CanWriteProperty("EndDate", true);
|
||||
if (value == null) value = string.Empty;
|
||||
_EndDate = value;
|
||||
try
|
||||
@ -285,13 +289,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)
|
||||
{
|
||||
@ -306,13 +310,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;
|
||||
@ -326,13 +330,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)
|
||||
{
|
||||
@ -344,11 +348,11 @@ namespace VEPROMS.CSLA.Library
|
||||
private byte[] _LastChanged = new byte[8];//timestamp
|
||||
public override bool IsDirty
|
||||
{
|
||||
get { return base.IsDirty || (_MyRole == null? false : _MyRole.IsDirty); }
|
||||
get { return base.IsDirty || (_MyRole == null ? false : _MyRole.IsDirty); }
|
||||
}
|
||||
public override bool IsValid
|
||||
{
|
||||
get { return (IsNew && !IsDirty ? true : base.IsValid) && (_MyRole == null? true : _MyRole.IsValid); }
|
||||
get { return (IsNew && !IsDirty ? true : base.IsValid) && (_MyRole == null ? true : _MyRole.IsValid); }
|
||||
}
|
||||
// TODO: Replace base Permission.ToString function as necessary
|
||||
/// <summary>
|
||||
@ -371,22 +375,23 @@ 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 (_MyRole != null && (hasBrokenRules = _MyRole.HasBrokenRules) != null) return hasBrokenRules;
|
||||
return hasBrokenRules;
|
||||
}
|
||||
finally
|
||||
{
|
||||
_CheckingBrokenRules=false;
|
||||
_CheckingBrokenRules = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -532,14 +537,25 @@ namespace VEPROMS.CSLA.Library
|
||||
#region Factory Methods
|
||||
public int CurrentEditLevel
|
||||
{ get { return EditLevel; } }
|
||||
private static int _PermissionUnique = 0;
|
||||
private int _MyPermissionUnique;
|
||||
public int MyPermissionUnique
|
||||
{
|
||||
get { return _MyPermissionUnique; }
|
||||
}
|
||||
protected Permission()
|
||||
{/* require use of factory methods */
|
||||
_MyPermissionUnique = ++_PermissionUnique;
|
||||
_AllList.Add(this);
|
||||
}
|
||||
public void Dispose()
|
||||
{
|
||||
_AllList.Remove(this);
|
||||
_AllByPrimaryKey.Remove(PID.ToString());
|
||||
if (!_AllByPrimaryKey.ContainsKey(PID.ToString())) return;
|
||||
List<Permission> listPermission = _AllByPrimaryKey[PID.ToString()]; // Get the list of items
|
||||
listPermission.Remove(this); // Remove the item from the list
|
||||
if (listPermission.Count == 0) //If there are no items left in the list
|
||||
_AllByPrimaryKey.Remove(PID.ToString()); // remove the list
|
||||
}
|
||||
public static Permission New()
|
||||
{
|
||||
@ -631,7 +647,7 @@ namespace VEPROMS.CSLA.Library
|
||||
if (tmp == null)
|
||||
{
|
||||
tmp = DataPortal.Fetch<Permission>(new PKCriteria(pid));
|
||||
_AllList.Add(tmp);
|
||||
if (!_AllList.Contains(tmp)) _AllList.Add(tmp);
|
||||
}
|
||||
if (tmp.ErrorMessage == "No Record Found") tmp = null;
|
||||
return tmp;
|
||||
@ -712,7 +728,7 @@ namespace VEPROMS.CSLA.Library
|
||||
}
|
||||
private void ReadData(SafeDataReader dr)
|
||||
{
|
||||
if(_MyLog.IsDebugEnabled)_MyLog.DebugFormat("[{0}] Permission.ReadData", GetHashCode());
|
||||
if (_MyLog.IsDebugEnabled) _MyLog.DebugFormat("[{0}] Permission.ReadData", GetHashCode());
|
||||
try
|
||||
{
|
||||
_PID = dr.GetInt32("PID");
|
||||
@ -731,14 +747,14 @@ namespace VEPROMS.CSLA.Library
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
if(_MyLog.IsErrorEnabled)_MyLog.Error("Permission.ReadData", ex);
|
||||
if (_MyLog.IsErrorEnabled) _MyLog.Error("Permission.ReadData", ex);
|
||||
_ErrorMessage = ex.Message;
|
||||
throw new DbCslaException("Permission.ReadData", ex);
|
||||
}
|
||||
}
|
||||
private void DataPortal_Fetch(PKCriteria criteria)
|
||||
{
|
||||
if(_MyLog.IsDebugEnabled)_MyLog.DebugFormat("[{0}] Permission.DataPortal_Fetch", GetHashCode());
|
||||
if (_MyLog.IsDebugEnabled) _MyLog.DebugFormat("[{0}] Permission.DataPortal_Fetch", GetHashCode());
|
||||
try
|
||||
{
|
||||
using (SqlConnection cn = Database.VEPROMS_SqlConnection)
|
||||
@ -766,7 +782,7 @@ namespace VEPROMS.CSLA.Library
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
if(_MyLog.IsErrorEnabled)_MyLog.Error("Permission.DataPortal_Fetch", ex);
|
||||
if (_MyLog.IsErrorEnabled) _MyLog.Error("Permission.DataPortal_Fetch", ex);
|
||||
_ErrorMessage = ex.Message;
|
||||
throw new DbCslaException("Permission.DataPortal_Fetch", ex);
|
||||
}
|
||||
@ -787,13 +803,13 @@ namespace VEPROMS.CSLA.Library
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
if(_MyLog.IsErrorEnabled)_MyLog.Error("Permission.DataPortal_Insert", ex);
|
||||
if (_MyLog.IsErrorEnabled) _MyLog.Error("Permission.DataPortal_Insert", ex);
|
||||
_ErrorMessage = ex.Message;
|
||||
throw new DbCslaException("Permission.DataPortal_Insert", ex);
|
||||
}
|
||||
finally
|
||||
{
|
||||
if(_MyLog.IsDebugEnabled)_MyLog.DebugFormat("[{0}] Permission.DataPortal_Insert", GetHashCode());
|
||||
if (_MyLog.IsDebugEnabled) _MyLog.DebugFormat("[{0}] Permission.DataPortal_Insert", GetHashCode());
|
||||
}
|
||||
}
|
||||
[Transactional(TransactionalTypes.TransactionScope)]
|
||||
@ -802,7 +818,7 @@ namespace VEPROMS.CSLA.Library
|
||||
if (!this.IsDirty) return;
|
||||
try
|
||||
{
|
||||
if(_MyRole != null) _MyRole.Update();
|
||||
if (_MyRole != null) _MyRole.Update();
|
||||
SqlConnection cn = (SqlConnection)ApplicationContext.LocalContext["cn"];
|
||||
using (SqlCommand cm = cn.CreateCommand())
|
||||
{
|
||||
@ -834,11 +850,11 @@ namespace VEPROMS.CSLA.Library
|
||||
}
|
||||
MarkOld();
|
||||
// update child objects
|
||||
if(_MyLog.IsDebugEnabled)_MyLog.DebugFormat("[{0}] Permission.SQLInsert", GetHashCode());
|
||||
if (_MyLog.IsDebugEnabled) _MyLog.DebugFormat("[{0}] Permission.SQLInsert", GetHashCode());
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
if(_MyLog.IsErrorEnabled)_MyLog.Error("Permission.SQLInsert", ex);
|
||||
if (_MyLog.IsErrorEnabled) _MyLog.Error("Permission.SQLInsert", ex);
|
||||
_ErrorMessage = ex.Message;
|
||||
throw new DbCslaException("Permission.SQLInsert", ex);
|
||||
}
|
||||
@ -846,7 +862,7 @@ namespace VEPROMS.CSLA.Library
|
||||
[Transactional(TransactionalTypes.TransactionScope)]
|
||||
public static byte[] Add(SqlConnection cn, ref int pid, Role myRole, int permLevel, int versionType, int permValue, int permAD, SmartDate startDate, SmartDate endDate, string config, DateTime dts, string usrID)
|
||||
{
|
||||
if(_MyLog.IsDebugEnabled)_MyLog.DebugFormat("[{0}] Permission.Add", 0);
|
||||
if (_MyLog.IsDebugEnabled) _MyLog.DebugFormat("[{0}] Permission.Add", 0);
|
||||
try
|
||||
{
|
||||
using (SqlCommand cm = cn.CreateCommand())
|
||||
@ -880,7 +896,7 @@ namespace VEPROMS.CSLA.Library
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
if(_MyLog.IsErrorEnabled)_MyLog.Error("Permission.Add", ex);
|
||||
if (_MyLog.IsErrorEnabled) _MyLog.Error("Permission.Add", ex);
|
||||
throw new DbCslaException("Permission.Add", ex);
|
||||
}
|
||||
}
|
||||
@ -888,7 +904,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}] Permission.DataPortal_Update", GetHashCode());
|
||||
if (_MyLog.IsDebugEnabled) _MyLog.DebugFormat("[{0}] Permission.DataPortal_Update", GetHashCode());
|
||||
try
|
||||
{
|
||||
using (SqlConnection cn = Database.VEPROMS_SqlConnection)
|
||||
@ -902,7 +918,7 @@ namespace VEPROMS.CSLA.Library
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
if(_MyLog.IsErrorEnabled)_MyLog.Error("Permission.DataPortal_Update", ex);
|
||||
if (_MyLog.IsErrorEnabled) _MyLog.Error("Permission.DataPortal_Update", ex);
|
||||
_ErrorMessage = ex.Message;
|
||||
if (!ex.Message.EndsWith("has been edited by another user.")) throw ex;
|
||||
}
|
||||
@ -911,10 +927,10 @@ namespace VEPROMS.CSLA.Library
|
||||
internal void SQLUpdate()
|
||||
{
|
||||
if (!IsDirty) return; // If not dirty - nothing to do
|
||||
if(_MyLog.IsDebugEnabled)_MyLog.DebugFormat("[{0}] Permission.SQLUpdate", GetHashCode());
|
||||
if (_MyLog.IsDebugEnabled) _MyLog.DebugFormat("[{0}] Permission.SQLUpdate", GetHashCode());
|
||||
try
|
||||
{
|
||||
if(_MyRole != null) _MyRole.Update();
|
||||
if (_MyRole != null) _MyRole.Update();
|
||||
SqlConnection cn = (SqlConnection)ApplicationContext.LocalContext["cn"];
|
||||
if (base.IsDirty)
|
||||
{
|
||||
@ -950,7 +966,7 @@ namespace VEPROMS.CSLA.Library
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
if(_MyLog.IsErrorEnabled)_MyLog.Error("Permission.SQLUpdate", ex);
|
||||
if (_MyLog.IsErrorEnabled) _MyLog.Error("Permission.SQLUpdate", ex);
|
||||
_ErrorMessage = ex.Message;
|
||||
if (!ex.Message.EndsWith("has been edited by another user.")) throw ex;
|
||||
}
|
||||
@ -971,7 +987,7 @@ namespace VEPROMS.CSLA.Library
|
||||
[Transactional(TransactionalTypes.TransactionScope)]
|
||||
public static byte[] Update(SqlConnection cn, ref int pid, Role myRole, int permLevel, int versionType, int permValue, int permAD, SmartDate startDate, SmartDate endDate, string config, DateTime dts, string usrID, ref byte[] lastChanged)
|
||||
{
|
||||
if(_MyLog.IsDebugEnabled)_MyLog.DebugFormat("[{0}] Permission.Update", 0);
|
||||
if (_MyLog.IsDebugEnabled) _MyLog.DebugFormat("[{0}] Permission.Update", 0);
|
||||
try
|
||||
{
|
||||
using (SqlCommand cm = cn.CreateCommand())
|
||||
@ -1003,7 +1019,7 @@ namespace VEPROMS.CSLA.Library
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
if(_MyLog.IsErrorEnabled)_MyLog.Error("Permission.Update", ex);
|
||||
if (_MyLog.IsErrorEnabled) _MyLog.Error("Permission.Update", ex);
|
||||
throw new DbCslaException("Permission.Update", ex);
|
||||
}
|
||||
}
|
||||
@ -1015,7 +1031,7 @@ namespace VEPROMS.CSLA.Library
|
||||
[Transactional(TransactionalTypes.TransactionScope)]
|
||||
private void DataPortal_Delete(PKCriteria criteria)
|
||||
{
|
||||
if(_MyLog.IsDebugEnabled)_MyLog.DebugFormat("[{0}] Permission.DataPortal_Delete", GetHashCode());
|
||||
if (_MyLog.IsDebugEnabled) _MyLog.DebugFormat("[{0}] Permission.DataPortal_Delete", GetHashCode());
|
||||
try
|
||||
{
|
||||
using (SqlConnection cn = Database.VEPROMS_SqlConnection)
|
||||
@ -1031,7 +1047,7 @@ namespace VEPROMS.CSLA.Library
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
if(_MyLog.IsErrorEnabled)_MyLog.Error("Permission.DataPortal_Delete", ex);
|
||||
if (_MyLog.IsErrorEnabled) _MyLog.Error("Permission.DataPortal_Delete", ex);
|
||||
_ErrorMessage = ex.Message;
|
||||
throw new DbCslaException("Permission.DataPortal_Delete", ex);
|
||||
}
|
||||
@ -1039,7 +1055,7 @@ namespace VEPROMS.CSLA.Library
|
||||
[Transactional(TransactionalTypes.TransactionScope)]
|
||||
public static void Remove(SqlConnection cn, int pid)
|
||||
{
|
||||
if(_MyLog.IsDebugEnabled)_MyLog.DebugFormat("[{0}] Permission.Remove", 0);
|
||||
if (_MyLog.IsDebugEnabled) _MyLog.DebugFormat("[{0}] Permission.Remove", 0);
|
||||
try
|
||||
{
|
||||
using (SqlCommand cm = cn.CreateCommand())
|
||||
@ -1054,7 +1070,7 @@ namespace VEPROMS.CSLA.Library
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
if(_MyLog.IsErrorEnabled)_MyLog.Error("Permission.Remove", ex);
|
||||
if (_MyLog.IsErrorEnabled) _MyLog.Error("Permission.Remove", ex);
|
||||
throw new DbCslaException("Permission.Remove", ex);
|
||||
}
|
||||
}
|
||||
@ -1088,7 +1104,7 @@ namespace VEPROMS.CSLA.Library
|
||||
}
|
||||
protected override void DataPortal_Execute()
|
||||
{
|
||||
if(_MyLog.IsDebugEnabled)_MyLog.DebugFormat("[{0}] Permission.DataPortal_Execute", GetHashCode());
|
||||
if (_MyLog.IsDebugEnabled) _MyLog.DebugFormat("[{0}] Permission.DataPortal_Execute", GetHashCode());
|
||||
try
|
||||
{
|
||||
using (SqlConnection cn = Database.VEPROMS_SqlConnection)
|
||||
@ -1106,7 +1122,7 @@ namespace VEPROMS.CSLA.Library
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
if(_MyLog.IsErrorEnabled)_MyLog.Error("Permission.DataPortal_Execute", ex);
|
||||
if (_MyLog.IsErrorEnabled) _MyLog.Error("Permission.DataPortal_Execute", ex);
|
||||
throw new DbCslaException("Permission.DataPortal_Execute", ex);
|
||||
}
|
||||
}
|
||||
|
@ -37,13 +37,17 @@ namespace VEPROMS.CSLA.Library
|
||||
#endregion
|
||||
#region Collection
|
||||
protected static List<PermissionInfo> _AllList = new List<PermissionInfo>();
|
||||
private static Dictionary<string, PermissionInfo> _AllByPrimaryKey = new Dictionary<string, PermissionInfo>();
|
||||
private static Dictionary<string, List<PermissionInfo>> _AllByPrimaryKey = new Dictionary<string, List<PermissionInfo>>();
|
||||
private static void ConvertListToDictionary()
|
||||
{
|
||||
List<PermissionInfo> remove = new List<PermissionInfo>();
|
||||
foreach (PermissionInfo tmp in _AllList)
|
||||
{
|
||||
_AllByPrimaryKey[tmp.PID.ToString()]=tmp; // Primary Key
|
||||
if (!_AllByPrimaryKey.ContainsKey(tmp.PID.ToString()))
|
||||
{
|
||||
_AllByPrimaryKey[tmp.PID.ToString()] = new List<PermissionInfo>(); // Add new list for PrimaryKey
|
||||
}
|
||||
_AllByPrimaryKey[tmp.PID.ToString()].Add(tmp); // Add to Primary Key list
|
||||
remove.Add(tmp);
|
||||
}
|
||||
foreach (PermissionInfo tmp in remove)
|
||||
@ -57,7 +61,7 @@ namespace VEPROMS.CSLA.Library
|
||||
{
|
||||
ConvertListToDictionary();
|
||||
string key = pid.ToString();
|
||||
if (_AllByPrimaryKey.ContainsKey(key)) return _AllByPrimaryKey[key];
|
||||
if (_AllByPrimaryKey.ContainsKey(key)) return _AllByPrimaryKey[key][0];
|
||||
return null;
|
||||
}
|
||||
#endregion
|
||||
@ -85,7 +89,7 @@ namespace VEPROMS.CSLA.Library
|
||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||
get
|
||||
{
|
||||
CanReadProperty("PID",true);
|
||||
CanReadProperty("PID", true);
|
||||
return _PID;
|
||||
}
|
||||
}
|
||||
@ -95,7 +99,7 @@ namespace VEPROMS.CSLA.Library
|
||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||
get
|
||||
{
|
||||
CanReadProperty("RID",true);
|
||||
CanReadProperty("RID", true);
|
||||
if (_MyRole != null) _RID = _MyRole.RID;
|
||||
return _RID;
|
||||
}
|
||||
@ -106,7 +110,7 @@ namespace VEPROMS.CSLA.Library
|
||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||
get
|
||||
{
|
||||
CanReadProperty("MyRole",true);
|
||||
CanReadProperty("MyRole", true);
|
||||
if (_MyRole == null && _RID != 0) _MyRole = RoleInfo.Get(_RID);
|
||||
return _MyRole;
|
||||
}
|
||||
@ -120,7 +124,7 @@ namespace VEPROMS.CSLA.Library
|
||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||
get
|
||||
{
|
||||
CanReadProperty("PermLevel",true);
|
||||
CanReadProperty("PermLevel", true);
|
||||
return _PermLevel;
|
||||
}
|
||||
}
|
||||
@ -133,7 +137,7 @@ namespace VEPROMS.CSLA.Library
|
||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||
get
|
||||
{
|
||||
CanReadProperty("VersionType",true);
|
||||
CanReadProperty("VersionType", true);
|
||||
return _VersionType;
|
||||
}
|
||||
}
|
||||
@ -146,7 +150,7 @@ namespace VEPROMS.CSLA.Library
|
||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||
get
|
||||
{
|
||||
CanReadProperty("PermValue",true);
|
||||
CanReadProperty("PermValue", true);
|
||||
return _PermValue;
|
||||
}
|
||||
}
|
||||
@ -159,7 +163,7 @@ namespace VEPROMS.CSLA.Library
|
||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||
get
|
||||
{
|
||||
CanReadProperty("PermAD",true);
|
||||
CanReadProperty("PermAD", true);
|
||||
return _PermAD;
|
||||
}
|
||||
}
|
||||
@ -169,7 +173,7 @@ namespace VEPROMS.CSLA.Library
|
||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||
get
|
||||
{
|
||||
CanReadProperty("StartDate",true);
|
||||
CanReadProperty("StartDate", true);
|
||||
return _StartDate;
|
||||
}
|
||||
}
|
||||
@ -179,7 +183,7 @@ namespace VEPROMS.CSLA.Library
|
||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||
get
|
||||
{
|
||||
CanReadProperty("EndDate",true);
|
||||
CanReadProperty("EndDate", true);
|
||||
return _EndDate;
|
||||
}
|
||||
}
|
||||
@ -189,7 +193,7 @@ namespace VEPROMS.CSLA.Library
|
||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||
get
|
||||
{
|
||||
CanReadProperty("Config",true);
|
||||
CanReadProperty("Config", true);
|
||||
return _Config;
|
||||
}
|
||||
}
|
||||
@ -199,7 +203,7 @@ namespace VEPROMS.CSLA.Library
|
||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||
get
|
||||
{
|
||||
CanReadProperty("DTS",true);
|
||||
CanReadProperty("DTS", true);
|
||||
return _DTS;
|
||||
}
|
||||
}
|
||||
@ -209,7 +213,7 @@ namespace VEPROMS.CSLA.Library
|
||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||
get
|
||||
{
|
||||
CanReadProperty("UsrID",true);
|
||||
CanReadProperty("UsrID", true);
|
||||
return _UsrID;
|
||||
}
|
||||
}
|
||||
@ -233,14 +237,25 @@ namespace VEPROMS.CSLA.Library
|
||||
}
|
||||
#endregion
|
||||
#region Factory Methods
|
||||
private static int _PermissionInfoUnique = 0;
|
||||
private int _MyPermissionInfoUnique;
|
||||
public int MyPermissionInfoUnique
|
||||
{
|
||||
get { return _MyPermissionInfoUnique; }
|
||||
}
|
||||
private PermissionInfo()
|
||||
{/* require use of factory methods */
|
||||
_MyPermissionInfoUnique = ++_PermissionInfoUnique;
|
||||
_AllList.Add(this);
|
||||
}
|
||||
public void Dispose()
|
||||
{
|
||||
_AllList.Remove(this);
|
||||
_AllByPrimaryKey.Remove(PID.ToString());
|
||||
if (!_AllByPrimaryKey.ContainsKey(PID.ToString())) return;
|
||||
List<PermissionInfo> listPermissionInfo = _AllByPrimaryKey[PID.ToString()]; // Get the list of items
|
||||
listPermissionInfo.Remove(this); // Remove the item from the list
|
||||
if (listPermissionInfo.Count == 0) // If there are no items left in the list
|
||||
_AllByPrimaryKey.Remove(PID.ToString()); // remove the list
|
||||
}
|
||||
public virtual Permission Get()
|
||||
{
|
||||
@ -248,8 +263,10 @@ namespace VEPROMS.CSLA.Library
|
||||
}
|
||||
public static void Refresh(Permission tmp)
|
||||
{
|
||||
PermissionInfo tmpInfo = GetExistingByPrimaryKey(tmp.PID);
|
||||
if (tmpInfo == null) return;
|
||||
string key = tmp.PID.ToString();
|
||||
ConvertListToDictionary();
|
||||
if (_AllByPrimaryKey.ContainsKey(key))
|
||||
foreach (PermissionInfo tmpInfo in _AllByPrimaryKey[key])
|
||||
tmpInfo.RefreshFields(tmp);
|
||||
}
|
||||
private void RefreshFields(Permission tmp)
|
||||
@ -258,9 +275,9 @@ namespace VEPROMS.CSLA.Library
|
||||
{
|
||||
MyRole.RefreshRolePermissions(); // Update List for old value
|
||||
_RID = tmp.RID; // Update the value
|
||||
_MyRole = null; // Reset list so that the next line gets a new list
|
||||
MyRole.RefreshRolePermissions(); // Update List for new value
|
||||
}
|
||||
_MyRole = null; // Reset list so that the next line gets a new list
|
||||
if (MyRole != null) MyRole.RefreshRolePermissions(); // Update List for new value
|
||||
_PermLevel = tmp.PermLevel;
|
||||
_VersionType = tmp.VersionType;
|
||||
_PermValue = tmp.PermValue;
|
||||
@ -276,8 +293,10 @@ namespace VEPROMS.CSLA.Library
|
||||
}
|
||||
public static void Refresh(RolePermission tmp)
|
||||
{
|
||||
PermissionInfo tmpInfo = GetExistingByPrimaryKey(tmp.PID);
|
||||
if (tmpInfo == null) return;
|
||||
string key = tmp.PID.ToString();
|
||||
ConvertListToDictionary();
|
||||
if (_AllByPrimaryKey.ContainsKey(key))
|
||||
foreach (PermissionInfo tmpInfo in _AllByPrimaryKey[key])
|
||||
tmpInfo.RefreshFields(tmp);
|
||||
}
|
||||
private void RefreshFields(RolePermission tmp)
|
||||
@ -305,7 +324,7 @@ namespace VEPROMS.CSLA.Library
|
||||
if (tmp == null)
|
||||
{
|
||||
tmp = DataPortal.Fetch<PermissionInfo>(new PKCriteria(pid));
|
||||
_AllList.Add(tmp);
|
||||
if (!_AllList.Contains(tmp)) _AllList.Add(tmp);
|
||||
}
|
||||
if (tmp.ErrorMessage == "No Record Found") tmp = null;
|
||||
return tmp;
|
||||
@ -319,14 +338,15 @@ namespace VEPROMS.CSLA.Library
|
||||
#region Data Access Portal
|
||||
internal PermissionInfo(SafeDataReader dr)
|
||||
{
|
||||
if(_MyLog.IsDebugEnabled)_MyLog.DebugFormat("[{0}] PermissionInfo.Constructor", GetHashCode());
|
||||
_MyPermissionInfoUnique = ++_PermissionInfoUnique;
|
||||
if (_MyLog.IsDebugEnabled) _MyLog.DebugFormat("[{0}] PermissionInfo.Constructor", GetHashCode());
|
||||
try
|
||||
{
|
||||
ReadData(dr);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
if(_MyLog.IsErrorEnabled)_MyLog.Error("PermissionInfo.Constructor", ex);
|
||||
if (_MyLog.IsErrorEnabled) _MyLog.Error("PermissionInfo.Constructor", ex);
|
||||
throw new DbCslaException("PermissionInfo.Constructor", ex);
|
||||
}
|
||||
}
|
||||
@ -343,7 +363,7 @@ namespace VEPROMS.CSLA.Library
|
||||
}
|
||||
private void ReadData(SafeDataReader dr)
|
||||
{
|
||||
if(_MyLog.IsDebugEnabled)_MyLog.DebugFormat("[{0}] PermissionInfo.ReadData", GetHashCode());
|
||||
if (_MyLog.IsDebugEnabled) _MyLog.DebugFormat("[{0}] PermissionInfo.ReadData", GetHashCode());
|
||||
try
|
||||
{
|
||||
_PID = dr.GetInt32("PID");
|
||||
@ -360,14 +380,14 @@ namespace VEPROMS.CSLA.Library
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
if(_MyLog.IsErrorEnabled)_MyLog.Error("PermissionInfo.ReadData", ex);
|
||||
if (_MyLog.IsErrorEnabled) _MyLog.Error("PermissionInfo.ReadData", ex);
|
||||
_ErrorMessage = ex.Message;
|
||||
throw new DbCslaException("PermissionInfo.ReadData", ex);
|
||||
}
|
||||
}
|
||||
private void DataPortal_Fetch(PKCriteria criteria)
|
||||
{
|
||||
if(_MyLog.IsDebugEnabled)_MyLog.DebugFormat("[{0}] PermissionInfo.DataPortal_Fetch", GetHashCode());
|
||||
if (_MyLog.IsDebugEnabled) _MyLog.DebugFormat("[{0}] PermissionInfo.DataPortal_Fetch", GetHashCode());
|
||||
try
|
||||
{
|
||||
using (SqlConnection cn = Database.VEPROMS_SqlConnection)
|
||||
@ -395,7 +415,7 @@ namespace VEPROMS.CSLA.Library
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
if(_MyLog.IsErrorEnabled)_MyLog.Error("PermissionInfo.DataPortal_Fetch", ex);
|
||||
if (_MyLog.IsErrorEnabled) _MyLog.Error("PermissionInfo.DataPortal_Fetch", ex);
|
||||
_ErrorMessage = ex.Message;
|
||||
throw new DbCslaException("PermissionInfo.DataPortal_Fetch", ex);
|
||||
}
|
||||
@ -405,7 +425,7 @@ namespace VEPROMS.CSLA.Library
|
||||
#region extension
|
||||
PermissionInfoExtension _PermissionInfoExtension = new PermissionInfoExtension();
|
||||
[Serializable()]
|
||||
partial class PermissionInfoExtension : extensionBase {}
|
||||
partial class PermissionInfoExtension : extensionBase { }
|
||||
[Serializable()]
|
||||
class extensionBase
|
||||
{
|
||||
|
@ -110,7 +110,7 @@ namespace VEPROMS.CSLA.Library
|
||||
private void DataPortal_Fetch()
|
||||
{
|
||||
this.RaiseListChangedEvents = false;
|
||||
if(_MyLog.IsDebugEnabled)_MyLog.DebugFormat("[{0}] PermissionInfoList.DataPortal_Fetch", GetHashCode());
|
||||
if (_MyLog.IsDebugEnabled) _MyLog.DebugFormat("[{0}] PermissionInfoList.DataPortal_Fetch", GetHashCode());
|
||||
try
|
||||
{
|
||||
using (SqlConnection cn = Database.VEPROMS_SqlConnection)
|
||||
@ -130,7 +130,7 @@ namespace VEPROMS.CSLA.Library
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
if(_MyLog.IsErrorEnabled)_MyLog.Error("PermissionInfoList.DataPortal_Fetch", ex);
|
||||
if (_MyLog.IsErrorEnabled) _MyLog.Error("PermissionInfoList.DataPortal_Fetch", ex);
|
||||
throw new DbCslaException("PermissionInfoList.DataPortal_Fetch", ex);
|
||||
}
|
||||
this.RaiseListChangedEvents = true;
|
||||
@ -152,7 +152,7 @@ namespace VEPROMS.CSLA.Library
|
||||
private void DataPortal_Fetch(RIDCriteria criteria)
|
||||
{
|
||||
this.RaiseListChangedEvents = false;
|
||||
if(_MyLog.IsDebugEnabled)_MyLog.DebugFormat("[{0}] PermissionInfoList.DataPortal_FetchRID", GetHashCode());
|
||||
if (_MyLog.IsDebugEnabled) _MyLog.DebugFormat("[{0}] PermissionInfoList.DataPortal_FetchRID", GetHashCode());
|
||||
try
|
||||
{
|
||||
using (SqlConnection cn = Database.VEPROMS_SqlConnection)
|
||||
@ -173,7 +173,7 @@ namespace VEPROMS.CSLA.Library
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
if(_MyLog.IsErrorEnabled)_MyLog.Error("PermissionInfoList.DataPortal_FetchRID", ex);
|
||||
if (_MyLog.IsErrorEnabled) _MyLog.Error("PermissionInfoList.DataPortal_FetchRID", ex);
|
||||
throw new DbCslaException("PermissionInfoList.DataPortal_Fetch", ex);
|
||||
}
|
||||
this.RaiseListChangedEvents = true;
|
||||
@ -234,8 +234,8 @@ namespace VEPROMS.CSLA.Library
|
||||
/// </summary>
|
||||
public partial class PermissionInfoListPropertyDescriptor : vlnListPropertyDescriptor
|
||||
{
|
||||
private PermissionInfo Item { get { return (PermissionInfo) _Item;} }
|
||||
public PermissionInfoListPropertyDescriptor(PermissionInfoList collection, int index):base(collection, index){;}
|
||||
private PermissionInfo Item { get { return (PermissionInfo)_Item; } }
|
||||
public PermissionInfoListPropertyDescriptor(PermissionInfoList collection, int index) : base(collection, index) { ;}
|
||||
}
|
||||
#endregion
|
||||
#region Converter
|
||||
@ -246,7 +246,7 @@ namespace VEPROMS.CSLA.Library
|
||||
if (destType == typeof(string) && value is PermissionInfoList)
|
||||
{
|
||||
// Return department and department role separated by comma.
|
||||
return ((PermissionInfoList) value).Items.Count.ToString() + " Permissions";
|
||||
return ((PermissionInfoList)value).Items.Count.ToString() + " Permissions";
|
||||
}
|
||||
return base.ConvertTo(context, culture, value, destType);
|
||||
}
|
||||
|
@ -47,19 +47,23 @@ namespace VEPROMS.CSLA.Library
|
||||
foreach (RoUsage tmp in _RefreshRoUsages)
|
||||
{
|
||||
RoUsageInfo.Refresh(tmp);
|
||||
if(tmp._MyContent != null) ContentInfo.Refresh(tmp._MyContent);
|
||||
if (tmp._MyContent != null) ContentInfo.Refresh(tmp._MyContent);
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
#region Collection
|
||||
protected static List<RoUsage> _AllList = new List<RoUsage>();
|
||||
private static Dictionary<string, RoUsage> _AllByPrimaryKey = new Dictionary<string, RoUsage>();
|
||||
private static Dictionary<string, List<RoUsage>> _AllByPrimaryKey = new Dictionary<string, List<RoUsage>>();
|
||||
private static void ConvertListToDictionary()
|
||||
{
|
||||
List<RoUsage> remove = new List<RoUsage>();
|
||||
foreach (RoUsage tmp in _AllList)
|
||||
{
|
||||
_AllByPrimaryKey[tmp.ROUsageID.ToString()]=tmp; // Primary Key
|
||||
if (!_AllByPrimaryKey.ContainsKey(tmp.ROUsageID.ToString()))
|
||||
{
|
||||
_AllByPrimaryKey[tmp.ROUsageID.ToString()] = new List<RoUsage>(); // Add new list for PrimaryKey
|
||||
}
|
||||
_AllByPrimaryKey[tmp.ROUsageID.ToString()].Add(tmp); // Add to Primary Key list
|
||||
remove.Add(tmp);
|
||||
}
|
||||
foreach (RoUsage tmp in remove)
|
||||
@ -69,7 +73,7 @@ namespace VEPROMS.CSLA.Library
|
||||
{
|
||||
ConvertListToDictionary();
|
||||
string key = rOUsageID.ToString();
|
||||
if (_AllByPrimaryKey.ContainsKey(key)) return _AllByPrimaryKey[key];
|
||||
if (_AllByPrimaryKey.ContainsKey(key)) return _AllByPrimaryKey[key][0];
|
||||
return null;
|
||||
}
|
||||
#endregion
|
||||
@ -91,7 +95,7 @@ namespace VEPROMS.CSLA.Library
|
||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||
get
|
||||
{
|
||||
CanReadProperty("ROUsageID",true);
|
||||
CanReadProperty("ROUsageID", true);
|
||||
return _ROUsageID;
|
||||
}
|
||||
}
|
||||
@ -101,7 +105,7 @@ namespace VEPROMS.CSLA.Library
|
||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||
get
|
||||
{
|
||||
CanReadProperty("ContentID",true);
|
||||
CanReadProperty("ContentID", true);
|
||||
if (_MyContent != null) _ContentID = _MyContent.ContentID;
|
||||
return _ContentID;
|
||||
}
|
||||
@ -112,14 +116,14 @@ namespace VEPROMS.CSLA.Library
|
||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||
get
|
||||
{
|
||||
CanReadProperty("MyContent",true);
|
||||
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);
|
||||
CanWriteProperty("MyContent", true);
|
||||
if (_MyContent != value)
|
||||
{
|
||||
_MyContent = value;
|
||||
@ -133,13 +137,13 @@ namespace VEPROMS.CSLA.Library
|
||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||
get
|
||||
{
|
||||
CanReadProperty("ROID",true);
|
||||
CanReadProperty("ROID", true);
|
||||
return _ROID;
|
||||
}
|
||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||
set
|
||||
{
|
||||
CanWriteProperty("ROID",true);
|
||||
CanWriteProperty("ROID", true);
|
||||
if (value == null) value = string.Empty;
|
||||
if (_ROID != value)
|
||||
{
|
||||
@ -154,13 +158,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)
|
||||
{
|
||||
@ -175,13 +179,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;
|
||||
@ -195,13 +199,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)
|
||||
{
|
||||
@ -213,11 +217,11 @@ namespace VEPROMS.CSLA.Library
|
||||
private byte[] _LastChanged = new byte[8];//timestamp
|
||||
public override bool IsDirty
|
||||
{
|
||||
get { return base.IsDirty || (_MyContent == null? false : _MyContent.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); }
|
||||
get { return (IsNew && !IsDirty ? true : base.IsValid) && (_MyContent == null ? true : _MyContent.IsValid); }
|
||||
}
|
||||
// TODO: Replace base RoUsage.ToString function as necessary
|
||||
/// <summary>
|
||||
@ -240,22 +244,23 @@ 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 (_MyContent != null && (hasBrokenRules = _MyContent.HasBrokenRules) != null) return hasBrokenRules;
|
||||
return hasBrokenRules;
|
||||
}
|
||||
finally
|
||||
{
|
||||
_CheckingBrokenRules=false;
|
||||
_CheckingBrokenRules = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -366,14 +371,25 @@ namespace VEPROMS.CSLA.Library
|
||||
#region Factory Methods
|
||||
public int CurrentEditLevel
|
||||
{ get { return EditLevel; } }
|
||||
private static int _RoUsageUnique = 0;
|
||||
private int _MyRoUsageUnique;
|
||||
public int MyRoUsageUnique
|
||||
{
|
||||
get { return _MyRoUsageUnique; }
|
||||
}
|
||||
protected RoUsage()
|
||||
{/* require use of factory methods */
|
||||
_MyRoUsageUnique = ++_RoUsageUnique;
|
||||
_AllList.Add(this);
|
||||
}
|
||||
public void Dispose()
|
||||
{
|
||||
_AllList.Remove(this);
|
||||
_AllByPrimaryKey.Remove(ROUsageID.ToString());
|
||||
if (!_AllByPrimaryKey.ContainsKey(ROUsageID.ToString())) return;
|
||||
List<RoUsage> listRoUsage = _AllByPrimaryKey[ROUsageID.ToString()]; // Get the list of items
|
||||
listRoUsage.Remove(this); // Remove the item from the list
|
||||
if (listRoUsage.Count == 0) //If there are no items left in the list
|
||||
_AllByPrimaryKey.Remove(ROUsageID.ToString()); // remove the list
|
||||
}
|
||||
public static RoUsage New()
|
||||
{
|
||||
@ -454,7 +470,7 @@ namespace VEPROMS.CSLA.Library
|
||||
if (tmp == null)
|
||||
{
|
||||
tmp = DataPortal.Fetch<RoUsage>(new PKCriteria(rOUsageID));
|
||||
_AllList.Add(tmp);
|
||||
if (!_AllList.Contains(tmp)) _AllList.Add(tmp);
|
||||
}
|
||||
if (tmp.ErrorMessage == "No Record Found") tmp = null;
|
||||
return tmp;
|
||||
@ -534,7 +550,7 @@ namespace VEPROMS.CSLA.Library
|
||||
}
|
||||
private void ReadData(SafeDataReader dr)
|
||||
{
|
||||
if(_MyLog.IsDebugEnabled)_MyLog.DebugFormat("[{0}] RoUsage.ReadData", GetHashCode());
|
||||
if (_MyLog.IsDebugEnabled) _MyLog.DebugFormat("[{0}] RoUsage.ReadData", GetHashCode());
|
||||
try
|
||||
{
|
||||
_ROUsageID = dr.GetInt32("ROUsageID");
|
||||
@ -548,14 +564,14 @@ namespace VEPROMS.CSLA.Library
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
if(_MyLog.IsErrorEnabled)_MyLog.Error("RoUsage.ReadData", ex);
|
||||
if (_MyLog.IsErrorEnabled) _MyLog.Error("RoUsage.ReadData", ex);
|
||||
_ErrorMessage = ex.Message;
|
||||
throw new DbCslaException("RoUsage.ReadData", ex);
|
||||
}
|
||||
}
|
||||
private void DataPortal_Fetch(PKCriteria criteria)
|
||||
{
|
||||
if(_MyLog.IsDebugEnabled)_MyLog.DebugFormat("[{0}] RoUsage.DataPortal_Fetch", GetHashCode());
|
||||
if (_MyLog.IsDebugEnabled) _MyLog.DebugFormat("[{0}] RoUsage.DataPortal_Fetch", GetHashCode());
|
||||
try
|
||||
{
|
||||
using (SqlConnection cn = Database.VEPROMS_SqlConnection)
|
||||
@ -583,7 +599,7 @@ namespace VEPROMS.CSLA.Library
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
if(_MyLog.IsErrorEnabled)_MyLog.Error("RoUsage.DataPortal_Fetch", ex);
|
||||
if (_MyLog.IsErrorEnabled) _MyLog.Error("RoUsage.DataPortal_Fetch", ex);
|
||||
_ErrorMessage = ex.Message;
|
||||
throw new DbCslaException("RoUsage.DataPortal_Fetch", ex);
|
||||
}
|
||||
@ -604,13 +620,13 @@ namespace VEPROMS.CSLA.Library
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
if(_MyLog.IsErrorEnabled)_MyLog.Error("RoUsage.DataPortal_Insert", ex);
|
||||
if (_MyLog.IsErrorEnabled) _MyLog.Error("RoUsage.DataPortal_Insert", ex);
|
||||
_ErrorMessage = ex.Message;
|
||||
throw new DbCslaException("RoUsage.DataPortal_Insert", ex);
|
||||
}
|
||||
finally
|
||||
{
|
||||
if(_MyLog.IsDebugEnabled)_MyLog.DebugFormat("[{0}] RoUsage.DataPortal_Insert", GetHashCode());
|
||||
if (_MyLog.IsDebugEnabled) _MyLog.DebugFormat("[{0}] RoUsage.DataPortal_Insert", GetHashCode());
|
||||
}
|
||||
}
|
||||
[Transactional(TransactionalTypes.TransactionScope)]
|
||||
@ -619,7 +635,7 @@ namespace VEPROMS.CSLA.Library
|
||||
if (!this.IsDirty) return;
|
||||
try
|
||||
{
|
||||
if(_MyContent != null) _MyContent.Update();
|
||||
if (_MyContent != null) _MyContent.Update();
|
||||
SqlConnection cn = (SqlConnection)ApplicationContext.LocalContext["cn"];
|
||||
using (SqlCommand cm = cn.CreateCommand())
|
||||
{
|
||||
@ -646,11 +662,11 @@ namespace VEPROMS.CSLA.Library
|
||||
}
|
||||
MarkOld();
|
||||
// update child objects
|
||||
if(_MyLog.IsDebugEnabled)_MyLog.DebugFormat("[{0}] RoUsage.SQLInsert", GetHashCode());
|
||||
if (_MyLog.IsDebugEnabled) _MyLog.DebugFormat("[{0}] RoUsage.SQLInsert", GetHashCode());
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
if(_MyLog.IsErrorEnabled)_MyLog.Error("RoUsage.SQLInsert", ex);
|
||||
if (_MyLog.IsErrorEnabled) _MyLog.Error("RoUsage.SQLInsert", ex);
|
||||
_ErrorMessage = ex.Message;
|
||||
throw new DbCslaException("RoUsage.SQLInsert", ex);
|
||||
}
|
||||
@ -658,7 +674,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)
|
||||
{
|
||||
if(_MyLog.IsDebugEnabled)_MyLog.DebugFormat("[{0}] RoUsage.Add", 0);
|
||||
if (_MyLog.IsDebugEnabled) _MyLog.DebugFormat("[{0}] RoUsage.Add", 0);
|
||||
try
|
||||
{
|
||||
using (SqlCommand cm = cn.CreateCommand())
|
||||
@ -687,7 +703,7 @@ namespace VEPROMS.CSLA.Library
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
if(_MyLog.IsErrorEnabled)_MyLog.Error("RoUsage.Add", ex);
|
||||
if (_MyLog.IsErrorEnabled) _MyLog.Error("RoUsage.Add", ex);
|
||||
throw new DbCslaException("RoUsage.Add", ex);
|
||||
}
|
||||
}
|
||||
@ -695,7 +711,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}] RoUsage.DataPortal_Update", GetHashCode());
|
||||
if (_MyLog.IsDebugEnabled) _MyLog.DebugFormat("[{0}] RoUsage.DataPortal_Update", GetHashCode());
|
||||
try
|
||||
{
|
||||
using (SqlConnection cn = Database.VEPROMS_SqlConnection)
|
||||
@ -709,7 +725,7 @@ namespace VEPROMS.CSLA.Library
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
if(_MyLog.IsErrorEnabled)_MyLog.Error("RoUsage.DataPortal_Update", ex);
|
||||
if (_MyLog.IsErrorEnabled) _MyLog.Error("RoUsage.DataPortal_Update", ex);
|
||||
_ErrorMessage = ex.Message;
|
||||
if (!ex.Message.EndsWith("has been edited by another user.")) throw ex;
|
||||
}
|
||||
@ -718,10 +734,10 @@ namespace VEPROMS.CSLA.Library
|
||||
internal void SQLUpdate()
|
||||
{
|
||||
if (!IsDirty) return; // If not dirty - nothing to do
|
||||
if(_MyLog.IsDebugEnabled)_MyLog.DebugFormat("[{0}] RoUsage.SQLUpdate", GetHashCode());
|
||||
if (_MyLog.IsDebugEnabled) _MyLog.DebugFormat("[{0}] RoUsage.SQLUpdate", GetHashCode());
|
||||
try
|
||||
{
|
||||
if(_MyContent != null) _MyContent.Update();
|
||||
if (_MyContent != null) _MyContent.Update();
|
||||
SqlConnection cn = (SqlConnection)ApplicationContext.LocalContext["cn"];
|
||||
if (base.IsDirty)
|
||||
{
|
||||
@ -752,7 +768,7 @@ namespace VEPROMS.CSLA.Library
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
if(_MyLog.IsErrorEnabled)_MyLog.Error("RoUsage.SQLUpdate", ex);
|
||||
if (_MyLog.IsErrorEnabled) _MyLog.Error("RoUsage.SQLUpdate", ex);
|
||||
_ErrorMessage = ex.Message;
|
||||
if (!ex.Message.EndsWith("has been edited by another user.")) throw ex;
|
||||
}
|
||||
@ -773,7 +789,7 @@ namespace VEPROMS.CSLA.Library
|
||||
[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)
|
||||
{
|
||||
if(_MyLog.IsDebugEnabled)_MyLog.DebugFormat("[{0}] RoUsage.Update", 0);
|
||||
if (_MyLog.IsDebugEnabled) _MyLog.DebugFormat("[{0}] RoUsage.Update", 0);
|
||||
try
|
||||
{
|
||||
using (SqlCommand cm = cn.CreateCommand())
|
||||
@ -800,7 +816,7 @@ namespace VEPROMS.CSLA.Library
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
if(_MyLog.IsErrorEnabled)_MyLog.Error("RoUsage.Update", ex);
|
||||
if (_MyLog.IsErrorEnabled) _MyLog.Error("RoUsage.Update", ex);
|
||||
throw new DbCslaException("RoUsage.Update", ex);
|
||||
}
|
||||
}
|
||||
@ -812,7 +828,7 @@ namespace VEPROMS.CSLA.Library
|
||||
[Transactional(TransactionalTypes.TransactionScope)]
|
||||
private void DataPortal_Delete(PKCriteria criteria)
|
||||
{
|
||||
if(_MyLog.IsDebugEnabled)_MyLog.DebugFormat("[{0}] RoUsage.DataPortal_Delete", GetHashCode());
|
||||
if (_MyLog.IsDebugEnabled) _MyLog.DebugFormat("[{0}] RoUsage.DataPortal_Delete", GetHashCode());
|
||||
try
|
||||
{
|
||||
using (SqlConnection cn = Database.VEPROMS_SqlConnection)
|
||||
@ -828,7 +844,7 @@ namespace VEPROMS.CSLA.Library
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
if(_MyLog.IsErrorEnabled)_MyLog.Error("RoUsage.DataPortal_Delete", ex);
|
||||
if (_MyLog.IsErrorEnabled) _MyLog.Error("RoUsage.DataPortal_Delete", ex);
|
||||
_ErrorMessage = ex.Message;
|
||||
throw new DbCslaException("RoUsage.DataPortal_Delete", ex);
|
||||
}
|
||||
@ -836,7 +852,7 @@ namespace VEPROMS.CSLA.Library
|
||||
[Transactional(TransactionalTypes.TransactionScope)]
|
||||
public static void Remove(SqlConnection cn, int rOUsageID)
|
||||
{
|
||||
if(_MyLog.IsDebugEnabled)_MyLog.DebugFormat("[{0}] RoUsage.Remove", 0);
|
||||
if (_MyLog.IsDebugEnabled) _MyLog.DebugFormat("[{0}] RoUsage.Remove", 0);
|
||||
try
|
||||
{
|
||||
using (SqlCommand cm = cn.CreateCommand())
|
||||
@ -851,7 +867,7 @@ namespace VEPROMS.CSLA.Library
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
if(_MyLog.IsErrorEnabled)_MyLog.Error("RoUsage.Remove", ex);
|
||||
if (_MyLog.IsErrorEnabled) _MyLog.Error("RoUsage.Remove", ex);
|
||||
throw new DbCslaException("RoUsage.Remove", ex);
|
||||
}
|
||||
}
|
||||
@ -885,7 +901,7 @@ namespace VEPROMS.CSLA.Library
|
||||
}
|
||||
protected override void DataPortal_Execute()
|
||||
{
|
||||
if(_MyLog.IsDebugEnabled)_MyLog.DebugFormat("[{0}] RoUsage.DataPortal_Execute", GetHashCode());
|
||||
if (_MyLog.IsDebugEnabled) _MyLog.DebugFormat("[{0}] RoUsage.DataPortal_Execute", GetHashCode());
|
||||
try
|
||||
{
|
||||
using (SqlConnection cn = Database.VEPROMS_SqlConnection)
|
||||
@ -903,7 +919,7 @@ namespace VEPROMS.CSLA.Library
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
if(_MyLog.IsErrorEnabled)_MyLog.Error("RoUsage.DataPortal_Execute", ex);
|
||||
if (_MyLog.IsErrorEnabled) _MyLog.Error("RoUsage.DataPortal_Execute", ex);
|
||||
throw new DbCslaException("RoUsage.DataPortal_Execute", ex);
|
||||
}
|
||||
}
|
||||
|
@ -37,13 +37,17 @@ namespace VEPROMS.CSLA.Library
|
||||
#endregion
|
||||
#region Collection
|
||||
protected static List<RoUsageInfo> _AllList = new List<RoUsageInfo>();
|
||||
private static Dictionary<string, RoUsageInfo> _AllByPrimaryKey = new Dictionary<string, RoUsageInfo>();
|
||||
private static Dictionary<string, List<RoUsageInfo>> _AllByPrimaryKey = new Dictionary<string, List<RoUsageInfo>>();
|
||||
private static void ConvertListToDictionary()
|
||||
{
|
||||
List<RoUsageInfo> remove = new List<RoUsageInfo>();
|
||||
foreach (RoUsageInfo tmp in _AllList)
|
||||
{
|
||||
_AllByPrimaryKey[tmp.ROUsageID.ToString()]=tmp; // Primary Key
|
||||
if (!_AllByPrimaryKey.ContainsKey(tmp.ROUsageID.ToString()))
|
||||
{
|
||||
_AllByPrimaryKey[tmp.ROUsageID.ToString()] = new List<RoUsageInfo>(); // Add new list for PrimaryKey
|
||||
}
|
||||
_AllByPrimaryKey[tmp.ROUsageID.ToString()].Add(tmp); // Add to Primary Key list
|
||||
remove.Add(tmp);
|
||||
}
|
||||
foreach (RoUsageInfo tmp in remove)
|
||||
@ -57,7 +61,7 @@ namespace VEPROMS.CSLA.Library
|
||||
{
|
||||
ConvertListToDictionary();
|
||||
string key = rOUsageID.ToString();
|
||||
if (_AllByPrimaryKey.ContainsKey(key)) return _AllByPrimaryKey[key];
|
||||
if (_AllByPrimaryKey.ContainsKey(key)) return _AllByPrimaryKey[key][0];
|
||||
return null;
|
||||
}
|
||||
#endregion
|
||||
@ -85,7 +89,7 @@ namespace VEPROMS.CSLA.Library
|
||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||
get
|
||||
{
|
||||
CanReadProperty("ROUsageID",true);
|
||||
CanReadProperty("ROUsageID", true);
|
||||
return _ROUsageID;
|
||||
}
|
||||
}
|
||||
@ -95,7 +99,7 @@ namespace VEPROMS.CSLA.Library
|
||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||
get
|
||||
{
|
||||
CanReadProperty("ContentID",true);
|
||||
CanReadProperty("ContentID", true);
|
||||
if (_MyContent != null) _ContentID = _MyContent.ContentID;
|
||||
return _ContentID;
|
||||
}
|
||||
@ -106,7 +110,7 @@ namespace VEPROMS.CSLA.Library
|
||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||
get
|
||||
{
|
||||
CanReadProperty("MyContent",true);
|
||||
CanReadProperty("MyContent", true);
|
||||
if (_MyContent == null && _ContentID != 0) _MyContent = ContentInfo.Get(_ContentID);
|
||||
return _MyContent;
|
||||
}
|
||||
@ -117,7 +121,7 @@ namespace VEPROMS.CSLA.Library
|
||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||
get
|
||||
{
|
||||
CanReadProperty("ROID",true);
|
||||
CanReadProperty("ROID", true);
|
||||
return _ROID;
|
||||
}
|
||||
}
|
||||
@ -127,7 +131,7 @@ namespace VEPROMS.CSLA.Library
|
||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||
get
|
||||
{
|
||||
CanReadProperty("Config",true);
|
||||
CanReadProperty("Config", true);
|
||||
return _Config;
|
||||
}
|
||||
}
|
||||
@ -137,7 +141,7 @@ namespace VEPROMS.CSLA.Library
|
||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||
get
|
||||
{
|
||||
CanReadProperty("DTS",true);
|
||||
CanReadProperty("DTS", true);
|
||||
return _DTS;
|
||||
}
|
||||
}
|
||||
@ -147,7 +151,7 @@ namespace VEPROMS.CSLA.Library
|
||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||
get
|
||||
{
|
||||
CanReadProperty("UserID",true);
|
||||
CanReadProperty("UserID", true);
|
||||
return _UserID;
|
||||
}
|
||||
}
|
||||
@ -171,14 +175,25 @@ namespace VEPROMS.CSLA.Library
|
||||
}
|
||||
#endregion
|
||||
#region Factory Methods
|
||||
private static int _RoUsageInfoUnique = 0;
|
||||
private int _MyRoUsageInfoUnique;
|
||||
public int MyRoUsageInfoUnique
|
||||
{
|
||||
get { return _MyRoUsageInfoUnique; }
|
||||
}
|
||||
private RoUsageInfo()
|
||||
{/* require use of factory methods */
|
||||
_MyRoUsageInfoUnique = ++_RoUsageInfoUnique;
|
||||
_AllList.Add(this);
|
||||
}
|
||||
public void Dispose()
|
||||
{
|
||||
_AllList.Remove(this);
|
||||
_AllByPrimaryKey.Remove(ROUsageID.ToString());
|
||||
if (!_AllByPrimaryKey.ContainsKey(ROUsageID.ToString())) return;
|
||||
List<RoUsageInfo> listRoUsageInfo = _AllByPrimaryKey[ROUsageID.ToString()]; // Get the list of items
|
||||
listRoUsageInfo.Remove(this); // Remove the item from the list
|
||||
if (listRoUsageInfo.Count == 0) // If there are no items left in the list
|
||||
_AllByPrimaryKey.Remove(ROUsageID.ToString()); // remove the list
|
||||
}
|
||||
public virtual RoUsage Get()
|
||||
{
|
||||
@ -186,8 +201,10 @@ namespace VEPROMS.CSLA.Library
|
||||
}
|
||||
public static void Refresh(RoUsage tmp)
|
||||
{
|
||||
RoUsageInfo tmpInfo = GetExistingByPrimaryKey(tmp.ROUsageID);
|
||||
if (tmpInfo == null) return;
|
||||
string key = tmp.ROUsageID.ToString();
|
||||
ConvertListToDictionary();
|
||||
if (_AllByPrimaryKey.ContainsKey(key))
|
||||
foreach (RoUsageInfo tmpInfo in _AllByPrimaryKey[key])
|
||||
tmpInfo.RefreshFields(tmp);
|
||||
}
|
||||
private void RefreshFields(RoUsage tmp)
|
||||
@ -196,9 +213,9 @@ namespace VEPROMS.CSLA.Library
|
||||
{
|
||||
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
|
||||
MyContent.RefreshContentRoUsages(); // Update List for new 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;
|
||||
@ -209,8 +226,10 @@ namespace VEPROMS.CSLA.Library
|
||||
}
|
||||
public static void Refresh(ContentRoUsage tmp)
|
||||
{
|
||||
RoUsageInfo tmpInfo = GetExistingByPrimaryKey(tmp.ROUsageID);
|
||||
if (tmpInfo == null) return;
|
||||
string key = tmp.ROUsageID.ToString();
|
||||
ConvertListToDictionary();
|
||||
if (_AllByPrimaryKey.ContainsKey(key))
|
||||
foreach (RoUsageInfo tmpInfo in _AllByPrimaryKey[key])
|
||||
tmpInfo.RefreshFields(tmp);
|
||||
}
|
||||
private void RefreshFields(ContentRoUsage tmp)
|
||||
@ -233,7 +252,7 @@ namespace VEPROMS.CSLA.Library
|
||||
if (tmp == null)
|
||||
{
|
||||
tmp = DataPortal.Fetch<RoUsageInfo>(new PKCriteria(rOUsageID));
|
||||
_AllList.Add(tmp);
|
||||
if (!_AllList.Contains(tmp)) _AllList.Add(tmp);
|
||||
}
|
||||
if (tmp.ErrorMessage == "No Record Found") tmp = null;
|
||||
return tmp;
|
||||
@ -247,14 +266,15 @@ namespace VEPROMS.CSLA.Library
|
||||
#region Data Access Portal
|
||||
internal RoUsageInfo(SafeDataReader dr)
|
||||
{
|
||||
if(_MyLog.IsDebugEnabled)_MyLog.DebugFormat("[{0}] RoUsageInfo.Constructor", GetHashCode());
|
||||
_MyRoUsageInfoUnique = ++_RoUsageInfoUnique;
|
||||
if (_MyLog.IsDebugEnabled) _MyLog.DebugFormat("[{0}] RoUsageInfo.Constructor", GetHashCode());
|
||||
try
|
||||
{
|
||||
ReadData(dr);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
if(_MyLog.IsErrorEnabled)_MyLog.Error("RoUsageInfo.Constructor", ex);
|
||||
if (_MyLog.IsErrorEnabled) _MyLog.Error("RoUsageInfo.Constructor", ex);
|
||||
throw new DbCslaException("RoUsageInfo.Constructor", ex);
|
||||
}
|
||||
}
|
||||
@ -271,7 +291,7 @@ namespace VEPROMS.CSLA.Library
|
||||
}
|
||||
private void ReadData(SafeDataReader dr)
|
||||
{
|
||||
if(_MyLog.IsDebugEnabled)_MyLog.DebugFormat("[{0}] RoUsageInfo.ReadData", GetHashCode());
|
||||
if (_MyLog.IsDebugEnabled) _MyLog.DebugFormat("[{0}] RoUsageInfo.ReadData", GetHashCode());
|
||||
try
|
||||
{
|
||||
_ROUsageID = dr.GetInt32("ROUsageID");
|
||||
@ -283,14 +303,14 @@ namespace VEPROMS.CSLA.Library
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
if(_MyLog.IsErrorEnabled)_MyLog.Error("RoUsageInfo.ReadData", ex);
|
||||
if (_MyLog.IsErrorEnabled) _MyLog.Error("RoUsageInfo.ReadData", ex);
|
||||
_ErrorMessage = ex.Message;
|
||||
throw new DbCslaException("RoUsageInfo.ReadData", ex);
|
||||
}
|
||||
}
|
||||
private void DataPortal_Fetch(PKCriteria criteria)
|
||||
{
|
||||
if(_MyLog.IsDebugEnabled)_MyLog.DebugFormat("[{0}] RoUsageInfo.DataPortal_Fetch", GetHashCode());
|
||||
if (_MyLog.IsDebugEnabled) _MyLog.DebugFormat("[{0}] RoUsageInfo.DataPortal_Fetch", GetHashCode());
|
||||
try
|
||||
{
|
||||
using (SqlConnection cn = Database.VEPROMS_SqlConnection)
|
||||
@ -318,7 +338,7 @@ namespace VEPROMS.CSLA.Library
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
if(_MyLog.IsErrorEnabled)_MyLog.Error("RoUsageInfo.DataPortal_Fetch", ex);
|
||||
if (_MyLog.IsErrorEnabled) _MyLog.Error("RoUsageInfo.DataPortal_Fetch", ex);
|
||||
_ErrorMessage = ex.Message;
|
||||
throw new DbCslaException("RoUsageInfo.DataPortal_Fetch", ex);
|
||||
}
|
||||
@ -328,7 +348,7 @@ namespace VEPROMS.CSLA.Library
|
||||
#region extension
|
||||
RoUsageInfoExtension _RoUsageInfoExtension = new RoUsageInfoExtension();
|
||||
[Serializable()]
|
||||
partial class RoUsageInfoExtension : extensionBase {}
|
||||
partial class RoUsageInfoExtension : extensionBase { }
|
||||
[Serializable()]
|
||||
class extensionBase
|
||||
{
|
||||
|
@ -110,7 +110,7 @@ namespace VEPROMS.CSLA.Library
|
||||
private void DataPortal_Fetch()
|
||||
{
|
||||
this.RaiseListChangedEvents = false;
|
||||
if(_MyLog.IsDebugEnabled)_MyLog.DebugFormat("[{0}] RoUsageInfoList.DataPortal_Fetch", GetHashCode());
|
||||
if (_MyLog.IsDebugEnabled) _MyLog.DebugFormat("[{0}] RoUsageInfoList.DataPortal_Fetch", GetHashCode());
|
||||
try
|
||||
{
|
||||
using (SqlConnection cn = Database.VEPROMS_SqlConnection)
|
||||
@ -130,7 +130,7 @@ namespace VEPROMS.CSLA.Library
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
if(_MyLog.IsErrorEnabled)_MyLog.Error("RoUsageInfoList.DataPortal_Fetch", ex);
|
||||
if (_MyLog.IsErrorEnabled) _MyLog.Error("RoUsageInfoList.DataPortal_Fetch", ex);
|
||||
throw new DbCslaException("RoUsageInfoList.DataPortal_Fetch", ex);
|
||||
}
|
||||
this.RaiseListChangedEvents = true;
|
||||
@ -152,7 +152,7 @@ namespace VEPROMS.CSLA.Library
|
||||
private void DataPortal_Fetch(ContentIDCriteria criteria)
|
||||
{
|
||||
this.RaiseListChangedEvents = false;
|
||||
if(_MyLog.IsDebugEnabled)_MyLog.DebugFormat("[{0}] RoUsageInfoList.DataPortal_FetchContentID", GetHashCode());
|
||||
if (_MyLog.IsDebugEnabled) _MyLog.DebugFormat("[{0}] RoUsageInfoList.DataPortal_FetchContentID", GetHashCode());
|
||||
try
|
||||
{
|
||||
using (SqlConnection cn = Database.VEPROMS_SqlConnection)
|
||||
@ -173,7 +173,7 @@ namespace VEPROMS.CSLA.Library
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
if(_MyLog.IsErrorEnabled)_MyLog.Error("RoUsageInfoList.DataPortal_FetchContentID", ex);
|
||||
if (_MyLog.IsErrorEnabled) _MyLog.Error("RoUsageInfoList.DataPortal_FetchContentID", ex);
|
||||
throw new DbCslaException("RoUsageInfoList.DataPortal_Fetch", ex);
|
||||
}
|
||||
this.RaiseListChangedEvents = true;
|
||||
@ -234,8 +234,8 @@ namespace VEPROMS.CSLA.Library
|
||||
/// </summary>
|
||||
public partial class RoUsageInfoListPropertyDescriptor : vlnListPropertyDescriptor
|
||||
{
|
||||
private RoUsageInfo Item { get { return (RoUsageInfo) _Item;} }
|
||||
public RoUsageInfoListPropertyDescriptor(RoUsageInfoList collection, int index):base(collection, index){;}
|
||||
private RoUsageInfo Item { get { return (RoUsageInfo)_Item; } }
|
||||
public RoUsageInfoListPropertyDescriptor(RoUsageInfoList collection, int index) : base(collection, index) { ;}
|
||||
}
|
||||
#endregion
|
||||
#region Converter
|
||||
@ -246,7 +246,7 @@ namespace VEPROMS.CSLA.Library
|
||||
if (destType == typeof(string) && value is RoUsageInfoList)
|
||||
{
|
||||
// Return department and department role separated by comma.
|
||||
return ((RoUsageInfoList) value).Items.Count.ToString() + " RoUsages";
|
||||
return ((RoUsageInfoList)value).Items.Count.ToString() + " RoUsages";
|
||||
}
|
||||
return base.ConvertTo(context, culture, value, destType);
|
||||
}
|
||||
|
@ -42,14 +42,14 @@ namespace VEPROMS.CSLA.Library
|
||||
{
|
||||
foreach (RoleAssignment tmp in _RoleAssignments)
|
||||
{
|
||||
if(tmp.IsDirty)refreshRoleAssignments.Add(tmp);
|
||||
if (tmp.IsDirty) refreshRoleAssignments.Add(tmp);
|
||||
}
|
||||
}
|
||||
if (_RolePermissions != null && _RolePermissions.IsDirty)
|
||||
{
|
||||
foreach (RolePermission tmp in _RolePermissions)
|
||||
{
|
||||
if(tmp.IsDirty)refreshRolePermissions.Add(tmp);
|
||||
if (tmp.IsDirty) refreshRolePermissions.Add(tmp);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -78,15 +78,20 @@ namespace VEPROMS.CSLA.Library
|
||||
#endregion
|
||||
#region Collection
|
||||
protected static List<Role> _AllList = new List<Role>();
|
||||
private static Dictionary<string, Role> _AllByPrimaryKey = new Dictionary<string, Role>();
|
||||
private static Dictionary<string, Role> _AllByName = new Dictionary<string, Role>();
|
||||
private static Dictionary<string, List<Role>> _AllByPrimaryKey = new Dictionary<string, List<Role>>();
|
||||
private static Dictionary<string, List<Role>> _AllByName = new Dictionary<string, List<Role>>();
|
||||
private static void ConvertListToDictionary()
|
||||
{
|
||||
List<Role> remove = new List<Role>();
|
||||
foreach (Role tmp in _AllList)
|
||||
{
|
||||
_AllByPrimaryKey[tmp.RID.ToString()]=tmp; // Primary Key
|
||||
_AllByName[tmp.Name.ToString()] = tmp; // Unique Index
|
||||
if (!_AllByPrimaryKey.ContainsKey(tmp.RID.ToString()))
|
||||
{
|
||||
_AllByPrimaryKey[tmp.RID.ToString()] = new List<Role>(); // Add new list for PrimaryKey
|
||||
_AllByName[tmp.Name.ToString()] = new List<Role>(); // Add new list for Name
|
||||
}
|
||||
_AllByPrimaryKey[tmp.RID.ToString()].Add(tmp); // Add to Primary Key list
|
||||
_AllByName[tmp.Name.ToString()].Add(tmp); // Unique Index
|
||||
remove.Add(tmp);
|
||||
}
|
||||
foreach (Role tmp in remove)
|
||||
@ -96,14 +101,14 @@ namespace VEPROMS.CSLA.Library
|
||||
{
|
||||
ConvertListToDictionary();
|
||||
string key = rid.ToString();
|
||||
if (_AllByPrimaryKey.ContainsKey(key)) return _AllByPrimaryKey[key];
|
||||
if (_AllByPrimaryKey.ContainsKey(key)) return _AllByPrimaryKey[key][0];
|
||||
return null;
|
||||
}
|
||||
public static Role GetExistingByName(string name)
|
||||
{
|
||||
ConvertListToDictionary();
|
||||
string key = name.ToString();
|
||||
if (_AllByName.ContainsKey(key)) return _AllByName[key];
|
||||
if (_AllByName.ContainsKey(key)) return _AllByName[key][0];
|
||||
return null;
|
||||
}
|
||||
#endregion
|
||||
@ -125,7 +130,7 @@ namespace VEPROMS.CSLA.Library
|
||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||
get
|
||||
{
|
||||
CanReadProperty("RID",true);
|
||||
CanReadProperty("RID", true);
|
||||
return _RID;
|
||||
}
|
||||
}
|
||||
@ -135,13 +140,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)
|
||||
{
|
||||
@ -156,13 +161,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)
|
||||
{
|
||||
@ -177,13 +182,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;
|
||||
@ -197,13 +202,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)
|
||||
{
|
||||
@ -222,7 +227,7 @@ namespace VEPROMS.CSLA.Library
|
||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||
get
|
||||
{
|
||||
CanReadProperty("RoleAssignmentCount",true);
|
||||
CanReadProperty("RoleAssignmentCount", true);
|
||||
return _RoleAssignmentCount;
|
||||
}
|
||||
}
|
||||
@ -236,10 +241,10 @@ namespace VEPROMS.CSLA.Library
|
||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||
get
|
||||
{
|
||||
CanReadProperty("RoleAssignments",true);
|
||||
if(_RoleAssignmentCount > 0 && _RoleAssignments == null)
|
||||
CanReadProperty("RoleAssignments", true);
|
||||
if (_RoleAssignmentCount > 0 && _RoleAssignments == null)
|
||||
_RoleAssignments = RoleAssignments.GetByRID(RID);
|
||||
else if(_RoleAssignments == null)
|
||||
else if (_RoleAssignments == null)
|
||||
_RoleAssignments = RoleAssignments.New();
|
||||
return _RoleAssignments;
|
||||
}
|
||||
@ -253,7 +258,7 @@ namespace VEPROMS.CSLA.Library
|
||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||
get
|
||||
{
|
||||
CanReadProperty("RolePermissionCount",true);
|
||||
CanReadProperty("RolePermissionCount", true);
|
||||
return _RolePermissionCount;
|
||||
}
|
||||
}
|
||||
@ -267,21 +272,21 @@ namespace VEPROMS.CSLA.Library
|
||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||
get
|
||||
{
|
||||
CanReadProperty("RolePermissions",true);
|
||||
if(_RolePermissionCount > 0 && _RolePermissions == null)
|
||||
CanReadProperty("RolePermissions", true);
|
||||
if (_RolePermissionCount > 0 && _RolePermissions == null)
|
||||
_RolePermissions = RolePermissions.GetByRID(RID);
|
||||
else if(_RolePermissions == null)
|
||||
else if (_RolePermissions == null)
|
||||
_RolePermissions = RolePermissions.New();
|
||||
return _RolePermissions;
|
||||
}
|
||||
}
|
||||
public override bool IsDirty
|
||||
{
|
||||
get { return base.IsDirty || (_RoleAssignments == null? false : _RoleAssignments.IsDirty) || (_RolePermissions == null? false : _RolePermissions.IsDirty); }
|
||||
get { return base.IsDirty || (_RoleAssignments == null ? false : _RoleAssignments.IsDirty) || (_RolePermissions == null ? false : _RolePermissions.IsDirty); }
|
||||
}
|
||||
public override bool IsValid
|
||||
{
|
||||
get { return (IsNew && !IsDirty ? true : base.IsValid) && (_RoleAssignments == null? true : _RoleAssignments.IsValid) && (_RolePermissions == null? true : _RolePermissions.IsValid); }
|
||||
get { return (IsNew && !IsDirty ? true : base.IsValid) && (_RoleAssignments == null ? true : _RoleAssignments.IsValid) && (_RolePermissions == null ? true : _RolePermissions.IsValid); }
|
||||
}
|
||||
// TODO: Replace base Role.ToString function as necessary
|
||||
/// <summary>
|
||||
@ -304,15 +309,16 @@ 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 (_RoleAssignments != null && (hasBrokenRules = _RoleAssignments.HasBrokenRules) != null) return hasBrokenRules;
|
||||
if (_RolePermissions != null && (hasBrokenRules = _RolePermissions.HasBrokenRules) != null) return hasBrokenRules;
|
||||
@ -320,7 +326,7 @@ namespace VEPROMS.CSLA.Library
|
||||
}
|
||||
finally
|
||||
{
|
||||
_CheckingBrokenRules=false;
|
||||
_CheckingBrokenRules = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -435,15 +441,29 @@ namespace VEPROMS.CSLA.Library
|
||||
#region Factory Methods
|
||||
public int CurrentEditLevel
|
||||
{ get { return EditLevel; } }
|
||||
private static int _RoleUnique = 0;
|
||||
private int _MyRoleUnique;
|
||||
public int MyRoleUnique
|
||||
{
|
||||
get { return _MyRoleUnique; }
|
||||
}
|
||||
protected Role()
|
||||
{/* require use of factory methods */
|
||||
_MyRoleUnique = ++_RoleUnique;
|
||||
_AllList.Add(this);
|
||||
}
|
||||
public void Dispose()
|
||||
{
|
||||
_AllList.Remove(this);
|
||||
_AllByPrimaryKey.Remove(RID.ToString());
|
||||
_AllByName.Remove(Name.ToString());
|
||||
if (!_AllByPrimaryKey.ContainsKey(RID.ToString())) return;
|
||||
List<Role> listRole = _AllByPrimaryKey[RID.ToString()]; // Get the list of items
|
||||
listRole.Remove(this); // Remove the item from the list
|
||||
if (listRole.Count == 0) //If there are no items left in the list
|
||||
_AllByPrimaryKey.Remove(RID.ToString()); // remove the list
|
||||
listRole = _AllByName[RID.ToString()]; // Get the list of items
|
||||
listRole.Remove(this); // Remove the item from the list
|
||||
if (listRole.Count == 0) //If there are no items left in the list
|
||||
_AllByName.Remove(RID.ToString()); // remove the list
|
||||
}
|
||||
public static Role New()
|
||||
{
|
||||
@ -500,7 +520,7 @@ namespace VEPROMS.CSLA.Library
|
||||
if (tmp == null)
|
||||
{
|
||||
tmp = DataPortal.Fetch<Role>(new PKCriteria(rid));
|
||||
_AllList.Add(tmp);
|
||||
if (!_AllList.Contains(tmp)) _AllList.Add(tmp);
|
||||
}
|
||||
if (tmp.ErrorMessage == "No Record Found") tmp = null;
|
||||
return tmp;
|
||||
@ -519,8 +539,8 @@ namespace VEPROMS.CSLA.Library
|
||||
Role tmp = GetExistingByName(name);
|
||||
if (tmp == null)
|
||||
{
|
||||
tmp=DataPortal.Fetch<Role>(new NameCriteria(name));
|
||||
_AllList.Add(tmp);
|
||||
tmp = DataPortal.Fetch<Role>(new NameCriteria(name));
|
||||
if (!_AllList.Contains(tmp)) _AllList.Add(tmp);
|
||||
}
|
||||
if (tmp.ErrorMessage == "No Record Found") tmp = null;
|
||||
return tmp;
|
||||
@ -610,7 +630,7 @@ namespace VEPROMS.CSLA.Library
|
||||
}
|
||||
private void ReadData(SafeDataReader dr)
|
||||
{
|
||||
if(_MyLog.IsDebugEnabled)_MyLog.DebugFormat("[{0}] Role.ReadData", GetHashCode());
|
||||
if (_MyLog.IsDebugEnabled) _MyLog.DebugFormat("[{0}] Role.ReadData", GetHashCode());
|
||||
try
|
||||
{
|
||||
_RID = dr.GetInt32("RID");
|
||||
@ -625,14 +645,14 @@ namespace VEPROMS.CSLA.Library
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
if(_MyLog.IsErrorEnabled)_MyLog.Error("Role.ReadData", ex);
|
||||
if (_MyLog.IsErrorEnabled) _MyLog.Error("Role.ReadData", ex);
|
||||
_ErrorMessage = ex.Message;
|
||||
throw new DbCslaException("Role.ReadData", ex);
|
||||
}
|
||||
}
|
||||
private void DataPortal_Fetch(PKCriteria criteria)
|
||||
{
|
||||
if(_MyLog.IsDebugEnabled)_MyLog.DebugFormat("[{0}] Role.DataPortal_Fetch", GetHashCode());
|
||||
if (_MyLog.IsDebugEnabled) _MyLog.DebugFormat("[{0}] Role.DataPortal_Fetch", GetHashCode());
|
||||
try
|
||||
{
|
||||
using (SqlConnection cn = Database.VEPROMS_SqlConnection)
|
||||
@ -666,14 +686,14 @@ namespace VEPROMS.CSLA.Library
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
if(_MyLog.IsErrorEnabled)_MyLog.Error("Role.DataPortal_Fetch", ex);
|
||||
if (_MyLog.IsErrorEnabled) _MyLog.Error("Role.DataPortal_Fetch", ex);
|
||||
_ErrorMessage = ex.Message;
|
||||
throw new DbCslaException("Role.DataPortal_Fetch", ex);
|
||||
}
|
||||
}
|
||||
private void DataPortal_Fetch(NameCriteria criteria)
|
||||
{
|
||||
if(_MyLog.IsDebugEnabled)_MyLog.DebugFormat("[{0}] Role.DataPortal_Fetch", GetHashCode());
|
||||
if (_MyLog.IsDebugEnabled) _MyLog.DebugFormat("[{0}] Role.DataPortal_Fetch", GetHashCode());
|
||||
try
|
||||
{
|
||||
using (SqlConnection cn = Database.VEPROMS_SqlConnection)
|
||||
@ -701,7 +721,7 @@ namespace VEPROMS.CSLA.Library
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
if(_MyLog.IsErrorEnabled)_MyLog.Error("Role.DataPortal_Fetch", ex);
|
||||
if (_MyLog.IsErrorEnabled) _MyLog.Error("Role.DataPortal_Fetch", ex);
|
||||
_ErrorMessage = ex.Message;
|
||||
throw new DbCslaException("Role.DataPortal_Fetch", ex);
|
||||
}
|
||||
@ -722,13 +742,13 @@ namespace VEPROMS.CSLA.Library
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
if(_MyLog.IsErrorEnabled)_MyLog.Error("Role.DataPortal_Insert", ex);
|
||||
if (_MyLog.IsErrorEnabled) _MyLog.Error("Role.DataPortal_Insert", ex);
|
||||
_ErrorMessage = ex.Message;
|
||||
throw new DbCslaException("Role.DataPortal_Insert", ex);
|
||||
}
|
||||
finally
|
||||
{
|
||||
if(_MyLog.IsDebugEnabled)_MyLog.DebugFormat("[{0}] Role.DataPortal_Insert", GetHashCode());
|
||||
if (_MyLog.IsDebugEnabled) _MyLog.DebugFormat("[{0}] Role.DataPortal_Insert", GetHashCode());
|
||||
}
|
||||
}
|
||||
[Transactional(TransactionalTypes.TransactionScope)]
|
||||
@ -764,11 +784,11 @@ namespace VEPROMS.CSLA.Library
|
||||
// update child objects
|
||||
if (_RoleAssignments != null) _RoleAssignments.Update(this);
|
||||
if (_RolePermissions != null) _RolePermissions.Update(this);
|
||||
if(_MyLog.IsDebugEnabled)_MyLog.DebugFormat("[{0}] Role.SQLInsert", GetHashCode());
|
||||
if (_MyLog.IsDebugEnabled) _MyLog.DebugFormat("[{0}] Role.SQLInsert", GetHashCode());
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
if(_MyLog.IsErrorEnabled)_MyLog.Error("Role.SQLInsert", ex);
|
||||
if (_MyLog.IsErrorEnabled) _MyLog.Error("Role.SQLInsert", ex);
|
||||
_ErrorMessage = ex.Message;
|
||||
throw new DbCslaException("Role.SQLInsert", ex);
|
||||
}
|
||||
@ -776,7 +796,7 @@ namespace VEPROMS.CSLA.Library
|
||||
[Transactional(TransactionalTypes.TransactionScope)]
|
||||
public static byte[] Add(SqlConnection cn, ref int rid, string name, string title, DateTime dts, string usrID)
|
||||
{
|
||||
if(_MyLog.IsDebugEnabled)_MyLog.DebugFormat("[{0}] Role.Add", 0);
|
||||
if (_MyLog.IsDebugEnabled) _MyLog.DebugFormat("[{0}] Role.Add", 0);
|
||||
try
|
||||
{
|
||||
using (SqlCommand cm = cn.CreateCommand())
|
||||
@ -804,7 +824,7 @@ namespace VEPROMS.CSLA.Library
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
if(_MyLog.IsErrorEnabled)_MyLog.Error("Role.Add", ex);
|
||||
if (_MyLog.IsErrorEnabled) _MyLog.Error("Role.Add", ex);
|
||||
throw new DbCslaException("Role.Add", ex);
|
||||
}
|
||||
}
|
||||
@ -812,7 +832,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}] Role.DataPortal_Update", GetHashCode());
|
||||
if (_MyLog.IsDebugEnabled) _MyLog.DebugFormat("[{0}] Role.DataPortal_Update", GetHashCode());
|
||||
try
|
||||
{
|
||||
using (SqlConnection cn = Database.VEPROMS_SqlConnection)
|
||||
@ -826,7 +846,7 @@ namespace VEPROMS.CSLA.Library
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
if(_MyLog.IsErrorEnabled)_MyLog.Error("Role.DataPortal_Update", ex);
|
||||
if (_MyLog.IsErrorEnabled) _MyLog.Error("Role.DataPortal_Update", ex);
|
||||
_ErrorMessage = ex.Message;
|
||||
if (!ex.Message.EndsWith("has been edited by another user.")) throw ex;
|
||||
}
|
||||
@ -835,7 +855,7 @@ namespace VEPROMS.CSLA.Library
|
||||
internal void SQLUpdate()
|
||||
{
|
||||
if (!IsDirty) return; // If not dirty - nothing to do
|
||||
if(_MyLog.IsDebugEnabled)_MyLog.DebugFormat("[{0}] Role.SQLUpdate", GetHashCode());
|
||||
if (_MyLog.IsDebugEnabled) _MyLog.DebugFormat("[{0}] Role.SQLUpdate", GetHashCode());
|
||||
try
|
||||
{
|
||||
SqlConnection cn = (SqlConnection)ApplicationContext.LocalContext["cn"];
|
||||
@ -869,7 +889,7 @@ namespace VEPROMS.CSLA.Library
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
if(_MyLog.IsErrorEnabled)_MyLog.Error("Role.SQLUpdate", ex);
|
||||
if (_MyLog.IsErrorEnabled) _MyLog.Error("Role.SQLUpdate", ex);
|
||||
_ErrorMessage = ex.Message;
|
||||
if (!ex.Message.EndsWith("has been edited by another user.")) throw ex;
|
||||
}
|
||||
@ -892,7 +912,7 @@ namespace VEPROMS.CSLA.Library
|
||||
[Transactional(TransactionalTypes.TransactionScope)]
|
||||
public static byte[] Update(SqlConnection cn, ref int rid, string name, string title, DateTime dts, string usrID, ref byte[] lastChanged)
|
||||
{
|
||||
if(_MyLog.IsDebugEnabled)_MyLog.DebugFormat("[{0}] Role.Update", 0);
|
||||
if (_MyLog.IsDebugEnabled) _MyLog.DebugFormat("[{0}] Role.Update", 0);
|
||||
try
|
||||
{
|
||||
using (SqlCommand cm = cn.CreateCommand())
|
||||
@ -918,7 +938,7 @@ namespace VEPROMS.CSLA.Library
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
if(_MyLog.IsErrorEnabled)_MyLog.Error("Role.Update", ex);
|
||||
if (_MyLog.IsErrorEnabled) _MyLog.Error("Role.Update", ex);
|
||||
throw new DbCslaException("Role.Update", ex);
|
||||
}
|
||||
}
|
||||
@ -930,7 +950,7 @@ namespace VEPROMS.CSLA.Library
|
||||
[Transactional(TransactionalTypes.TransactionScope)]
|
||||
private void DataPortal_Delete(PKCriteria criteria)
|
||||
{
|
||||
if(_MyLog.IsDebugEnabled)_MyLog.DebugFormat("[{0}] Role.DataPortal_Delete", GetHashCode());
|
||||
if (_MyLog.IsDebugEnabled) _MyLog.DebugFormat("[{0}] Role.DataPortal_Delete", GetHashCode());
|
||||
try
|
||||
{
|
||||
using (SqlConnection cn = Database.VEPROMS_SqlConnection)
|
||||
@ -946,7 +966,7 @@ namespace VEPROMS.CSLA.Library
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
if(_MyLog.IsErrorEnabled)_MyLog.Error("Role.DataPortal_Delete", ex);
|
||||
if (_MyLog.IsErrorEnabled) _MyLog.Error("Role.DataPortal_Delete", ex);
|
||||
_ErrorMessage = ex.Message;
|
||||
throw new DbCslaException("Role.DataPortal_Delete", ex);
|
||||
}
|
||||
@ -954,7 +974,7 @@ namespace VEPROMS.CSLA.Library
|
||||
[Transactional(TransactionalTypes.TransactionScope)]
|
||||
public static void Remove(SqlConnection cn, int rid)
|
||||
{
|
||||
if(_MyLog.IsDebugEnabled)_MyLog.DebugFormat("[{0}] Role.Remove", 0);
|
||||
if (_MyLog.IsDebugEnabled) _MyLog.DebugFormat("[{0}] Role.Remove", 0);
|
||||
try
|
||||
{
|
||||
using (SqlCommand cm = cn.CreateCommand())
|
||||
@ -969,7 +989,7 @@ namespace VEPROMS.CSLA.Library
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
if(_MyLog.IsErrorEnabled)_MyLog.Error("Role.Remove", ex);
|
||||
if (_MyLog.IsErrorEnabled) _MyLog.Error("Role.Remove", ex);
|
||||
throw new DbCslaException("Role.Remove", ex);
|
||||
}
|
||||
}
|
||||
@ -1003,7 +1023,7 @@ namespace VEPROMS.CSLA.Library
|
||||
}
|
||||
protected override void DataPortal_Execute()
|
||||
{
|
||||
if(_MyLog.IsDebugEnabled)_MyLog.DebugFormat("[{0}] Role.DataPortal_Execute", GetHashCode());
|
||||
if (_MyLog.IsDebugEnabled) _MyLog.DebugFormat("[{0}] Role.DataPortal_Execute", GetHashCode());
|
||||
try
|
||||
{
|
||||
using (SqlConnection cn = Database.VEPROMS_SqlConnection)
|
||||
@ -1021,7 +1041,7 @@ namespace VEPROMS.CSLA.Library
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
if(_MyLog.IsErrorEnabled)_MyLog.Error("Role.DataPortal_Execute", ex);
|
||||
if (_MyLog.IsErrorEnabled) _MyLog.Error("Role.DataPortal_Execute", ex);
|
||||
throw new DbCslaException("Role.DataPortal_Execute", ex);
|
||||
}
|
||||
}
|
||||
|
@ -42,7 +42,7 @@ namespace VEPROMS.CSLA.Library
|
||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||
get
|
||||
{
|
||||
CanReadProperty("AID",true);
|
||||
CanReadProperty("AID", true);
|
||||
if (_MyAssignment != null) _AID = _MyAssignment.AID;
|
||||
return _AID;
|
||||
}
|
||||
@ -54,7 +54,7 @@ namespace VEPROMS.CSLA.Library
|
||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||
get
|
||||
{
|
||||
CanReadProperty("MyAssignment",true);
|
||||
CanReadProperty("MyAssignment", true);
|
||||
if (_MyAssignment == null && _AID != 0) _MyAssignment = Assignment.Get(_AID);
|
||||
return _MyAssignment;
|
||||
}
|
||||
@ -65,7 +65,7 @@ namespace VEPROMS.CSLA.Library
|
||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||
get
|
||||
{
|
||||
CanReadProperty("GID",true);
|
||||
CanReadProperty("GID", true);
|
||||
if (_MyGroup != null) _GID = _MyGroup.GID;
|
||||
return _GID;
|
||||
}
|
||||
@ -76,14 +76,14 @@ namespace VEPROMS.CSLA.Library
|
||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||
get
|
||||
{
|
||||
CanReadProperty("MyGroup",true);
|
||||
CanReadProperty("MyGroup", true);
|
||||
if (_MyGroup == null && _GID != 0) _MyGroup = Group.Get(_GID);
|
||||
return _MyGroup;
|
||||
}
|
||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||
set
|
||||
{
|
||||
CanWriteProperty("MyGroup",true);
|
||||
CanWriteProperty("MyGroup", true);
|
||||
if (_MyGroup != value)
|
||||
{
|
||||
_MyGroup = value;
|
||||
@ -97,7 +97,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;
|
||||
}
|
||||
@ -108,14 +108,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;
|
||||
@ -129,13 +129,13 @@ namespace VEPROMS.CSLA.Library
|
||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||
get
|
||||
{
|
||||
CanReadProperty("StartDate",true);
|
||||
CanReadProperty("StartDate", true);
|
||||
return _StartDate;
|
||||
}
|
||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||
set
|
||||
{
|
||||
CanWriteProperty("StartDate",true);
|
||||
CanWriteProperty("StartDate", true);
|
||||
if (value == null) value = string.Empty;
|
||||
_StartDate = value;
|
||||
try
|
||||
@ -159,13 +159,13 @@ namespace VEPROMS.CSLA.Library
|
||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||
get
|
||||
{
|
||||
CanReadProperty("EndDate",true);
|
||||
CanReadProperty("EndDate", true);
|
||||
return _EndDate;
|
||||
}
|
||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||
set
|
||||
{
|
||||
CanWriteProperty("EndDate",true);
|
||||
CanWriteProperty("EndDate", true);
|
||||
if (value == null) value = string.Empty;
|
||||
_EndDate = value;
|
||||
try
|
||||
@ -189,13 +189,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;
|
||||
@ -209,13 +209,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)
|
||||
{
|
||||
@ -231,7 +231,7 @@ namespace VEPROMS.CSLA.Library
|
||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||
get
|
||||
{
|
||||
CanReadProperty("Folder_ParentID",true);
|
||||
CanReadProperty("Folder_ParentID", true);
|
||||
return _Folder_ParentID;
|
||||
}
|
||||
}
|
||||
@ -241,7 +241,7 @@ namespace VEPROMS.CSLA.Library
|
||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||
get
|
||||
{
|
||||
CanReadProperty("Folder_DBID",true);
|
||||
CanReadProperty("Folder_DBID", true);
|
||||
return _Folder_DBID;
|
||||
}
|
||||
}
|
||||
@ -251,7 +251,7 @@ namespace VEPROMS.CSLA.Library
|
||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||
get
|
||||
{
|
||||
CanReadProperty("Folder_Name",true);
|
||||
CanReadProperty("Folder_Name", true);
|
||||
return _Folder_Name;
|
||||
}
|
||||
}
|
||||
@ -261,7 +261,7 @@ namespace VEPROMS.CSLA.Library
|
||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||
get
|
||||
{
|
||||
CanReadProperty("Folder_Title",true);
|
||||
CanReadProperty("Folder_Title", true);
|
||||
return _Folder_Title;
|
||||
}
|
||||
}
|
||||
@ -271,7 +271,7 @@ namespace VEPROMS.CSLA.Library
|
||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||
get
|
||||
{
|
||||
CanReadProperty("Folder_ShortName",true);
|
||||
CanReadProperty("Folder_ShortName", true);
|
||||
return _Folder_ShortName;
|
||||
}
|
||||
}
|
||||
@ -281,7 +281,7 @@ namespace VEPROMS.CSLA.Library
|
||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||
get
|
||||
{
|
||||
CanReadProperty("Folder_FormatID",true);
|
||||
CanReadProperty("Folder_FormatID", true);
|
||||
return _Folder_FormatID;
|
||||
}
|
||||
}
|
||||
@ -291,7 +291,7 @@ namespace VEPROMS.CSLA.Library
|
||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||
get
|
||||
{
|
||||
CanReadProperty("Folder_Config",true);
|
||||
CanReadProperty("Folder_Config", true);
|
||||
return _Folder_Config;
|
||||
}
|
||||
}
|
||||
@ -301,7 +301,7 @@ namespace VEPROMS.CSLA.Library
|
||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||
get
|
||||
{
|
||||
CanReadProperty("Folder_DTS",true);
|
||||
CanReadProperty("Folder_DTS", true);
|
||||
return _Folder_DTS;
|
||||
}
|
||||
}
|
||||
@ -311,7 +311,7 @@ namespace VEPROMS.CSLA.Library
|
||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||
get
|
||||
{
|
||||
CanReadProperty("Folder_UsrID",true);
|
||||
CanReadProperty("Folder_UsrID", true);
|
||||
return _Folder_UsrID;
|
||||
}
|
||||
}
|
||||
@ -321,7 +321,7 @@ namespace VEPROMS.CSLA.Library
|
||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||
get
|
||||
{
|
||||
CanReadProperty("Group_GroupName",true);
|
||||
CanReadProperty("Group_GroupName", true);
|
||||
return _Group_GroupName;
|
||||
}
|
||||
}
|
||||
@ -331,7 +331,7 @@ namespace VEPROMS.CSLA.Library
|
||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||
get
|
||||
{
|
||||
CanReadProperty("Group_GroupType",true);
|
||||
CanReadProperty("Group_GroupType", true);
|
||||
return _Group_GroupType;
|
||||
}
|
||||
}
|
||||
@ -341,7 +341,7 @@ namespace VEPROMS.CSLA.Library
|
||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||
get
|
||||
{
|
||||
CanReadProperty("Group_Config",true);
|
||||
CanReadProperty("Group_Config", true);
|
||||
return _Group_Config;
|
||||
}
|
||||
}
|
||||
@ -351,7 +351,7 @@ namespace VEPROMS.CSLA.Library
|
||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||
get
|
||||
{
|
||||
CanReadProperty("Group_DTS",true);
|
||||
CanReadProperty("Group_DTS", true);
|
||||
return _Group_DTS;
|
||||
}
|
||||
}
|
||||
@ -361,7 +361,7 @@ namespace VEPROMS.CSLA.Library
|
||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||
get
|
||||
{
|
||||
CanReadProperty("Group_UsrID",true);
|
||||
CanReadProperty("Group_UsrID", true);
|
||||
return _Group_UsrID;
|
||||
}
|
||||
}
|
||||
@ -394,16 +394,16 @@ namespace VEPROMS.CSLA.Library
|
||||
#endregion
|
||||
#region ValidationRules
|
||||
[NonSerialized]
|
||||
private bool _CheckingBrokenRules=false;
|
||||
private bool _CheckingBrokenRules = false;
|
||||
public IVEHasBrokenRules HasBrokenRules
|
||||
{
|
||||
get
|
||||
{
|
||||
if(_CheckingBrokenRules)return null;
|
||||
if (_CheckingBrokenRules) return null;
|
||||
if (BrokenRulesCollection.Count > 0) return this;
|
||||
try
|
||||
{
|
||||
_CheckingBrokenRules=true;
|
||||
_CheckingBrokenRules = true;
|
||||
IVEHasBrokenRules hasBrokenRules = null;
|
||||
if (_MyGroup != null && (hasBrokenRules = _MyGroup.HasBrokenRules) != null) return hasBrokenRules;
|
||||
if (_MyFolder != null && (hasBrokenRules = _MyFolder.HasBrokenRules) != null) return hasBrokenRules;
|
||||
@ -411,7 +411,7 @@ namespace VEPROMS.CSLA.Library
|
||||
}
|
||||
finally
|
||||
{
|
||||
_CheckingBrokenRules=false;
|
||||
_CheckingBrokenRules = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -580,7 +580,7 @@ namespace VEPROMS.CSLA.Library
|
||||
#region Data Access Portal
|
||||
private void Fetch(SafeDataReader dr)
|
||||
{
|
||||
if(_MyLog.IsDebugEnabled)_MyLog.DebugFormat("[{0}] RoleAssignment.FetchDR", GetHashCode());
|
||||
if (_MyLog.IsDebugEnabled) _MyLog.DebugFormat("[{0}] RoleAssignment.FetchDR", GetHashCode());
|
||||
try
|
||||
{
|
||||
_AID = dr.GetInt32("AID");
|
||||
@ -608,7 +608,7 @@ namespace VEPROMS.CSLA.Library
|
||||
}
|
||||
catch (Exception ex) // FKItem Fetch
|
||||
{
|
||||
if(_MyLog.IsErrorEnabled)_MyLog.Error("RoleAssignment.FetchDR", ex);
|
||||
if (_MyLog.IsErrorEnabled) _MyLog.Error("RoleAssignment.FetchDR", ex);
|
||||
throw new DbCslaException("RoleAssignment.Fetch", ex);
|
||||
}
|
||||
MarkOld();
|
||||
|
@ -94,8 +94,8 @@ namespace VEPROMS.CSLA.Library
|
||||
{
|
||||
get
|
||||
{
|
||||
IVEHasBrokenRules hasBrokenRules=null;
|
||||
foreach(RoleAssignment roleAssignment in this)
|
||||
IVEHasBrokenRules hasBrokenRules = null;
|
||||
foreach (RoleAssignment roleAssignment in this)
|
||||
if ((hasBrokenRules = roleAssignment.HasBrokenRules) != null) return hasBrokenRules;
|
||||
return hasBrokenRules;
|
||||
}
|
||||
@ -165,7 +165,7 @@ namespace VEPROMS.CSLA.Library
|
||||
private void DataPortal_Fetch(RIDCriteria criteria)
|
||||
{
|
||||
this.RaiseListChangedEvents = false;
|
||||
if(_MyLog.IsDebugEnabled)_MyLog.DebugFormat("[{0}] RoleAssignments.DataPortal_FetchRID", GetHashCode());
|
||||
if (_MyLog.IsDebugEnabled) _MyLog.DebugFormat("[{0}] RoleAssignments.DataPortal_FetchRID", GetHashCode());
|
||||
try
|
||||
{
|
||||
using (SqlConnection cn = Database.VEPROMS_SqlConnection)
|
||||
@ -184,7 +184,7 @@ namespace VEPROMS.CSLA.Library
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
if(_MyLog.IsErrorEnabled)_MyLog.Error("RoleAssignments.DataPortal_FetchRID", ex);
|
||||
if (_MyLog.IsErrorEnabled) _MyLog.Error("RoleAssignments.DataPortal_FetchRID", ex);
|
||||
throw new DbCslaException("RoleAssignments.DataPortal_Fetch", ex);
|
||||
}
|
||||
this.RaiseListChangedEvents = true;
|
||||
@ -269,8 +269,8 @@ namespace VEPROMS.CSLA.Library
|
||||
/// </summary>
|
||||
public partial class RoleAssignmentsPropertyDescriptor : vlnListPropertyDescriptor
|
||||
{
|
||||
private RoleAssignment Item { get { return (RoleAssignment) _Item;} }
|
||||
public RoleAssignmentsPropertyDescriptor(RoleAssignments collection, int index):base(collection, index){;}
|
||||
private RoleAssignment Item { get { return (RoleAssignment)_Item; } }
|
||||
public RoleAssignmentsPropertyDescriptor(RoleAssignments collection, int index) : base(collection, index) { ;}
|
||||
}
|
||||
#endregion
|
||||
#region Converter
|
||||
@ -281,7 +281,7 @@ namespace VEPROMS.CSLA.Library
|
||||
if (destType == typeof(string) && value is RoleAssignments)
|
||||
{
|
||||
// Return department and department role separated by comma.
|
||||
return ((RoleAssignments) value).Items.Count.ToString() + " Assignments";
|
||||
return ((RoleAssignments)value).Items.Count.ToString() + " Assignments";
|
||||
}
|
||||
return base.ConvertTo(context, culture, value, destType);
|
||||
}
|
||||
|
@ -37,13 +37,17 @@ namespace VEPROMS.CSLA.Library
|
||||
#endregion
|
||||
#region Collection
|
||||
protected static List<RoleInfo> _AllList = new List<RoleInfo>();
|
||||
private static Dictionary<string, RoleInfo> _AllByPrimaryKey = new Dictionary<string, RoleInfo>();
|
||||
private static Dictionary<string, List<RoleInfo>> _AllByPrimaryKey = new Dictionary<string, List<RoleInfo>>();
|
||||
private static void ConvertListToDictionary()
|
||||
{
|
||||
List<RoleInfo> remove = new List<RoleInfo>();
|
||||
foreach (RoleInfo tmp in _AllList)
|
||||
{
|
||||
_AllByPrimaryKey[tmp.RID.ToString()]=tmp; // Primary Key
|
||||
if (!_AllByPrimaryKey.ContainsKey(tmp.RID.ToString()))
|
||||
{
|
||||
_AllByPrimaryKey[tmp.RID.ToString()] = new List<RoleInfo>(); // Add new list for PrimaryKey
|
||||
}
|
||||
_AllByPrimaryKey[tmp.RID.ToString()].Add(tmp); // Add to Primary Key list
|
||||
remove.Add(tmp);
|
||||
}
|
||||
foreach (RoleInfo tmp in remove)
|
||||
@ -57,7 +61,7 @@ namespace VEPROMS.CSLA.Library
|
||||
{
|
||||
ConvertListToDictionary();
|
||||
string key = rid.ToString();
|
||||
if (_AllByPrimaryKey.ContainsKey(key)) return _AllByPrimaryKey[key];
|
||||
if (_AllByPrimaryKey.ContainsKey(key)) return _AllByPrimaryKey[key][0];
|
||||
return null;
|
||||
}
|
||||
#endregion
|
||||
@ -85,7 +89,7 @@ namespace VEPROMS.CSLA.Library
|
||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||
get
|
||||
{
|
||||
CanReadProperty("RID",true);
|
||||
CanReadProperty("RID", true);
|
||||
return _RID;
|
||||
}
|
||||
}
|
||||
@ -95,7 +99,7 @@ namespace VEPROMS.CSLA.Library
|
||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||
get
|
||||
{
|
||||
CanReadProperty("Name",true);
|
||||
CanReadProperty("Name", true);
|
||||
return _Name;
|
||||
}
|
||||
}
|
||||
@ -105,7 +109,7 @@ namespace VEPROMS.CSLA.Library
|
||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||
get
|
||||
{
|
||||
CanReadProperty("Title",true);
|
||||
CanReadProperty("Title", true);
|
||||
return _Title;
|
||||
}
|
||||
}
|
||||
@ -115,7 +119,7 @@ namespace VEPROMS.CSLA.Library
|
||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||
get
|
||||
{
|
||||
CanReadProperty("DTS",true);
|
||||
CanReadProperty("DTS", true);
|
||||
return _DTS;
|
||||
}
|
||||
}
|
||||
@ -125,7 +129,7 @@ namespace VEPROMS.CSLA.Library
|
||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||
get
|
||||
{
|
||||
CanReadProperty("UsrID",true);
|
||||
CanReadProperty("UsrID", true);
|
||||
return _UsrID;
|
||||
}
|
||||
}
|
||||
@ -138,7 +142,7 @@ namespace VEPROMS.CSLA.Library
|
||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||
get
|
||||
{
|
||||
CanReadProperty("RoleAssignmentCount",true);
|
||||
CanReadProperty("RoleAssignmentCount", true);
|
||||
return _RoleAssignmentCount;
|
||||
}
|
||||
}
|
||||
@ -149,7 +153,7 @@ namespace VEPROMS.CSLA.Library
|
||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||
get
|
||||
{
|
||||
CanReadProperty("RoleAssignments",true);
|
||||
CanReadProperty("RoleAssignments", true);
|
||||
if (_RoleAssignmentCount < 0 || (_RoleAssignmentCount > 0 && _RoleAssignments == null))
|
||||
_RoleAssignments = AssignmentInfoList.GetByRID(_RID);
|
||||
if (_RoleAssignmentCount < 0)
|
||||
@ -159,7 +163,10 @@ namespace VEPROMS.CSLA.Library
|
||||
}
|
||||
internal void RefreshRoleAssignments()
|
||||
{
|
||||
_RoleAssignmentCount = -1; // This will cause the data to be requeried
|
||||
ConvertListToDictionary();
|
||||
if (_AllByPrimaryKey.ContainsKey(_RID.ToString()))
|
||||
foreach (RoleInfo tmp in _AllByPrimaryKey[_RID.ToString()])
|
||||
tmp._RoleAssignmentCount = -1; // This will cause the data to be requeried
|
||||
}
|
||||
private int _RolePermissionCount = 0;
|
||||
/// <summary>
|
||||
@ -170,7 +177,7 @@ namespace VEPROMS.CSLA.Library
|
||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||
get
|
||||
{
|
||||
CanReadProperty("RolePermissionCount",true);
|
||||
CanReadProperty("RolePermissionCount", true);
|
||||
return _RolePermissionCount;
|
||||
}
|
||||
}
|
||||
@ -181,7 +188,7 @@ namespace VEPROMS.CSLA.Library
|
||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||
get
|
||||
{
|
||||
CanReadProperty("RolePermissions",true);
|
||||
CanReadProperty("RolePermissions", true);
|
||||
if (_RolePermissionCount < 0 || (_RolePermissionCount > 0 && _RolePermissions == null))
|
||||
_RolePermissions = PermissionInfoList.GetByRID(_RID);
|
||||
if (_RolePermissionCount < 0)
|
||||
@ -191,7 +198,10 @@ namespace VEPROMS.CSLA.Library
|
||||
}
|
||||
internal void RefreshRolePermissions()
|
||||
{
|
||||
_RolePermissionCount = -1; // This will cause the data to be requeried
|
||||
ConvertListToDictionary();
|
||||
if (_AllByPrimaryKey.ContainsKey(_RID.ToString()))
|
||||
foreach (RoleInfo tmp in _AllByPrimaryKey[_RID.ToString()])
|
||||
tmp._RolePermissionCount = -1; // This will cause the data to be requeried
|
||||
}
|
||||
// TODO: Replace base RoleInfo.ToString function as necessary
|
||||
/// <summary>
|
||||
@ -213,14 +223,25 @@ namespace VEPROMS.CSLA.Library
|
||||
}
|
||||
#endregion
|
||||
#region Factory Methods
|
||||
private static int _RoleInfoUnique = 0;
|
||||
private int _MyRoleInfoUnique;
|
||||
public int MyRoleInfoUnique
|
||||
{
|
||||
get { return _MyRoleInfoUnique; }
|
||||
}
|
||||
private RoleInfo()
|
||||
{/* require use of factory methods */
|
||||
_MyRoleInfoUnique = ++_RoleInfoUnique;
|
||||
_AllList.Add(this);
|
||||
}
|
||||
public void Dispose()
|
||||
{
|
||||
_AllList.Remove(this);
|
||||
_AllByPrimaryKey.Remove(RID.ToString());
|
||||
if (!_AllByPrimaryKey.ContainsKey(RID.ToString())) return;
|
||||
List<RoleInfo> listRoleInfo = _AllByPrimaryKey[RID.ToString()]; // Get the list of items
|
||||
listRoleInfo.Remove(this); // Remove the item from the list
|
||||
if (listRoleInfo.Count == 0) // If there are no items left in the list
|
||||
_AllByPrimaryKey.Remove(RID.ToString()); // remove the list
|
||||
}
|
||||
public virtual Role Get()
|
||||
{
|
||||
@ -228,8 +249,10 @@ namespace VEPROMS.CSLA.Library
|
||||
}
|
||||
public static void Refresh(Role tmp)
|
||||
{
|
||||
RoleInfo tmpInfo = GetExistingByPrimaryKey(tmp.RID);
|
||||
if (tmpInfo == null) return;
|
||||
string key = tmp.RID.ToString();
|
||||
ConvertListToDictionary();
|
||||
if (_AllByPrimaryKey.ContainsKey(key))
|
||||
foreach (RoleInfo tmpInfo in _AllByPrimaryKey[key])
|
||||
tmpInfo.RefreshFields(tmp);
|
||||
}
|
||||
private void RefreshFields(Role tmp)
|
||||
@ -251,7 +274,7 @@ namespace VEPROMS.CSLA.Library
|
||||
if (tmp == null)
|
||||
{
|
||||
tmp = DataPortal.Fetch<RoleInfo>(new PKCriteria(rid));
|
||||
_AllList.Add(tmp);
|
||||
if (!_AllList.Contains(tmp)) _AllList.Add(tmp);
|
||||
}
|
||||
if (tmp.ErrorMessage == "No Record Found") tmp = null;
|
||||
return tmp;
|
||||
@ -265,14 +288,15 @@ namespace VEPROMS.CSLA.Library
|
||||
#region Data Access Portal
|
||||
internal RoleInfo(SafeDataReader dr)
|
||||
{
|
||||
if(_MyLog.IsDebugEnabled)_MyLog.DebugFormat("[{0}] RoleInfo.Constructor", GetHashCode());
|
||||
_MyRoleInfoUnique = ++_RoleInfoUnique;
|
||||
if (_MyLog.IsDebugEnabled) _MyLog.DebugFormat("[{0}] RoleInfo.Constructor", GetHashCode());
|
||||
try
|
||||
{
|
||||
ReadData(dr);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
if(_MyLog.IsErrorEnabled)_MyLog.Error("RoleInfo.Constructor", ex);
|
||||
if (_MyLog.IsErrorEnabled) _MyLog.Error("RoleInfo.Constructor", ex);
|
||||
throw new DbCslaException("RoleInfo.Constructor", ex);
|
||||
}
|
||||
}
|
||||
@ -289,7 +313,7 @@ namespace VEPROMS.CSLA.Library
|
||||
}
|
||||
private void ReadData(SafeDataReader dr)
|
||||
{
|
||||
if(_MyLog.IsDebugEnabled)_MyLog.DebugFormat("[{0}] RoleInfo.ReadData", GetHashCode());
|
||||
if (_MyLog.IsDebugEnabled) _MyLog.DebugFormat("[{0}] RoleInfo.ReadData", GetHashCode());
|
||||
try
|
||||
{
|
||||
_RID = dr.GetInt32("RID");
|
||||
@ -302,14 +326,14 @@ namespace VEPROMS.CSLA.Library
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
if(_MyLog.IsErrorEnabled)_MyLog.Error("RoleInfo.ReadData", ex);
|
||||
if (_MyLog.IsErrorEnabled) _MyLog.Error("RoleInfo.ReadData", ex);
|
||||
_ErrorMessage = ex.Message;
|
||||
throw new DbCslaException("RoleInfo.ReadData", ex);
|
||||
}
|
||||
}
|
||||
private void DataPortal_Fetch(PKCriteria criteria)
|
||||
{
|
||||
if(_MyLog.IsDebugEnabled)_MyLog.DebugFormat("[{0}] RoleInfo.DataPortal_Fetch", GetHashCode());
|
||||
if (_MyLog.IsDebugEnabled) _MyLog.DebugFormat("[{0}] RoleInfo.DataPortal_Fetch", GetHashCode());
|
||||
try
|
||||
{
|
||||
using (SqlConnection cn = Database.VEPROMS_SqlConnection)
|
||||
@ -337,7 +361,7 @@ namespace VEPROMS.CSLA.Library
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
if(_MyLog.IsErrorEnabled)_MyLog.Error("RoleInfo.DataPortal_Fetch", ex);
|
||||
if (_MyLog.IsErrorEnabled) _MyLog.Error("RoleInfo.DataPortal_Fetch", ex);
|
||||
_ErrorMessage = ex.Message;
|
||||
throw new DbCslaException("RoleInfo.DataPortal_Fetch", ex);
|
||||
}
|
||||
@ -347,7 +371,7 @@ namespace VEPROMS.CSLA.Library
|
||||
#region extension
|
||||
RoleInfoExtension _RoleInfoExtension = new RoleInfoExtension();
|
||||
[Serializable()]
|
||||
partial class RoleInfoExtension : extensionBase {}
|
||||
partial class RoleInfoExtension : extensionBase { }
|
||||
[Serializable()]
|
||||
class extensionBase
|
||||
{
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
x
Reference in New Issue
Block a user