This commit is contained in:
parent
9d0b3cd543
commit
cda0291dbd
@ -11,30 +11,13 @@ namespace VEPROMS.CSLA.Library
|
|||||||
return _SearchText;
|
return _SearchText;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public partial class AnnotationType
|
public partial class AnnotationType
|
||||||
{
|
{
|
||||||
public override string ToString()
|
public override string ToString()
|
||||||
{
|
{
|
||||||
return _Name;
|
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 partial class AnnotationTypeInfo
|
||||||
{
|
{
|
||||||
public static List<AnnotationTypeInfo> AllList()
|
public static List<AnnotationTypeInfo> AllList()
|
||||||
@ -42,14 +25,11 @@ namespace VEPROMS.CSLA.Library
|
|||||||
//return _AllList;
|
//return _AllList;
|
||||||
return AnnotationTypeInfo._AllList;
|
return AnnotationTypeInfo._AllList;
|
||||||
}
|
}
|
||||||
|
|
||||||
public override string ToString()
|
public override string ToString()
|
||||||
{
|
{
|
||||||
return _Name;
|
return _Name;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public partial class Annotation
|
public partial class Annotation
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@ -73,7 +53,6 @@ namespace VEPROMS.CSLA.Library
|
|||||||
//Update();
|
//Update();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//public partial class AnnotationTypeAnnotations
|
//public partial class AnnotationTypeAnnotations
|
||||||
//{
|
//{
|
||||||
// public static int GetAnnotationID()
|
// public static int GetAnnotationID()
|
||||||
|
@ -54,13 +54,17 @@ namespace VEPROMS.CSLA.Library
|
|||||||
#endregion
|
#endregion
|
||||||
#region Collection
|
#region Collection
|
||||||
protected static List<Annotation> _AllList = new List<Annotation>();
|
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()
|
private static void ConvertListToDictionary()
|
||||||
{
|
{
|
||||||
List<Annotation> remove = new List<Annotation>();
|
List<Annotation> remove = new List<Annotation>();
|
||||||
foreach (Annotation tmp in _AllList)
|
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);
|
remove.Add(tmp);
|
||||||
}
|
}
|
||||||
foreach (Annotation tmp in remove)
|
foreach (Annotation tmp in remove)
|
||||||
@ -70,7 +74,7 @@ namespace VEPROMS.CSLA.Library
|
|||||||
{
|
{
|
||||||
ConvertListToDictionary();
|
ConvertListToDictionary();
|
||||||
string key = annotationID.ToString();
|
string key = annotationID.ToString();
|
||||||
if (_AllByPrimaryKey.ContainsKey(key)) return _AllByPrimaryKey[key];
|
if (_AllByPrimaryKey.ContainsKey(key)) return _AllByPrimaryKey[key][0];
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
#endregion
|
#endregion
|
||||||
@ -297,7 +301,8 @@ namespace VEPROMS.CSLA.Library
|
|||||||
private bool _CheckingBrokenRules = false;
|
private bool _CheckingBrokenRules = false;
|
||||||
public IVEHasBrokenRules HasBrokenRules
|
public IVEHasBrokenRules HasBrokenRules
|
||||||
{
|
{
|
||||||
get {
|
get
|
||||||
|
{
|
||||||
if (_CheckingBrokenRules) return null;
|
if (_CheckingBrokenRules) return null;
|
||||||
if ((IsDirty || !IsNew) && BrokenRulesCollection.Count > 0) return this;
|
if ((IsDirty || !IsNew) && BrokenRulesCollection.Count > 0) return this;
|
||||||
try
|
try
|
||||||
@ -436,14 +441,25 @@ namespace VEPROMS.CSLA.Library
|
|||||||
#region Factory Methods
|
#region Factory Methods
|
||||||
public int CurrentEditLevel
|
public int CurrentEditLevel
|
||||||
{ get { return EditLevel; } }
|
{ get { return EditLevel; } }
|
||||||
|
private static int _AnnotationUnique = 0;
|
||||||
|
private int _MyAnnotationUnique;
|
||||||
|
public int MyAnnotationUnique
|
||||||
|
{
|
||||||
|
get { return _MyAnnotationUnique; }
|
||||||
|
}
|
||||||
protected Annotation()
|
protected Annotation()
|
||||||
{/* require use of factory methods */
|
{/* require use of factory methods */
|
||||||
|
_MyAnnotationUnique = ++_AnnotationUnique;
|
||||||
_AllList.Add(this);
|
_AllList.Add(this);
|
||||||
}
|
}
|
||||||
public void Dispose()
|
public void Dispose()
|
||||||
{
|
{
|
||||||
_AllList.Remove(this);
|
_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()
|
public static Annotation New()
|
||||||
{
|
{
|
||||||
@ -529,7 +545,7 @@ namespace VEPROMS.CSLA.Library
|
|||||||
if (tmp == null)
|
if (tmp == null)
|
||||||
{
|
{
|
||||||
tmp = DataPortal.Fetch<Annotation>(new PKCriteria(annotationID));
|
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;
|
if (tmp.ErrorMessage == "No Record Found") tmp = null;
|
||||||
return tmp;
|
return tmp;
|
||||||
|
@ -37,13 +37,17 @@ namespace VEPROMS.CSLA.Library
|
|||||||
#endregion
|
#endregion
|
||||||
#region Collection
|
#region Collection
|
||||||
protected static List<AnnotationInfo> _AllList = new List<AnnotationInfo>();
|
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()
|
private static void ConvertListToDictionary()
|
||||||
{
|
{
|
||||||
List<AnnotationInfo> remove = new List<AnnotationInfo>();
|
List<AnnotationInfo> remove = new List<AnnotationInfo>();
|
||||||
foreach (AnnotationInfo tmp in _AllList)
|
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);
|
remove.Add(tmp);
|
||||||
}
|
}
|
||||||
foreach (AnnotationInfo tmp in remove)
|
foreach (AnnotationInfo tmp in remove)
|
||||||
@ -57,7 +61,7 @@ namespace VEPROMS.CSLA.Library
|
|||||||
{
|
{
|
||||||
ConvertListToDictionary();
|
ConvertListToDictionary();
|
||||||
string key = annotationID.ToString();
|
string key = annotationID.ToString();
|
||||||
if (_AllByPrimaryKey.ContainsKey(key)) return _AllByPrimaryKey[key];
|
if (_AllByPrimaryKey.ContainsKey(key)) return _AllByPrimaryKey[key][0];
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
#endregion
|
#endregion
|
||||||
@ -203,14 +207,25 @@ namespace VEPROMS.CSLA.Library
|
|||||||
}
|
}
|
||||||
#endregion
|
#endregion
|
||||||
#region Factory Methods
|
#region Factory Methods
|
||||||
|
private static int _AnnotationInfoUnique = 0;
|
||||||
|
private int _MyAnnotationInfoUnique;
|
||||||
|
public int MyAnnotationInfoUnique
|
||||||
|
{
|
||||||
|
get { return _MyAnnotationInfoUnique; }
|
||||||
|
}
|
||||||
private AnnotationInfo()
|
private AnnotationInfo()
|
||||||
{/* require use of factory methods */
|
{/* require use of factory methods */
|
||||||
|
_MyAnnotationInfoUnique = ++_AnnotationInfoUnique;
|
||||||
_AllList.Add(this);
|
_AllList.Add(this);
|
||||||
}
|
}
|
||||||
public void Dispose()
|
public void Dispose()
|
||||||
{
|
{
|
||||||
_AllList.Remove(this);
|
_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()
|
public virtual Annotation Get()
|
||||||
{
|
{
|
||||||
@ -218,8 +233,10 @@ namespace VEPROMS.CSLA.Library
|
|||||||
}
|
}
|
||||||
public static void Refresh(Annotation tmp)
|
public static void Refresh(Annotation tmp)
|
||||||
{
|
{
|
||||||
AnnotationInfo tmpInfo = GetExistingByPrimaryKey(tmp.AnnotationID);
|
string key = tmp.AnnotationID.ToString();
|
||||||
if (tmpInfo == null) return;
|
ConvertListToDictionary();
|
||||||
|
if (_AllByPrimaryKey.ContainsKey(key))
|
||||||
|
foreach (AnnotationInfo tmpInfo in _AllByPrimaryKey[key])
|
||||||
tmpInfo.RefreshFields(tmp);
|
tmpInfo.RefreshFields(tmp);
|
||||||
}
|
}
|
||||||
private void RefreshFields(Annotation tmp)
|
private void RefreshFields(Annotation tmp)
|
||||||
@ -228,16 +245,16 @@ namespace VEPROMS.CSLA.Library
|
|||||||
{
|
{
|
||||||
MyItem.RefreshItemAnnotations(); // Update List for old value
|
MyItem.RefreshItemAnnotations(); // Update List for old value
|
||||||
_ItemID = tmp.ItemID; // Update the 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)
|
if (_TypeID != tmp.TypeID)
|
||||||
{
|
{
|
||||||
MyAnnotationType.RefreshAnnotationTypeAnnotations(); // Update List for old value
|
MyAnnotationType.RefreshAnnotationTypeAnnotations(); // Update List for old value
|
||||||
_TypeID = tmp.TypeID; // Update the 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;
|
_RtfText = tmp.RtfText;
|
||||||
_SearchText = tmp.SearchText;
|
_SearchText = tmp.SearchText;
|
||||||
_Config = tmp.Config;
|
_Config = tmp.Config;
|
||||||
@ -250,8 +267,10 @@ namespace VEPROMS.CSLA.Library
|
|||||||
}
|
}
|
||||||
public static void Refresh(AnnotationTypeAnnotation tmp)
|
public static void Refresh(AnnotationTypeAnnotation tmp)
|
||||||
{
|
{
|
||||||
AnnotationInfo tmpInfo = GetExistingByPrimaryKey(tmp.AnnotationID);
|
string key = tmp.AnnotationID.ToString();
|
||||||
if (tmpInfo == null) return;
|
ConvertListToDictionary();
|
||||||
|
if (_AllByPrimaryKey.ContainsKey(key))
|
||||||
|
foreach (AnnotationInfo tmpInfo in _AllByPrimaryKey[key])
|
||||||
tmpInfo.RefreshFields(tmp);
|
tmpInfo.RefreshFields(tmp);
|
||||||
}
|
}
|
||||||
private void RefreshFields(AnnotationTypeAnnotation tmp)
|
private void RefreshFields(AnnotationTypeAnnotation tmp)
|
||||||
@ -260,9 +279,9 @@ namespace VEPROMS.CSLA.Library
|
|||||||
{
|
{
|
||||||
MyItem.RefreshItemAnnotations(); // Update List for old value
|
MyItem.RefreshItemAnnotations(); // Update List for old value
|
||||||
_ItemID = tmp.ItemID; // Update the 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;
|
_RtfText = tmp.RtfText;
|
||||||
_SearchText = tmp.SearchText;
|
_SearchText = tmp.SearchText;
|
||||||
_Config = tmp.Config;
|
_Config = tmp.Config;
|
||||||
@ -275,8 +294,10 @@ namespace VEPROMS.CSLA.Library
|
|||||||
}
|
}
|
||||||
public static void Refresh(ItemAnnotation tmp)
|
public static void Refresh(ItemAnnotation tmp)
|
||||||
{
|
{
|
||||||
AnnotationInfo tmpInfo = GetExistingByPrimaryKey(tmp.AnnotationID);
|
string key = tmp.AnnotationID.ToString();
|
||||||
if (tmpInfo == null) return;
|
ConvertListToDictionary();
|
||||||
|
if (_AllByPrimaryKey.ContainsKey(key))
|
||||||
|
foreach (AnnotationInfo tmpInfo in _AllByPrimaryKey[key])
|
||||||
tmpInfo.RefreshFields(tmp);
|
tmpInfo.RefreshFields(tmp);
|
||||||
}
|
}
|
||||||
private void RefreshFields(ItemAnnotation tmp)
|
private void RefreshFields(ItemAnnotation tmp)
|
||||||
@ -285,9 +306,9 @@ namespace VEPROMS.CSLA.Library
|
|||||||
{
|
{
|
||||||
MyAnnotationType.RefreshAnnotationTypeAnnotations(); // Update List for old value
|
MyAnnotationType.RefreshAnnotationTypeAnnotations(); // Update List for old value
|
||||||
_TypeID = tmp.TypeID; // Update the 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;
|
_RtfText = tmp.RtfText;
|
||||||
_SearchText = tmp.SearchText;
|
_SearchText = tmp.SearchText;
|
||||||
_Config = tmp.Config;
|
_Config = tmp.Config;
|
||||||
@ -308,7 +329,7 @@ namespace VEPROMS.CSLA.Library
|
|||||||
if (tmp == null)
|
if (tmp == null)
|
||||||
{
|
{
|
||||||
tmp = DataPortal.Fetch<AnnotationInfo>(new PKCriteria(annotationID));
|
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;
|
if (tmp.ErrorMessage == "No Record Found") tmp = null;
|
||||||
return tmp;
|
return tmp;
|
||||||
@ -322,6 +343,7 @@ namespace VEPROMS.CSLA.Library
|
|||||||
#region Data Access Portal
|
#region Data Access Portal
|
||||||
internal AnnotationInfo(SafeDataReader dr)
|
internal AnnotationInfo(SafeDataReader dr)
|
||||||
{
|
{
|
||||||
|
_MyAnnotationInfoUnique = ++_AnnotationInfoUnique;
|
||||||
if (_MyLog.IsDebugEnabled) _MyLog.DebugFormat("[{0}] AnnotationInfo.Constructor", GetHashCode());
|
if (_MyLog.IsDebugEnabled) _MyLog.DebugFormat("[{0}] AnnotationInfo.Constructor", GetHashCode());
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
@ -65,15 +65,20 @@ namespace VEPROMS.CSLA.Library
|
|||||||
#endregion
|
#endregion
|
||||||
#region Collection
|
#region Collection
|
||||||
protected static List<AnnotationType> _AllList = new List<AnnotationType>();
|
protected static List<AnnotationType> _AllList = new List<AnnotationType>();
|
||||||
private static Dictionary<string, AnnotationType> _AllByPrimaryKey = new Dictionary<string, AnnotationType>();
|
private static Dictionary<string, List<AnnotationType>> _AllByPrimaryKey = new Dictionary<string, List<AnnotationType>>();
|
||||||
private static Dictionary<string, AnnotationType> _AllByName = new Dictionary<string, AnnotationType>();
|
private static Dictionary<string, List<AnnotationType>> _AllByName = new Dictionary<string, List<AnnotationType>>();
|
||||||
private static void ConvertListToDictionary()
|
private static void ConvertListToDictionary()
|
||||||
{
|
{
|
||||||
List<AnnotationType> remove = new List<AnnotationType>();
|
List<AnnotationType> remove = new List<AnnotationType>();
|
||||||
foreach (AnnotationType tmp in _AllList)
|
foreach (AnnotationType tmp in _AllList)
|
||||||
{
|
{
|
||||||
_AllByPrimaryKey[tmp.TypeID.ToString()]=tmp; // Primary Key
|
if (!_AllByPrimaryKey.ContainsKey(tmp.TypeID.ToString()))
|
||||||
_AllByName[tmp.Name.ToString()] = tmp; // Unique Index
|
{
|
||||||
|
_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);
|
remove.Add(tmp);
|
||||||
}
|
}
|
||||||
foreach (AnnotationType tmp in remove)
|
foreach (AnnotationType tmp in remove)
|
||||||
@ -83,14 +88,14 @@ namespace VEPROMS.CSLA.Library
|
|||||||
{
|
{
|
||||||
ConvertListToDictionary();
|
ConvertListToDictionary();
|
||||||
string key = typeID.ToString();
|
string key = typeID.ToString();
|
||||||
if (_AllByPrimaryKey.ContainsKey(key)) return _AllByPrimaryKey[key];
|
if (_AllByPrimaryKey.ContainsKey(key)) return _AllByPrimaryKey[key][0];
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
public static AnnotationType GetExistingByName(string name)
|
public static AnnotationType GetExistingByName(string name)
|
||||||
{
|
{
|
||||||
ConvertListToDictionary();
|
ConvertListToDictionary();
|
||||||
string key = name.ToString();
|
string key = name.ToString();
|
||||||
if (_AllByName.ContainsKey(key)) return _AllByName[key];
|
if (_AllByName.ContainsKey(key)) return _AllByName[key][0];
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
#endregion
|
#endregion
|
||||||
@ -263,7 +268,8 @@ namespace VEPROMS.CSLA.Library
|
|||||||
private bool _CheckingBrokenRules = false;
|
private bool _CheckingBrokenRules = false;
|
||||||
public IVEHasBrokenRules HasBrokenRules
|
public IVEHasBrokenRules HasBrokenRules
|
||||||
{
|
{
|
||||||
get {
|
get
|
||||||
|
{
|
||||||
if (_CheckingBrokenRules) return null;
|
if (_CheckingBrokenRules) return null;
|
||||||
if ((IsDirty || !IsNew) && BrokenRulesCollection.Count > 0) return this;
|
if ((IsDirty || !IsNew) && BrokenRulesCollection.Count > 0) return this;
|
||||||
try
|
try
|
||||||
@ -387,15 +393,29 @@ namespace VEPROMS.CSLA.Library
|
|||||||
#region Factory Methods
|
#region Factory Methods
|
||||||
public int CurrentEditLevel
|
public int CurrentEditLevel
|
||||||
{ get { return EditLevel; } }
|
{ get { return EditLevel; } }
|
||||||
|
private static int _AnnotationTypeUnique = 0;
|
||||||
|
private int _MyAnnotationTypeUnique;
|
||||||
|
public int MyAnnotationTypeUnique
|
||||||
|
{
|
||||||
|
get { return _MyAnnotationTypeUnique; }
|
||||||
|
}
|
||||||
protected AnnotationType()
|
protected AnnotationType()
|
||||||
{/* require use of factory methods */
|
{/* require use of factory methods */
|
||||||
|
_MyAnnotationTypeUnique = ++_AnnotationTypeUnique;
|
||||||
_AllList.Add(this);
|
_AllList.Add(this);
|
||||||
}
|
}
|
||||||
public void Dispose()
|
public void Dispose()
|
||||||
{
|
{
|
||||||
_AllList.Remove(this);
|
_AllList.Remove(this);
|
||||||
_AllByPrimaryKey.Remove(TypeID.ToString());
|
if (!_AllByPrimaryKey.ContainsKey(TypeID.ToString())) return;
|
||||||
_AllByName.Remove(Name.ToString());
|
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()
|
public static AnnotationType New()
|
||||||
{
|
{
|
||||||
@ -474,7 +494,7 @@ namespace VEPROMS.CSLA.Library
|
|||||||
if (tmp == null)
|
if (tmp == null)
|
||||||
{
|
{
|
||||||
tmp = DataPortal.Fetch<AnnotationType>(new PKCriteria(typeID));
|
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;
|
if (tmp.ErrorMessage == "No Record Found") tmp = null;
|
||||||
return tmp;
|
return tmp;
|
||||||
@ -494,7 +514,7 @@ namespace VEPROMS.CSLA.Library
|
|||||||
if (tmp == null)
|
if (tmp == null)
|
||||||
{
|
{
|
||||||
tmp = DataPortal.Fetch<AnnotationType>(new NameCriteria(name));
|
tmp = DataPortal.Fetch<AnnotationType>(new NameCriteria(name));
|
||||||
_AllList.Add(tmp);
|
if (!_AllList.Contains(tmp)) _AllList.Add(tmp);
|
||||||
}
|
}
|
||||||
if (tmp.ErrorMessage == "No Record Found") tmp = null;
|
if (tmp.ErrorMessage == "No Record Found") tmp = null;
|
||||||
return tmp;
|
return tmp;
|
||||||
|
@ -37,13 +37,17 @@ namespace VEPROMS.CSLA.Library
|
|||||||
#endregion
|
#endregion
|
||||||
#region Collection
|
#region Collection
|
||||||
protected static List<AnnotationTypeInfo> _AllList = new List<AnnotationTypeInfo>();
|
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()
|
private static void ConvertListToDictionary()
|
||||||
{
|
{
|
||||||
List<AnnotationTypeInfo> remove = new List<AnnotationTypeInfo>();
|
List<AnnotationTypeInfo> remove = new List<AnnotationTypeInfo>();
|
||||||
foreach (AnnotationTypeInfo tmp in _AllList)
|
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);
|
remove.Add(tmp);
|
||||||
}
|
}
|
||||||
foreach (AnnotationTypeInfo tmp in remove)
|
foreach (AnnotationTypeInfo tmp in remove)
|
||||||
@ -57,7 +61,7 @@ namespace VEPROMS.CSLA.Library
|
|||||||
{
|
{
|
||||||
ConvertListToDictionary();
|
ConvertListToDictionary();
|
||||||
string key = typeID.ToString();
|
string key = typeID.ToString();
|
||||||
if (_AllByPrimaryKey.ContainsKey(key)) return _AllByPrimaryKey[key];
|
if (_AllByPrimaryKey.ContainsKey(key)) return _AllByPrimaryKey[key][0];
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
#endregion
|
#endregion
|
||||||
@ -159,7 +163,10 @@ namespace VEPROMS.CSLA.Library
|
|||||||
}
|
}
|
||||||
internal void RefreshAnnotationTypeAnnotations()
|
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
|
// TODO: Replace base AnnotationTypeInfo.ToString function as necessary
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@ -181,14 +188,25 @@ namespace VEPROMS.CSLA.Library
|
|||||||
}
|
}
|
||||||
#endregion
|
#endregion
|
||||||
#region Factory Methods
|
#region Factory Methods
|
||||||
|
private static int _AnnotationTypeInfoUnique = 0;
|
||||||
|
private int _MyAnnotationTypeInfoUnique;
|
||||||
|
public int MyAnnotationTypeInfoUnique
|
||||||
|
{
|
||||||
|
get { return _MyAnnotationTypeInfoUnique; }
|
||||||
|
}
|
||||||
private AnnotationTypeInfo()
|
private AnnotationTypeInfo()
|
||||||
{/* require use of factory methods */
|
{/* require use of factory methods */
|
||||||
|
_MyAnnotationTypeInfoUnique = ++_AnnotationTypeInfoUnique;
|
||||||
_AllList.Add(this);
|
_AllList.Add(this);
|
||||||
}
|
}
|
||||||
public void Dispose()
|
public void Dispose()
|
||||||
{
|
{
|
||||||
_AllList.Remove(this);
|
_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()
|
public virtual AnnotationType Get()
|
||||||
{
|
{
|
||||||
@ -196,8 +214,10 @@ namespace VEPROMS.CSLA.Library
|
|||||||
}
|
}
|
||||||
public static void Refresh(AnnotationType tmp)
|
public static void Refresh(AnnotationType tmp)
|
||||||
{
|
{
|
||||||
AnnotationTypeInfo tmpInfo = GetExistingByPrimaryKey(tmp.TypeID);
|
string key = tmp.TypeID.ToString();
|
||||||
if (tmpInfo == null) return;
|
ConvertListToDictionary();
|
||||||
|
if (_AllByPrimaryKey.ContainsKey(key))
|
||||||
|
foreach (AnnotationTypeInfo tmpInfo in _AllByPrimaryKey[key])
|
||||||
tmpInfo.RefreshFields(tmp);
|
tmpInfo.RefreshFields(tmp);
|
||||||
}
|
}
|
||||||
private void RefreshFields(AnnotationType tmp)
|
private void RefreshFields(AnnotationType tmp)
|
||||||
@ -219,7 +239,7 @@ namespace VEPROMS.CSLA.Library
|
|||||||
if (tmp == null)
|
if (tmp == null)
|
||||||
{
|
{
|
||||||
tmp = DataPortal.Fetch<AnnotationTypeInfo>(new PKCriteria(typeID));
|
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;
|
if (tmp.ErrorMessage == "No Record Found") tmp = null;
|
||||||
return tmp;
|
return tmp;
|
||||||
@ -233,6 +253,7 @@ namespace VEPROMS.CSLA.Library
|
|||||||
#region Data Access Portal
|
#region Data Access Portal
|
||||||
internal AnnotationTypeInfo(SafeDataReader dr)
|
internal AnnotationTypeInfo(SafeDataReader dr)
|
||||||
{
|
{
|
||||||
|
_MyAnnotationTypeInfoUnique = ++_AnnotationTypeInfoUnique;
|
||||||
if (_MyLog.IsDebugEnabled) _MyLog.DebugFormat("[{0}] AnnotationTypeInfo.Constructor", GetHashCode());
|
if (_MyLog.IsDebugEnabled) _MyLog.DebugFormat("[{0}] AnnotationTypeInfo.Constructor", GetHashCode());
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
@ -55,13 +55,17 @@ namespace VEPROMS.CSLA.Library
|
|||||||
#endregion
|
#endregion
|
||||||
#region Collection
|
#region Collection
|
||||||
protected static List<Assignment> _AllList = new List<Assignment>();
|
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()
|
private static void ConvertListToDictionary()
|
||||||
{
|
{
|
||||||
List<Assignment> remove = new List<Assignment>();
|
List<Assignment> remove = new List<Assignment>();
|
||||||
foreach (Assignment tmp in _AllList)
|
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);
|
remove.Add(tmp);
|
||||||
}
|
}
|
||||||
foreach (Assignment tmp in remove)
|
foreach (Assignment tmp in remove)
|
||||||
@ -71,7 +75,7 @@ namespace VEPROMS.CSLA.Library
|
|||||||
{
|
{
|
||||||
ConvertListToDictionary();
|
ConvertListToDictionary();
|
||||||
string key = aid.ToString();
|
string key = aid.ToString();
|
||||||
if (_AllByPrimaryKey.ContainsKey(key)) return _AllByPrimaryKey[key];
|
if (_AllByPrimaryKey.ContainsKey(key)) return _AllByPrimaryKey[key][0];
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
#endregion
|
#endregion
|
||||||
@ -327,7 +331,8 @@ namespace VEPROMS.CSLA.Library
|
|||||||
private bool _CheckingBrokenRules = false;
|
private bool _CheckingBrokenRules = false;
|
||||||
public IVEHasBrokenRules HasBrokenRules
|
public IVEHasBrokenRules HasBrokenRules
|
||||||
{
|
{
|
||||||
get {
|
get
|
||||||
|
{
|
||||||
if (_CheckingBrokenRules) return null;
|
if (_CheckingBrokenRules) return null;
|
||||||
if ((IsDirty || !IsNew) && BrokenRulesCollection.Count > 0) return this;
|
if ((IsDirty || !IsNew) && BrokenRulesCollection.Count > 0) return this;
|
||||||
try
|
try
|
||||||
@ -498,14 +503,25 @@ namespace VEPROMS.CSLA.Library
|
|||||||
#region Factory Methods
|
#region Factory Methods
|
||||||
public int CurrentEditLevel
|
public int CurrentEditLevel
|
||||||
{ get { return EditLevel; } }
|
{ get { return EditLevel; } }
|
||||||
|
private static int _AssignmentUnique = 0;
|
||||||
|
private int _MyAssignmentUnique;
|
||||||
|
public int MyAssignmentUnique
|
||||||
|
{
|
||||||
|
get { return _MyAssignmentUnique; }
|
||||||
|
}
|
||||||
protected Assignment()
|
protected Assignment()
|
||||||
{/* require use of factory methods */
|
{/* require use of factory methods */
|
||||||
|
_MyAssignmentUnique = ++_AssignmentUnique;
|
||||||
_AllList.Add(this);
|
_AllList.Add(this);
|
||||||
}
|
}
|
||||||
public void Dispose()
|
public void Dispose()
|
||||||
{
|
{
|
||||||
_AllList.Remove(this);
|
_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()
|
public static Assignment New()
|
||||||
{
|
{
|
||||||
@ -591,7 +607,7 @@ namespace VEPROMS.CSLA.Library
|
|||||||
if (tmp == null)
|
if (tmp == null)
|
||||||
{
|
{
|
||||||
tmp = DataPortal.Fetch<Assignment>(new PKCriteria(aid));
|
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;
|
if (tmp.ErrorMessage == "No Record Found") tmp = null;
|
||||||
return tmp;
|
return tmp;
|
||||||
|
@ -37,13 +37,17 @@ namespace VEPROMS.CSLA.Library
|
|||||||
#endregion
|
#endregion
|
||||||
#region Collection
|
#region Collection
|
||||||
protected static List<AssignmentInfo> _AllList = new List<AssignmentInfo>();
|
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()
|
private static void ConvertListToDictionary()
|
||||||
{
|
{
|
||||||
List<AssignmentInfo> remove = new List<AssignmentInfo>();
|
List<AssignmentInfo> remove = new List<AssignmentInfo>();
|
||||||
foreach (AssignmentInfo tmp in _AllList)
|
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);
|
remove.Add(tmp);
|
||||||
}
|
}
|
||||||
foreach (AssignmentInfo tmp in remove)
|
foreach (AssignmentInfo tmp in remove)
|
||||||
@ -57,7 +61,7 @@ namespace VEPROMS.CSLA.Library
|
|||||||
{
|
{
|
||||||
ConvertListToDictionary();
|
ConvertListToDictionary();
|
||||||
string key = aid.ToString();
|
string key = aid.ToString();
|
||||||
if (_AllByPrimaryKey.ContainsKey(key)) return _AllByPrimaryKey[key];
|
if (_AllByPrimaryKey.ContainsKey(key)) return _AllByPrimaryKey[key][0];
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
#endregion
|
#endregion
|
||||||
@ -215,14 +219,25 @@ namespace VEPROMS.CSLA.Library
|
|||||||
}
|
}
|
||||||
#endregion
|
#endregion
|
||||||
#region Factory Methods
|
#region Factory Methods
|
||||||
|
private static int _AssignmentInfoUnique = 0;
|
||||||
|
private int _MyAssignmentInfoUnique;
|
||||||
|
public int MyAssignmentInfoUnique
|
||||||
|
{
|
||||||
|
get { return _MyAssignmentInfoUnique; }
|
||||||
|
}
|
||||||
private AssignmentInfo()
|
private AssignmentInfo()
|
||||||
{/* require use of factory methods */
|
{/* require use of factory methods */
|
||||||
|
_MyAssignmentInfoUnique = ++_AssignmentInfoUnique;
|
||||||
_AllList.Add(this);
|
_AllList.Add(this);
|
||||||
}
|
}
|
||||||
public void Dispose()
|
public void Dispose()
|
||||||
{
|
{
|
||||||
_AllList.Remove(this);
|
_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()
|
public virtual Assignment Get()
|
||||||
{
|
{
|
||||||
@ -230,8 +245,10 @@ namespace VEPROMS.CSLA.Library
|
|||||||
}
|
}
|
||||||
public static void Refresh(Assignment tmp)
|
public static void Refresh(Assignment tmp)
|
||||||
{
|
{
|
||||||
AssignmentInfo tmpInfo = GetExistingByPrimaryKey(tmp.AID);
|
string key = tmp.AID.ToString();
|
||||||
if (tmpInfo == null) return;
|
ConvertListToDictionary();
|
||||||
|
if (_AllByPrimaryKey.ContainsKey(key))
|
||||||
|
foreach (AssignmentInfo tmpInfo in _AllByPrimaryKey[key])
|
||||||
tmpInfo.RefreshFields(tmp);
|
tmpInfo.RefreshFields(tmp);
|
||||||
}
|
}
|
||||||
private void RefreshFields(Assignment tmp)
|
private void RefreshFields(Assignment tmp)
|
||||||
@ -240,23 +257,23 @@ namespace VEPROMS.CSLA.Library
|
|||||||
{
|
{
|
||||||
MyGroup.RefreshGroupAssignments(); // Update List for old value
|
MyGroup.RefreshGroupAssignments(); // Update List for old value
|
||||||
_GID = tmp.GID; // Update the 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)
|
if (_RID != tmp.RID)
|
||||||
{
|
{
|
||||||
MyRole.RefreshRoleAssignments(); // Update List for old value
|
MyRole.RefreshRoleAssignments(); // Update List for old value
|
||||||
_RID = tmp.RID; // Update the 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)
|
if (_FolderID != tmp.FolderID)
|
||||||
{
|
{
|
||||||
MyFolder.RefreshFolderAssignments(); // Update List for old value
|
MyFolder.RefreshFolderAssignments(); // Update List for old value
|
||||||
_FolderID = tmp.FolderID; // Update the 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;
|
_StartDate = tmp.StartDate;
|
||||||
_EndDate = tmp.EndDate;
|
_EndDate = tmp.EndDate;
|
||||||
_DTS = tmp.DTS;
|
_DTS = tmp.DTS;
|
||||||
@ -269,8 +286,10 @@ namespace VEPROMS.CSLA.Library
|
|||||||
}
|
}
|
||||||
public static void Refresh(FolderAssignment tmp)
|
public static void Refresh(FolderAssignment tmp)
|
||||||
{
|
{
|
||||||
AssignmentInfo tmpInfo = GetExistingByPrimaryKey(tmp.AID);
|
string key = tmp.AID.ToString();
|
||||||
if (tmpInfo == null) return;
|
ConvertListToDictionary();
|
||||||
|
if (_AllByPrimaryKey.ContainsKey(key))
|
||||||
|
foreach (AssignmentInfo tmpInfo in _AllByPrimaryKey[key])
|
||||||
tmpInfo.RefreshFields(tmp);
|
tmpInfo.RefreshFields(tmp);
|
||||||
}
|
}
|
||||||
private void RefreshFields(FolderAssignment tmp)
|
private void RefreshFields(FolderAssignment tmp)
|
||||||
@ -279,16 +298,16 @@ namespace VEPROMS.CSLA.Library
|
|||||||
{
|
{
|
||||||
MyGroup.RefreshGroupAssignments(); // Update List for old value
|
MyGroup.RefreshGroupAssignments(); // Update List for old value
|
||||||
_GID = tmp.GID; // Update the 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)
|
if (_RID != tmp.RID)
|
||||||
{
|
{
|
||||||
MyRole.RefreshRoleAssignments(); // Update List for old value
|
MyRole.RefreshRoleAssignments(); // Update List for old value
|
||||||
_RID = tmp.RID; // Update the 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;
|
_StartDate = tmp.StartDate;
|
||||||
_EndDate = tmp.EndDate;
|
_EndDate = tmp.EndDate;
|
||||||
_DTS = tmp.DTS;
|
_DTS = tmp.DTS;
|
||||||
@ -301,8 +320,10 @@ namespace VEPROMS.CSLA.Library
|
|||||||
}
|
}
|
||||||
public static void Refresh(GroupAssignment tmp)
|
public static void Refresh(GroupAssignment tmp)
|
||||||
{
|
{
|
||||||
AssignmentInfo tmpInfo = GetExistingByPrimaryKey(tmp.AID);
|
string key = tmp.AID.ToString();
|
||||||
if (tmpInfo == null) return;
|
ConvertListToDictionary();
|
||||||
|
if (_AllByPrimaryKey.ContainsKey(key))
|
||||||
|
foreach (AssignmentInfo tmpInfo in _AllByPrimaryKey[key])
|
||||||
tmpInfo.RefreshFields(tmp);
|
tmpInfo.RefreshFields(tmp);
|
||||||
}
|
}
|
||||||
private void RefreshFields(GroupAssignment tmp)
|
private void RefreshFields(GroupAssignment tmp)
|
||||||
@ -311,16 +332,16 @@ namespace VEPROMS.CSLA.Library
|
|||||||
{
|
{
|
||||||
MyRole.RefreshRoleAssignments(); // Update List for old value
|
MyRole.RefreshRoleAssignments(); // Update List for old value
|
||||||
_RID = tmp.RID; // Update the 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)
|
if (_FolderID != tmp.FolderID)
|
||||||
{
|
{
|
||||||
MyFolder.RefreshFolderAssignments(); // Update List for old value
|
MyFolder.RefreshFolderAssignments(); // Update List for old value
|
||||||
_FolderID = tmp.FolderID; // Update the 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;
|
_StartDate = tmp.StartDate;
|
||||||
_EndDate = tmp.EndDate;
|
_EndDate = tmp.EndDate;
|
||||||
_DTS = tmp.DTS;
|
_DTS = tmp.DTS;
|
||||||
@ -333,8 +354,10 @@ namespace VEPROMS.CSLA.Library
|
|||||||
}
|
}
|
||||||
public static void Refresh(RoleAssignment tmp)
|
public static void Refresh(RoleAssignment tmp)
|
||||||
{
|
{
|
||||||
AssignmentInfo tmpInfo = GetExistingByPrimaryKey(tmp.AID);
|
string key = tmp.AID.ToString();
|
||||||
if (tmpInfo == null) return;
|
ConvertListToDictionary();
|
||||||
|
if (_AllByPrimaryKey.ContainsKey(key))
|
||||||
|
foreach (AssignmentInfo tmpInfo in _AllByPrimaryKey[key])
|
||||||
tmpInfo.RefreshFields(tmp);
|
tmpInfo.RefreshFields(tmp);
|
||||||
}
|
}
|
||||||
private void RefreshFields(RoleAssignment tmp)
|
private void RefreshFields(RoleAssignment tmp)
|
||||||
@ -343,16 +366,16 @@ namespace VEPROMS.CSLA.Library
|
|||||||
{
|
{
|
||||||
MyGroup.RefreshGroupAssignments(); // Update List for old value
|
MyGroup.RefreshGroupAssignments(); // Update List for old value
|
||||||
_GID = tmp.GID; // Update the 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)
|
if (_FolderID != tmp.FolderID)
|
||||||
{
|
{
|
||||||
MyFolder.RefreshFolderAssignments(); // Update List for old value
|
MyFolder.RefreshFolderAssignments(); // Update List for old value
|
||||||
_FolderID = tmp.FolderID; // Update the 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;
|
_StartDate = tmp.StartDate;
|
||||||
_EndDate = tmp.EndDate;
|
_EndDate = tmp.EndDate;
|
||||||
_DTS = tmp.DTS;
|
_DTS = tmp.DTS;
|
||||||
@ -373,7 +396,7 @@ namespace VEPROMS.CSLA.Library
|
|||||||
if (tmp == null)
|
if (tmp == null)
|
||||||
{
|
{
|
||||||
tmp = DataPortal.Fetch<AssignmentInfo>(new PKCriteria(aid));
|
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;
|
if (tmp.ErrorMessage == "No Record Found") tmp = null;
|
||||||
return tmp;
|
return tmp;
|
||||||
@ -387,6 +410,7 @@ namespace VEPROMS.CSLA.Library
|
|||||||
#region Data Access Portal
|
#region Data Access Portal
|
||||||
internal AssignmentInfo(SafeDataReader dr)
|
internal AssignmentInfo(SafeDataReader dr)
|
||||||
{
|
{
|
||||||
|
_MyAssignmentInfoUnique = ++_AssignmentInfoUnique;
|
||||||
if (_MyLog.IsDebugEnabled) _MyLog.DebugFormat("[{0}] AssignmentInfo.Constructor", GetHashCode());
|
if (_MyLog.IsDebugEnabled) _MyLog.DebugFormat("[{0}] AssignmentInfo.Constructor", GetHashCode());
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
@ -65,15 +65,20 @@ namespace VEPROMS.CSLA.Library
|
|||||||
#endregion
|
#endregion
|
||||||
#region Collection
|
#region Collection
|
||||||
protected static List<Connection> _AllList = new List<Connection>();
|
protected static List<Connection> _AllList = new List<Connection>();
|
||||||
private static Dictionary<string, Connection> _AllByPrimaryKey = new Dictionary<string, Connection>();
|
private static Dictionary<string, List<Connection>> _AllByPrimaryKey = new Dictionary<string, List<Connection>>();
|
||||||
private static Dictionary<string, Connection> _AllByName = new Dictionary<string, Connection>();
|
private static Dictionary<string, List<Connection>> _AllByName = new Dictionary<string, List<Connection>>();
|
||||||
private static void ConvertListToDictionary()
|
private static void ConvertListToDictionary()
|
||||||
{
|
{
|
||||||
List<Connection> remove = new List<Connection>();
|
List<Connection> remove = new List<Connection>();
|
||||||
foreach (Connection tmp in _AllList)
|
foreach (Connection tmp in _AllList)
|
||||||
{
|
{
|
||||||
_AllByPrimaryKey[tmp.DBID.ToString()]=tmp; // Primary Key
|
if (!_AllByPrimaryKey.ContainsKey(tmp.DBID.ToString()))
|
||||||
_AllByName[tmp.Name.ToString()] = tmp; // Unique Index
|
{
|
||||||
|
_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);
|
remove.Add(tmp);
|
||||||
}
|
}
|
||||||
foreach (Connection tmp in remove)
|
foreach (Connection tmp in remove)
|
||||||
@ -83,14 +88,14 @@ namespace VEPROMS.CSLA.Library
|
|||||||
{
|
{
|
||||||
ConvertListToDictionary();
|
ConvertListToDictionary();
|
||||||
string key = dbid.ToString();
|
string key = dbid.ToString();
|
||||||
if (_AllByPrimaryKey.ContainsKey(key)) return _AllByPrimaryKey[key];
|
if (_AllByPrimaryKey.ContainsKey(key)) return _AllByPrimaryKey[key][0];
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
public static Connection GetExistingByName(string name)
|
public static Connection GetExistingByName(string name)
|
||||||
{
|
{
|
||||||
ConvertListToDictionary();
|
ConvertListToDictionary();
|
||||||
string key = name.ToString();
|
string key = name.ToString();
|
||||||
if (_AllByName.ContainsKey(key)) return _AllByName[key];
|
if (_AllByName.ContainsKey(key)) return _AllByName[key][0];
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
#endregion
|
#endregion
|
||||||
@ -328,7 +333,8 @@ namespace VEPROMS.CSLA.Library
|
|||||||
private bool _CheckingBrokenRules = false;
|
private bool _CheckingBrokenRules = false;
|
||||||
public IVEHasBrokenRules HasBrokenRules
|
public IVEHasBrokenRules HasBrokenRules
|
||||||
{
|
{
|
||||||
get {
|
get
|
||||||
|
{
|
||||||
if (_CheckingBrokenRules) return null;
|
if (_CheckingBrokenRules) return null;
|
||||||
if ((IsDirty || !IsNew) && BrokenRulesCollection.Count > 0) return this;
|
if ((IsDirty || !IsNew) && BrokenRulesCollection.Count > 0) return this;
|
||||||
try
|
try
|
||||||
@ -462,15 +468,29 @@ namespace VEPROMS.CSLA.Library
|
|||||||
#region Factory Methods
|
#region Factory Methods
|
||||||
public int CurrentEditLevel
|
public int CurrentEditLevel
|
||||||
{ get { return EditLevel; } }
|
{ get { return EditLevel; } }
|
||||||
|
private static int _ConnectionUnique = 0;
|
||||||
|
private int _MyConnectionUnique;
|
||||||
|
public int MyConnectionUnique
|
||||||
|
{
|
||||||
|
get { return _MyConnectionUnique; }
|
||||||
|
}
|
||||||
protected Connection()
|
protected Connection()
|
||||||
{/* require use of factory methods */
|
{/* require use of factory methods */
|
||||||
|
_MyConnectionUnique = ++_ConnectionUnique;
|
||||||
_AllList.Add(this);
|
_AllList.Add(this);
|
||||||
}
|
}
|
||||||
public void Dispose()
|
public void Dispose()
|
||||||
{
|
{
|
||||||
_AllList.Remove(this);
|
_AllList.Remove(this);
|
||||||
_AllByPrimaryKey.Remove(DBID.ToString());
|
if (!_AllByPrimaryKey.ContainsKey(DBID.ToString())) return;
|
||||||
_AllByName.Remove(Name.ToString());
|
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()
|
public static Connection New()
|
||||||
{
|
{
|
||||||
@ -548,7 +568,7 @@ namespace VEPROMS.CSLA.Library
|
|||||||
if (tmp == null)
|
if (tmp == null)
|
||||||
{
|
{
|
||||||
tmp = DataPortal.Fetch<Connection>(new PKCriteria(dbid));
|
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;
|
if (tmp.ErrorMessage == "No Record Found") tmp = null;
|
||||||
return tmp;
|
return tmp;
|
||||||
@ -568,7 +588,7 @@ namespace VEPROMS.CSLA.Library
|
|||||||
if (tmp == null)
|
if (tmp == null)
|
||||||
{
|
{
|
||||||
tmp = DataPortal.Fetch<Connection>(new NameCriteria(name));
|
tmp = DataPortal.Fetch<Connection>(new NameCriteria(name));
|
||||||
_AllList.Add(tmp);
|
if (!_AllList.Contains(tmp)) _AllList.Add(tmp);
|
||||||
}
|
}
|
||||||
if (tmp.ErrorMessage == "No Record Found") tmp = null;
|
if (tmp.ErrorMessage == "No Record Found") tmp = null;
|
||||||
return tmp;
|
return tmp;
|
||||||
|
@ -37,13 +37,17 @@ namespace VEPROMS.CSLA.Library
|
|||||||
#endregion
|
#endregion
|
||||||
#region Collection
|
#region Collection
|
||||||
protected static List<ConnectionInfo> _AllList = new List<ConnectionInfo>();
|
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()
|
private static void ConvertListToDictionary()
|
||||||
{
|
{
|
||||||
List<ConnectionInfo> remove = new List<ConnectionInfo>();
|
List<ConnectionInfo> remove = new List<ConnectionInfo>();
|
||||||
foreach (ConnectionInfo tmp in _AllList)
|
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);
|
remove.Add(tmp);
|
||||||
}
|
}
|
||||||
foreach (ConnectionInfo tmp in remove)
|
foreach (ConnectionInfo tmp in remove)
|
||||||
@ -57,7 +61,7 @@ namespace VEPROMS.CSLA.Library
|
|||||||
{
|
{
|
||||||
ConvertListToDictionary();
|
ConvertListToDictionary();
|
||||||
string key = dbid.ToString();
|
string key = dbid.ToString();
|
||||||
if (_AllByPrimaryKey.ContainsKey(key)) return _AllByPrimaryKey[key];
|
if (_AllByPrimaryKey.ContainsKey(key)) return _AllByPrimaryKey[key][0];
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
#endregion
|
#endregion
|
||||||
@ -192,7 +196,10 @@ namespace VEPROMS.CSLA.Library
|
|||||||
}
|
}
|
||||||
internal void RefreshConnectionFolders()
|
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
|
// TODO: Replace base ConnectionInfo.ToString function as necessary
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@ -214,14 +221,25 @@ namespace VEPROMS.CSLA.Library
|
|||||||
}
|
}
|
||||||
#endregion
|
#endregion
|
||||||
#region Factory Methods
|
#region Factory Methods
|
||||||
|
private static int _ConnectionInfoUnique = 0;
|
||||||
|
private int _MyConnectionInfoUnique;
|
||||||
|
public int MyConnectionInfoUnique
|
||||||
|
{
|
||||||
|
get { return _MyConnectionInfoUnique; }
|
||||||
|
}
|
||||||
private ConnectionInfo()
|
private ConnectionInfo()
|
||||||
{/* require use of factory methods */
|
{/* require use of factory methods */
|
||||||
|
_MyConnectionInfoUnique = ++_ConnectionInfoUnique;
|
||||||
_AllList.Add(this);
|
_AllList.Add(this);
|
||||||
}
|
}
|
||||||
public void Dispose()
|
public void Dispose()
|
||||||
{
|
{
|
||||||
_AllList.Remove(this);
|
_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()
|
public virtual Connection Get()
|
||||||
{
|
{
|
||||||
@ -229,8 +247,10 @@ namespace VEPROMS.CSLA.Library
|
|||||||
}
|
}
|
||||||
public static void Refresh(Connection tmp)
|
public static void Refresh(Connection tmp)
|
||||||
{
|
{
|
||||||
ConnectionInfo tmpInfo = GetExistingByPrimaryKey(tmp.DBID);
|
string key = tmp.DBID.ToString();
|
||||||
if (tmpInfo == null) return;
|
ConvertListToDictionary();
|
||||||
|
if (_AllByPrimaryKey.ContainsKey(key))
|
||||||
|
foreach (ConnectionInfo tmpInfo in _AllByPrimaryKey[key])
|
||||||
tmpInfo.RefreshFields(tmp);
|
tmpInfo.RefreshFields(tmp);
|
||||||
}
|
}
|
||||||
private void RefreshFields(Connection tmp)
|
private void RefreshFields(Connection tmp)
|
||||||
@ -255,7 +275,7 @@ namespace VEPROMS.CSLA.Library
|
|||||||
if (tmp == null)
|
if (tmp == null)
|
||||||
{
|
{
|
||||||
tmp = DataPortal.Fetch<ConnectionInfo>(new PKCriteria(dbid));
|
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;
|
if (tmp.ErrorMessage == "No Record Found") tmp = null;
|
||||||
return tmp;
|
return tmp;
|
||||||
@ -269,6 +289,7 @@ namespace VEPROMS.CSLA.Library
|
|||||||
#region Data Access Portal
|
#region Data Access Portal
|
||||||
internal ConnectionInfo(SafeDataReader dr)
|
internal ConnectionInfo(SafeDataReader dr)
|
||||||
{
|
{
|
||||||
|
_MyConnectionInfoUnique = ++_ConnectionInfoUnique;
|
||||||
if (_MyLog.IsDebugEnabled) _MyLog.DebugFormat("[{0}] ConnectionInfo.Constructor", GetHashCode());
|
if (_MyLog.IsDebugEnabled) _MyLog.DebugFormat("[{0}] ConnectionInfo.Constructor", GetHashCode());
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
@ -118,13 +118,17 @@ namespace VEPROMS.CSLA.Library
|
|||||||
#endregion
|
#endregion
|
||||||
#region Collection
|
#region Collection
|
||||||
protected static List<Content> _AllList = new List<Content>();
|
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()
|
private static void ConvertListToDictionary()
|
||||||
{
|
{
|
||||||
List<Content> remove = new List<Content>();
|
List<Content> remove = new List<Content>();
|
||||||
foreach (Content tmp in _AllList)
|
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);
|
remove.Add(tmp);
|
||||||
}
|
}
|
||||||
foreach (Content tmp in remove)
|
foreach (Content tmp in remove)
|
||||||
@ -134,7 +138,7 @@ namespace VEPROMS.CSLA.Library
|
|||||||
{
|
{
|
||||||
ConvertListToDictionary();
|
ConvertListToDictionary();
|
||||||
string key = contentID.ToString();
|
string key = contentID.ToString();
|
||||||
if (_AllByPrimaryKey.ContainsKey(key)) return _AllByPrimaryKey[key];
|
if (_AllByPrimaryKey.ContainsKey(key)) return _AllByPrimaryKey[key][0];
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
#endregion
|
#endregion
|
||||||
@ -564,7 +568,8 @@ namespace VEPROMS.CSLA.Library
|
|||||||
private bool _CheckingBrokenRules = false;
|
private bool _CheckingBrokenRules = false;
|
||||||
public IVEHasBrokenRules HasBrokenRules
|
public IVEHasBrokenRules HasBrokenRules
|
||||||
{
|
{
|
||||||
get {
|
get
|
||||||
|
{
|
||||||
if (_CheckingBrokenRules) return null;
|
if (_CheckingBrokenRules) return null;
|
||||||
if ((IsDirty || !IsNew) && BrokenRulesCollection.Count > 0) return this;
|
if ((IsDirty || !IsNew) && BrokenRulesCollection.Count > 0) return this;
|
||||||
try
|
try
|
||||||
@ -708,14 +713,25 @@ namespace VEPROMS.CSLA.Library
|
|||||||
#region Factory Methods
|
#region Factory Methods
|
||||||
public int CurrentEditLevel
|
public int CurrentEditLevel
|
||||||
{ get { return EditLevel; } }
|
{ get { return EditLevel; } }
|
||||||
|
private static int _ContentUnique = 0;
|
||||||
|
private int _MyContentUnique;
|
||||||
|
public int MyContentUnique
|
||||||
|
{
|
||||||
|
get { return _MyContentUnique; }
|
||||||
|
}
|
||||||
protected Content()
|
protected Content()
|
||||||
{/* require use of factory methods */
|
{/* require use of factory methods */
|
||||||
|
_MyContentUnique = ++_ContentUnique;
|
||||||
_AllList.Add(this);
|
_AllList.Add(this);
|
||||||
}
|
}
|
||||||
public void Dispose()
|
public void Dispose()
|
||||||
{
|
{
|
||||||
_AllList.Remove(this);
|
_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()
|
public static Content New()
|
||||||
{
|
{
|
||||||
@ -794,7 +810,7 @@ namespace VEPROMS.CSLA.Library
|
|||||||
if (tmp == null)
|
if (tmp == null)
|
||||||
{
|
{
|
||||||
tmp = DataPortal.Fetch<Content>(new PKCriteria(contentID));
|
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;
|
if (tmp.ErrorMessage == "No Record Found") tmp = null;
|
||||||
return tmp;
|
return tmp;
|
||||||
|
@ -37,13 +37,17 @@ namespace VEPROMS.CSLA.Library
|
|||||||
#endregion
|
#endregion
|
||||||
#region Collection
|
#region Collection
|
||||||
protected static List<ContentInfo> _AllList = new List<ContentInfo>();
|
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()
|
private static void ConvertListToDictionary()
|
||||||
{
|
{
|
||||||
List<ContentInfo> remove = new List<ContentInfo>();
|
List<ContentInfo> remove = new List<ContentInfo>();
|
||||||
foreach (ContentInfo tmp in _AllList)
|
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);
|
remove.Add(tmp);
|
||||||
}
|
}
|
||||||
foreach (ContentInfo tmp in remove)
|
foreach (ContentInfo tmp in remove)
|
||||||
@ -57,7 +61,7 @@ namespace VEPROMS.CSLA.Library
|
|||||||
{
|
{
|
||||||
ConvertListToDictionary();
|
ConvertListToDictionary();
|
||||||
string key = contentID.ToString();
|
string key = contentID.ToString();
|
||||||
if (_AllByPrimaryKey.ContainsKey(key)) return _AllByPrimaryKey[key];
|
if (_AllByPrimaryKey.ContainsKey(key)) return _AllByPrimaryKey[key][0];
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
#endregion
|
#endregion
|
||||||
@ -204,7 +208,10 @@ namespace VEPROMS.CSLA.Library
|
|||||||
}
|
}
|
||||||
internal void RefreshContentDetails()
|
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;
|
private int _ContentEntryCount = 0;
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@ -262,7 +269,10 @@ namespace VEPROMS.CSLA.Library
|
|||||||
}
|
}
|
||||||
internal void RefreshContentItems()
|
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;
|
private int _ContentPartCount = 0;
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@ -294,7 +304,10 @@ namespace VEPROMS.CSLA.Library
|
|||||||
}
|
}
|
||||||
internal void RefreshContentParts()
|
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;
|
private int _ContentRoUsageCount = 0;
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@ -326,7 +339,10 @@ namespace VEPROMS.CSLA.Library
|
|||||||
}
|
}
|
||||||
internal void RefreshContentRoUsages()
|
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;
|
private int _ContentTransitionCount = 0;
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@ -358,7 +374,10 @@ namespace VEPROMS.CSLA.Library
|
|||||||
}
|
}
|
||||||
internal void RefreshContentTransitions()
|
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;
|
private int _ContentZContentCount = 0;
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@ -406,14 +425,25 @@ namespace VEPROMS.CSLA.Library
|
|||||||
}
|
}
|
||||||
#endregion
|
#endregion
|
||||||
#region Factory Methods
|
#region Factory Methods
|
||||||
|
private static int _ContentInfoUnique = 0;
|
||||||
|
private int _MyContentInfoUnique;
|
||||||
|
public int MyContentInfoUnique
|
||||||
|
{
|
||||||
|
get { return _MyContentInfoUnique; }
|
||||||
|
}
|
||||||
private ContentInfo()
|
private ContentInfo()
|
||||||
{/* require use of factory methods */
|
{/* require use of factory methods */
|
||||||
|
_MyContentInfoUnique = ++_ContentInfoUnique;
|
||||||
_AllList.Add(this);
|
_AllList.Add(this);
|
||||||
}
|
}
|
||||||
public void Dispose()
|
public void Dispose()
|
||||||
{
|
{
|
||||||
_AllList.Remove(this);
|
_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()
|
public virtual Content Get()
|
||||||
{
|
{
|
||||||
@ -421,8 +451,10 @@ namespace VEPROMS.CSLA.Library
|
|||||||
}
|
}
|
||||||
public static void Refresh(Content tmp)
|
public static void Refresh(Content tmp)
|
||||||
{
|
{
|
||||||
ContentInfo tmpInfo = GetExistingByPrimaryKey(tmp.ContentID);
|
string key = tmp.ContentID.ToString();
|
||||||
if (tmpInfo == null) return;
|
ConvertListToDictionary();
|
||||||
|
if (_AllByPrimaryKey.ContainsKey(key))
|
||||||
|
foreach (ContentInfo tmpInfo in _AllByPrimaryKey[key])
|
||||||
tmpInfo.RefreshFields(tmp);
|
tmpInfo.RefreshFields(tmp);
|
||||||
}
|
}
|
||||||
private void RefreshFields(Content tmp)
|
private void RefreshFields(Content tmp)
|
||||||
@ -434,9 +466,9 @@ namespace VEPROMS.CSLA.Library
|
|||||||
{
|
{
|
||||||
MyFormat.RefreshFormatContents(); // Update List for old value
|
MyFormat.RefreshFormatContents(); // Update List for old value
|
||||||
_FormatID = tmp.FormatID; // Update the 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;
|
_Config = tmp.Config;
|
||||||
_DTS = tmp.DTS;
|
_DTS = tmp.DTS;
|
||||||
_UserID = tmp.UserID;
|
_UserID = tmp.UserID;
|
||||||
@ -448,8 +480,10 @@ namespace VEPROMS.CSLA.Library
|
|||||||
}
|
}
|
||||||
public static void Refresh(FormatContent tmp)
|
public static void Refresh(FormatContent tmp)
|
||||||
{
|
{
|
||||||
ContentInfo tmpInfo = GetExistingByPrimaryKey(tmp.ContentID);
|
string key = tmp.ContentID.ToString();
|
||||||
if (tmpInfo == null) return;
|
ConvertListToDictionary();
|
||||||
|
if (_AllByPrimaryKey.ContainsKey(key))
|
||||||
|
foreach (ContentInfo tmpInfo in _AllByPrimaryKey[key])
|
||||||
tmpInfo.RefreshFields(tmp);
|
tmpInfo.RefreshFields(tmp);
|
||||||
}
|
}
|
||||||
private void RefreshFields(FormatContent tmp)
|
private void RefreshFields(FormatContent tmp)
|
||||||
@ -476,7 +510,7 @@ namespace VEPROMS.CSLA.Library
|
|||||||
if (tmp == null)
|
if (tmp == null)
|
||||||
{
|
{
|
||||||
tmp = DataPortal.Fetch<ContentInfo>(new PKCriteria(contentID));
|
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;
|
if (tmp.ErrorMessage == "No Record Found") tmp = null;
|
||||||
return tmp;
|
return tmp;
|
||||||
@ -490,6 +524,7 @@ namespace VEPROMS.CSLA.Library
|
|||||||
#region Data Access Portal
|
#region Data Access Portal
|
||||||
internal ContentInfo(SafeDataReader dr)
|
internal ContentInfo(SafeDataReader dr)
|
||||||
{
|
{
|
||||||
|
_MyContentInfoUnique = ++_ContentInfoUnique;
|
||||||
if (_MyLog.IsDebugEnabled) _MyLog.DebugFormat("[{0}] ContentInfo.Constructor", GetHashCode());
|
if (_MyLog.IsDebugEnabled) _MyLog.DebugFormat("[{0}] ContentInfo.Constructor", GetHashCode());
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
@ -53,13 +53,17 @@ namespace VEPROMS.CSLA.Library
|
|||||||
#endregion
|
#endregion
|
||||||
#region Collection
|
#region Collection
|
||||||
protected static List<Detail> _AllList = new List<Detail>();
|
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()
|
private static void ConvertListToDictionary()
|
||||||
{
|
{
|
||||||
List<Detail> remove = new List<Detail>();
|
List<Detail> remove = new List<Detail>();
|
||||||
foreach (Detail tmp in _AllList)
|
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);
|
remove.Add(tmp);
|
||||||
}
|
}
|
||||||
foreach (Detail tmp in remove)
|
foreach (Detail tmp in remove)
|
||||||
@ -69,7 +73,7 @@ namespace VEPROMS.CSLA.Library
|
|||||||
{
|
{
|
||||||
ConvertListToDictionary();
|
ConvertListToDictionary();
|
||||||
string key = detailID.ToString();
|
string key = detailID.ToString();
|
||||||
if (_AllByPrimaryKey.ContainsKey(key)) return _AllByPrimaryKey[key];
|
if (_AllByPrimaryKey.ContainsKey(key)) return _AllByPrimaryKey[key][0];
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
#endregion
|
#endregion
|
||||||
@ -263,7 +267,8 @@ namespace VEPROMS.CSLA.Library
|
|||||||
private bool _CheckingBrokenRules = false;
|
private bool _CheckingBrokenRules = false;
|
||||||
public IVEHasBrokenRules HasBrokenRules
|
public IVEHasBrokenRules HasBrokenRules
|
||||||
{
|
{
|
||||||
get {
|
get
|
||||||
|
{
|
||||||
if (_CheckingBrokenRules) return null;
|
if (_CheckingBrokenRules) return null;
|
||||||
if ((IsDirty || !IsNew) && BrokenRulesCollection.Count > 0) return this;
|
if ((IsDirty || !IsNew) && BrokenRulesCollection.Count > 0) return this;
|
||||||
try
|
try
|
||||||
@ -388,14 +393,25 @@ namespace VEPROMS.CSLA.Library
|
|||||||
#region Factory Methods
|
#region Factory Methods
|
||||||
public int CurrentEditLevel
|
public int CurrentEditLevel
|
||||||
{ get { return EditLevel; } }
|
{ get { return EditLevel; } }
|
||||||
|
private static int _DetailUnique = 0;
|
||||||
|
private int _MyDetailUnique;
|
||||||
|
public int MyDetailUnique
|
||||||
|
{
|
||||||
|
get { return _MyDetailUnique; }
|
||||||
|
}
|
||||||
protected Detail()
|
protected Detail()
|
||||||
{/* require use of factory methods */
|
{/* require use of factory methods */
|
||||||
|
_MyDetailUnique = ++_DetailUnique;
|
||||||
_AllList.Add(this);
|
_AllList.Add(this);
|
||||||
}
|
}
|
||||||
public void Dispose()
|
public void Dispose()
|
||||||
{
|
{
|
||||||
_AllList.Remove(this);
|
_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()
|
public static Detail New()
|
||||||
{
|
{
|
||||||
@ -480,7 +496,7 @@ namespace VEPROMS.CSLA.Library
|
|||||||
if (tmp == null)
|
if (tmp == null)
|
||||||
{
|
{
|
||||||
tmp = DataPortal.Fetch<Detail>(new PKCriteria(detailID));
|
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;
|
if (tmp.ErrorMessage == "No Record Found") tmp = null;
|
||||||
return tmp;
|
return tmp;
|
||||||
|
@ -37,13 +37,17 @@ namespace VEPROMS.CSLA.Library
|
|||||||
#endregion
|
#endregion
|
||||||
#region Collection
|
#region Collection
|
||||||
protected static List<DetailInfo> _AllList = new List<DetailInfo>();
|
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()
|
private static void ConvertListToDictionary()
|
||||||
{
|
{
|
||||||
List<DetailInfo> remove = new List<DetailInfo>();
|
List<DetailInfo> remove = new List<DetailInfo>();
|
||||||
foreach (DetailInfo tmp in _AllList)
|
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);
|
remove.Add(tmp);
|
||||||
}
|
}
|
||||||
foreach (DetailInfo tmp in remove)
|
foreach (DetailInfo tmp in remove)
|
||||||
@ -57,7 +61,7 @@ namespace VEPROMS.CSLA.Library
|
|||||||
{
|
{
|
||||||
ConvertListToDictionary();
|
ConvertListToDictionary();
|
||||||
string key = detailID.ToString();
|
string key = detailID.ToString();
|
||||||
if (_AllByPrimaryKey.ContainsKey(key)) return _AllByPrimaryKey[key];
|
if (_AllByPrimaryKey.ContainsKey(key)) return _AllByPrimaryKey[key][0];
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
#endregion
|
#endregion
|
||||||
@ -181,14 +185,25 @@ namespace VEPROMS.CSLA.Library
|
|||||||
}
|
}
|
||||||
#endregion
|
#endregion
|
||||||
#region Factory Methods
|
#region Factory Methods
|
||||||
|
private static int _DetailInfoUnique = 0;
|
||||||
|
private int _MyDetailInfoUnique;
|
||||||
|
public int MyDetailInfoUnique
|
||||||
|
{
|
||||||
|
get { return _MyDetailInfoUnique; }
|
||||||
|
}
|
||||||
private DetailInfo()
|
private DetailInfo()
|
||||||
{/* require use of factory methods */
|
{/* require use of factory methods */
|
||||||
|
_MyDetailInfoUnique = ++_DetailInfoUnique;
|
||||||
_AllList.Add(this);
|
_AllList.Add(this);
|
||||||
}
|
}
|
||||||
public void Dispose()
|
public void Dispose()
|
||||||
{
|
{
|
||||||
_AllList.Remove(this);
|
_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()
|
public virtual Detail Get()
|
||||||
{
|
{
|
||||||
@ -196,8 +211,10 @@ namespace VEPROMS.CSLA.Library
|
|||||||
}
|
}
|
||||||
public static void Refresh(Detail tmp)
|
public static void Refresh(Detail tmp)
|
||||||
{
|
{
|
||||||
DetailInfo tmpInfo = GetExistingByPrimaryKey(tmp.DetailID);
|
string key = tmp.DetailID.ToString();
|
||||||
if (tmpInfo == null) return;
|
ConvertListToDictionary();
|
||||||
|
if (_AllByPrimaryKey.ContainsKey(key))
|
||||||
|
foreach (DetailInfo tmpInfo in _AllByPrimaryKey[key])
|
||||||
tmpInfo.RefreshFields(tmp);
|
tmpInfo.RefreshFields(tmp);
|
||||||
}
|
}
|
||||||
private void RefreshFields(Detail tmp)
|
private void RefreshFields(Detail tmp)
|
||||||
@ -206,9 +223,9 @@ namespace VEPROMS.CSLA.Library
|
|||||||
{
|
{
|
||||||
MyContent.RefreshContentDetails(); // Update List for old value
|
MyContent.RefreshContentDetails(); // Update List for old value
|
||||||
_ContentID = tmp.ContentID; // Update the 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;
|
_ItemType = tmp.ItemType;
|
||||||
_Text = tmp.Text;
|
_Text = tmp.Text;
|
||||||
_Config = tmp.Config;
|
_Config = tmp.Config;
|
||||||
@ -220,8 +237,10 @@ namespace VEPROMS.CSLA.Library
|
|||||||
}
|
}
|
||||||
public static void Refresh(ContentDetail tmp)
|
public static void Refresh(ContentDetail tmp)
|
||||||
{
|
{
|
||||||
DetailInfo tmpInfo = GetExistingByPrimaryKey(tmp.DetailID);
|
string key = tmp.DetailID.ToString();
|
||||||
if (tmpInfo == null) return;
|
ConvertListToDictionary();
|
||||||
|
if (_AllByPrimaryKey.ContainsKey(key))
|
||||||
|
foreach (DetailInfo tmpInfo in _AllByPrimaryKey[key])
|
||||||
tmpInfo.RefreshFields(tmp);
|
tmpInfo.RefreshFields(tmp);
|
||||||
}
|
}
|
||||||
private void RefreshFields(ContentDetail tmp)
|
private void RefreshFields(ContentDetail tmp)
|
||||||
@ -245,7 +264,7 @@ namespace VEPROMS.CSLA.Library
|
|||||||
if (tmp == null)
|
if (tmp == null)
|
||||||
{
|
{
|
||||||
tmp = DataPortal.Fetch<DetailInfo>(new PKCriteria(detailID));
|
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;
|
if (tmp.ErrorMessage == "No Record Found") tmp = null;
|
||||||
return tmp;
|
return tmp;
|
||||||
@ -259,6 +278,7 @@ namespace VEPROMS.CSLA.Library
|
|||||||
#region Data Access Portal
|
#region Data Access Portal
|
||||||
internal DetailInfo(SafeDataReader dr)
|
internal DetailInfo(SafeDataReader dr)
|
||||||
{
|
{
|
||||||
|
_MyDetailInfoUnique = ++_DetailInfoUnique;
|
||||||
if (_MyLog.IsDebugEnabled) _MyLog.DebugFormat("[{0}] DetailInfo.Constructor", GetHashCode());
|
if (_MyLog.IsDebugEnabled) _MyLog.DebugFormat("[{0}] DetailInfo.Constructor", GetHashCode());
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
@ -55,13 +55,17 @@ namespace VEPROMS.CSLA.Library
|
|||||||
#endregion
|
#endregion
|
||||||
#region Collection
|
#region Collection
|
||||||
protected static List<DocVersion> _AllList = new List<DocVersion>();
|
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()
|
private static void ConvertListToDictionary()
|
||||||
{
|
{
|
||||||
List<DocVersion> remove = new List<DocVersion>();
|
List<DocVersion> remove = new List<DocVersion>();
|
||||||
foreach (DocVersion tmp in _AllList)
|
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);
|
remove.Add(tmp);
|
||||||
}
|
}
|
||||||
foreach (DocVersion tmp in remove)
|
foreach (DocVersion tmp in remove)
|
||||||
@ -71,7 +75,7 @@ namespace VEPROMS.CSLA.Library
|
|||||||
{
|
{
|
||||||
ConvertListToDictionary();
|
ConvertListToDictionary();
|
||||||
string key = versionID.ToString();
|
string key = versionID.ToString();
|
||||||
if (_AllByPrimaryKey.ContainsKey(key)) return _AllByPrimaryKey[key];
|
if (_AllByPrimaryKey.ContainsKey(key)) return _AllByPrimaryKey[key][0];
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
#endregion
|
#endregion
|
||||||
@ -355,7 +359,8 @@ namespace VEPROMS.CSLA.Library
|
|||||||
private bool _CheckingBrokenRules = false;
|
private bool _CheckingBrokenRules = false;
|
||||||
public IVEHasBrokenRules HasBrokenRules
|
public IVEHasBrokenRules HasBrokenRules
|
||||||
{
|
{
|
||||||
get {
|
get
|
||||||
|
{
|
||||||
if (_CheckingBrokenRules) return null;
|
if (_CheckingBrokenRules) return null;
|
||||||
if ((IsDirty || !IsNew) && BrokenRulesCollection.Count > 0) return this;
|
if ((IsDirty || !IsNew) && BrokenRulesCollection.Count > 0) return this;
|
||||||
try
|
try
|
||||||
@ -491,14 +496,25 @@ namespace VEPROMS.CSLA.Library
|
|||||||
#region Factory Methods
|
#region Factory Methods
|
||||||
public int CurrentEditLevel
|
public int CurrentEditLevel
|
||||||
{ get { return EditLevel; } }
|
{ get { return EditLevel; } }
|
||||||
|
private static int _DocVersionUnique = 0;
|
||||||
|
private int _MyDocVersionUnique;
|
||||||
|
public int MyDocVersionUnique
|
||||||
|
{
|
||||||
|
get { return _MyDocVersionUnique; }
|
||||||
|
}
|
||||||
protected DocVersion()
|
protected DocVersion()
|
||||||
{/* require use of factory methods */
|
{/* require use of factory methods */
|
||||||
|
_MyDocVersionUnique = ++_DocVersionUnique;
|
||||||
_AllList.Add(this);
|
_AllList.Add(this);
|
||||||
}
|
}
|
||||||
public void Dispose()
|
public void Dispose()
|
||||||
{
|
{
|
||||||
_AllList.Remove(this);
|
_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()
|
public static DocVersion New()
|
||||||
{
|
{
|
||||||
@ -587,7 +603,7 @@ namespace VEPROMS.CSLA.Library
|
|||||||
if (tmp == null)
|
if (tmp == null)
|
||||||
{
|
{
|
||||||
tmp = DataPortal.Fetch<DocVersion>(new PKCriteria(versionID));
|
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;
|
if (tmp.ErrorMessage == "No Record Found") tmp = null;
|
||||||
return tmp;
|
return tmp;
|
||||||
|
@ -37,13 +37,17 @@ namespace VEPROMS.CSLA.Library
|
|||||||
#endregion
|
#endregion
|
||||||
#region Collection
|
#region Collection
|
||||||
protected static List<DocVersionInfo> _AllList = new List<DocVersionInfo>();
|
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()
|
private static void ConvertListToDictionary()
|
||||||
{
|
{
|
||||||
List<DocVersionInfo> remove = new List<DocVersionInfo>();
|
List<DocVersionInfo> remove = new List<DocVersionInfo>();
|
||||||
foreach (DocVersionInfo tmp in _AllList)
|
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);
|
remove.Add(tmp);
|
||||||
}
|
}
|
||||||
foreach (DocVersionInfo tmp in remove)
|
foreach (DocVersionInfo tmp in remove)
|
||||||
@ -57,7 +61,7 @@ namespace VEPROMS.CSLA.Library
|
|||||||
{
|
{
|
||||||
ConvertListToDictionary();
|
ConvertListToDictionary();
|
||||||
string key = versionID.ToString();
|
string key = versionID.ToString();
|
||||||
if (_AllByPrimaryKey.ContainsKey(key)) return _AllByPrimaryKey[key];
|
if (_AllByPrimaryKey.ContainsKey(key)) return _AllByPrimaryKey[key][0];
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
#endregion
|
#endregion
|
||||||
@ -238,14 +242,25 @@ namespace VEPROMS.CSLA.Library
|
|||||||
}
|
}
|
||||||
#endregion
|
#endregion
|
||||||
#region Factory Methods
|
#region Factory Methods
|
||||||
|
private static int _DocVersionInfoUnique = 0;
|
||||||
|
private int _MyDocVersionInfoUnique;
|
||||||
|
public int MyDocVersionInfoUnique
|
||||||
|
{
|
||||||
|
get { return _MyDocVersionInfoUnique; }
|
||||||
|
}
|
||||||
private DocVersionInfo()
|
private DocVersionInfo()
|
||||||
{/* require use of factory methods */
|
{/* require use of factory methods */
|
||||||
|
_MyDocVersionInfoUnique = ++_DocVersionInfoUnique;
|
||||||
_AllList.Add(this);
|
_AllList.Add(this);
|
||||||
}
|
}
|
||||||
public void Dispose()
|
public void Dispose()
|
||||||
{
|
{
|
||||||
_AllList.Remove(this);
|
_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()
|
public virtual DocVersion Get()
|
||||||
{
|
{
|
||||||
@ -253,8 +268,10 @@ namespace VEPROMS.CSLA.Library
|
|||||||
}
|
}
|
||||||
public static void Refresh(DocVersion tmp)
|
public static void Refresh(DocVersion tmp)
|
||||||
{
|
{
|
||||||
DocVersionInfo tmpInfo = GetExistingByPrimaryKey(tmp.VersionID);
|
string key = tmp.VersionID.ToString();
|
||||||
if (tmpInfo == null) return;
|
ConvertListToDictionary();
|
||||||
|
if (_AllByPrimaryKey.ContainsKey(key))
|
||||||
|
foreach (DocVersionInfo tmpInfo in _AllByPrimaryKey[key])
|
||||||
tmpInfo.RefreshFields(tmp);
|
tmpInfo.RefreshFields(tmp);
|
||||||
}
|
}
|
||||||
private void RefreshFields(DocVersion tmp)
|
private void RefreshFields(DocVersion tmp)
|
||||||
@ -263,9 +280,9 @@ namespace VEPROMS.CSLA.Library
|
|||||||
{
|
{
|
||||||
MyFolder.RefreshFolderDocVersions(); // Update List for old value
|
MyFolder.RefreshFolderDocVersions(); // Update List for old value
|
||||||
_FolderID = tmp.FolderID; // Update the 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;
|
_VersionType = tmp.VersionType;
|
||||||
_Name = tmp.Name;
|
_Name = tmp.Name;
|
||||||
_Title = tmp.Title;
|
_Title = tmp.Title;
|
||||||
@ -273,16 +290,16 @@ namespace VEPROMS.CSLA.Library
|
|||||||
{
|
{
|
||||||
MyItem.RefreshItemDocVersions(); // Update List for old value
|
MyItem.RefreshItemDocVersions(); // Update List for old value
|
||||||
_ItemID = tmp.ItemID; // Update the 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)
|
if (_FormatID != tmp.FormatID)
|
||||||
{
|
{
|
||||||
MyFormat.RefreshFormatDocVersions(); // Update List for old value
|
MyFormat.RefreshFormatDocVersions(); // Update List for old value
|
||||||
_FormatID = tmp.FormatID; // Update the 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;
|
_Config = tmp.Config;
|
||||||
_DTS = tmp.DTS;
|
_DTS = tmp.DTS;
|
||||||
_UserID = tmp.UserID;
|
_UserID = tmp.UserID;
|
||||||
@ -294,8 +311,10 @@ namespace VEPROMS.CSLA.Library
|
|||||||
}
|
}
|
||||||
public static void Refresh(FolderDocVersion tmp)
|
public static void Refresh(FolderDocVersion tmp)
|
||||||
{
|
{
|
||||||
DocVersionInfo tmpInfo = GetExistingByPrimaryKey(tmp.VersionID);
|
string key = tmp.VersionID.ToString();
|
||||||
if (tmpInfo == null) return;
|
ConvertListToDictionary();
|
||||||
|
if (_AllByPrimaryKey.ContainsKey(key))
|
||||||
|
foreach (DocVersionInfo tmpInfo in _AllByPrimaryKey[key])
|
||||||
tmpInfo.RefreshFields(tmp);
|
tmpInfo.RefreshFields(tmp);
|
||||||
}
|
}
|
||||||
private void RefreshFields(FolderDocVersion tmp)
|
private void RefreshFields(FolderDocVersion tmp)
|
||||||
@ -307,16 +326,16 @@ namespace VEPROMS.CSLA.Library
|
|||||||
{
|
{
|
||||||
MyItem.RefreshItemDocVersions(); // Update List for old value
|
MyItem.RefreshItemDocVersions(); // Update List for old value
|
||||||
_ItemID = tmp.ItemID; // Update the 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)
|
if (_FormatID != tmp.FormatID)
|
||||||
{
|
{
|
||||||
MyFormat.RefreshFormatDocVersions(); // Update List for old value
|
MyFormat.RefreshFormatDocVersions(); // Update List for old value
|
||||||
_FormatID = tmp.FormatID; // Update the 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;
|
_Config = tmp.Config;
|
||||||
_DTS = tmp.DTS;
|
_DTS = tmp.DTS;
|
||||||
_UserID = tmp.UserID;
|
_UserID = tmp.UserID;
|
||||||
@ -328,8 +347,10 @@ namespace VEPROMS.CSLA.Library
|
|||||||
}
|
}
|
||||||
public static void Refresh(FormatDocVersion tmp)
|
public static void Refresh(FormatDocVersion tmp)
|
||||||
{
|
{
|
||||||
DocVersionInfo tmpInfo = GetExistingByPrimaryKey(tmp.VersionID);
|
string key = tmp.VersionID.ToString();
|
||||||
if (tmpInfo == null) return;
|
ConvertListToDictionary();
|
||||||
|
if (_AllByPrimaryKey.ContainsKey(key))
|
||||||
|
foreach (DocVersionInfo tmpInfo in _AllByPrimaryKey[key])
|
||||||
tmpInfo.RefreshFields(tmp);
|
tmpInfo.RefreshFields(tmp);
|
||||||
}
|
}
|
||||||
private void RefreshFields(FormatDocVersion tmp)
|
private void RefreshFields(FormatDocVersion tmp)
|
||||||
@ -338,9 +359,9 @@ namespace VEPROMS.CSLA.Library
|
|||||||
{
|
{
|
||||||
MyFolder.RefreshFolderDocVersions(); // Update List for old value
|
MyFolder.RefreshFolderDocVersions(); // Update List for old value
|
||||||
_FolderID = tmp.FolderID; // Update the 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;
|
_VersionType = tmp.VersionType;
|
||||||
_Name = tmp.Name;
|
_Name = tmp.Name;
|
||||||
_Title = tmp.Title;
|
_Title = tmp.Title;
|
||||||
@ -348,9 +369,9 @@ namespace VEPROMS.CSLA.Library
|
|||||||
{
|
{
|
||||||
MyItem.RefreshItemDocVersions(); // Update List for old value
|
MyItem.RefreshItemDocVersions(); // Update List for old value
|
||||||
_ItemID = tmp.ItemID; // Update the 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;
|
_Config = tmp.Config;
|
||||||
_DTS = tmp.DTS;
|
_DTS = tmp.DTS;
|
||||||
_UserID = tmp.UserID;
|
_UserID = tmp.UserID;
|
||||||
@ -362,8 +383,10 @@ namespace VEPROMS.CSLA.Library
|
|||||||
}
|
}
|
||||||
public static void Refresh(ItemDocVersion tmp)
|
public static void Refresh(ItemDocVersion tmp)
|
||||||
{
|
{
|
||||||
DocVersionInfo tmpInfo = GetExistingByPrimaryKey(tmp.VersionID);
|
string key = tmp.VersionID.ToString();
|
||||||
if (tmpInfo == null) return;
|
ConvertListToDictionary();
|
||||||
|
if (_AllByPrimaryKey.ContainsKey(key))
|
||||||
|
foreach (DocVersionInfo tmpInfo in _AllByPrimaryKey[key])
|
||||||
tmpInfo.RefreshFields(tmp);
|
tmpInfo.RefreshFields(tmp);
|
||||||
}
|
}
|
||||||
private void RefreshFields(ItemDocVersion tmp)
|
private void RefreshFields(ItemDocVersion tmp)
|
||||||
@ -372,9 +395,9 @@ namespace VEPROMS.CSLA.Library
|
|||||||
{
|
{
|
||||||
MyFolder.RefreshFolderDocVersions(); // Update List for old value
|
MyFolder.RefreshFolderDocVersions(); // Update List for old value
|
||||||
_FolderID = tmp.FolderID; // Update the 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;
|
_VersionType = tmp.VersionType;
|
||||||
_Name = tmp.Name;
|
_Name = tmp.Name;
|
||||||
_Title = tmp.Title;
|
_Title = tmp.Title;
|
||||||
@ -382,9 +405,9 @@ namespace VEPROMS.CSLA.Library
|
|||||||
{
|
{
|
||||||
MyFormat.RefreshFormatDocVersions(); // Update List for old value
|
MyFormat.RefreshFormatDocVersions(); // Update List for old value
|
||||||
_FormatID = tmp.FormatID; // Update the 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;
|
_Config = tmp.Config;
|
||||||
_DTS = tmp.DTS;
|
_DTS = tmp.DTS;
|
||||||
_UserID = tmp.UserID;
|
_UserID = tmp.UserID;
|
||||||
@ -404,7 +427,7 @@ namespace VEPROMS.CSLA.Library
|
|||||||
if (tmp == null)
|
if (tmp == null)
|
||||||
{
|
{
|
||||||
tmp = DataPortal.Fetch<DocVersionInfo>(new PKCriteria(versionID));
|
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;
|
if (tmp.ErrorMessage == "No Record Found") tmp = null;
|
||||||
return tmp;
|
return tmp;
|
||||||
@ -418,6 +441,7 @@ namespace VEPROMS.CSLA.Library
|
|||||||
#region Data Access Portal
|
#region Data Access Portal
|
||||||
internal DocVersionInfo(SafeDataReader dr)
|
internal DocVersionInfo(SafeDataReader dr)
|
||||||
{
|
{
|
||||||
|
_MyDocVersionInfoUnique = ++_DocVersionInfoUnique;
|
||||||
if (_MyLog.IsDebugEnabled) _MyLog.DebugFormat("[{0}] DocVersionInfo.Constructor", GetHashCode());
|
if (_MyLog.IsDebugEnabled) _MyLog.DebugFormat("[{0}] DocVersionInfo.Constructor", GetHashCode());
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
@ -65,13 +65,17 @@ namespace VEPROMS.CSLA.Library
|
|||||||
#endregion
|
#endregion
|
||||||
#region Collection
|
#region Collection
|
||||||
protected static List<Document> _AllList = new List<Document>();
|
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()
|
private static void ConvertListToDictionary()
|
||||||
{
|
{
|
||||||
List<Document> remove = new List<Document>();
|
List<Document> remove = new List<Document>();
|
||||||
foreach (Document tmp in _AllList)
|
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);
|
remove.Add(tmp);
|
||||||
}
|
}
|
||||||
foreach (Document tmp in remove)
|
foreach (Document tmp in remove)
|
||||||
@ -81,7 +85,7 @@ namespace VEPROMS.CSLA.Library
|
|||||||
{
|
{
|
||||||
ConvertListToDictionary();
|
ConvertListToDictionary();
|
||||||
string key = docID.ToString();
|
string key = docID.ToString();
|
||||||
if (_AllByPrimaryKey.ContainsKey(key)) return _AllByPrimaryKey[key];
|
if (_AllByPrimaryKey.ContainsKey(key)) return _AllByPrimaryKey[key][0];
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
#endregion
|
#endregion
|
||||||
@ -301,7 +305,8 @@ namespace VEPROMS.CSLA.Library
|
|||||||
private bool _CheckingBrokenRules = false;
|
private bool _CheckingBrokenRules = false;
|
||||||
public IVEHasBrokenRules HasBrokenRules
|
public IVEHasBrokenRules HasBrokenRules
|
||||||
{
|
{
|
||||||
get {
|
get
|
||||||
|
{
|
||||||
if (_CheckingBrokenRules) return null;
|
if (_CheckingBrokenRules) return null;
|
||||||
if ((IsDirty || !IsNew) && BrokenRulesCollection.Count > 0) return this;
|
if ((IsDirty || !IsNew) && BrokenRulesCollection.Count > 0) return this;
|
||||||
try
|
try
|
||||||
@ -430,14 +435,25 @@ namespace VEPROMS.CSLA.Library
|
|||||||
#region Factory Methods
|
#region Factory Methods
|
||||||
public int CurrentEditLevel
|
public int CurrentEditLevel
|
||||||
{ get { return EditLevel; } }
|
{ get { return EditLevel; } }
|
||||||
|
private static int _DocumentUnique = 0;
|
||||||
|
private int _MyDocumentUnique;
|
||||||
|
public int MyDocumentUnique
|
||||||
|
{
|
||||||
|
get { return _MyDocumentUnique; }
|
||||||
|
}
|
||||||
protected Document()
|
protected Document()
|
||||||
{/* require use of factory methods */
|
{/* require use of factory methods */
|
||||||
|
_MyDocumentUnique = ++_DocumentUnique;
|
||||||
_AllList.Add(this);
|
_AllList.Add(this);
|
||||||
}
|
}
|
||||||
public void Dispose()
|
public void Dispose()
|
||||||
{
|
{
|
||||||
_AllList.Remove(this);
|
_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()
|
public static Document New()
|
||||||
{
|
{
|
||||||
@ -514,7 +530,7 @@ namespace VEPROMS.CSLA.Library
|
|||||||
if (tmp == null)
|
if (tmp == null)
|
||||||
{
|
{
|
||||||
tmp = DataPortal.Fetch<Document>(new PKCriteria(docID));
|
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;
|
if (tmp.ErrorMessage == "No Record Found") tmp = null;
|
||||||
return tmp;
|
return tmp;
|
||||||
|
@ -37,13 +37,17 @@ namespace VEPROMS.CSLA.Library
|
|||||||
#endregion
|
#endregion
|
||||||
#region Collection
|
#region Collection
|
||||||
protected static List<DocumentInfo> _AllList = new List<DocumentInfo>();
|
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()
|
private static void ConvertListToDictionary()
|
||||||
{
|
{
|
||||||
List<DocumentInfo> remove = new List<DocumentInfo>();
|
List<DocumentInfo> remove = new List<DocumentInfo>();
|
||||||
foreach (DocumentInfo tmp in _AllList)
|
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);
|
remove.Add(tmp);
|
||||||
}
|
}
|
||||||
foreach (DocumentInfo tmp in remove)
|
foreach (DocumentInfo tmp in remove)
|
||||||
@ -57,7 +61,7 @@ namespace VEPROMS.CSLA.Library
|
|||||||
{
|
{
|
||||||
ConvertListToDictionary();
|
ConvertListToDictionary();
|
||||||
string key = docID.ToString();
|
string key = docID.ToString();
|
||||||
if (_AllByPrimaryKey.ContainsKey(key)) return _AllByPrimaryKey[key];
|
if (_AllByPrimaryKey.ContainsKey(key)) return _AllByPrimaryKey[key][0];
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
#endregion
|
#endregion
|
||||||
@ -185,7 +189,10 @@ namespace VEPROMS.CSLA.Library
|
|||||||
}
|
}
|
||||||
internal void RefreshDocumentEntries()
|
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
|
// TODO: Replace base DocumentInfo.ToString function as necessary
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@ -207,14 +214,25 @@ namespace VEPROMS.CSLA.Library
|
|||||||
}
|
}
|
||||||
#endregion
|
#endregion
|
||||||
#region Factory Methods
|
#region Factory Methods
|
||||||
|
private static int _DocumentInfoUnique = 0;
|
||||||
|
private int _MyDocumentInfoUnique;
|
||||||
|
public int MyDocumentInfoUnique
|
||||||
|
{
|
||||||
|
get { return _MyDocumentInfoUnique; }
|
||||||
|
}
|
||||||
private DocumentInfo()
|
private DocumentInfo()
|
||||||
{/* require use of factory methods */
|
{/* require use of factory methods */
|
||||||
|
_MyDocumentInfoUnique = ++_DocumentInfoUnique;
|
||||||
_AllList.Add(this);
|
_AllList.Add(this);
|
||||||
}
|
}
|
||||||
public void Dispose()
|
public void Dispose()
|
||||||
{
|
{
|
||||||
_AllList.Remove(this);
|
_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()
|
public virtual Document Get()
|
||||||
{
|
{
|
||||||
@ -222,8 +240,10 @@ namespace VEPROMS.CSLA.Library
|
|||||||
}
|
}
|
||||||
public static void Refresh(Document tmp)
|
public static void Refresh(Document tmp)
|
||||||
{
|
{
|
||||||
DocumentInfo tmpInfo = GetExistingByPrimaryKey(tmp.DocID);
|
string key = tmp.DocID.ToString();
|
||||||
if (tmpInfo == null) return;
|
ConvertListToDictionary();
|
||||||
|
if (_AllByPrimaryKey.ContainsKey(key))
|
||||||
|
foreach (DocumentInfo tmpInfo in _AllByPrimaryKey[key])
|
||||||
tmpInfo.RefreshFields(tmp);
|
tmpInfo.RefreshFields(tmp);
|
||||||
}
|
}
|
||||||
private void RefreshFields(Document tmp)
|
private void RefreshFields(Document tmp)
|
||||||
@ -247,7 +267,7 @@ namespace VEPROMS.CSLA.Library
|
|||||||
if (tmp == null)
|
if (tmp == null)
|
||||||
{
|
{
|
||||||
tmp = DataPortal.Fetch<DocumentInfo>(new PKCriteria(docID));
|
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;
|
if (tmp.ErrorMessage == "No Record Found") tmp = null;
|
||||||
return tmp;
|
return tmp;
|
||||||
@ -261,6 +281,7 @@ namespace VEPROMS.CSLA.Library
|
|||||||
#region Data Access Portal
|
#region Data Access Portal
|
||||||
internal DocumentInfo(SafeDataReader dr)
|
internal DocumentInfo(SafeDataReader dr)
|
||||||
{
|
{
|
||||||
|
_MyDocumentInfoUnique = ++_DocumentInfoUnique;
|
||||||
if (_MyLog.IsDebugEnabled) _MyLog.DebugFormat("[{0}] DocumentInfo.Constructor", GetHashCode());
|
if (_MyLog.IsDebugEnabled) _MyLog.DebugFormat("[{0}] DocumentInfo.Constructor", GetHashCode());
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
@ -53,13 +53,17 @@ namespace VEPROMS.CSLA.Library
|
|||||||
#endregion
|
#endregion
|
||||||
#region Collection
|
#region Collection
|
||||||
protected static List<Entry> _AllList = new List<Entry>();
|
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()
|
private static void ConvertListToDictionary()
|
||||||
{
|
{
|
||||||
List<Entry> remove = new List<Entry>();
|
List<Entry> remove = new List<Entry>();
|
||||||
foreach (Entry tmp in _AllList)
|
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);
|
remove.Add(tmp);
|
||||||
}
|
}
|
||||||
foreach (Entry tmp in remove)
|
foreach (Entry tmp in remove)
|
||||||
@ -69,7 +73,7 @@ namespace VEPROMS.CSLA.Library
|
|||||||
{
|
{
|
||||||
ConvertListToDictionary();
|
ConvertListToDictionary();
|
||||||
string key = contentID.ToString();
|
string key = contentID.ToString();
|
||||||
if (_AllByPrimaryKey.ContainsKey(key)) return _AllByPrimaryKey[key];
|
if (_AllByPrimaryKey.ContainsKey(key)) return _AllByPrimaryKey[key][0];
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
#endregion
|
#endregion
|
||||||
@ -209,7 +213,8 @@ namespace VEPROMS.CSLA.Library
|
|||||||
private bool _CheckingBrokenRules = false;
|
private bool _CheckingBrokenRules = false;
|
||||||
public IVEHasBrokenRules HasBrokenRules
|
public IVEHasBrokenRules HasBrokenRules
|
||||||
{
|
{
|
||||||
get {
|
get
|
||||||
|
{
|
||||||
if (_CheckingBrokenRules) return null;
|
if (_CheckingBrokenRules) return null;
|
||||||
if ((IsDirty || !IsNew) && BrokenRulesCollection.Count > 0) return this;
|
if ((IsDirty || !IsNew) && BrokenRulesCollection.Count > 0) return this;
|
||||||
try
|
try
|
||||||
@ -320,14 +325,25 @@ namespace VEPROMS.CSLA.Library
|
|||||||
#region Factory Methods
|
#region Factory Methods
|
||||||
public int CurrentEditLevel
|
public int CurrentEditLevel
|
||||||
{ get { return EditLevel; } }
|
{ get { return EditLevel; } }
|
||||||
|
private static int _EntryUnique = 0;
|
||||||
|
private int _MyEntryUnique;
|
||||||
|
public int MyEntryUnique
|
||||||
|
{
|
||||||
|
get { return _MyEntryUnique; }
|
||||||
|
}
|
||||||
protected Entry()
|
protected Entry()
|
||||||
{/* require use of factory methods */
|
{/* require use of factory methods */
|
||||||
|
_MyEntryUnique = ++_EntryUnique;
|
||||||
_AllList.Add(this);
|
_AllList.Add(this);
|
||||||
}
|
}
|
||||||
public void Dispose()
|
public void Dispose()
|
||||||
{
|
{
|
||||||
_AllList.Remove(this);
|
_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()
|
public static Entry New()
|
||||||
{
|
{
|
||||||
@ -392,7 +408,7 @@ namespace VEPROMS.CSLA.Library
|
|||||||
if (tmp == null)
|
if (tmp == null)
|
||||||
{
|
{
|
||||||
tmp = DataPortal.Fetch<Entry>(new PKCriteria(contentID));
|
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;
|
if (tmp.ErrorMessage == "No Record Found") tmp = null;
|
||||||
return tmp;
|
return tmp;
|
||||||
|
@ -37,13 +37,17 @@ namespace VEPROMS.CSLA.Library
|
|||||||
#endregion
|
#endregion
|
||||||
#region Collection
|
#region Collection
|
||||||
protected static List<EntryInfo> _AllList = new List<EntryInfo>();
|
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()
|
private static void ConvertListToDictionary()
|
||||||
{
|
{
|
||||||
List<EntryInfo> remove = new List<EntryInfo>();
|
List<EntryInfo> remove = new List<EntryInfo>();
|
||||||
foreach (EntryInfo tmp in _AllList)
|
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);
|
remove.Add(tmp);
|
||||||
}
|
}
|
||||||
foreach (EntryInfo tmp in remove)
|
foreach (EntryInfo tmp in remove)
|
||||||
@ -57,7 +61,7 @@ namespace VEPROMS.CSLA.Library
|
|||||||
{
|
{
|
||||||
ConvertListToDictionary();
|
ConvertListToDictionary();
|
||||||
string key = contentID.ToString();
|
string key = contentID.ToString();
|
||||||
if (_AllByPrimaryKey.ContainsKey(key)) return _AllByPrimaryKey[key];
|
if (_AllByPrimaryKey.ContainsKey(key)) return _AllByPrimaryKey[key][0];
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
#endregion
|
#endregion
|
||||||
@ -164,14 +168,25 @@ namespace VEPROMS.CSLA.Library
|
|||||||
}
|
}
|
||||||
#endregion
|
#endregion
|
||||||
#region Factory Methods
|
#region Factory Methods
|
||||||
|
private static int _EntryInfoUnique = 0;
|
||||||
|
private int _MyEntryInfoUnique;
|
||||||
|
public int MyEntryInfoUnique
|
||||||
|
{
|
||||||
|
get { return _MyEntryInfoUnique; }
|
||||||
|
}
|
||||||
private EntryInfo()
|
private EntryInfo()
|
||||||
{/* require use of factory methods */
|
{/* require use of factory methods */
|
||||||
|
_MyEntryInfoUnique = ++_EntryInfoUnique;
|
||||||
_AllList.Add(this);
|
_AllList.Add(this);
|
||||||
}
|
}
|
||||||
public void Dispose()
|
public void Dispose()
|
||||||
{
|
{
|
||||||
_AllList.Remove(this);
|
_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()
|
public virtual Entry Get()
|
||||||
{
|
{
|
||||||
@ -179,8 +194,10 @@ namespace VEPROMS.CSLA.Library
|
|||||||
}
|
}
|
||||||
public static void Refresh(Entry tmp)
|
public static void Refresh(Entry tmp)
|
||||||
{
|
{
|
||||||
EntryInfo tmpInfo = GetExistingByPrimaryKey(tmp.ContentID);
|
string key = tmp.ContentID.ToString();
|
||||||
if (tmpInfo == null) return;
|
ConvertListToDictionary();
|
||||||
|
if (_AllByPrimaryKey.ContainsKey(key))
|
||||||
|
foreach (EntryInfo tmpInfo in _AllByPrimaryKey[key])
|
||||||
tmpInfo.RefreshFields(tmp);
|
tmpInfo.RefreshFields(tmp);
|
||||||
}
|
}
|
||||||
private void RefreshFields(Entry tmp)
|
private void RefreshFields(Entry tmp)
|
||||||
@ -189,9 +206,9 @@ namespace VEPROMS.CSLA.Library
|
|||||||
{
|
{
|
||||||
MyDocument.RefreshDocumentEntries(); // Update List for old value
|
MyDocument.RefreshDocumentEntries(); // Update List for old value
|
||||||
_DocID = tmp.DocID; // Update the 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;
|
_DTS = tmp.DTS;
|
||||||
_UserID = tmp.UserID;
|
_UserID = tmp.UserID;
|
||||||
_EntryInfoExtension.Refresh(this);
|
_EntryInfoExtension.Refresh(this);
|
||||||
@ -201,8 +218,10 @@ namespace VEPROMS.CSLA.Library
|
|||||||
}
|
}
|
||||||
public static void Refresh(DocumentEntry tmp)
|
public static void Refresh(DocumentEntry tmp)
|
||||||
{
|
{
|
||||||
EntryInfo tmpInfo = GetExistingByPrimaryKey(tmp.ContentID);
|
string key = tmp.ContentID.ToString();
|
||||||
if (tmpInfo == null) return;
|
ConvertListToDictionary();
|
||||||
|
if (_AllByPrimaryKey.ContainsKey(key))
|
||||||
|
foreach (EntryInfo tmpInfo in _AllByPrimaryKey[key])
|
||||||
tmpInfo.RefreshFields(tmp);
|
tmpInfo.RefreshFields(tmp);
|
||||||
}
|
}
|
||||||
private void RefreshFields(DocumentEntry tmp)
|
private void RefreshFields(DocumentEntry tmp)
|
||||||
@ -224,7 +243,7 @@ namespace VEPROMS.CSLA.Library
|
|||||||
if (tmp == null)
|
if (tmp == null)
|
||||||
{
|
{
|
||||||
tmp = DataPortal.Fetch<EntryInfo>(new PKCriteria(contentID));
|
tmp = DataPortal.Fetch<EntryInfo>(new PKCriteria(contentID));
|
||||||
_AllList.Add(tmp);
|
if (!_AllList.Contains(tmp)) _AllList.Add(tmp);
|
||||||
}
|
}
|
||||||
if (tmp.ErrorMessage == "No Record Found")
|
if (tmp.ErrorMessage == "No Record Found")
|
||||||
{
|
{
|
||||||
@ -241,6 +260,7 @@ namespace VEPROMS.CSLA.Library
|
|||||||
#region Data Access Portal
|
#region Data Access Portal
|
||||||
internal EntryInfo(SafeDataReader dr)
|
internal EntryInfo(SafeDataReader dr)
|
||||||
{
|
{
|
||||||
|
_MyEntryInfoUnique = ++_EntryInfoUnique;
|
||||||
if (_MyLog.IsDebugEnabled) _MyLog.DebugFormat("[{0}] EntryInfo.Constructor", GetHashCode());
|
if (_MyLog.IsDebugEnabled) _MyLog.DebugFormat("[{0}] EntryInfo.Constructor", GetHashCode());
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
@ -87,15 +87,20 @@ namespace VEPROMS.CSLA.Library
|
|||||||
#endregion
|
#endregion
|
||||||
#region Collection
|
#region Collection
|
||||||
protected static List<Folder> _AllList = new List<Folder>();
|
protected static List<Folder> _AllList = new List<Folder>();
|
||||||
private static Dictionary<string, Folder> _AllByPrimaryKey = new Dictionary<string, Folder>();
|
private static Dictionary<string, List<Folder>> _AllByPrimaryKey = new Dictionary<string, List<Folder>>();
|
||||||
private static Dictionary<string, Folder> _AllByParentID_Name = new Dictionary<string, Folder>();
|
private static Dictionary<string, List<Folder>> _AllByParentID_Name = new Dictionary<string, List<Folder>>();
|
||||||
private static void ConvertListToDictionary()
|
private static void ConvertListToDictionary()
|
||||||
{
|
{
|
||||||
List<Folder> remove = new List<Folder>();
|
List<Folder> remove = new List<Folder>();
|
||||||
foreach (Folder tmp in _AllList)
|
foreach (Folder tmp in _AllList)
|
||||||
{
|
{
|
||||||
_AllByPrimaryKey[tmp.FolderID.ToString()]=tmp; // Primary Key
|
if (!_AllByPrimaryKey.ContainsKey(tmp.FolderID.ToString()))
|
||||||
_AllByParentID_Name[tmp.ParentID.ToString() + "_" + tmp.Name.ToString()] = tmp; // Unique Index
|
{
|
||||||
|
_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);
|
remove.Add(tmp);
|
||||||
}
|
}
|
||||||
foreach (Folder tmp in remove)
|
foreach (Folder tmp in remove)
|
||||||
@ -105,14 +110,14 @@ namespace VEPROMS.CSLA.Library
|
|||||||
{
|
{
|
||||||
ConvertListToDictionary();
|
ConvertListToDictionary();
|
||||||
string key = folderID.ToString();
|
string key = folderID.ToString();
|
||||||
if (_AllByPrimaryKey.ContainsKey(key)) return _AllByPrimaryKey[key];
|
if (_AllByPrimaryKey.ContainsKey(key)) return _AllByPrimaryKey[key][0];
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
public static Folder GetExistingByParentID_Name(int parentID, string name)
|
public static Folder GetExistingByParentID_Name(int parentID, string name)
|
||||||
{
|
{
|
||||||
ConvertListToDictionary();
|
ConvertListToDictionary();
|
||||||
string key = parentID.ToString() + "_" + name.ToString();
|
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;
|
return null;
|
||||||
}
|
}
|
||||||
#endregion
|
#endregion
|
||||||
@ -486,7 +491,8 @@ namespace VEPROMS.CSLA.Library
|
|||||||
private bool _CheckingBrokenRules = false;
|
private bool _CheckingBrokenRules = false;
|
||||||
public IVEHasBrokenRules HasBrokenRules
|
public IVEHasBrokenRules HasBrokenRules
|
||||||
{
|
{
|
||||||
get {
|
get
|
||||||
|
{
|
||||||
if (_CheckingBrokenRules) return null;
|
if (_CheckingBrokenRules) return null;
|
||||||
if ((IsDirty || !IsNew) && BrokenRulesCollection.Count > 0) return this;
|
if ((IsDirty || !IsNew) && BrokenRulesCollection.Count > 0) return this;
|
||||||
try
|
try
|
||||||
@ -644,15 +650,29 @@ namespace VEPROMS.CSLA.Library
|
|||||||
#region Factory Methods
|
#region Factory Methods
|
||||||
public int CurrentEditLevel
|
public int CurrentEditLevel
|
||||||
{ get { return EditLevel; } }
|
{ get { return EditLevel; } }
|
||||||
|
private static int _FolderUnique = 0;
|
||||||
|
private int _MyFolderUnique;
|
||||||
|
public int MyFolderUnique
|
||||||
|
{
|
||||||
|
get { return _MyFolderUnique; }
|
||||||
|
}
|
||||||
protected Folder()
|
protected Folder()
|
||||||
{/* require use of factory methods */
|
{/* require use of factory methods */
|
||||||
|
_MyFolderUnique = ++_FolderUnique;
|
||||||
_AllList.Add(this);
|
_AllList.Add(this);
|
||||||
}
|
}
|
||||||
public void Dispose()
|
public void Dispose()
|
||||||
{
|
{
|
||||||
_AllList.Remove(this);
|
_AllList.Remove(this);
|
||||||
_AllByPrimaryKey.Remove(FolderID.ToString());
|
if (!_AllByPrimaryKey.ContainsKey(FolderID.ToString())) return;
|
||||||
_AllByParentID_Name.Remove(ParentID.ToString() + "_" + Name.ToString());
|
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()
|
public static Folder New()
|
||||||
{
|
{
|
||||||
@ -743,7 +763,7 @@ namespace VEPROMS.CSLA.Library
|
|||||||
if (tmp == null)
|
if (tmp == null)
|
||||||
{
|
{
|
||||||
tmp = DataPortal.Fetch<Folder>(new PKCriteria(folderID));
|
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;
|
if (tmp.ErrorMessage == "No Record Found") tmp = null;
|
||||||
return tmp;
|
return tmp;
|
||||||
@ -763,7 +783,7 @@ namespace VEPROMS.CSLA.Library
|
|||||||
if (tmp == null)
|
if (tmp == null)
|
||||||
{
|
{
|
||||||
tmp = DataPortal.Fetch<Folder>(new ParentID_NameCriteria(parentID, name));
|
tmp = DataPortal.Fetch<Folder>(new ParentID_NameCriteria(parentID, name));
|
||||||
_AllList.Add(tmp);
|
if (!_AllList.Contains(tmp)) _AllList.Add(tmp);
|
||||||
}
|
}
|
||||||
if (tmp.ErrorMessage == "No Record Found") tmp = null;
|
if (tmp.ErrorMessage == "No Record Found") tmp = null;
|
||||||
return tmp;
|
return tmp;
|
||||||
|
@ -37,13 +37,17 @@ namespace VEPROMS.CSLA.Library
|
|||||||
#endregion
|
#endregion
|
||||||
#region Collection
|
#region Collection
|
||||||
protected static List<FolderInfo> _AllList = new List<FolderInfo>();
|
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()
|
private static void ConvertListToDictionary()
|
||||||
{
|
{
|
||||||
List<FolderInfo> remove = new List<FolderInfo>();
|
List<FolderInfo> remove = new List<FolderInfo>();
|
||||||
foreach (FolderInfo tmp in _AllList)
|
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);
|
remove.Add(tmp);
|
||||||
}
|
}
|
||||||
foreach (FolderInfo tmp in remove)
|
foreach (FolderInfo tmp in remove)
|
||||||
@ -57,7 +61,7 @@ namespace VEPROMS.CSLA.Library
|
|||||||
{
|
{
|
||||||
ConvertListToDictionary();
|
ConvertListToDictionary();
|
||||||
string key = folderID.ToString();
|
string key = folderID.ToString();
|
||||||
if (_AllByPrimaryKey.ContainsKey(key)) return _AllByPrimaryKey[key];
|
if (_AllByPrimaryKey.ContainsKey(key)) return _AllByPrimaryKey[key][0];
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
#endregion
|
#endregion
|
||||||
@ -245,7 +249,10 @@ namespace VEPROMS.CSLA.Library
|
|||||||
}
|
}
|
||||||
internal void RefreshFolderAssignments()
|
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;
|
private int _FolderDocVersionCount = 0;
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@ -277,7 +284,10 @@ namespace VEPROMS.CSLA.Library
|
|||||||
}
|
}
|
||||||
internal void RefreshFolderDocVersions()
|
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;
|
private int _ChildFolderCount = 0;
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@ -309,7 +319,10 @@ namespace VEPROMS.CSLA.Library
|
|||||||
}
|
}
|
||||||
internal void RefreshChildFolders()
|
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
|
// TODO: Replace base FolderInfo.ToString function as necessary
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@ -331,14 +344,25 @@ namespace VEPROMS.CSLA.Library
|
|||||||
}
|
}
|
||||||
#endregion
|
#endregion
|
||||||
#region Factory Methods
|
#region Factory Methods
|
||||||
|
private static int _FolderInfoUnique = 0;
|
||||||
|
private int _MyFolderInfoUnique;
|
||||||
|
public int MyFolderInfoUnique
|
||||||
|
{
|
||||||
|
get { return _MyFolderInfoUnique; }
|
||||||
|
}
|
||||||
private FolderInfo()
|
private FolderInfo()
|
||||||
{/* require use of factory methods */
|
{/* require use of factory methods */
|
||||||
|
_MyFolderInfoUnique = ++_FolderInfoUnique;
|
||||||
_AllList.Add(this);
|
_AllList.Add(this);
|
||||||
}
|
}
|
||||||
public void Dispose()
|
public void Dispose()
|
||||||
{
|
{
|
||||||
_AllList.Remove(this);
|
_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()
|
public virtual Folder Get()
|
||||||
{
|
{
|
||||||
@ -346,8 +370,10 @@ namespace VEPROMS.CSLA.Library
|
|||||||
}
|
}
|
||||||
public static void Refresh(Folder tmp)
|
public static void Refresh(Folder tmp)
|
||||||
{
|
{
|
||||||
FolderInfo tmpInfo = GetExistingByPrimaryKey(tmp.FolderID);
|
string key = tmp.FolderID.ToString();
|
||||||
if (tmpInfo == null) return;
|
ConvertListToDictionary();
|
||||||
|
if (_AllByPrimaryKey.ContainsKey(key))
|
||||||
|
foreach (FolderInfo tmpInfo in _AllByPrimaryKey[key])
|
||||||
tmpInfo.RefreshFields(tmp);
|
tmpInfo.RefreshFields(tmp);
|
||||||
}
|
}
|
||||||
private void RefreshFields(Folder tmp)
|
private void RefreshFields(Folder tmp)
|
||||||
@ -356,16 +382,16 @@ namespace VEPROMS.CSLA.Library
|
|||||||
{
|
{
|
||||||
MyParent.RefreshChildFolders(); // Update List for old value
|
MyParent.RefreshChildFolders(); // Update List for old value
|
||||||
_ParentID = tmp.ParentID; // Update the 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)
|
if (_DBID != tmp.DBID)
|
||||||
{
|
{
|
||||||
MyConnection.RefreshConnectionFolders(); // Update List for old value
|
MyConnection.RefreshConnectionFolders(); // Update List for old value
|
||||||
_DBID = tmp.DBID; // Update the 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;
|
_Name = tmp.Name;
|
||||||
_Title = tmp.Title;
|
_Title = tmp.Title;
|
||||||
_ShortName = tmp.ShortName;
|
_ShortName = tmp.ShortName;
|
||||||
@ -373,9 +399,9 @@ namespace VEPROMS.CSLA.Library
|
|||||||
{
|
{
|
||||||
MyFormat.RefreshFormatFolders(); // Update List for old value
|
MyFormat.RefreshFormatFolders(); // Update List for old value
|
||||||
_FormatID = tmp.FormatID; // Update the 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;
|
_Config = tmp.Config;
|
||||||
_DTS = tmp.DTS;
|
_DTS = tmp.DTS;
|
||||||
_UsrID = tmp.UsrID;
|
_UsrID = tmp.UsrID;
|
||||||
@ -387,8 +413,10 @@ namespace VEPROMS.CSLA.Library
|
|||||||
}
|
}
|
||||||
public static void Refresh(ConnectionFolder tmp)
|
public static void Refresh(ConnectionFolder tmp)
|
||||||
{
|
{
|
||||||
FolderInfo tmpInfo = GetExistingByPrimaryKey(tmp.FolderID);
|
string key = tmp.FolderID.ToString();
|
||||||
if (tmpInfo == null) return;
|
ConvertListToDictionary();
|
||||||
|
if (_AllByPrimaryKey.ContainsKey(key))
|
||||||
|
foreach (FolderInfo tmpInfo in _AllByPrimaryKey[key])
|
||||||
tmpInfo.RefreshFields(tmp);
|
tmpInfo.RefreshFields(tmp);
|
||||||
}
|
}
|
||||||
private void RefreshFields(ConnectionFolder tmp)
|
private void RefreshFields(ConnectionFolder tmp)
|
||||||
@ -397,9 +425,9 @@ namespace VEPROMS.CSLA.Library
|
|||||||
{
|
{
|
||||||
MyParent.RefreshChildFolders(); // Update List for old value
|
MyParent.RefreshChildFolders(); // Update List for old value
|
||||||
_ParentID = tmp.ParentID; // Update the 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;
|
_Name = tmp.Name;
|
||||||
_Title = tmp.Title;
|
_Title = tmp.Title;
|
||||||
_ShortName = tmp.ShortName;
|
_ShortName = tmp.ShortName;
|
||||||
@ -407,9 +435,9 @@ namespace VEPROMS.CSLA.Library
|
|||||||
{
|
{
|
||||||
MyFormat.RefreshFormatFolders(); // Update List for old value
|
MyFormat.RefreshFormatFolders(); // Update List for old value
|
||||||
_FormatID = tmp.FormatID; // Update the 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;
|
_Config = tmp.Config;
|
||||||
_DTS = tmp.DTS;
|
_DTS = tmp.DTS;
|
||||||
_UsrID = tmp.UsrID;
|
_UsrID = tmp.UsrID;
|
||||||
@ -421,8 +449,10 @@ namespace VEPROMS.CSLA.Library
|
|||||||
}
|
}
|
||||||
public static void Refresh(FormatFolder tmp)
|
public static void Refresh(FormatFolder tmp)
|
||||||
{
|
{
|
||||||
FolderInfo tmpInfo = GetExistingByPrimaryKey(tmp.FolderID);
|
string key = tmp.FolderID.ToString();
|
||||||
if (tmpInfo == null) return;
|
ConvertListToDictionary();
|
||||||
|
if (_AllByPrimaryKey.ContainsKey(key))
|
||||||
|
foreach (FolderInfo tmpInfo in _AllByPrimaryKey[key])
|
||||||
tmpInfo.RefreshFields(tmp);
|
tmpInfo.RefreshFields(tmp);
|
||||||
}
|
}
|
||||||
private void RefreshFields(FormatFolder tmp)
|
private void RefreshFields(FormatFolder tmp)
|
||||||
@ -431,16 +461,16 @@ namespace VEPROMS.CSLA.Library
|
|||||||
{
|
{
|
||||||
MyParent.RefreshChildFolders(); // Update List for old value
|
MyParent.RefreshChildFolders(); // Update List for old value
|
||||||
_ParentID = tmp.ParentID; // Update the 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)
|
if (_DBID != tmp.DBID)
|
||||||
{
|
{
|
||||||
MyConnection.RefreshConnectionFolders(); // Update List for old value
|
MyConnection.RefreshConnectionFolders(); // Update List for old value
|
||||||
_DBID = tmp.DBID; // Update the 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;
|
_Name = tmp.Name;
|
||||||
_Title = tmp.Title;
|
_Title = tmp.Title;
|
||||||
_ShortName = tmp.ShortName;
|
_ShortName = tmp.ShortName;
|
||||||
@ -463,7 +493,7 @@ namespace VEPROMS.CSLA.Library
|
|||||||
if (tmp == null)
|
if (tmp == null)
|
||||||
{
|
{
|
||||||
tmp = DataPortal.Fetch<FolderInfo>(new PKCriteria(folderID));
|
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;
|
if (tmp.ErrorMessage == "No Record Found") tmp = null;
|
||||||
return tmp;
|
return tmp;
|
||||||
@ -477,6 +507,7 @@ namespace VEPROMS.CSLA.Library
|
|||||||
#region Data Access Portal
|
#region Data Access Portal
|
||||||
internal FolderInfo(SafeDataReader dr)
|
internal FolderInfo(SafeDataReader dr)
|
||||||
{
|
{
|
||||||
|
_MyFolderInfoUnique = ++_FolderInfoUnique;
|
||||||
if (_MyLog.IsDebugEnabled) _MyLog.DebugFormat("[{0}] FolderInfo.Constructor", GetHashCode());
|
if (_MyLog.IsDebugEnabled) _MyLog.DebugFormat("[{0}] FolderInfo.Constructor", GetHashCode());
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
@ -98,15 +98,20 @@ namespace VEPROMS.CSLA.Library
|
|||||||
#endregion
|
#endregion
|
||||||
#region Collection
|
#region Collection
|
||||||
protected static List<Format> _AllList = new List<Format>();
|
protected static List<Format> _AllList = new List<Format>();
|
||||||
private static Dictionary<string, Format> _AllByPrimaryKey = new Dictionary<string, Format>();
|
private static Dictionary<string, List<Format>> _AllByPrimaryKey = new Dictionary<string, List<Format>>();
|
||||||
private static Dictionary<string, Format> _AllByParentID_Name = new Dictionary<string, Format>();
|
private static Dictionary<string, List<Format>> _AllByParentID_Name = new Dictionary<string, List<Format>>();
|
||||||
private static void ConvertListToDictionary()
|
private static void ConvertListToDictionary()
|
||||||
{
|
{
|
||||||
List<Format> remove = new List<Format>();
|
List<Format> remove = new List<Format>();
|
||||||
foreach (Format tmp in _AllList)
|
foreach (Format tmp in _AllList)
|
||||||
{
|
{
|
||||||
_AllByPrimaryKey[tmp.FormatID.ToString()]=tmp; // Primary Key
|
if (!_AllByPrimaryKey.ContainsKey(tmp.FormatID.ToString()))
|
||||||
_AllByParentID_Name[tmp.ParentID.ToString() + "_" + tmp.Name.ToString()] = tmp; // Unique Index
|
{
|
||||||
|
_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);
|
remove.Add(tmp);
|
||||||
}
|
}
|
||||||
foreach (Format tmp in remove)
|
foreach (Format tmp in remove)
|
||||||
@ -116,14 +121,14 @@ namespace VEPROMS.CSLA.Library
|
|||||||
{
|
{
|
||||||
ConvertListToDictionary();
|
ConvertListToDictionary();
|
||||||
string key = formatID.ToString();
|
string key = formatID.ToString();
|
||||||
if (_AllByPrimaryKey.ContainsKey(key)) return _AllByPrimaryKey[key];
|
if (_AllByPrimaryKey.ContainsKey(key)) return _AllByPrimaryKey[key][0];
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
public static Format GetExistingByParentID_Name(int parentID, string name)
|
public static Format GetExistingByParentID_Name(int parentID, string name)
|
||||||
{
|
{
|
||||||
ConvertListToDictionary();
|
ConvertListToDictionary();
|
||||||
string key = parentID.ToString() + "_" + name.ToString();
|
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;
|
return null;
|
||||||
}
|
}
|
||||||
#endregion
|
#endregion
|
||||||
@ -463,7 +468,8 @@ namespace VEPROMS.CSLA.Library
|
|||||||
private bool _CheckingBrokenRules = false;
|
private bool _CheckingBrokenRules = false;
|
||||||
public IVEHasBrokenRules HasBrokenRules
|
public IVEHasBrokenRules HasBrokenRules
|
||||||
{
|
{
|
||||||
get {
|
get
|
||||||
|
{
|
||||||
if (_CheckingBrokenRules) return null;
|
if (_CheckingBrokenRules) return null;
|
||||||
if ((IsDirty || !IsNew) && BrokenRulesCollection.Count > 0) return this;
|
if ((IsDirty || !IsNew) && BrokenRulesCollection.Count > 0) return this;
|
||||||
try
|
try
|
||||||
@ -607,15 +613,29 @@ namespace VEPROMS.CSLA.Library
|
|||||||
#region Factory Methods
|
#region Factory Methods
|
||||||
public int CurrentEditLevel
|
public int CurrentEditLevel
|
||||||
{ get { return EditLevel; } }
|
{ get { return EditLevel; } }
|
||||||
|
private static int _FormatUnique = 0;
|
||||||
|
private int _MyFormatUnique;
|
||||||
|
public int MyFormatUnique
|
||||||
|
{
|
||||||
|
get { return _MyFormatUnique; }
|
||||||
|
}
|
||||||
protected Format()
|
protected Format()
|
||||||
{/* require use of factory methods */
|
{/* require use of factory methods */
|
||||||
|
_MyFormatUnique = ++_FormatUnique;
|
||||||
_AllList.Add(this);
|
_AllList.Add(this);
|
||||||
}
|
}
|
||||||
public void Dispose()
|
public void Dispose()
|
||||||
{
|
{
|
||||||
_AllList.Remove(this);
|
_AllList.Remove(this);
|
||||||
_AllByPrimaryKey.Remove(FormatID.ToString());
|
if (!_AllByPrimaryKey.ContainsKey(FormatID.ToString())) return;
|
||||||
_AllByParentID_Name.Remove(ParentID.ToString() + "_" + Name.ToString());
|
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()
|
public static Format New()
|
||||||
{
|
{
|
||||||
@ -702,7 +722,7 @@ namespace VEPROMS.CSLA.Library
|
|||||||
if (tmp == null)
|
if (tmp == null)
|
||||||
{
|
{
|
||||||
tmp = DataPortal.Fetch<Format>(new PKCriteria(formatID));
|
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;
|
if (tmp.ErrorMessage == "No Record Found") tmp = null;
|
||||||
return tmp;
|
return tmp;
|
||||||
@ -722,7 +742,7 @@ namespace VEPROMS.CSLA.Library
|
|||||||
if (tmp == null)
|
if (tmp == null)
|
||||||
{
|
{
|
||||||
tmp = DataPortal.Fetch<Format>(new ParentID_NameCriteria(parentID, name));
|
tmp = DataPortal.Fetch<Format>(new ParentID_NameCriteria(parentID, name));
|
||||||
_AllList.Add(tmp);
|
if (!_AllList.Contains(tmp)) _AllList.Add(tmp);
|
||||||
}
|
}
|
||||||
if (tmp.ErrorMessage == "No Record Found") tmp = null;
|
if (tmp.ErrorMessage == "No Record Found") tmp = null;
|
||||||
return tmp;
|
return tmp;
|
||||||
|
@ -37,13 +37,17 @@ namespace VEPROMS.CSLA.Library
|
|||||||
#endregion
|
#endregion
|
||||||
#region Collection
|
#region Collection
|
||||||
protected static List<FormatInfo> _AllList = new List<FormatInfo>();
|
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()
|
private static void ConvertListToDictionary()
|
||||||
{
|
{
|
||||||
List<FormatInfo> remove = new List<FormatInfo>();
|
List<FormatInfo> remove = new List<FormatInfo>();
|
||||||
foreach (FormatInfo tmp in _AllList)
|
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);
|
remove.Add(tmp);
|
||||||
}
|
}
|
||||||
foreach (FormatInfo tmp in remove)
|
foreach (FormatInfo tmp in remove)
|
||||||
@ -57,7 +61,7 @@ namespace VEPROMS.CSLA.Library
|
|||||||
{
|
{
|
||||||
ConvertListToDictionary();
|
ConvertListToDictionary();
|
||||||
string key = formatID.ToString();
|
string key = formatID.ToString();
|
||||||
if (_AllByPrimaryKey.ContainsKey(key)) return _AllByPrimaryKey[key];
|
if (_AllByPrimaryKey.ContainsKey(key)) return _AllByPrimaryKey[key][0];
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
#endregion
|
#endregion
|
||||||
@ -201,7 +205,10 @@ namespace VEPROMS.CSLA.Library
|
|||||||
}
|
}
|
||||||
internal void RefreshFormatContents()
|
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;
|
private int _FormatDocVersionCount = 0;
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@ -233,7 +240,10 @@ namespace VEPROMS.CSLA.Library
|
|||||||
}
|
}
|
||||||
internal void RefreshFormatDocVersions()
|
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;
|
private int _FormatFolderCount = 0;
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@ -265,7 +275,10 @@ namespace VEPROMS.CSLA.Library
|
|||||||
}
|
}
|
||||||
internal void RefreshFormatFolders()
|
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;
|
private int _ChildFormatCount = 0;
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@ -297,7 +310,10 @@ namespace VEPROMS.CSLA.Library
|
|||||||
}
|
}
|
||||||
internal void RefreshChildFormats()
|
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
|
// TODO: Replace base FormatInfo.ToString function as necessary
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@ -319,14 +335,25 @@ namespace VEPROMS.CSLA.Library
|
|||||||
}
|
}
|
||||||
#endregion
|
#endregion
|
||||||
#region Factory Methods
|
#region Factory Methods
|
||||||
|
private static int _FormatInfoUnique = 0;
|
||||||
|
private int _MyFormatInfoUnique;
|
||||||
|
public int MyFormatInfoUnique
|
||||||
|
{
|
||||||
|
get { return _MyFormatInfoUnique; }
|
||||||
|
}
|
||||||
private FormatInfo()
|
private FormatInfo()
|
||||||
{/* require use of factory methods */
|
{/* require use of factory methods */
|
||||||
|
_MyFormatInfoUnique = ++_FormatInfoUnique;
|
||||||
_AllList.Add(this);
|
_AllList.Add(this);
|
||||||
}
|
}
|
||||||
public void Dispose()
|
public void Dispose()
|
||||||
{
|
{
|
||||||
_AllList.Remove(this);
|
_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()
|
public virtual Format Get()
|
||||||
{
|
{
|
||||||
@ -334,8 +361,10 @@ namespace VEPROMS.CSLA.Library
|
|||||||
}
|
}
|
||||||
public static void Refresh(Format tmp)
|
public static void Refresh(Format tmp)
|
||||||
{
|
{
|
||||||
FormatInfo tmpInfo = GetExistingByPrimaryKey(tmp.FormatID);
|
string key = tmp.FormatID.ToString();
|
||||||
if (tmpInfo == null) return;
|
ConvertListToDictionary();
|
||||||
|
if (_AllByPrimaryKey.ContainsKey(key))
|
||||||
|
foreach (FormatInfo tmpInfo in _AllByPrimaryKey[key])
|
||||||
tmpInfo.RefreshFields(tmp);
|
tmpInfo.RefreshFields(tmp);
|
||||||
}
|
}
|
||||||
private void RefreshFields(Format tmp)
|
private void RefreshFields(Format tmp)
|
||||||
@ -344,9 +373,9 @@ namespace VEPROMS.CSLA.Library
|
|||||||
{
|
{
|
||||||
MyParent.RefreshChildFormats(); // Update List for old value
|
MyParent.RefreshChildFormats(); // Update List for old value
|
||||||
_ParentID = tmp.ParentID; // Update the 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;
|
_Name = tmp.Name;
|
||||||
_Description = tmp.Description;
|
_Description = tmp.Description;
|
||||||
_Data = tmp.Data;
|
_Data = tmp.Data;
|
||||||
@ -367,7 +396,7 @@ namespace VEPROMS.CSLA.Library
|
|||||||
if (tmp == null)
|
if (tmp == null)
|
||||||
{
|
{
|
||||||
tmp = DataPortal.Fetch<FormatInfo>(new PKCriteria(formatID));
|
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;
|
if (tmp.ErrorMessage == "No Record Found") tmp = null;
|
||||||
return tmp;
|
return tmp;
|
||||||
@ -381,6 +410,7 @@ namespace VEPROMS.CSLA.Library
|
|||||||
#region Data Access Portal
|
#region Data Access Portal
|
||||||
internal FormatInfo(SafeDataReader dr)
|
internal FormatInfo(SafeDataReader dr)
|
||||||
{
|
{
|
||||||
|
_MyFormatInfoUnique = ++_FormatInfoUnique;
|
||||||
if (_MyLog.IsDebugEnabled) _MyLog.DebugFormat("[{0}] FormatInfo.Constructor", GetHashCode());
|
if (_MyLog.IsDebugEnabled) _MyLog.DebugFormat("[{0}] FormatInfo.Constructor", GetHashCode());
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
@ -78,15 +78,20 @@ namespace VEPROMS.CSLA.Library
|
|||||||
#endregion
|
#endregion
|
||||||
#region Collection
|
#region Collection
|
||||||
protected static List<Group> _AllList = new List<Group>();
|
protected static List<Group> _AllList = new List<Group>();
|
||||||
private static Dictionary<string, Group> _AllByPrimaryKey = new Dictionary<string, Group>();
|
private static Dictionary<string, List<Group>> _AllByPrimaryKey = new Dictionary<string, List<Group>>();
|
||||||
private static Dictionary<string, Group> _AllByGroupName = new Dictionary<string, Group>();
|
private static Dictionary<string, List<Group>> _AllByGroupName = new Dictionary<string, List<Group>>();
|
||||||
private static void ConvertListToDictionary()
|
private static void ConvertListToDictionary()
|
||||||
{
|
{
|
||||||
List<Group> remove = new List<Group>();
|
List<Group> remove = new List<Group>();
|
||||||
foreach (Group tmp in _AllList)
|
foreach (Group tmp in _AllList)
|
||||||
{
|
{
|
||||||
_AllByPrimaryKey[tmp.GID.ToString()]=tmp; // Primary Key
|
if (!_AllByPrimaryKey.ContainsKey(tmp.GID.ToString()))
|
||||||
_AllByGroupName[tmp.GroupName.ToString()] = tmp; // Unique Index
|
{
|
||||||
|
_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);
|
remove.Add(tmp);
|
||||||
}
|
}
|
||||||
foreach (Group tmp in remove)
|
foreach (Group tmp in remove)
|
||||||
@ -96,14 +101,14 @@ namespace VEPROMS.CSLA.Library
|
|||||||
{
|
{
|
||||||
ConvertListToDictionary();
|
ConvertListToDictionary();
|
||||||
string key = gid.ToString();
|
string key = gid.ToString();
|
||||||
if (_AllByPrimaryKey.ContainsKey(key)) return _AllByPrimaryKey[key];
|
if (_AllByPrimaryKey.ContainsKey(key)) return _AllByPrimaryKey[key][0];
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
public static Group GetExistingByGroupName(string groupName)
|
public static Group GetExistingByGroupName(string groupName)
|
||||||
{
|
{
|
||||||
ConvertListToDictionary();
|
ConvertListToDictionary();
|
||||||
string key = groupName.ToString();
|
string key = groupName.ToString();
|
||||||
if (_AllByGroupName.ContainsKey(key)) return _AllByGroupName[key];
|
if (_AllByGroupName.ContainsKey(key)) return _AllByGroupName[key][0];
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
#endregion
|
#endregion
|
||||||
@ -327,7 +332,8 @@ namespace VEPROMS.CSLA.Library
|
|||||||
private bool _CheckingBrokenRules = false;
|
private bool _CheckingBrokenRules = false;
|
||||||
public IVEHasBrokenRules HasBrokenRules
|
public IVEHasBrokenRules HasBrokenRules
|
||||||
{
|
{
|
||||||
get {
|
get
|
||||||
|
{
|
||||||
if (_CheckingBrokenRules) return null;
|
if (_CheckingBrokenRules) return null;
|
||||||
if ((IsDirty || !IsNew) && BrokenRulesCollection.Count > 0) return this;
|
if ((IsDirty || !IsNew) && BrokenRulesCollection.Count > 0) return this;
|
||||||
try
|
try
|
||||||
@ -455,15 +461,29 @@ namespace VEPROMS.CSLA.Library
|
|||||||
#region Factory Methods
|
#region Factory Methods
|
||||||
public int CurrentEditLevel
|
public int CurrentEditLevel
|
||||||
{ get { return EditLevel; } }
|
{ get { return EditLevel; } }
|
||||||
|
private static int _GroupUnique = 0;
|
||||||
|
private int _MyGroupUnique;
|
||||||
|
public int MyGroupUnique
|
||||||
|
{
|
||||||
|
get { return _MyGroupUnique; }
|
||||||
|
}
|
||||||
protected Group()
|
protected Group()
|
||||||
{/* require use of factory methods */
|
{/* require use of factory methods */
|
||||||
|
_MyGroupUnique = ++_GroupUnique;
|
||||||
_AllList.Add(this);
|
_AllList.Add(this);
|
||||||
}
|
}
|
||||||
public void Dispose()
|
public void Dispose()
|
||||||
{
|
{
|
||||||
_AllList.Remove(this);
|
_AllList.Remove(this);
|
||||||
_AllByPrimaryKey.Remove(GID.ToString());
|
if (!_AllByPrimaryKey.ContainsKey(GID.ToString())) return;
|
||||||
_AllByGroupName.Remove(GroupName.ToString());
|
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()
|
public static Group New()
|
||||||
{
|
{
|
||||||
@ -544,7 +564,7 @@ namespace VEPROMS.CSLA.Library
|
|||||||
if (tmp == null)
|
if (tmp == null)
|
||||||
{
|
{
|
||||||
tmp = DataPortal.Fetch<Group>(new PKCriteria(gid));
|
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;
|
if (tmp.ErrorMessage == "No Record Found") tmp = null;
|
||||||
return tmp;
|
return tmp;
|
||||||
@ -564,7 +584,7 @@ namespace VEPROMS.CSLA.Library
|
|||||||
if (tmp == null)
|
if (tmp == null)
|
||||||
{
|
{
|
||||||
tmp = DataPortal.Fetch<Group>(new GroupNameCriteria(groupName));
|
tmp = DataPortal.Fetch<Group>(new GroupNameCriteria(groupName));
|
||||||
_AllList.Add(tmp);
|
if (!_AllList.Contains(tmp)) _AllList.Add(tmp);
|
||||||
}
|
}
|
||||||
if (tmp.ErrorMessage == "No Record Found") tmp = null;
|
if (tmp.ErrorMessage == "No Record Found") tmp = null;
|
||||||
return tmp;
|
return tmp;
|
||||||
|
@ -37,13 +37,17 @@ namespace VEPROMS.CSLA.Library
|
|||||||
#endregion
|
#endregion
|
||||||
#region Collection
|
#region Collection
|
||||||
protected static List<GroupInfo> _AllList = new List<GroupInfo>();
|
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()
|
private static void ConvertListToDictionary()
|
||||||
{
|
{
|
||||||
List<GroupInfo> remove = new List<GroupInfo>();
|
List<GroupInfo> remove = new List<GroupInfo>();
|
||||||
foreach (GroupInfo tmp in _AllList)
|
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);
|
remove.Add(tmp);
|
||||||
}
|
}
|
||||||
foreach (GroupInfo tmp in remove)
|
foreach (GroupInfo tmp in remove)
|
||||||
@ -57,7 +61,7 @@ namespace VEPROMS.CSLA.Library
|
|||||||
{
|
{
|
||||||
ConvertListToDictionary();
|
ConvertListToDictionary();
|
||||||
string key = gid.ToString();
|
string key = gid.ToString();
|
||||||
if (_AllByPrimaryKey.ContainsKey(key)) return _AllByPrimaryKey[key];
|
if (_AllByPrimaryKey.ContainsKey(key)) return _AllByPrimaryKey[key][0];
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
#endregion
|
#endregion
|
||||||
@ -169,7 +173,10 @@ namespace VEPROMS.CSLA.Library
|
|||||||
}
|
}
|
||||||
internal void RefreshGroupAssignments()
|
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;
|
private int _GroupMembershipCount = 0;
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@ -201,7 +208,10 @@ namespace VEPROMS.CSLA.Library
|
|||||||
}
|
}
|
||||||
internal void RefreshGroupMemberships()
|
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
|
// TODO: Replace base GroupInfo.ToString function as necessary
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@ -223,14 +233,25 @@ namespace VEPROMS.CSLA.Library
|
|||||||
}
|
}
|
||||||
#endregion
|
#endregion
|
||||||
#region Factory Methods
|
#region Factory Methods
|
||||||
|
private static int _GroupInfoUnique = 0;
|
||||||
|
private int _MyGroupInfoUnique;
|
||||||
|
public int MyGroupInfoUnique
|
||||||
|
{
|
||||||
|
get { return _MyGroupInfoUnique; }
|
||||||
|
}
|
||||||
private GroupInfo()
|
private GroupInfo()
|
||||||
{/* require use of factory methods */
|
{/* require use of factory methods */
|
||||||
|
_MyGroupInfoUnique = ++_GroupInfoUnique;
|
||||||
_AllList.Add(this);
|
_AllList.Add(this);
|
||||||
}
|
}
|
||||||
public void Dispose()
|
public void Dispose()
|
||||||
{
|
{
|
||||||
_AllList.Remove(this);
|
_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()
|
public virtual Group Get()
|
||||||
{
|
{
|
||||||
@ -238,8 +259,10 @@ namespace VEPROMS.CSLA.Library
|
|||||||
}
|
}
|
||||||
public static void Refresh(Group tmp)
|
public static void Refresh(Group tmp)
|
||||||
{
|
{
|
||||||
GroupInfo tmpInfo = GetExistingByPrimaryKey(tmp.GID);
|
string key = tmp.GID.ToString();
|
||||||
if (tmpInfo == null) return;
|
ConvertListToDictionary();
|
||||||
|
if (_AllByPrimaryKey.ContainsKey(key))
|
||||||
|
foreach (GroupInfo tmpInfo in _AllByPrimaryKey[key])
|
||||||
tmpInfo.RefreshFields(tmp);
|
tmpInfo.RefreshFields(tmp);
|
||||||
}
|
}
|
||||||
private void RefreshFields(Group tmp)
|
private void RefreshFields(Group tmp)
|
||||||
@ -262,7 +285,7 @@ namespace VEPROMS.CSLA.Library
|
|||||||
if (tmp == null)
|
if (tmp == null)
|
||||||
{
|
{
|
||||||
tmp = DataPortal.Fetch<GroupInfo>(new PKCriteria(gid));
|
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;
|
if (tmp.ErrorMessage == "No Record Found") tmp = null;
|
||||||
return tmp;
|
return tmp;
|
||||||
@ -276,6 +299,7 @@ namespace VEPROMS.CSLA.Library
|
|||||||
#region Data Access Portal
|
#region Data Access Portal
|
||||||
internal GroupInfo(SafeDataReader dr)
|
internal GroupInfo(SafeDataReader dr)
|
||||||
{
|
{
|
||||||
|
_MyGroupInfoUnique = ++_GroupInfoUnique;
|
||||||
if (_MyLog.IsDebugEnabled) _MyLog.DebugFormat("[{0}] GroupInfo.Constructor", GetHashCode());
|
if (_MyLog.IsDebugEnabled) _MyLog.DebugFormat("[{0}] GroupInfo.Constructor", GetHashCode());
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
@ -125,13 +125,17 @@ namespace VEPROMS.CSLA.Library
|
|||||||
#endregion
|
#endregion
|
||||||
#region Collection
|
#region Collection
|
||||||
protected static List<Item> _AllList = new List<Item>();
|
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()
|
private static void ConvertListToDictionary()
|
||||||
{
|
{
|
||||||
List<Item> remove = new List<Item>();
|
List<Item> remove = new List<Item>();
|
||||||
foreach (Item tmp in _AllList)
|
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);
|
remove.Add(tmp);
|
||||||
}
|
}
|
||||||
foreach (Item tmp in remove)
|
foreach (Item tmp in remove)
|
||||||
@ -141,7 +145,7 @@ namespace VEPROMS.CSLA.Library
|
|||||||
{
|
{
|
||||||
ConvertListToDictionary();
|
ConvertListToDictionary();
|
||||||
string key = itemID.ToString();
|
string key = itemID.ToString();
|
||||||
if (_AllByPrimaryKey.ContainsKey(key)) return _AllByPrimaryKey[key];
|
if (_AllByPrimaryKey.ContainsKey(key)) return _AllByPrimaryKey[key][0];
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
#endregion
|
#endregion
|
||||||
@ -492,7 +496,8 @@ namespace VEPROMS.CSLA.Library
|
|||||||
private bool _CheckingBrokenRules = false;
|
private bool _CheckingBrokenRules = false;
|
||||||
public IVEHasBrokenRules HasBrokenRules
|
public IVEHasBrokenRules HasBrokenRules
|
||||||
{
|
{
|
||||||
get {
|
get
|
||||||
|
{
|
||||||
if (_CheckingBrokenRules) return null;
|
if (_CheckingBrokenRules) return null;
|
||||||
if ((IsDirty || !IsNew) && BrokenRulesCollection.Count > 0) return this;
|
if ((IsDirty || !IsNew) && BrokenRulesCollection.Count > 0) return this;
|
||||||
try
|
try
|
||||||
@ -629,14 +634,25 @@ namespace VEPROMS.CSLA.Library
|
|||||||
#region Factory Methods
|
#region Factory Methods
|
||||||
public int CurrentEditLevel
|
public int CurrentEditLevel
|
||||||
{ get { return EditLevel; } }
|
{ get { return EditLevel; } }
|
||||||
|
private static int _ItemUnique = 0;
|
||||||
|
private int _MyItemUnique;
|
||||||
|
public int MyItemUnique
|
||||||
|
{
|
||||||
|
get { return _MyItemUnique; }
|
||||||
|
}
|
||||||
protected Item()
|
protected Item()
|
||||||
{/* require use of factory methods */
|
{/* require use of factory methods */
|
||||||
|
_MyItemUnique = ++_ItemUnique;
|
||||||
_AllList.Add(this);
|
_AllList.Add(this);
|
||||||
}
|
}
|
||||||
public void Dispose()
|
public void Dispose()
|
||||||
{
|
{
|
||||||
_AllList.Remove(this);
|
_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()
|
public static Item New()
|
||||||
{
|
{
|
||||||
@ -715,7 +731,7 @@ namespace VEPROMS.CSLA.Library
|
|||||||
if (tmp == null)
|
if (tmp == null)
|
||||||
{
|
{
|
||||||
tmp = DataPortal.Fetch<Item>(new PKCriteria(itemID));
|
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;
|
if (tmp.ErrorMessage == "No Record Found") tmp = null;
|
||||||
return tmp;
|
return tmp;
|
||||||
|
@ -37,13 +37,17 @@ namespace VEPROMS.CSLA.Library
|
|||||||
#endregion
|
#endregion
|
||||||
#region Collection
|
#region Collection
|
||||||
protected static List<ItemInfo> _AllList = new List<ItemInfo>();
|
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()
|
private static void ConvertListToDictionary()
|
||||||
{
|
{
|
||||||
List<ItemInfo> remove = new List<ItemInfo>();
|
List<ItemInfo> remove = new List<ItemInfo>();
|
||||||
foreach (ItemInfo tmp in _AllList)
|
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);
|
remove.Add(tmp);
|
||||||
}
|
}
|
||||||
foreach (ItemInfo tmp in remove)
|
foreach (ItemInfo tmp in remove)
|
||||||
@ -57,7 +61,7 @@ namespace VEPROMS.CSLA.Library
|
|||||||
{
|
{
|
||||||
ConvertListToDictionary();
|
ConvertListToDictionary();
|
||||||
string key = itemID.ToString();
|
string key = itemID.ToString();
|
||||||
if (_AllByPrimaryKey.ContainsKey(key)) return _AllByPrimaryKey[key];
|
if (_AllByPrimaryKey.ContainsKey(key)) return _AllByPrimaryKey[key][0];
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
#endregion
|
#endregion
|
||||||
@ -183,7 +187,10 @@ namespace VEPROMS.CSLA.Library
|
|||||||
}
|
}
|
||||||
internal void RefreshItemAnnotations()
|
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;
|
private int _ItemDocVersionCount = 0;
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@ -215,7 +222,10 @@ namespace VEPROMS.CSLA.Library
|
|||||||
}
|
}
|
||||||
internal void RefreshItemDocVersions()
|
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;
|
private int _NextItemCount = 0;
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@ -247,7 +257,10 @@ namespace VEPROMS.CSLA.Library
|
|||||||
}
|
}
|
||||||
internal void RefreshNextItems()
|
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;
|
private int _ItemPartCount = 0;
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@ -279,7 +292,10 @@ namespace VEPROMS.CSLA.Library
|
|||||||
}
|
}
|
||||||
internal void RefreshItemParts()
|
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;
|
private int _ItemTransition_RangeIDCount = 0;
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@ -311,7 +327,10 @@ namespace VEPROMS.CSLA.Library
|
|||||||
}
|
}
|
||||||
internal void RefreshItemTransitions_RangeID()
|
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;
|
private int _ItemTransition_ToIDCount = 0;
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@ -343,7 +362,10 @@ namespace VEPROMS.CSLA.Library
|
|||||||
}
|
}
|
||||||
internal void RefreshItemTransitions_ToID()
|
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
|
// TODO: Replace base ItemInfo.ToString function as necessary
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@ -365,14 +387,25 @@ namespace VEPROMS.CSLA.Library
|
|||||||
}
|
}
|
||||||
#endregion
|
#endregion
|
||||||
#region Factory Methods
|
#region Factory Methods
|
||||||
|
private static int _ItemInfoUnique = 0;
|
||||||
|
private int _MyItemInfoUnique;
|
||||||
|
public int MyItemInfoUnique
|
||||||
|
{
|
||||||
|
get { return _MyItemInfoUnique; }
|
||||||
|
}
|
||||||
private ItemInfo()
|
private ItemInfo()
|
||||||
{/* require use of factory methods */
|
{/* require use of factory methods */
|
||||||
|
_MyItemInfoUnique = ++_ItemInfoUnique;
|
||||||
_AllList.Add(this);
|
_AllList.Add(this);
|
||||||
}
|
}
|
||||||
public void Dispose()
|
public void Dispose()
|
||||||
{
|
{
|
||||||
_AllList.Remove(this);
|
_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()
|
public virtual Item Get()
|
||||||
{
|
{
|
||||||
@ -380,8 +413,10 @@ namespace VEPROMS.CSLA.Library
|
|||||||
}
|
}
|
||||||
public static void Refresh(Item tmp)
|
public static void Refresh(Item tmp)
|
||||||
{
|
{
|
||||||
ItemInfo tmpInfo = GetExistingByPrimaryKey(tmp.ItemID);
|
string key = tmp.ItemID.ToString();
|
||||||
if (tmpInfo == null) return;
|
ConvertListToDictionary();
|
||||||
|
if (_AllByPrimaryKey.ContainsKey(key))
|
||||||
|
foreach (ItemInfo tmpInfo in _AllByPrimaryKey[key])
|
||||||
tmpInfo.RefreshFields(tmp);
|
tmpInfo.RefreshFields(tmp);
|
||||||
}
|
}
|
||||||
private void RefreshFields(Item tmp)
|
private void RefreshFields(Item tmp)
|
||||||
@ -390,16 +425,16 @@ namespace VEPROMS.CSLA.Library
|
|||||||
{
|
{
|
||||||
MyPrevious.RefreshNextItems(); // Update List for old value
|
MyPrevious.RefreshNextItems(); // Update List for old value
|
||||||
_PreviousID = tmp.PreviousID; // Update the 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)
|
if (_ContentID != tmp.ContentID)
|
||||||
{
|
{
|
||||||
MyContent.RefreshContentItems(); // Update List for old value
|
MyContent.RefreshContentItems(); // Update List for old value
|
||||||
_ContentID = tmp.ContentID; // Update the 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;
|
_DTS = tmp.DTS;
|
||||||
_UserID = tmp.UserID;
|
_UserID = tmp.UserID;
|
||||||
_ItemInfoExtension.Refresh(this);
|
_ItemInfoExtension.Refresh(this);
|
||||||
@ -409,8 +444,10 @@ namespace VEPROMS.CSLA.Library
|
|||||||
}
|
}
|
||||||
public static void Refresh(ContentItem tmp)
|
public static void Refresh(ContentItem tmp)
|
||||||
{
|
{
|
||||||
ItemInfo tmpInfo = GetExistingByPrimaryKey(tmp.ItemID);
|
string key = tmp.ItemID.ToString();
|
||||||
if (tmpInfo == null) return;
|
ConvertListToDictionary();
|
||||||
|
if (_AllByPrimaryKey.ContainsKey(key))
|
||||||
|
foreach (ItemInfo tmpInfo in _AllByPrimaryKey[key])
|
||||||
tmpInfo.RefreshFields(tmp);
|
tmpInfo.RefreshFields(tmp);
|
||||||
}
|
}
|
||||||
private void RefreshFields(ContentItem tmp)
|
private void RefreshFields(ContentItem tmp)
|
||||||
@ -419,9 +456,9 @@ namespace VEPROMS.CSLA.Library
|
|||||||
{
|
{
|
||||||
MyPrevious.RefreshNextItems(); // Update List for old value
|
MyPrevious.RefreshNextItems(); // Update List for old value
|
||||||
_PreviousID = tmp.PreviousID; // Update the 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;
|
_DTS = tmp.DTS;
|
||||||
_UserID = tmp.UserID;
|
_UserID = tmp.UserID;
|
||||||
_ItemInfoExtension.Refresh(this);
|
_ItemInfoExtension.Refresh(this);
|
||||||
@ -439,7 +476,7 @@ namespace VEPROMS.CSLA.Library
|
|||||||
if (tmp == null)
|
if (tmp == null)
|
||||||
{
|
{
|
||||||
tmp = DataPortal.Fetch<ItemInfo>(new PKCriteria(itemID));
|
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;
|
if (tmp.ErrorMessage == "No Record Found") tmp = null;
|
||||||
return tmp;
|
return tmp;
|
||||||
@ -453,6 +490,7 @@ namespace VEPROMS.CSLA.Library
|
|||||||
#region Data Access Portal
|
#region Data Access Portal
|
||||||
internal ItemInfo(SafeDataReader dr)
|
internal ItemInfo(SafeDataReader dr)
|
||||||
{
|
{
|
||||||
|
_MyItemInfoUnique = ++_ItemInfoUnique;
|
||||||
if (_MyLog.IsDebugEnabled) _MyLog.DebugFormat("[{0}] ItemInfo.Constructor", GetHashCode());
|
if (_MyLog.IsDebugEnabled) _MyLog.DebugFormat("[{0}] ItemInfo.Constructor", GetHashCode());
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
@ -54,13 +54,17 @@ namespace VEPROMS.CSLA.Library
|
|||||||
#endregion
|
#endregion
|
||||||
#region Collection
|
#region Collection
|
||||||
protected static List<Membership> _AllList = new List<Membership>();
|
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()
|
private static void ConvertListToDictionary()
|
||||||
{
|
{
|
||||||
List<Membership> remove = new List<Membership>();
|
List<Membership> remove = new List<Membership>();
|
||||||
foreach (Membership tmp in _AllList)
|
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);
|
remove.Add(tmp);
|
||||||
}
|
}
|
||||||
foreach (Membership tmp in remove)
|
foreach (Membership tmp in remove)
|
||||||
@ -70,7 +74,7 @@ namespace VEPROMS.CSLA.Library
|
|||||||
{
|
{
|
||||||
ConvertListToDictionary();
|
ConvertListToDictionary();
|
||||||
string key = ugid.ToString();
|
string key = ugid.ToString();
|
||||||
if (_AllByPrimaryKey.ContainsKey(key)) return _AllByPrimaryKey[key];
|
if (_AllByPrimaryKey.ContainsKey(key)) return _AllByPrimaryKey[key][0];
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
#endregion
|
#endregion
|
||||||
@ -315,7 +319,8 @@ namespace VEPROMS.CSLA.Library
|
|||||||
private bool _CheckingBrokenRules = false;
|
private bool _CheckingBrokenRules = false;
|
||||||
public IVEHasBrokenRules HasBrokenRules
|
public IVEHasBrokenRules HasBrokenRules
|
||||||
{
|
{
|
||||||
get {
|
get
|
||||||
|
{
|
||||||
if (_CheckingBrokenRules) return null;
|
if (_CheckingBrokenRules) return null;
|
||||||
if ((IsDirty || !IsNew) && BrokenRulesCollection.Count > 0) return this;
|
if ((IsDirty || !IsNew) && BrokenRulesCollection.Count > 0) return this;
|
||||||
try
|
try
|
||||||
@ -478,14 +483,25 @@ namespace VEPROMS.CSLA.Library
|
|||||||
#region Factory Methods
|
#region Factory Methods
|
||||||
public int CurrentEditLevel
|
public int CurrentEditLevel
|
||||||
{ get { return EditLevel; } }
|
{ get { return EditLevel; } }
|
||||||
|
private static int _MembershipUnique = 0;
|
||||||
|
private int _MyMembershipUnique;
|
||||||
|
public int MyMembershipUnique
|
||||||
|
{
|
||||||
|
get { return _MyMembershipUnique; }
|
||||||
|
}
|
||||||
protected Membership()
|
protected Membership()
|
||||||
{/* require use of factory methods */
|
{/* require use of factory methods */
|
||||||
|
_MyMembershipUnique = ++_MembershipUnique;
|
||||||
_AllList.Add(this);
|
_AllList.Add(this);
|
||||||
}
|
}
|
||||||
public void Dispose()
|
public void Dispose()
|
||||||
{
|
{
|
||||||
_AllList.Remove(this);
|
_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()
|
public static Membership New()
|
||||||
{
|
{
|
||||||
@ -570,7 +586,7 @@ namespace VEPROMS.CSLA.Library
|
|||||||
if (tmp == null)
|
if (tmp == null)
|
||||||
{
|
{
|
||||||
tmp = DataPortal.Fetch<Membership>(new PKCriteria(ugid));
|
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;
|
if (tmp.ErrorMessage == "No Record Found") tmp = null;
|
||||||
return tmp;
|
return tmp;
|
||||||
|
@ -37,13 +37,17 @@ namespace VEPROMS.CSLA.Library
|
|||||||
#endregion
|
#endregion
|
||||||
#region Collection
|
#region Collection
|
||||||
protected static List<MembershipInfo> _AllList = new List<MembershipInfo>();
|
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()
|
private static void ConvertListToDictionary()
|
||||||
{
|
{
|
||||||
List<MembershipInfo> remove = new List<MembershipInfo>();
|
List<MembershipInfo> remove = new List<MembershipInfo>();
|
||||||
foreach (MembershipInfo tmp in _AllList)
|
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);
|
remove.Add(tmp);
|
||||||
}
|
}
|
||||||
foreach (MembershipInfo tmp in remove)
|
foreach (MembershipInfo tmp in remove)
|
||||||
@ -57,7 +61,7 @@ namespace VEPROMS.CSLA.Library
|
|||||||
{
|
{
|
||||||
ConvertListToDictionary();
|
ConvertListToDictionary();
|
||||||
string key = ugid.ToString();
|
string key = ugid.ToString();
|
||||||
if (_AllByPrimaryKey.ContainsKey(key)) return _AllByPrimaryKey[key];
|
if (_AllByPrimaryKey.ContainsKey(key)) return _AllByPrimaryKey[key][0];
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
#endregion
|
#endregion
|
||||||
@ -203,14 +207,25 @@ namespace VEPROMS.CSLA.Library
|
|||||||
}
|
}
|
||||||
#endregion
|
#endregion
|
||||||
#region Factory Methods
|
#region Factory Methods
|
||||||
|
private static int _MembershipInfoUnique = 0;
|
||||||
|
private int _MyMembershipInfoUnique;
|
||||||
|
public int MyMembershipInfoUnique
|
||||||
|
{
|
||||||
|
get { return _MyMembershipInfoUnique; }
|
||||||
|
}
|
||||||
private MembershipInfo()
|
private MembershipInfo()
|
||||||
{/* require use of factory methods */
|
{/* require use of factory methods */
|
||||||
|
_MyMembershipInfoUnique = ++_MembershipInfoUnique;
|
||||||
_AllList.Add(this);
|
_AllList.Add(this);
|
||||||
}
|
}
|
||||||
public void Dispose()
|
public void Dispose()
|
||||||
{
|
{
|
||||||
_AllList.Remove(this);
|
_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()
|
public virtual Membership Get()
|
||||||
{
|
{
|
||||||
@ -218,8 +233,10 @@ namespace VEPROMS.CSLA.Library
|
|||||||
}
|
}
|
||||||
public static void Refresh(Membership tmp)
|
public static void Refresh(Membership tmp)
|
||||||
{
|
{
|
||||||
MembershipInfo tmpInfo = GetExistingByPrimaryKey(tmp.UGID);
|
string key = tmp.UGID.ToString();
|
||||||
if (tmpInfo == null) return;
|
ConvertListToDictionary();
|
||||||
|
if (_AllByPrimaryKey.ContainsKey(key))
|
||||||
|
foreach (MembershipInfo tmpInfo in _AllByPrimaryKey[key])
|
||||||
tmpInfo.RefreshFields(tmp);
|
tmpInfo.RefreshFields(tmp);
|
||||||
}
|
}
|
||||||
private void RefreshFields(Membership tmp)
|
private void RefreshFields(Membership tmp)
|
||||||
@ -228,16 +245,16 @@ namespace VEPROMS.CSLA.Library
|
|||||||
{
|
{
|
||||||
MyUser.RefreshUserMemberships(); // Update List for old value
|
MyUser.RefreshUserMemberships(); // Update List for old value
|
||||||
_UID = tmp.UID; // Update the 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)
|
if (_GID != tmp.GID)
|
||||||
{
|
{
|
||||||
MyGroup.RefreshGroupMemberships(); // Update List for old value
|
MyGroup.RefreshGroupMemberships(); // Update List for old value
|
||||||
_GID = tmp.GID; // Update the 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;
|
_StartDate = tmp.StartDate;
|
||||||
_EndDate = tmp.EndDate;
|
_EndDate = tmp.EndDate;
|
||||||
_Config = tmp.Config;
|
_Config = tmp.Config;
|
||||||
@ -250,8 +267,10 @@ namespace VEPROMS.CSLA.Library
|
|||||||
}
|
}
|
||||||
public static void Refresh(GroupMembership tmp)
|
public static void Refresh(GroupMembership tmp)
|
||||||
{
|
{
|
||||||
MembershipInfo tmpInfo = GetExistingByPrimaryKey(tmp.UGID);
|
string key = tmp.UGID.ToString();
|
||||||
if (tmpInfo == null) return;
|
ConvertListToDictionary();
|
||||||
|
if (_AllByPrimaryKey.ContainsKey(key))
|
||||||
|
foreach (MembershipInfo tmpInfo in _AllByPrimaryKey[key])
|
||||||
tmpInfo.RefreshFields(tmp);
|
tmpInfo.RefreshFields(tmp);
|
||||||
}
|
}
|
||||||
private void RefreshFields(GroupMembership tmp)
|
private void RefreshFields(GroupMembership tmp)
|
||||||
@ -260,9 +279,9 @@ namespace VEPROMS.CSLA.Library
|
|||||||
{
|
{
|
||||||
MyUser.RefreshUserMemberships(); // Update List for old value
|
MyUser.RefreshUserMemberships(); // Update List for old value
|
||||||
_UID = tmp.UID; // Update the 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;
|
_StartDate = tmp.StartDate;
|
||||||
_EndDate = tmp.EndDate;
|
_EndDate = tmp.EndDate;
|
||||||
_Config = tmp.Config;
|
_Config = tmp.Config;
|
||||||
@ -275,8 +294,10 @@ namespace VEPROMS.CSLA.Library
|
|||||||
}
|
}
|
||||||
public static void Refresh(UserMembership tmp)
|
public static void Refresh(UserMembership tmp)
|
||||||
{
|
{
|
||||||
MembershipInfo tmpInfo = GetExistingByPrimaryKey(tmp.UGID);
|
string key = tmp.UGID.ToString();
|
||||||
if (tmpInfo == null) return;
|
ConvertListToDictionary();
|
||||||
|
if (_AllByPrimaryKey.ContainsKey(key))
|
||||||
|
foreach (MembershipInfo tmpInfo in _AllByPrimaryKey[key])
|
||||||
tmpInfo.RefreshFields(tmp);
|
tmpInfo.RefreshFields(tmp);
|
||||||
}
|
}
|
||||||
private void RefreshFields(UserMembership tmp)
|
private void RefreshFields(UserMembership tmp)
|
||||||
@ -285,9 +306,9 @@ namespace VEPROMS.CSLA.Library
|
|||||||
{
|
{
|
||||||
MyGroup.RefreshGroupMemberships(); // Update List for old value
|
MyGroup.RefreshGroupMemberships(); // Update List for old value
|
||||||
_GID = tmp.GID; // Update the 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;
|
_StartDate = tmp.StartDate;
|
||||||
_EndDate = tmp.EndDate;
|
_EndDate = tmp.EndDate;
|
||||||
_Config = tmp.Config;
|
_Config = tmp.Config;
|
||||||
@ -308,7 +329,7 @@ namespace VEPROMS.CSLA.Library
|
|||||||
if (tmp == null)
|
if (tmp == null)
|
||||||
{
|
{
|
||||||
tmp = DataPortal.Fetch<MembershipInfo>(new PKCriteria(ugid));
|
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;
|
if (tmp.ErrorMessage == "No Record Found") tmp = null;
|
||||||
return tmp;
|
return tmp;
|
||||||
@ -322,6 +343,7 @@ namespace VEPROMS.CSLA.Library
|
|||||||
#region Data Access Portal
|
#region Data Access Portal
|
||||||
internal MembershipInfo(SafeDataReader dr)
|
internal MembershipInfo(SafeDataReader dr)
|
||||||
{
|
{
|
||||||
|
_MyMembershipInfoUnique = ++_MembershipInfoUnique;
|
||||||
if (_MyLog.IsDebugEnabled) _MyLog.DebugFormat("[{0}] MembershipInfo.Constructor", GetHashCode());
|
if (_MyLog.IsDebugEnabled) _MyLog.DebugFormat("[{0}] MembershipInfo.Constructor", GetHashCode());
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
@ -54,13 +54,17 @@ namespace VEPROMS.CSLA.Library
|
|||||||
#endregion
|
#endregion
|
||||||
#region Collection
|
#region Collection
|
||||||
protected static List<Part> _AllList = new List<Part>();
|
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()
|
private static void ConvertListToDictionary()
|
||||||
{
|
{
|
||||||
List<Part> remove = new List<Part>();
|
List<Part> remove = new List<Part>();
|
||||||
foreach (Part tmp in _AllList)
|
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);
|
remove.Add(tmp);
|
||||||
}
|
}
|
||||||
foreach (Part tmp in remove)
|
foreach (Part tmp in remove)
|
||||||
@ -70,7 +74,7 @@ namespace VEPROMS.CSLA.Library
|
|||||||
{
|
{
|
||||||
ConvertListToDictionary();
|
ConvertListToDictionary();
|
||||||
string key = contentID.ToString() + "_" + fromType.ToString();
|
string key = contentID.ToString() + "_" + fromType.ToString();
|
||||||
if (_AllByPrimaryKey.ContainsKey(key)) return _AllByPrimaryKey[key];
|
if (_AllByPrimaryKey.ContainsKey(key)) return _AllByPrimaryKey[key][0];
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
#endregion
|
#endregion
|
||||||
@ -221,7 +225,8 @@ namespace VEPROMS.CSLA.Library
|
|||||||
private bool _CheckingBrokenRules = false;
|
private bool _CheckingBrokenRules = false;
|
||||||
public IVEHasBrokenRules HasBrokenRules
|
public IVEHasBrokenRules HasBrokenRules
|
||||||
{
|
{
|
||||||
get {
|
get
|
||||||
|
{
|
||||||
if (_CheckingBrokenRules) return null;
|
if (_CheckingBrokenRules) return null;
|
||||||
if ((IsDirty || !IsNew) && BrokenRulesCollection.Count > 0) return this;
|
if ((IsDirty || !IsNew) && BrokenRulesCollection.Count > 0) return this;
|
||||||
try
|
try
|
||||||
@ -333,14 +338,25 @@ namespace VEPROMS.CSLA.Library
|
|||||||
#region Factory Methods
|
#region Factory Methods
|
||||||
public int CurrentEditLevel
|
public int CurrentEditLevel
|
||||||
{ get { return EditLevel; } }
|
{ get { return EditLevel; } }
|
||||||
|
private static int _PartUnique = 0;
|
||||||
|
private int _MyPartUnique;
|
||||||
|
public int MyPartUnique
|
||||||
|
{
|
||||||
|
get { return _MyPartUnique; }
|
||||||
|
}
|
||||||
protected Part()
|
protected Part()
|
||||||
{/* require use of factory methods */
|
{/* require use of factory methods */
|
||||||
|
_MyPartUnique = ++_PartUnique;
|
||||||
_AllList.Add(this);
|
_AllList.Add(this);
|
||||||
}
|
}
|
||||||
public void Dispose()
|
public void Dispose()
|
||||||
{
|
{
|
||||||
_AllList.Remove(this);
|
_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()
|
public static Part New()
|
||||||
{
|
{
|
||||||
@ -399,7 +415,7 @@ namespace VEPROMS.CSLA.Library
|
|||||||
if (tmp == null)
|
if (tmp == null)
|
||||||
{
|
{
|
||||||
tmp = DataPortal.Fetch<Part>(new PKCriteria(contentID, fromType));
|
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;
|
if (tmp.ErrorMessage == "No Record Found") tmp = null;
|
||||||
return tmp;
|
return tmp;
|
||||||
|
@ -37,13 +37,17 @@ namespace VEPROMS.CSLA.Library
|
|||||||
#endregion
|
#endregion
|
||||||
#region Collection
|
#region Collection
|
||||||
protected static List<PartInfo> _AllList = new List<PartInfo>();
|
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()
|
private static void ConvertListToDictionary()
|
||||||
{
|
{
|
||||||
List<PartInfo> remove = new List<PartInfo>();
|
List<PartInfo> remove = new List<PartInfo>();
|
||||||
foreach (PartInfo tmp in _AllList)
|
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);
|
remove.Add(tmp);
|
||||||
}
|
}
|
||||||
foreach (PartInfo tmp in remove)
|
foreach (PartInfo tmp in remove)
|
||||||
@ -57,7 +61,7 @@ namespace VEPROMS.CSLA.Library
|
|||||||
{
|
{
|
||||||
ConvertListToDictionary();
|
ConvertListToDictionary();
|
||||||
string key = contentID.ToString() + "_" + fromType.ToString();
|
string key = contentID.ToString() + "_" + fromType.ToString();
|
||||||
if (_AllByPrimaryKey.ContainsKey(key)) return _AllByPrimaryKey[key];
|
if (_AllByPrimaryKey.ContainsKey(key)) return _AllByPrimaryKey[key][0];
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
#endregion
|
#endregion
|
||||||
@ -175,14 +179,25 @@ namespace VEPROMS.CSLA.Library
|
|||||||
}
|
}
|
||||||
#endregion
|
#endregion
|
||||||
#region Factory Methods
|
#region Factory Methods
|
||||||
|
private static int _PartInfoUnique = 0;
|
||||||
|
private int _MyPartInfoUnique;
|
||||||
|
public int MyPartInfoUnique
|
||||||
|
{
|
||||||
|
get { return _MyPartInfoUnique; }
|
||||||
|
}
|
||||||
private PartInfo()
|
private PartInfo()
|
||||||
{/* require use of factory methods */
|
{/* require use of factory methods */
|
||||||
|
_MyPartInfoUnique = ++_PartInfoUnique;
|
||||||
_AllList.Add(this);
|
_AllList.Add(this);
|
||||||
}
|
}
|
||||||
public void Dispose()
|
public void Dispose()
|
||||||
{
|
{
|
||||||
_AllList.Remove(this);
|
_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()
|
public virtual Part Get()
|
||||||
{
|
{
|
||||||
@ -190,8 +205,10 @@ namespace VEPROMS.CSLA.Library
|
|||||||
}
|
}
|
||||||
public static void Refresh(Part tmp)
|
public static void Refresh(Part tmp)
|
||||||
{
|
{
|
||||||
PartInfo tmpInfo = GetExistingByPrimaryKey(tmp.ContentID, tmp.FromType);
|
string key = tmp.ContentID.ToString() + "_" + tmp.FromType.ToString();
|
||||||
if (tmpInfo == null) return;
|
ConvertListToDictionary();
|
||||||
|
if (_AllByPrimaryKey.ContainsKey(key))
|
||||||
|
foreach (PartInfo tmpInfo in _AllByPrimaryKey[key])
|
||||||
tmpInfo.RefreshFields(tmp);
|
tmpInfo.RefreshFields(tmp);
|
||||||
}
|
}
|
||||||
private void RefreshFields(Part tmp)
|
private void RefreshFields(Part tmp)
|
||||||
@ -200,9 +217,9 @@ namespace VEPROMS.CSLA.Library
|
|||||||
{
|
{
|
||||||
MyItem.RefreshItemParts(); // Update List for old value
|
MyItem.RefreshItemParts(); // Update List for old value
|
||||||
_ItemID = tmp.ItemID; // Update the 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;
|
_DTS = tmp.DTS;
|
||||||
_UserID = tmp.UserID;
|
_UserID = tmp.UserID;
|
||||||
_PartInfoExtension.Refresh(this);
|
_PartInfoExtension.Refresh(this);
|
||||||
@ -212,8 +229,10 @@ namespace VEPROMS.CSLA.Library
|
|||||||
}
|
}
|
||||||
public static void Refresh(Content myContent, ContentPart tmp)
|
public static void Refresh(Content myContent, ContentPart tmp)
|
||||||
{
|
{
|
||||||
PartInfo tmpInfo = GetExistingByPrimaryKey(myContent.ContentID, tmp.FromType);
|
string key = myContent.ContentID.ToString() + "_" + tmp.FromType.ToString();
|
||||||
if (tmpInfo == null) return;
|
ConvertListToDictionary();
|
||||||
|
if (_AllByPrimaryKey.ContainsKey(key))
|
||||||
|
foreach (PartInfo tmpInfo in _AllByPrimaryKey[key])
|
||||||
tmpInfo.RefreshFields(tmp);
|
tmpInfo.RefreshFields(tmp);
|
||||||
}
|
}
|
||||||
private void RefreshFields(ContentPart tmp)
|
private void RefreshFields(ContentPart tmp)
|
||||||
@ -222,9 +241,9 @@ namespace VEPROMS.CSLA.Library
|
|||||||
{
|
{
|
||||||
MyItem.RefreshItemParts(); // Update List for old value
|
MyItem.RefreshItemParts(); // Update List for old value
|
||||||
_ItemID = tmp.ItemID; // Update the 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;
|
_DTS = tmp.DTS;
|
||||||
_UserID = tmp.UserID;
|
_UserID = tmp.UserID;
|
||||||
_PartInfoExtension.Refresh(this);
|
_PartInfoExtension.Refresh(this);
|
||||||
@ -234,8 +253,10 @@ namespace VEPROMS.CSLA.Library
|
|||||||
}
|
}
|
||||||
public static void Refresh(ItemPart tmp)
|
public static void Refresh(ItemPart tmp)
|
||||||
{
|
{
|
||||||
PartInfo tmpInfo = GetExistingByPrimaryKey(tmp.ContentID, tmp.FromType);
|
string key = tmp.ContentID.ToString() + "_" + tmp.FromType.ToString();
|
||||||
if (tmpInfo == null) return;
|
ConvertListToDictionary();
|
||||||
|
if (_AllByPrimaryKey.ContainsKey(key))
|
||||||
|
foreach (PartInfo tmpInfo in _AllByPrimaryKey[key])
|
||||||
tmpInfo.RefreshFields(tmp);
|
tmpInfo.RefreshFields(tmp);
|
||||||
}
|
}
|
||||||
private void RefreshFields(ItemPart tmp)
|
private void RefreshFields(ItemPart tmp)
|
||||||
@ -257,7 +278,7 @@ namespace VEPROMS.CSLA.Library
|
|||||||
if (tmp == null)
|
if (tmp == null)
|
||||||
{
|
{
|
||||||
tmp = DataPortal.Fetch<PartInfo>(new PKCriteria(contentID, fromType));
|
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;
|
if (tmp.ErrorMessage == "No Record Found") tmp = null;
|
||||||
return tmp;
|
return tmp;
|
||||||
@ -271,6 +292,7 @@ namespace VEPROMS.CSLA.Library
|
|||||||
#region Data Access Portal
|
#region Data Access Portal
|
||||||
internal PartInfo(SafeDataReader dr)
|
internal PartInfo(SafeDataReader dr)
|
||||||
{
|
{
|
||||||
|
_MyPartInfoUnique = ++_PartInfoUnique;
|
||||||
if (_MyLog.IsDebugEnabled) _MyLog.DebugFormat("[{0}] PartInfo.Constructor", GetHashCode());
|
if (_MyLog.IsDebugEnabled) _MyLog.DebugFormat("[{0}] PartInfo.Constructor", GetHashCode());
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
@ -53,13 +53,17 @@ namespace VEPROMS.CSLA.Library
|
|||||||
#endregion
|
#endregion
|
||||||
#region Collection
|
#region Collection
|
||||||
protected static List<Permission> _AllList = new List<Permission>();
|
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()
|
private static void ConvertListToDictionary()
|
||||||
{
|
{
|
||||||
List<Permission> remove = new List<Permission>();
|
List<Permission> remove = new List<Permission>();
|
||||||
foreach (Permission tmp in _AllList)
|
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);
|
remove.Add(tmp);
|
||||||
}
|
}
|
||||||
foreach (Permission tmp in remove)
|
foreach (Permission tmp in remove)
|
||||||
@ -69,7 +73,7 @@ namespace VEPROMS.CSLA.Library
|
|||||||
{
|
{
|
||||||
ConvertListToDictionary();
|
ConvertListToDictionary();
|
||||||
string key = pid.ToString();
|
string key = pid.ToString();
|
||||||
if (_AllByPrimaryKey.ContainsKey(key)) return _AllByPrimaryKey[key];
|
if (_AllByPrimaryKey.ContainsKey(key)) return _AllByPrimaryKey[key][0];
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
#endregion
|
#endregion
|
||||||
@ -374,7 +378,8 @@ namespace VEPROMS.CSLA.Library
|
|||||||
private bool _CheckingBrokenRules = false;
|
private bool _CheckingBrokenRules = false;
|
||||||
public IVEHasBrokenRules HasBrokenRules
|
public IVEHasBrokenRules HasBrokenRules
|
||||||
{
|
{
|
||||||
get {
|
get
|
||||||
|
{
|
||||||
if (_CheckingBrokenRules) return null;
|
if (_CheckingBrokenRules) return null;
|
||||||
if ((IsDirty || !IsNew) && BrokenRulesCollection.Count > 0) return this;
|
if ((IsDirty || !IsNew) && BrokenRulesCollection.Count > 0) return this;
|
||||||
try
|
try
|
||||||
@ -532,14 +537,25 @@ namespace VEPROMS.CSLA.Library
|
|||||||
#region Factory Methods
|
#region Factory Methods
|
||||||
public int CurrentEditLevel
|
public int CurrentEditLevel
|
||||||
{ get { return EditLevel; } }
|
{ get { return EditLevel; } }
|
||||||
|
private static int _PermissionUnique = 0;
|
||||||
|
private int _MyPermissionUnique;
|
||||||
|
public int MyPermissionUnique
|
||||||
|
{
|
||||||
|
get { return _MyPermissionUnique; }
|
||||||
|
}
|
||||||
protected Permission()
|
protected Permission()
|
||||||
{/* require use of factory methods */
|
{/* require use of factory methods */
|
||||||
|
_MyPermissionUnique = ++_PermissionUnique;
|
||||||
_AllList.Add(this);
|
_AllList.Add(this);
|
||||||
}
|
}
|
||||||
public void Dispose()
|
public void Dispose()
|
||||||
{
|
{
|
||||||
_AllList.Remove(this);
|
_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()
|
public static Permission New()
|
||||||
{
|
{
|
||||||
@ -631,7 +647,7 @@ namespace VEPROMS.CSLA.Library
|
|||||||
if (tmp == null)
|
if (tmp == null)
|
||||||
{
|
{
|
||||||
tmp = DataPortal.Fetch<Permission>(new PKCriteria(pid));
|
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;
|
if (tmp.ErrorMessage == "No Record Found") tmp = null;
|
||||||
return tmp;
|
return tmp;
|
||||||
|
@ -37,13 +37,17 @@ namespace VEPROMS.CSLA.Library
|
|||||||
#endregion
|
#endregion
|
||||||
#region Collection
|
#region Collection
|
||||||
protected static List<PermissionInfo> _AllList = new List<PermissionInfo>();
|
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()
|
private static void ConvertListToDictionary()
|
||||||
{
|
{
|
||||||
List<PermissionInfo> remove = new List<PermissionInfo>();
|
List<PermissionInfo> remove = new List<PermissionInfo>();
|
||||||
foreach (PermissionInfo tmp in _AllList)
|
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);
|
remove.Add(tmp);
|
||||||
}
|
}
|
||||||
foreach (PermissionInfo tmp in remove)
|
foreach (PermissionInfo tmp in remove)
|
||||||
@ -57,7 +61,7 @@ namespace VEPROMS.CSLA.Library
|
|||||||
{
|
{
|
||||||
ConvertListToDictionary();
|
ConvertListToDictionary();
|
||||||
string key = pid.ToString();
|
string key = pid.ToString();
|
||||||
if (_AllByPrimaryKey.ContainsKey(key)) return _AllByPrimaryKey[key];
|
if (_AllByPrimaryKey.ContainsKey(key)) return _AllByPrimaryKey[key][0];
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
#endregion
|
#endregion
|
||||||
@ -233,14 +237,25 @@ namespace VEPROMS.CSLA.Library
|
|||||||
}
|
}
|
||||||
#endregion
|
#endregion
|
||||||
#region Factory Methods
|
#region Factory Methods
|
||||||
|
private static int _PermissionInfoUnique = 0;
|
||||||
|
private int _MyPermissionInfoUnique;
|
||||||
|
public int MyPermissionInfoUnique
|
||||||
|
{
|
||||||
|
get { return _MyPermissionInfoUnique; }
|
||||||
|
}
|
||||||
private PermissionInfo()
|
private PermissionInfo()
|
||||||
{/* require use of factory methods */
|
{/* require use of factory methods */
|
||||||
|
_MyPermissionInfoUnique = ++_PermissionInfoUnique;
|
||||||
_AllList.Add(this);
|
_AllList.Add(this);
|
||||||
}
|
}
|
||||||
public void Dispose()
|
public void Dispose()
|
||||||
{
|
{
|
||||||
_AllList.Remove(this);
|
_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()
|
public virtual Permission Get()
|
||||||
{
|
{
|
||||||
@ -248,8 +263,10 @@ namespace VEPROMS.CSLA.Library
|
|||||||
}
|
}
|
||||||
public static void Refresh(Permission tmp)
|
public static void Refresh(Permission tmp)
|
||||||
{
|
{
|
||||||
PermissionInfo tmpInfo = GetExistingByPrimaryKey(tmp.PID);
|
string key = tmp.PID.ToString();
|
||||||
if (tmpInfo == null) return;
|
ConvertListToDictionary();
|
||||||
|
if (_AllByPrimaryKey.ContainsKey(key))
|
||||||
|
foreach (PermissionInfo tmpInfo in _AllByPrimaryKey[key])
|
||||||
tmpInfo.RefreshFields(tmp);
|
tmpInfo.RefreshFields(tmp);
|
||||||
}
|
}
|
||||||
private void RefreshFields(Permission tmp)
|
private void RefreshFields(Permission tmp)
|
||||||
@ -258,9 +275,9 @@ namespace VEPROMS.CSLA.Library
|
|||||||
{
|
{
|
||||||
MyRole.RefreshRolePermissions(); // Update List for old value
|
MyRole.RefreshRolePermissions(); // Update List for old value
|
||||||
_RID = tmp.RID; // Update the 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;
|
_PermLevel = tmp.PermLevel;
|
||||||
_VersionType = tmp.VersionType;
|
_VersionType = tmp.VersionType;
|
||||||
_PermValue = tmp.PermValue;
|
_PermValue = tmp.PermValue;
|
||||||
@ -276,8 +293,10 @@ namespace VEPROMS.CSLA.Library
|
|||||||
}
|
}
|
||||||
public static void Refresh(RolePermission tmp)
|
public static void Refresh(RolePermission tmp)
|
||||||
{
|
{
|
||||||
PermissionInfo tmpInfo = GetExistingByPrimaryKey(tmp.PID);
|
string key = tmp.PID.ToString();
|
||||||
if (tmpInfo == null) return;
|
ConvertListToDictionary();
|
||||||
|
if (_AllByPrimaryKey.ContainsKey(key))
|
||||||
|
foreach (PermissionInfo tmpInfo in _AllByPrimaryKey[key])
|
||||||
tmpInfo.RefreshFields(tmp);
|
tmpInfo.RefreshFields(tmp);
|
||||||
}
|
}
|
||||||
private void RefreshFields(RolePermission tmp)
|
private void RefreshFields(RolePermission tmp)
|
||||||
@ -305,7 +324,7 @@ namespace VEPROMS.CSLA.Library
|
|||||||
if (tmp == null)
|
if (tmp == null)
|
||||||
{
|
{
|
||||||
tmp = DataPortal.Fetch<PermissionInfo>(new PKCriteria(pid));
|
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;
|
if (tmp.ErrorMessage == "No Record Found") tmp = null;
|
||||||
return tmp;
|
return tmp;
|
||||||
@ -319,6 +338,7 @@ namespace VEPROMS.CSLA.Library
|
|||||||
#region Data Access Portal
|
#region Data Access Portal
|
||||||
internal PermissionInfo(SafeDataReader dr)
|
internal PermissionInfo(SafeDataReader dr)
|
||||||
{
|
{
|
||||||
|
_MyPermissionInfoUnique = ++_PermissionInfoUnique;
|
||||||
if (_MyLog.IsDebugEnabled) _MyLog.DebugFormat("[{0}] PermissionInfo.Constructor", GetHashCode());
|
if (_MyLog.IsDebugEnabled) _MyLog.DebugFormat("[{0}] PermissionInfo.Constructor", GetHashCode());
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
@ -53,13 +53,17 @@ namespace VEPROMS.CSLA.Library
|
|||||||
#endregion
|
#endregion
|
||||||
#region Collection
|
#region Collection
|
||||||
protected static List<RoUsage> _AllList = new List<RoUsage>();
|
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()
|
private static void ConvertListToDictionary()
|
||||||
{
|
{
|
||||||
List<RoUsage> remove = new List<RoUsage>();
|
List<RoUsage> remove = new List<RoUsage>();
|
||||||
foreach (RoUsage tmp in _AllList)
|
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);
|
remove.Add(tmp);
|
||||||
}
|
}
|
||||||
foreach (RoUsage tmp in remove)
|
foreach (RoUsage tmp in remove)
|
||||||
@ -69,7 +73,7 @@ namespace VEPROMS.CSLA.Library
|
|||||||
{
|
{
|
||||||
ConvertListToDictionary();
|
ConvertListToDictionary();
|
||||||
string key = rOUsageID.ToString();
|
string key = rOUsageID.ToString();
|
||||||
if (_AllByPrimaryKey.ContainsKey(key)) return _AllByPrimaryKey[key];
|
if (_AllByPrimaryKey.ContainsKey(key)) return _AllByPrimaryKey[key][0];
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
#endregion
|
#endregion
|
||||||
@ -243,7 +247,8 @@ namespace VEPROMS.CSLA.Library
|
|||||||
private bool _CheckingBrokenRules = false;
|
private bool _CheckingBrokenRules = false;
|
||||||
public IVEHasBrokenRules HasBrokenRules
|
public IVEHasBrokenRules HasBrokenRules
|
||||||
{
|
{
|
||||||
get {
|
get
|
||||||
|
{
|
||||||
if (_CheckingBrokenRules) return null;
|
if (_CheckingBrokenRules) return null;
|
||||||
if ((IsDirty || !IsNew) && BrokenRulesCollection.Count > 0) return this;
|
if ((IsDirty || !IsNew) && BrokenRulesCollection.Count > 0) return this;
|
||||||
try
|
try
|
||||||
@ -366,14 +371,25 @@ namespace VEPROMS.CSLA.Library
|
|||||||
#region Factory Methods
|
#region Factory Methods
|
||||||
public int CurrentEditLevel
|
public int CurrentEditLevel
|
||||||
{ get { return EditLevel; } }
|
{ get { return EditLevel; } }
|
||||||
|
private static int _RoUsageUnique = 0;
|
||||||
|
private int _MyRoUsageUnique;
|
||||||
|
public int MyRoUsageUnique
|
||||||
|
{
|
||||||
|
get { return _MyRoUsageUnique; }
|
||||||
|
}
|
||||||
protected RoUsage()
|
protected RoUsage()
|
||||||
{/* require use of factory methods */
|
{/* require use of factory methods */
|
||||||
|
_MyRoUsageUnique = ++_RoUsageUnique;
|
||||||
_AllList.Add(this);
|
_AllList.Add(this);
|
||||||
}
|
}
|
||||||
public void Dispose()
|
public void Dispose()
|
||||||
{
|
{
|
||||||
_AllList.Remove(this);
|
_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()
|
public static RoUsage New()
|
||||||
{
|
{
|
||||||
@ -454,7 +470,7 @@ namespace VEPROMS.CSLA.Library
|
|||||||
if (tmp == null)
|
if (tmp == null)
|
||||||
{
|
{
|
||||||
tmp = DataPortal.Fetch<RoUsage>(new PKCriteria(rOUsageID));
|
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;
|
if (tmp.ErrorMessage == "No Record Found") tmp = null;
|
||||||
return tmp;
|
return tmp;
|
||||||
|
@ -37,13 +37,17 @@ namespace VEPROMS.CSLA.Library
|
|||||||
#endregion
|
#endregion
|
||||||
#region Collection
|
#region Collection
|
||||||
protected static List<RoUsageInfo> _AllList = new List<RoUsageInfo>();
|
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()
|
private static void ConvertListToDictionary()
|
||||||
{
|
{
|
||||||
List<RoUsageInfo> remove = new List<RoUsageInfo>();
|
List<RoUsageInfo> remove = new List<RoUsageInfo>();
|
||||||
foreach (RoUsageInfo tmp in _AllList)
|
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);
|
remove.Add(tmp);
|
||||||
}
|
}
|
||||||
foreach (RoUsageInfo tmp in remove)
|
foreach (RoUsageInfo tmp in remove)
|
||||||
@ -57,7 +61,7 @@ namespace VEPROMS.CSLA.Library
|
|||||||
{
|
{
|
||||||
ConvertListToDictionary();
|
ConvertListToDictionary();
|
||||||
string key = rOUsageID.ToString();
|
string key = rOUsageID.ToString();
|
||||||
if (_AllByPrimaryKey.ContainsKey(key)) return _AllByPrimaryKey[key];
|
if (_AllByPrimaryKey.ContainsKey(key)) return _AllByPrimaryKey[key][0];
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
#endregion
|
#endregion
|
||||||
@ -171,14 +175,25 @@ namespace VEPROMS.CSLA.Library
|
|||||||
}
|
}
|
||||||
#endregion
|
#endregion
|
||||||
#region Factory Methods
|
#region Factory Methods
|
||||||
|
private static int _RoUsageInfoUnique = 0;
|
||||||
|
private int _MyRoUsageInfoUnique;
|
||||||
|
public int MyRoUsageInfoUnique
|
||||||
|
{
|
||||||
|
get { return _MyRoUsageInfoUnique; }
|
||||||
|
}
|
||||||
private RoUsageInfo()
|
private RoUsageInfo()
|
||||||
{/* require use of factory methods */
|
{/* require use of factory methods */
|
||||||
|
_MyRoUsageInfoUnique = ++_RoUsageInfoUnique;
|
||||||
_AllList.Add(this);
|
_AllList.Add(this);
|
||||||
}
|
}
|
||||||
public void Dispose()
|
public void Dispose()
|
||||||
{
|
{
|
||||||
_AllList.Remove(this);
|
_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()
|
public virtual RoUsage Get()
|
||||||
{
|
{
|
||||||
@ -186,8 +201,10 @@ namespace VEPROMS.CSLA.Library
|
|||||||
}
|
}
|
||||||
public static void Refresh(RoUsage tmp)
|
public static void Refresh(RoUsage tmp)
|
||||||
{
|
{
|
||||||
RoUsageInfo tmpInfo = GetExistingByPrimaryKey(tmp.ROUsageID);
|
string key = tmp.ROUsageID.ToString();
|
||||||
if (tmpInfo == null) return;
|
ConvertListToDictionary();
|
||||||
|
if (_AllByPrimaryKey.ContainsKey(key))
|
||||||
|
foreach (RoUsageInfo tmpInfo in _AllByPrimaryKey[key])
|
||||||
tmpInfo.RefreshFields(tmp);
|
tmpInfo.RefreshFields(tmp);
|
||||||
}
|
}
|
||||||
private void RefreshFields(RoUsage tmp)
|
private void RefreshFields(RoUsage tmp)
|
||||||
@ -196,9 +213,9 @@ namespace VEPROMS.CSLA.Library
|
|||||||
{
|
{
|
||||||
MyContent.RefreshContentRoUsages(); // Update List for old value
|
MyContent.RefreshContentRoUsages(); // Update List for old value
|
||||||
_ContentID = tmp.ContentID; // Update the 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;
|
_ROID = tmp.ROID;
|
||||||
_Config = tmp.Config;
|
_Config = tmp.Config;
|
||||||
_DTS = tmp.DTS;
|
_DTS = tmp.DTS;
|
||||||
@ -209,8 +226,10 @@ namespace VEPROMS.CSLA.Library
|
|||||||
}
|
}
|
||||||
public static void Refresh(ContentRoUsage tmp)
|
public static void Refresh(ContentRoUsage tmp)
|
||||||
{
|
{
|
||||||
RoUsageInfo tmpInfo = GetExistingByPrimaryKey(tmp.ROUsageID);
|
string key = tmp.ROUsageID.ToString();
|
||||||
if (tmpInfo == null) return;
|
ConvertListToDictionary();
|
||||||
|
if (_AllByPrimaryKey.ContainsKey(key))
|
||||||
|
foreach (RoUsageInfo tmpInfo in _AllByPrimaryKey[key])
|
||||||
tmpInfo.RefreshFields(tmp);
|
tmpInfo.RefreshFields(tmp);
|
||||||
}
|
}
|
||||||
private void RefreshFields(ContentRoUsage tmp)
|
private void RefreshFields(ContentRoUsage tmp)
|
||||||
@ -233,7 +252,7 @@ namespace VEPROMS.CSLA.Library
|
|||||||
if (tmp == null)
|
if (tmp == null)
|
||||||
{
|
{
|
||||||
tmp = DataPortal.Fetch<RoUsageInfo>(new PKCriteria(rOUsageID));
|
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;
|
if (tmp.ErrorMessage == "No Record Found") tmp = null;
|
||||||
return tmp;
|
return tmp;
|
||||||
@ -247,6 +266,7 @@ namespace VEPROMS.CSLA.Library
|
|||||||
#region Data Access Portal
|
#region Data Access Portal
|
||||||
internal RoUsageInfo(SafeDataReader dr)
|
internal RoUsageInfo(SafeDataReader dr)
|
||||||
{
|
{
|
||||||
|
_MyRoUsageInfoUnique = ++_RoUsageInfoUnique;
|
||||||
if (_MyLog.IsDebugEnabled) _MyLog.DebugFormat("[{0}] RoUsageInfo.Constructor", GetHashCode());
|
if (_MyLog.IsDebugEnabled) _MyLog.DebugFormat("[{0}] RoUsageInfo.Constructor", GetHashCode());
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
@ -78,15 +78,20 @@ namespace VEPROMS.CSLA.Library
|
|||||||
#endregion
|
#endregion
|
||||||
#region Collection
|
#region Collection
|
||||||
protected static List<Role> _AllList = new List<Role>();
|
protected static List<Role> _AllList = new List<Role>();
|
||||||
private static Dictionary<string, Role> _AllByPrimaryKey = new Dictionary<string, Role>();
|
private static Dictionary<string, List<Role>> _AllByPrimaryKey = new Dictionary<string, List<Role>>();
|
||||||
private static Dictionary<string, Role> _AllByName = new Dictionary<string, Role>();
|
private static Dictionary<string, List<Role>> _AllByName = new Dictionary<string, List<Role>>();
|
||||||
private static void ConvertListToDictionary()
|
private static void ConvertListToDictionary()
|
||||||
{
|
{
|
||||||
List<Role> remove = new List<Role>();
|
List<Role> remove = new List<Role>();
|
||||||
foreach (Role tmp in _AllList)
|
foreach (Role tmp in _AllList)
|
||||||
{
|
{
|
||||||
_AllByPrimaryKey[tmp.RID.ToString()]=tmp; // Primary Key
|
if (!_AllByPrimaryKey.ContainsKey(tmp.RID.ToString()))
|
||||||
_AllByName[tmp.Name.ToString()] = tmp; // Unique Index
|
{
|
||||||
|
_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);
|
remove.Add(tmp);
|
||||||
}
|
}
|
||||||
foreach (Role tmp in remove)
|
foreach (Role tmp in remove)
|
||||||
@ -96,14 +101,14 @@ namespace VEPROMS.CSLA.Library
|
|||||||
{
|
{
|
||||||
ConvertListToDictionary();
|
ConvertListToDictionary();
|
||||||
string key = rid.ToString();
|
string key = rid.ToString();
|
||||||
if (_AllByPrimaryKey.ContainsKey(key)) return _AllByPrimaryKey[key];
|
if (_AllByPrimaryKey.ContainsKey(key)) return _AllByPrimaryKey[key][0];
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
public static Role GetExistingByName(string name)
|
public static Role GetExistingByName(string name)
|
||||||
{
|
{
|
||||||
ConvertListToDictionary();
|
ConvertListToDictionary();
|
||||||
string key = name.ToString();
|
string key = name.ToString();
|
||||||
if (_AllByName.ContainsKey(key)) return _AllByName[key];
|
if (_AllByName.ContainsKey(key)) return _AllByName[key][0];
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
#endregion
|
#endregion
|
||||||
@ -307,7 +312,8 @@ namespace VEPROMS.CSLA.Library
|
|||||||
private bool _CheckingBrokenRules = false;
|
private bool _CheckingBrokenRules = false;
|
||||||
public IVEHasBrokenRules HasBrokenRules
|
public IVEHasBrokenRules HasBrokenRules
|
||||||
{
|
{
|
||||||
get {
|
get
|
||||||
|
{
|
||||||
if (_CheckingBrokenRules) return null;
|
if (_CheckingBrokenRules) return null;
|
||||||
if ((IsDirty || !IsNew) && BrokenRulesCollection.Count > 0) return this;
|
if ((IsDirty || !IsNew) && BrokenRulesCollection.Count > 0) return this;
|
||||||
try
|
try
|
||||||
@ -435,15 +441,29 @@ namespace VEPROMS.CSLA.Library
|
|||||||
#region Factory Methods
|
#region Factory Methods
|
||||||
public int CurrentEditLevel
|
public int CurrentEditLevel
|
||||||
{ get { return EditLevel; } }
|
{ get { return EditLevel; } }
|
||||||
|
private static int _RoleUnique = 0;
|
||||||
|
private int _MyRoleUnique;
|
||||||
|
public int MyRoleUnique
|
||||||
|
{
|
||||||
|
get { return _MyRoleUnique; }
|
||||||
|
}
|
||||||
protected Role()
|
protected Role()
|
||||||
{/* require use of factory methods */
|
{/* require use of factory methods */
|
||||||
|
_MyRoleUnique = ++_RoleUnique;
|
||||||
_AllList.Add(this);
|
_AllList.Add(this);
|
||||||
}
|
}
|
||||||
public void Dispose()
|
public void Dispose()
|
||||||
{
|
{
|
||||||
_AllList.Remove(this);
|
_AllList.Remove(this);
|
||||||
_AllByPrimaryKey.Remove(RID.ToString());
|
if (!_AllByPrimaryKey.ContainsKey(RID.ToString())) return;
|
||||||
_AllByName.Remove(Name.ToString());
|
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()
|
public static Role New()
|
||||||
{
|
{
|
||||||
@ -500,7 +520,7 @@ namespace VEPROMS.CSLA.Library
|
|||||||
if (tmp == null)
|
if (tmp == null)
|
||||||
{
|
{
|
||||||
tmp = DataPortal.Fetch<Role>(new PKCriteria(rid));
|
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;
|
if (tmp.ErrorMessage == "No Record Found") tmp = null;
|
||||||
return tmp;
|
return tmp;
|
||||||
@ -520,7 +540,7 @@ namespace VEPROMS.CSLA.Library
|
|||||||
if (tmp == null)
|
if (tmp == null)
|
||||||
{
|
{
|
||||||
tmp = DataPortal.Fetch<Role>(new NameCriteria(name));
|
tmp = DataPortal.Fetch<Role>(new NameCriteria(name));
|
||||||
_AllList.Add(tmp);
|
if (!_AllList.Contains(tmp)) _AllList.Add(tmp);
|
||||||
}
|
}
|
||||||
if (tmp.ErrorMessage == "No Record Found") tmp = null;
|
if (tmp.ErrorMessage == "No Record Found") tmp = null;
|
||||||
return tmp;
|
return tmp;
|
||||||
|
@ -37,13 +37,17 @@ namespace VEPROMS.CSLA.Library
|
|||||||
#endregion
|
#endregion
|
||||||
#region Collection
|
#region Collection
|
||||||
protected static List<RoleInfo> _AllList = new List<RoleInfo>();
|
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()
|
private static void ConvertListToDictionary()
|
||||||
{
|
{
|
||||||
List<RoleInfo> remove = new List<RoleInfo>();
|
List<RoleInfo> remove = new List<RoleInfo>();
|
||||||
foreach (RoleInfo tmp in _AllList)
|
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);
|
remove.Add(tmp);
|
||||||
}
|
}
|
||||||
foreach (RoleInfo tmp in remove)
|
foreach (RoleInfo tmp in remove)
|
||||||
@ -57,7 +61,7 @@ namespace VEPROMS.CSLA.Library
|
|||||||
{
|
{
|
||||||
ConvertListToDictionary();
|
ConvertListToDictionary();
|
||||||
string key = rid.ToString();
|
string key = rid.ToString();
|
||||||
if (_AllByPrimaryKey.ContainsKey(key)) return _AllByPrimaryKey[key];
|
if (_AllByPrimaryKey.ContainsKey(key)) return _AllByPrimaryKey[key][0];
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
#endregion
|
#endregion
|
||||||
@ -159,7 +163,10 @@ namespace VEPROMS.CSLA.Library
|
|||||||
}
|
}
|
||||||
internal void RefreshRoleAssignments()
|
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;
|
private int _RolePermissionCount = 0;
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@ -191,7 +198,10 @@ namespace VEPROMS.CSLA.Library
|
|||||||
}
|
}
|
||||||
internal void RefreshRolePermissions()
|
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
|
// TODO: Replace base RoleInfo.ToString function as necessary
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@ -213,14 +223,25 @@ namespace VEPROMS.CSLA.Library
|
|||||||
}
|
}
|
||||||
#endregion
|
#endregion
|
||||||
#region Factory Methods
|
#region Factory Methods
|
||||||
|
private static int _RoleInfoUnique = 0;
|
||||||
|
private int _MyRoleInfoUnique;
|
||||||
|
public int MyRoleInfoUnique
|
||||||
|
{
|
||||||
|
get { return _MyRoleInfoUnique; }
|
||||||
|
}
|
||||||
private RoleInfo()
|
private RoleInfo()
|
||||||
{/* require use of factory methods */
|
{/* require use of factory methods */
|
||||||
|
_MyRoleInfoUnique = ++_RoleInfoUnique;
|
||||||
_AllList.Add(this);
|
_AllList.Add(this);
|
||||||
}
|
}
|
||||||
public void Dispose()
|
public void Dispose()
|
||||||
{
|
{
|
||||||
_AllList.Remove(this);
|
_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()
|
public virtual Role Get()
|
||||||
{
|
{
|
||||||
@ -228,8 +249,10 @@ namespace VEPROMS.CSLA.Library
|
|||||||
}
|
}
|
||||||
public static void Refresh(Role tmp)
|
public static void Refresh(Role tmp)
|
||||||
{
|
{
|
||||||
RoleInfo tmpInfo = GetExistingByPrimaryKey(tmp.RID);
|
string key = tmp.RID.ToString();
|
||||||
if (tmpInfo == null) return;
|
ConvertListToDictionary();
|
||||||
|
if (_AllByPrimaryKey.ContainsKey(key))
|
||||||
|
foreach (RoleInfo tmpInfo in _AllByPrimaryKey[key])
|
||||||
tmpInfo.RefreshFields(tmp);
|
tmpInfo.RefreshFields(tmp);
|
||||||
}
|
}
|
||||||
private void RefreshFields(Role tmp)
|
private void RefreshFields(Role tmp)
|
||||||
@ -251,7 +274,7 @@ namespace VEPROMS.CSLA.Library
|
|||||||
if (tmp == null)
|
if (tmp == null)
|
||||||
{
|
{
|
||||||
tmp = DataPortal.Fetch<RoleInfo>(new PKCriteria(rid));
|
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;
|
if (tmp.ErrorMessage == "No Record Found") tmp = null;
|
||||||
return tmp;
|
return tmp;
|
||||||
@ -265,6 +288,7 @@ namespace VEPROMS.CSLA.Library
|
|||||||
#region Data Access Portal
|
#region Data Access Portal
|
||||||
internal RoleInfo(SafeDataReader dr)
|
internal RoleInfo(SafeDataReader dr)
|
||||||
{
|
{
|
||||||
|
_MyRoleInfoUnique = ++_RoleInfoUnique;
|
||||||
if (_MyLog.IsDebugEnabled) _MyLog.DebugFormat("[{0}] RoleInfo.Constructor", GetHashCode());
|
if (_MyLog.IsDebugEnabled) _MyLog.DebugFormat("[{0}] RoleInfo.Constructor", GetHashCode());
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
@ -55,13 +55,17 @@ namespace VEPROMS.CSLA.Library
|
|||||||
#endregion
|
#endregion
|
||||||
#region Collection
|
#region Collection
|
||||||
protected static List<Transition> _AllList = new List<Transition>();
|
protected static List<Transition> _AllList = new List<Transition>();
|
||||||
private static Dictionary<string, Transition> _AllByPrimaryKey = new Dictionary<string, Transition>();
|
private static Dictionary<string, List<Transition>> _AllByPrimaryKey = new Dictionary<string, List<Transition>>();
|
||||||
private static void ConvertListToDictionary()
|
private static void ConvertListToDictionary()
|
||||||
{
|
{
|
||||||
List<Transition> remove = new List<Transition>();
|
List<Transition> remove = new List<Transition>();
|
||||||
foreach (Transition tmp in _AllList)
|
foreach (Transition tmp in _AllList)
|
||||||
{
|
{
|
||||||
_AllByPrimaryKey[tmp.TransitionID.ToString()]=tmp; // Primary Key
|
if (!_AllByPrimaryKey.ContainsKey(tmp.TransitionID.ToString()))
|
||||||
|
{
|
||||||
|
_AllByPrimaryKey[tmp.TransitionID.ToString()] = new List<Transition>(); // Add new list for PrimaryKey
|
||||||
|
}
|
||||||
|
_AllByPrimaryKey[tmp.TransitionID.ToString()].Add(tmp); // Add to Primary Key list
|
||||||
remove.Add(tmp);
|
remove.Add(tmp);
|
||||||
}
|
}
|
||||||
foreach (Transition tmp in remove)
|
foreach (Transition tmp in remove)
|
||||||
@ -71,7 +75,7 @@ namespace VEPROMS.CSLA.Library
|
|||||||
{
|
{
|
||||||
ConvertListToDictionary();
|
ConvertListToDictionary();
|
||||||
string key = transitionID.ToString();
|
string key = transitionID.ToString();
|
||||||
if (_AllByPrimaryKey.ContainsKey(key)) return _AllByPrimaryKey[key];
|
if (_AllByPrimaryKey.ContainsKey(key)) return _AllByPrimaryKey[key][0];
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
#endregion
|
#endregion
|
||||||
@ -339,7 +343,8 @@ namespace VEPROMS.CSLA.Library
|
|||||||
private bool _CheckingBrokenRules = false;
|
private bool _CheckingBrokenRules = false;
|
||||||
public IVEHasBrokenRules HasBrokenRules
|
public IVEHasBrokenRules HasBrokenRules
|
||||||
{
|
{
|
||||||
get {
|
get
|
||||||
|
{
|
||||||
if (_CheckingBrokenRules) return null;
|
if (_CheckingBrokenRules) return null;
|
||||||
if ((IsDirty || !IsNew) && BrokenRulesCollection.Count > 0) return this;
|
if ((IsDirty || !IsNew) && BrokenRulesCollection.Count > 0) return this;
|
||||||
try
|
try
|
||||||
@ -497,14 +502,25 @@ namespace VEPROMS.CSLA.Library
|
|||||||
#region Factory Methods
|
#region Factory Methods
|
||||||
public int CurrentEditLevel
|
public int CurrentEditLevel
|
||||||
{ get { return EditLevel; } }
|
{ get { return EditLevel; } }
|
||||||
|
private static int _TransitionUnique = 0;
|
||||||
|
private int _MyTransitionUnique;
|
||||||
|
public int MyTransitionUnique
|
||||||
|
{
|
||||||
|
get { return _MyTransitionUnique; }
|
||||||
|
}
|
||||||
protected Transition()
|
protected Transition()
|
||||||
{/* require use of factory methods */
|
{/* require use of factory methods */
|
||||||
|
_MyTransitionUnique = ++_TransitionUnique;
|
||||||
_AllList.Add(this);
|
_AllList.Add(this);
|
||||||
}
|
}
|
||||||
public void Dispose()
|
public void Dispose()
|
||||||
{
|
{
|
||||||
_AllList.Remove(this);
|
_AllList.Remove(this);
|
||||||
_AllByPrimaryKey.Remove(TransitionID.ToString());
|
if (!_AllByPrimaryKey.ContainsKey(TransitionID.ToString())) return;
|
||||||
|
List<Transition> listTransition = _AllByPrimaryKey[TransitionID.ToString()]; // Get the list of items
|
||||||
|
listTransition.Remove(this); // Remove the item from the list
|
||||||
|
if (listTransition.Count == 0) //If there are no items left in the list
|
||||||
|
_AllByPrimaryKey.Remove(TransitionID.ToString()); // remove the list
|
||||||
}
|
}
|
||||||
public static Transition New()
|
public static Transition New()
|
||||||
{
|
{
|
||||||
@ -590,7 +606,7 @@ namespace VEPROMS.CSLA.Library
|
|||||||
if (tmp == null)
|
if (tmp == null)
|
||||||
{
|
{
|
||||||
tmp = DataPortal.Fetch<Transition>(new PKCriteria(transitionID));
|
tmp = DataPortal.Fetch<Transition>(new PKCriteria(transitionID));
|
||||||
_AllList.Add(tmp);
|
if (!_AllList.Contains(tmp)) _AllList.Add(tmp);
|
||||||
}
|
}
|
||||||
if (tmp.ErrorMessage == "No Record Found") tmp = null;
|
if (tmp.ErrorMessage == "No Record Found") tmp = null;
|
||||||
return tmp;
|
return tmp;
|
||||||
|
@ -37,13 +37,17 @@ namespace VEPROMS.CSLA.Library
|
|||||||
#endregion
|
#endregion
|
||||||
#region Collection
|
#region Collection
|
||||||
protected static List<TransitionInfo> _AllList = new List<TransitionInfo>();
|
protected static List<TransitionInfo> _AllList = new List<TransitionInfo>();
|
||||||
private static Dictionary<string, TransitionInfo> _AllByPrimaryKey = new Dictionary<string, TransitionInfo>();
|
private static Dictionary<string, List<TransitionInfo>> _AllByPrimaryKey = new Dictionary<string, List<TransitionInfo>>();
|
||||||
private static void ConvertListToDictionary()
|
private static void ConvertListToDictionary()
|
||||||
{
|
{
|
||||||
List<TransitionInfo> remove = new List<TransitionInfo>();
|
List<TransitionInfo> remove = new List<TransitionInfo>();
|
||||||
foreach (TransitionInfo tmp in _AllList)
|
foreach (TransitionInfo tmp in _AllList)
|
||||||
{
|
{
|
||||||
_AllByPrimaryKey[tmp.TransitionID.ToString()]=tmp; // Primary Key
|
if (!_AllByPrimaryKey.ContainsKey(tmp.TransitionID.ToString()))
|
||||||
|
{
|
||||||
|
_AllByPrimaryKey[tmp.TransitionID.ToString()] = new List<TransitionInfo>(); // Add new list for PrimaryKey
|
||||||
|
}
|
||||||
|
_AllByPrimaryKey[tmp.TransitionID.ToString()].Add(tmp); // Add to Primary Key list
|
||||||
remove.Add(tmp);
|
remove.Add(tmp);
|
||||||
}
|
}
|
||||||
foreach (TransitionInfo tmp in remove)
|
foreach (TransitionInfo tmp in remove)
|
||||||
@ -57,7 +61,7 @@ namespace VEPROMS.CSLA.Library
|
|||||||
{
|
{
|
||||||
ConvertListToDictionary();
|
ConvertListToDictionary();
|
||||||
string key = transitionID.ToString();
|
string key = transitionID.ToString();
|
||||||
if (_AllByPrimaryKey.ContainsKey(key)) return _AllByPrimaryKey[key];
|
if (_AllByPrimaryKey.ContainsKey(key)) return _AllByPrimaryKey[key][0];
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
#endregion
|
#endregion
|
||||||
@ -244,14 +248,25 @@ namespace VEPROMS.CSLA.Library
|
|||||||
}
|
}
|
||||||
#endregion
|
#endregion
|
||||||
#region Factory Methods
|
#region Factory Methods
|
||||||
|
private static int _TransitionInfoUnique = 0;
|
||||||
|
private int _MyTransitionInfoUnique;
|
||||||
|
public int MyTransitionInfoUnique
|
||||||
|
{
|
||||||
|
get { return _MyTransitionInfoUnique; }
|
||||||
|
}
|
||||||
private TransitionInfo()
|
private TransitionInfo()
|
||||||
{/* require use of factory methods */
|
{/* require use of factory methods */
|
||||||
|
_MyTransitionInfoUnique = ++_TransitionInfoUnique;
|
||||||
_AllList.Add(this);
|
_AllList.Add(this);
|
||||||
}
|
}
|
||||||
public void Dispose()
|
public void Dispose()
|
||||||
{
|
{
|
||||||
_AllList.Remove(this);
|
_AllList.Remove(this);
|
||||||
_AllByPrimaryKey.Remove(TransitionID.ToString());
|
if (!_AllByPrimaryKey.ContainsKey(TransitionID.ToString())) return;
|
||||||
|
List<TransitionInfo> listTransitionInfo = _AllByPrimaryKey[TransitionID.ToString()]; // Get the list of items
|
||||||
|
listTransitionInfo.Remove(this); // Remove the item from the list
|
||||||
|
if (listTransitionInfo.Count == 0) // If there are no items left in the list
|
||||||
|
_AllByPrimaryKey.Remove(TransitionID.ToString()); // remove the list
|
||||||
}
|
}
|
||||||
public virtual Transition Get()
|
public virtual Transition Get()
|
||||||
{
|
{
|
||||||
@ -259,8 +274,10 @@ namespace VEPROMS.CSLA.Library
|
|||||||
}
|
}
|
||||||
public static void Refresh(Transition tmp)
|
public static void Refresh(Transition tmp)
|
||||||
{
|
{
|
||||||
TransitionInfo tmpInfo = GetExistingByPrimaryKey(tmp.TransitionID);
|
string key = tmp.TransitionID.ToString();
|
||||||
if (tmpInfo == null) return;
|
ConvertListToDictionary();
|
||||||
|
if (_AllByPrimaryKey.ContainsKey(key))
|
||||||
|
foreach (TransitionInfo tmpInfo in _AllByPrimaryKey[key])
|
||||||
tmpInfo.RefreshFields(tmp);
|
tmpInfo.RefreshFields(tmp);
|
||||||
}
|
}
|
||||||
private void RefreshFields(Transition tmp)
|
private void RefreshFields(Transition tmp)
|
||||||
@ -269,23 +286,23 @@ namespace VEPROMS.CSLA.Library
|
|||||||
{
|
{
|
||||||
MyContent.RefreshContentTransitions(); // Update List for old value
|
MyContent.RefreshContentTransitions(); // Update List for old value
|
||||||
_FromID = tmp.FromID; // Update the value
|
_FromID = tmp.FromID; // Update the value
|
||||||
_MyContent = null; // Reset list so that the next line gets a new list
|
|
||||||
MyContent.RefreshContentTransitions(); // Update List for new value
|
|
||||||
}
|
}
|
||||||
|
_MyContent = null; // Reset list so that the next line gets a new list
|
||||||
|
if (MyContent != null) MyContent.RefreshContentTransitions(); // Update List for new value
|
||||||
if (_ToID != tmp.ToID)
|
if (_ToID != tmp.ToID)
|
||||||
{
|
{
|
||||||
MyItemToID.RefreshItemTransitions_ToID(); // Update List for old value
|
MyItemToID.RefreshItemTransitions_ToID(); // Update List for old value
|
||||||
_ToID = tmp.ToID; // Update the value
|
_ToID = tmp.ToID; // Update the value
|
||||||
_MyItemToID = null; // Reset list so that the next line gets a new list
|
|
||||||
MyItemToID.RefreshItemTransitions_ToID(); // Update List for new value
|
|
||||||
}
|
}
|
||||||
|
_MyItemToID = null; // Reset list so that the next line gets a new list
|
||||||
|
if (MyItemToID != null) MyItemToID.RefreshItemTransitions_ToID(); // Update List for new value
|
||||||
if (_RangeID != tmp.RangeID)
|
if (_RangeID != tmp.RangeID)
|
||||||
{
|
{
|
||||||
MyItemRangeID.RefreshItemTransitions_RangeID(); // Update List for old value
|
MyItemRangeID.RefreshItemTransitions_RangeID(); // Update List for old value
|
||||||
_RangeID = tmp.RangeID; // Update the value
|
_RangeID = tmp.RangeID; // Update the value
|
||||||
_MyItemRangeID = null; // Reset list so that the next line gets a new list
|
|
||||||
MyItemRangeID.RefreshItemTransitions_RangeID(); // Update List for new value
|
|
||||||
}
|
}
|
||||||
|
_MyItemRangeID = null; // Reset list so that the next line gets a new list
|
||||||
|
if (MyItemRangeID != null) MyItemRangeID.RefreshItemTransitions_RangeID(); // Update List for new value
|
||||||
_TranType = tmp.TranType;
|
_TranType = tmp.TranType;
|
||||||
_Config = tmp.Config;
|
_Config = tmp.Config;
|
||||||
_DTS = tmp.DTS;
|
_DTS = tmp.DTS;
|
||||||
@ -299,8 +316,10 @@ namespace VEPROMS.CSLA.Library
|
|||||||
}
|
}
|
||||||
public static void Refresh(ContentTransition tmp)
|
public static void Refresh(ContentTransition tmp)
|
||||||
{
|
{
|
||||||
TransitionInfo tmpInfo = GetExistingByPrimaryKey(tmp.TransitionID);
|
string key = tmp.TransitionID.ToString();
|
||||||
if (tmpInfo == null) return;
|
ConvertListToDictionary();
|
||||||
|
if (_AllByPrimaryKey.ContainsKey(key))
|
||||||
|
foreach (TransitionInfo tmpInfo in _AllByPrimaryKey[key])
|
||||||
tmpInfo.RefreshFields(tmp);
|
tmpInfo.RefreshFields(tmp);
|
||||||
}
|
}
|
||||||
private void RefreshFields(ContentTransition tmp)
|
private void RefreshFields(ContentTransition tmp)
|
||||||
@ -309,16 +328,16 @@ namespace VEPROMS.CSLA.Library
|
|||||||
{
|
{
|
||||||
MyItemToID.RefreshItemTransitions_ToID(); // Update List for old value
|
MyItemToID.RefreshItemTransitions_ToID(); // Update List for old value
|
||||||
_ToID = tmp.ToID; // Update the value
|
_ToID = tmp.ToID; // Update the value
|
||||||
_MyItemToID = null; // Reset list so that the next line gets a new list
|
|
||||||
MyItemToID.RefreshItemTransitions_ToID(); // Update List for new value
|
|
||||||
}
|
}
|
||||||
|
_MyItemToID = null; // Reset list so that the next line gets a new list
|
||||||
|
if (MyItemToID != null) MyItemToID.RefreshItemTransitions_ToID(); // Update List for new value
|
||||||
if (_RangeID != tmp.RangeID)
|
if (_RangeID != tmp.RangeID)
|
||||||
{
|
{
|
||||||
MyItemRangeID.RefreshItemTransitions_RangeID(); // Update List for old value
|
MyItemRangeID.RefreshItemTransitions_RangeID(); // Update List for old value
|
||||||
_RangeID = tmp.RangeID; // Update the value
|
_RangeID = tmp.RangeID; // Update the value
|
||||||
_MyItemRangeID = null; // Reset list so that the next line gets a new list
|
|
||||||
MyItemRangeID.RefreshItemTransitions_RangeID(); // Update List for new value
|
|
||||||
}
|
}
|
||||||
|
_MyItemRangeID = null; // Reset list so that the next line gets a new list
|
||||||
|
if (MyItemRangeID != null) MyItemRangeID.RefreshItemTransitions_RangeID(); // Update List for new value
|
||||||
_TranType = tmp.TranType;
|
_TranType = tmp.TranType;
|
||||||
_Config = tmp.Config;
|
_Config = tmp.Config;
|
||||||
_DTS = tmp.DTS;
|
_DTS = tmp.DTS;
|
||||||
@ -332,8 +351,10 @@ namespace VEPROMS.CSLA.Library
|
|||||||
}
|
}
|
||||||
public static void Refresh(ItemTransition_RangeID tmp)
|
public static void Refresh(ItemTransition_RangeID tmp)
|
||||||
{
|
{
|
||||||
TransitionInfo tmpInfo = GetExistingByPrimaryKey(tmp.TransitionID);
|
string key = tmp.TransitionID.ToString();
|
||||||
if (tmpInfo == null) return;
|
ConvertListToDictionary();
|
||||||
|
if (_AllByPrimaryKey.ContainsKey(key))
|
||||||
|
foreach (TransitionInfo tmpInfo in _AllByPrimaryKey[key])
|
||||||
tmpInfo.RefreshFields(tmp);
|
tmpInfo.RefreshFields(tmp);
|
||||||
}
|
}
|
||||||
private void RefreshFields(ItemTransition_RangeID tmp)
|
private void RefreshFields(ItemTransition_RangeID tmp)
|
||||||
@ -342,16 +363,16 @@ namespace VEPROMS.CSLA.Library
|
|||||||
{
|
{
|
||||||
MyContent.RefreshContentTransitions(); // Update List for old value
|
MyContent.RefreshContentTransitions(); // Update List for old value
|
||||||
_FromID = tmp.FromID; // Update the value
|
_FromID = tmp.FromID; // Update the value
|
||||||
_MyContent = null; // Reset list so that the next line gets a new list
|
|
||||||
MyContent.RefreshContentTransitions(); // Update List for new value
|
|
||||||
}
|
}
|
||||||
|
_MyContent = null; // Reset list so that the next line gets a new list
|
||||||
|
if (MyContent != null) MyContent.RefreshContentTransitions(); // Update List for new value
|
||||||
if (_ToID != tmp.ToID)
|
if (_ToID != tmp.ToID)
|
||||||
{
|
{
|
||||||
MyItemToID.RefreshItemTransitions_ToID(); // Update List for old value
|
MyItemToID.RefreshItemTransitions_ToID(); // Update List for old value
|
||||||
_ToID = tmp.ToID; // Update the value
|
_ToID = tmp.ToID; // Update the value
|
||||||
_MyItemToID = null; // Reset list so that the next line gets a new list
|
|
||||||
MyItemToID.RefreshItemTransitions_ToID(); // Update List for new value
|
|
||||||
}
|
}
|
||||||
|
_MyItemToID = null; // Reset list so that the next line gets a new list
|
||||||
|
if (MyItemToID != null) MyItemToID.RefreshItemTransitions_ToID(); // Update List for new value
|
||||||
_TranType = tmp.TranType;
|
_TranType = tmp.TranType;
|
||||||
_Config = tmp.Config;
|
_Config = tmp.Config;
|
||||||
_DTS = tmp.DTS;
|
_DTS = tmp.DTS;
|
||||||
@ -365,8 +386,10 @@ namespace VEPROMS.CSLA.Library
|
|||||||
}
|
}
|
||||||
public static void Refresh(ItemTransition_ToID tmp)
|
public static void Refresh(ItemTransition_ToID tmp)
|
||||||
{
|
{
|
||||||
TransitionInfo tmpInfo = GetExistingByPrimaryKey(tmp.TransitionID);
|
string key = tmp.TransitionID.ToString();
|
||||||
if (tmpInfo == null) return;
|
ConvertListToDictionary();
|
||||||
|
if (_AllByPrimaryKey.ContainsKey(key))
|
||||||
|
foreach (TransitionInfo tmpInfo in _AllByPrimaryKey[key])
|
||||||
tmpInfo.RefreshFields(tmp);
|
tmpInfo.RefreshFields(tmp);
|
||||||
}
|
}
|
||||||
private void RefreshFields(ItemTransition_ToID tmp)
|
private void RefreshFields(ItemTransition_ToID tmp)
|
||||||
@ -375,16 +398,16 @@ namespace VEPROMS.CSLA.Library
|
|||||||
{
|
{
|
||||||
MyContent.RefreshContentTransitions(); // Update List for old value
|
MyContent.RefreshContentTransitions(); // Update List for old value
|
||||||
_FromID = tmp.FromID; // Update the value
|
_FromID = tmp.FromID; // Update the value
|
||||||
_MyContent = null; // Reset list so that the next line gets a new list
|
|
||||||
MyContent.RefreshContentTransitions(); // Update List for new value
|
|
||||||
}
|
}
|
||||||
|
_MyContent = null; // Reset list so that the next line gets a new list
|
||||||
|
if (MyContent != null) MyContent.RefreshContentTransitions(); // Update List for new value
|
||||||
if (_RangeID != tmp.RangeID)
|
if (_RangeID != tmp.RangeID)
|
||||||
{
|
{
|
||||||
MyItemRangeID.RefreshItemTransitions_RangeID(); // Update List for old value
|
MyItemRangeID.RefreshItemTransitions_RangeID(); // Update List for old value
|
||||||
_RangeID = tmp.RangeID; // Update the value
|
_RangeID = tmp.RangeID; // Update the value
|
||||||
_MyItemRangeID = null; // Reset list so that the next line gets a new list
|
|
||||||
MyItemRangeID.RefreshItemTransitions_RangeID(); // Update List for new value
|
|
||||||
}
|
}
|
||||||
|
_MyItemRangeID = null; // Reset list so that the next line gets a new list
|
||||||
|
if (MyItemRangeID != null) MyItemRangeID.RefreshItemTransitions_RangeID(); // Update List for new value
|
||||||
_TranType = tmp.TranType;
|
_TranType = tmp.TranType;
|
||||||
_Config = tmp.Config;
|
_Config = tmp.Config;
|
||||||
_DTS = tmp.DTS;
|
_DTS = tmp.DTS;
|
||||||
@ -406,7 +429,7 @@ namespace VEPROMS.CSLA.Library
|
|||||||
if (tmp == null)
|
if (tmp == null)
|
||||||
{
|
{
|
||||||
tmp = DataPortal.Fetch<TransitionInfo>(new PKCriteria(transitionID));
|
tmp = DataPortal.Fetch<TransitionInfo>(new PKCriteria(transitionID));
|
||||||
_AllList.Add(tmp);
|
if (!_AllList.Contains(tmp)) _AllList.Add(tmp);
|
||||||
}
|
}
|
||||||
if (tmp.ErrorMessage == "No Record Found") tmp = null;
|
if (tmp.ErrorMessage == "No Record Found") tmp = null;
|
||||||
return tmp;
|
return tmp;
|
||||||
@ -420,6 +443,7 @@ namespace VEPROMS.CSLA.Library
|
|||||||
#region Data Access Portal
|
#region Data Access Portal
|
||||||
internal TransitionInfo(SafeDataReader dr)
|
internal TransitionInfo(SafeDataReader dr)
|
||||||
{
|
{
|
||||||
|
_MyTransitionInfoUnique = ++_TransitionInfoUnique;
|
||||||
if (_MyLog.IsDebugEnabled) _MyLog.DebugFormat("[{0}] TransitionInfo.Constructor", GetHashCode());
|
if (_MyLog.IsDebugEnabled) _MyLog.DebugFormat("[{0}] TransitionInfo.Constructor", GetHashCode());
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
@ -65,13 +65,17 @@ namespace VEPROMS.CSLA.Library
|
|||||||
#endregion
|
#endregion
|
||||||
#region Collection
|
#region Collection
|
||||||
protected static List<User> _AllList = new List<User>();
|
protected static List<User> _AllList = new List<User>();
|
||||||
private static Dictionary<string, User> _AllByPrimaryKey = new Dictionary<string, User>();
|
private static Dictionary<string, List<User>> _AllByPrimaryKey = new Dictionary<string, List<User>>();
|
||||||
private static void ConvertListToDictionary()
|
private static void ConvertListToDictionary()
|
||||||
{
|
{
|
||||||
List<User> remove = new List<User>();
|
List<User> remove = new List<User>();
|
||||||
foreach (User tmp in _AllList)
|
foreach (User tmp in _AllList)
|
||||||
{
|
{
|
||||||
_AllByPrimaryKey[tmp.UID.ToString()]=tmp; // Primary Key
|
if (!_AllByPrimaryKey.ContainsKey(tmp.UID.ToString()))
|
||||||
|
{
|
||||||
|
_AllByPrimaryKey[tmp.UID.ToString()] = new List<User>(); // Add new list for PrimaryKey
|
||||||
|
}
|
||||||
|
_AllByPrimaryKey[tmp.UID.ToString()].Add(tmp); // Add to Primary Key list
|
||||||
remove.Add(tmp);
|
remove.Add(tmp);
|
||||||
}
|
}
|
||||||
foreach (User tmp in remove)
|
foreach (User tmp in remove)
|
||||||
@ -81,7 +85,7 @@ namespace VEPROMS.CSLA.Library
|
|||||||
{
|
{
|
||||||
ConvertListToDictionary();
|
ConvertListToDictionary();
|
||||||
string key = uid.ToString();
|
string key = uid.ToString();
|
||||||
if (_AllByPrimaryKey.ContainsKey(key)) return _AllByPrimaryKey[key];
|
if (_AllByPrimaryKey.ContainsKey(key)) return _AllByPrimaryKey[key][0];
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
#endregion
|
#endregion
|
||||||
@ -443,7 +447,8 @@ namespace VEPROMS.CSLA.Library
|
|||||||
private bool _CheckingBrokenRules = false;
|
private bool _CheckingBrokenRules = false;
|
||||||
public IVEHasBrokenRules HasBrokenRules
|
public IVEHasBrokenRules HasBrokenRules
|
||||||
{
|
{
|
||||||
get {
|
get
|
||||||
|
{
|
||||||
if (_CheckingBrokenRules) return null;
|
if (_CheckingBrokenRules) return null;
|
||||||
if ((IsDirty || !IsNew) && BrokenRulesCollection.Count > 0) return this;
|
if ((IsDirty || !IsNew) && BrokenRulesCollection.Count > 0) return this;
|
||||||
try
|
try
|
||||||
@ -612,14 +617,25 @@ namespace VEPROMS.CSLA.Library
|
|||||||
#region Factory Methods
|
#region Factory Methods
|
||||||
public int CurrentEditLevel
|
public int CurrentEditLevel
|
||||||
{ get { return EditLevel; } }
|
{ get { return EditLevel; } }
|
||||||
|
private static int _UserUnique = 0;
|
||||||
|
private int _MyUserUnique;
|
||||||
|
public int MyUserUnique
|
||||||
|
{
|
||||||
|
get { return _MyUserUnique; }
|
||||||
|
}
|
||||||
protected User()
|
protected User()
|
||||||
{/* require use of factory methods */
|
{/* require use of factory methods */
|
||||||
|
_MyUserUnique = ++_UserUnique;
|
||||||
_AllList.Add(this);
|
_AllList.Add(this);
|
||||||
}
|
}
|
||||||
public void Dispose()
|
public void Dispose()
|
||||||
{
|
{
|
||||||
_AllList.Remove(this);
|
_AllList.Remove(this);
|
||||||
_AllByPrimaryKey.Remove(UID.ToString());
|
if (!_AllByPrimaryKey.ContainsKey(UID.ToString())) return;
|
||||||
|
List<User> listUser = _AllByPrimaryKey[UID.ToString()]; // Get the list of items
|
||||||
|
listUser.Remove(this); // Remove the item from the list
|
||||||
|
if (listUser.Count == 0) //If there are no items left in the list
|
||||||
|
_AllByPrimaryKey.Remove(UID.ToString()); // remove the list
|
||||||
}
|
}
|
||||||
public static User New()
|
public static User New()
|
||||||
{
|
{
|
||||||
@ -709,7 +725,7 @@ namespace VEPROMS.CSLA.Library
|
|||||||
if (tmp == null)
|
if (tmp == null)
|
||||||
{
|
{
|
||||||
tmp = DataPortal.Fetch<User>(new PKCriteria(uid));
|
tmp = DataPortal.Fetch<User>(new PKCriteria(uid));
|
||||||
_AllList.Add(tmp);
|
if (!_AllList.Contains(tmp)) _AllList.Add(tmp);
|
||||||
}
|
}
|
||||||
if (tmp.ErrorMessage == "No Record Found") tmp = null;
|
if (tmp.ErrorMessage == "No Record Found") tmp = null;
|
||||||
return tmp;
|
return tmp;
|
||||||
|
@ -37,13 +37,17 @@ namespace VEPROMS.CSLA.Library
|
|||||||
#endregion
|
#endregion
|
||||||
#region Collection
|
#region Collection
|
||||||
protected static List<UserInfo> _AllList = new List<UserInfo>();
|
protected static List<UserInfo> _AllList = new List<UserInfo>();
|
||||||
private static Dictionary<string, UserInfo> _AllByPrimaryKey = new Dictionary<string, UserInfo>();
|
private static Dictionary<string, List<UserInfo>> _AllByPrimaryKey = new Dictionary<string, List<UserInfo>>();
|
||||||
private static void ConvertListToDictionary()
|
private static void ConvertListToDictionary()
|
||||||
{
|
{
|
||||||
List<UserInfo> remove = new List<UserInfo>();
|
List<UserInfo> remove = new List<UserInfo>();
|
||||||
foreach (UserInfo tmp in _AllList)
|
foreach (UserInfo tmp in _AllList)
|
||||||
{
|
{
|
||||||
_AllByPrimaryKey[tmp.UID.ToString()]=tmp; // Primary Key
|
if (!_AllByPrimaryKey.ContainsKey(tmp.UID.ToString()))
|
||||||
|
{
|
||||||
|
_AllByPrimaryKey[tmp.UID.ToString()] = new List<UserInfo>(); // Add new list for PrimaryKey
|
||||||
|
}
|
||||||
|
_AllByPrimaryKey[tmp.UID.ToString()].Add(tmp); // Add to Primary Key list
|
||||||
remove.Add(tmp);
|
remove.Add(tmp);
|
||||||
}
|
}
|
||||||
foreach (UserInfo tmp in remove)
|
foreach (UserInfo tmp in remove)
|
||||||
@ -57,7 +61,7 @@ namespace VEPROMS.CSLA.Library
|
|||||||
{
|
{
|
||||||
ConvertListToDictionary();
|
ConvertListToDictionary();
|
||||||
string key = uid.ToString();
|
string key = uid.ToString();
|
||||||
if (_AllByPrimaryKey.ContainsKey(key)) return _AllByPrimaryKey[key];
|
if (_AllByPrimaryKey.ContainsKey(key)) return _AllByPrimaryKey[key][0];
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
#endregion
|
#endregion
|
||||||
@ -249,7 +253,10 @@ namespace VEPROMS.CSLA.Library
|
|||||||
}
|
}
|
||||||
internal void RefreshUserMemberships()
|
internal void RefreshUserMemberships()
|
||||||
{
|
{
|
||||||
_UserMembershipCount = -1; // This will cause the data to be requeried
|
ConvertListToDictionary();
|
||||||
|
if (_AllByPrimaryKey.ContainsKey(_UID.ToString()))
|
||||||
|
foreach (UserInfo tmp in _AllByPrimaryKey[_UID.ToString()])
|
||||||
|
tmp._UserMembershipCount = -1; // This will cause the data to be requeried
|
||||||
}
|
}
|
||||||
// TODO: Replace base UserInfo.ToString function as necessary
|
// TODO: Replace base UserInfo.ToString function as necessary
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@ -271,14 +278,25 @@ namespace VEPROMS.CSLA.Library
|
|||||||
}
|
}
|
||||||
#endregion
|
#endregion
|
||||||
#region Factory Methods
|
#region Factory Methods
|
||||||
|
private static int _UserInfoUnique = 0;
|
||||||
|
private int _MyUserInfoUnique;
|
||||||
|
public int MyUserInfoUnique
|
||||||
|
{
|
||||||
|
get { return _MyUserInfoUnique; }
|
||||||
|
}
|
||||||
private UserInfo()
|
private UserInfo()
|
||||||
{/* require use of factory methods */
|
{/* require use of factory methods */
|
||||||
|
_MyUserInfoUnique = ++_UserInfoUnique;
|
||||||
_AllList.Add(this);
|
_AllList.Add(this);
|
||||||
}
|
}
|
||||||
public void Dispose()
|
public void Dispose()
|
||||||
{
|
{
|
||||||
_AllList.Remove(this);
|
_AllList.Remove(this);
|
||||||
_AllByPrimaryKey.Remove(UID.ToString());
|
if (!_AllByPrimaryKey.ContainsKey(UID.ToString())) return;
|
||||||
|
List<UserInfo> listUserInfo = _AllByPrimaryKey[UID.ToString()]; // Get the list of items
|
||||||
|
listUserInfo.Remove(this); // Remove the item from the list
|
||||||
|
if (listUserInfo.Count == 0) // If there are no items left in the list
|
||||||
|
_AllByPrimaryKey.Remove(UID.ToString()); // remove the list
|
||||||
}
|
}
|
||||||
public virtual User Get()
|
public virtual User Get()
|
||||||
{
|
{
|
||||||
@ -286,8 +304,10 @@ namespace VEPROMS.CSLA.Library
|
|||||||
}
|
}
|
||||||
public static void Refresh(User tmp)
|
public static void Refresh(User tmp)
|
||||||
{
|
{
|
||||||
UserInfo tmpInfo = GetExistingByPrimaryKey(tmp.UID);
|
string key = tmp.UID.ToString();
|
||||||
if (tmpInfo == null) return;
|
ConvertListToDictionary();
|
||||||
|
if (_AllByPrimaryKey.ContainsKey(key))
|
||||||
|
foreach (UserInfo tmpInfo in _AllByPrimaryKey[key])
|
||||||
tmpInfo.RefreshFields(tmp);
|
tmpInfo.RefreshFields(tmp);
|
||||||
}
|
}
|
||||||
private void RefreshFields(User tmp)
|
private void RefreshFields(User tmp)
|
||||||
@ -318,7 +338,7 @@ namespace VEPROMS.CSLA.Library
|
|||||||
if (tmp == null)
|
if (tmp == null)
|
||||||
{
|
{
|
||||||
tmp = DataPortal.Fetch<UserInfo>(new PKCriteria(uid));
|
tmp = DataPortal.Fetch<UserInfo>(new PKCriteria(uid));
|
||||||
_AllList.Add(tmp);
|
if (!_AllList.Contains(tmp)) _AllList.Add(tmp);
|
||||||
}
|
}
|
||||||
if (tmp.ErrorMessage == "No Record Found") tmp = null;
|
if (tmp.ErrorMessage == "No Record Found") tmp = null;
|
||||||
return tmp;
|
return tmp;
|
||||||
@ -332,6 +352,7 @@ namespace VEPROMS.CSLA.Library
|
|||||||
#region Data Access Portal
|
#region Data Access Portal
|
||||||
internal UserInfo(SafeDataReader dr)
|
internal UserInfo(SafeDataReader dr)
|
||||||
{
|
{
|
||||||
|
_MyUserInfoUnique = ++_UserInfoUnique;
|
||||||
if (_MyLog.IsDebugEnabled) _MyLog.DebugFormat("[{0}] UserInfo.Constructor", GetHashCode());
|
if (_MyLog.IsDebugEnabled) _MyLog.DebugFormat("[{0}] UserInfo.Constructor", GetHashCode());
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
@ -52,13 +52,17 @@ namespace VEPROMS.CSLA.Library
|
|||||||
#endregion
|
#endregion
|
||||||
#region Collection
|
#region Collection
|
||||||
protected static List<ZContent> _AllList = new List<ZContent>();
|
protected static List<ZContent> _AllList = new List<ZContent>();
|
||||||
private static Dictionary<string, ZContent> _AllByPrimaryKey = new Dictionary<string, ZContent>();
|
private static Dictionary<string, List<ZContent>> _AllByPrimaryKey = new Dictionary<string, List<ZContent>>();
|
||||||
private static void ConvertListToDictionary()
|
private static void ConvertListToDictionary()
|
||||||
{
|
{
|
||||||
List<ZContent> remove = new List<ZContent>();
|
List<ZContent> remove = new List<ZContent>();
|
||||||
foreach (ZContent tmp in _AllList)
|
foreach (ZContent tmp in _AllList)
|
||||||
{
|
{
|
||||||
_AllByPrimaryKey[tmp.ContentID.ToString()]=tmp; // Primary Key
|
if (!_AllByPrimaryKey.ContainsKey(tmp.ContentID.ToString()))
|
||||||
|
{
|
||||||
|
_AllByPrimaryKey[tmp.ContentID.ToString()] = new List<ZContent>(); // Add new list for PrimaryKey
|
||||||
|
}
|
||||||
|
_AllByPrimaryKey[tmp.ContentID.ToString()].Add(tmp); // Add to Primary Key list
|
||||||
remove.Add(tmp);
|
remove.Add(tmp);
|
||||||
}
|
}
|
||||||
foreach (ZContent tmp in remove)
|
foreach (ZContent tmp in remove)
|
||||||
@ -68,7 +72,7 @@ namespace VEPROMS.CSLA.Library
|
|||||||
{
|
{
|
||||||
ConvertListToDictionary();
|
ConvertListToDictionary();
|
||||||
string key = contentID.ToString();
|
string key = contentID.ToString();
|
||||||
if (_AllByPrimaryKey.ContainsKey(key)) return _AllByPrimaryKey[key];
|
if (_AllByPrimaryKey.ContainsKey(key)) return _AllByPrimaryKey[key][0];
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
#endregion
|
#endregion
|
||||||
@ -152,7 +156,8 @@ namespace VEPROMS.CSLA.Library
|
|||||||
private bool _CheckingBrokenRules = false;
|
private bool _CheckingBrokenRules = false;
|
||||||
public IVEHasBrokenRules HasBrokenRules
|
public IVEHasBrokenRules HasBrokenRules
|
||||||
{
|
{
|
||||||
get {
|
get
|
||||||
|
{
|
||||||
if (_CheckingBrokenRules) return null;
|
if (_CheckingBrokenRules) return null;
|
||||||
if ((IsDirty || !IsNew) && BrokenRulesCollection.Count > 0) return this;
|
if ((IsDirty || !IsNew) && BrokenRulesCollection.Count > 0) return this;
|
||||||
try
|
try
|
||||||
@ -248,14 +253,25 @@ namespace VEPROMS.CSLA.Library
|
|||||||
#region Factory Methods
|
#region Factory Methods
|
||||||
public int CurrentEditLevel
|
public int CurrentEditLevel
|
||||||
{ get { return EditLevel; } }
|
{ get { return EditLevel; } }
|
||||||
|
private static int _ZContentUnique = 0;
|
||||||
|
private int _MyZContentUnique;
|
||||||
|
public int MyZContentUnique
|
||||||
|
{
|
||||||
|
get { return _MyZContentUnique; }
|
||||||
|
}
|
||||||
protected ZContent()
|
protected ZContent()
|
||||||
{/* require use of factory methods */
|
{/* require use of factory methods */
|
||||||
|
_MyZContentUnique = ++_ZContentUnique;
|
||||||
_AllList.Add(this);
|
_AllList.Add(this);
|
||||||
}
|
}
|
||||||
public void Dispose()
|
public void Dispose()
|
||||||
{
|
{
|
||||||
_AllList.Remove(this);
|
_AllList.Remove(this);
|
||||||
_AllByPrimaryKey.Remove(ContentID.ToString());
|
if (!_AllByPrimaryKey.ContainsKey(ContentID.ToString())) return;
|
||||||
|
List<ZContent> listZContent = _AllByPrimaryKey[ContentID.ToString()]; // Get the list of items
|
||||||
|
listZContent.Remove(this); // Remove the item from the list
|
||||||
|
if (listZContent.Count == 0) //If there are no items left in the list
|
||||||
|
_AllByPrimaryKey.Remove(ContentID.ToString()); // remove the list
|
||||||
}
|
}
|
||||||
public static ZContent New()
|
public static ZContent New()
|
||||||
{
|
{
|
||||||
@ -311,7 +327,7 @@ namespace VEPROMS.CSLA.Library
|
|||||||
if (tmp == null)
|
if (tmp == null)
|
||||||
{
|
{
|
||||||
tmp = DataPortal.Fetch<ZContent>(new PKCriteria(contentID));
|
tmp = DataPortal.Fetch<ZContent>(new PKCriteria(contentID));
|
||||||
_AllList.Add(tmp);
|
if (!_AllList.Contains(tmp)) _AllList.Add(tmp);
|
||||||
}
|
}
|
||||||
if (tmp.ErrorMessage == "No Record Found") tmp = null;
|
if (tmp.ErrorMessage == "No Record Found") tmp = null;
|
||||||
return tmp;
|
return tmp;
|
||||||
|
@ -37,13 +37,17 @@ namespace VEPROMS.CSLA.Library
|
|||||||
#endregion
|
#endregion
|
||||||
#region Collection
|
#region Collection
|
||||||
protected static List<ZContentInfo> _AllList = new List<ZContentInfo>();
|
protected static List<ZContentInfo> _AllList = new List<ZContentInfo>();
|
||||||
private static Dictionary<string, ZContentInfo> _AllByPrimaryKey = new Dictionary<string, ZContentInfo>();
|
private static Dictionary<string, List<ZContentInfo>> _AllByPrimaryKey = new Dictionary<string, List<ZContentInfo>>();
|
||||||
private static void ConvertListToDictionary()
|
private static void ConvertListToDictionary()
|
||||||
{
|
{
|
||||||
List<ZContentInfo> remove = new List<ZContentInfo>();
|
List<ZContentInfo> remove = new List<ZContentInfo>();
|
||||||
foreach (ZContentInfo tmp in _AllList)
|
foreach (ZContentInfo tmp in _AllList)
|
||||||
{
|
{
|
||||||
_AllByPrimaryKey[tmp.ContentID.ToString()]=tmp; // Primary Key
|
if (!_AllByPrimaryKey.ContainsKey(tmp.ContentID.ToString()))
|
||||||
|
{
|
||||||
|
_AllByPrimaryKey[tmp.ContentID.ToString()] = new List<ZContentInfo>(); // Add new list for PrimaryKey
|
||||||
|
}
|
||||||
|
_AllByPrimaryKey[tmp.ContentID.ToString()].Add(tmp); // Add to Primary Key list
|
||||||
remove.Add(tmp);
|
remove.Add(tmp);
|
||||||
}
|
}
|
||||||
foreach (ZContentInfo tmp in remove)
|
foreach (ZContentInfo tmp in remove)
|
||||||
@ -53,7 +57,7 @@ namespace VEPROMS.CSLA.Library
|
|||||||
{
|
{
|
||||||
ConvertListToDictionary();
|
ConvertListToDictionary();
|
||||||
string key = contentID.ToString();
|
string key = contentID.ToString();
|
||||||
if (_AllByPrimaryKey.ContainsKey(key)) return _AllByPrimaryKey[key];
|
if (_AllByPrimaryKey.ContainsKey(key)) return _AllByPrimaryKey[key][0];
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
#endregion
|
#endregion
|
||||||
@ -128,14 +132,25 @@ namespace VEPROMS.CSLA.Library
|
|||||||
}
|
}
|
||||||
#endregion
|
#endregion
|
||||||
#region Factory Methods
|
#region Factory Methods
|
||||||
|
private static int _ZContentInfoUnique = 0;
|
||||||
|
private int _MyZContentInfoUnique;
|
||||||
|
public int MyZContentInfoUnique
|
||||||
|
{
|
||||||
|
get { return _MyZContentInfoUnique; }
|
||||||
|
}
|
||||||
private ZContentInfo()
|
private ZContentInfo()
|
||||||
{/* require use of factory methods */
|
{/* require use of factory methods */
|
||||||
|
_MyZContentInfoUnique = ++_ZContentInfoUnique;
|
||||||
_AllList.Add(this);
|
_AllList.Add(this);
|
||||||
}
|
}
|
||||||
public void Dispose()
|
public void Dispose()
|
||||||
{
|
{
|
||||||
_AllList.Remove(this);
|
_AllList.Remove(this);
|
||||||
_AllByPrimaryKey.Remove(ContentID.ToString());
|
if (!_AllByPrimaryKey.ContainsKey(ContentID.ToString())) return;
|
||||||
|
List<ZContentInfo> listZContentInfo = _AllByPrimaryKey[ContentID.ToString()]; // Get the list of items
|
||||||
|
listZContentInfo.Remove(this); // Remove the item from the list
|
||||||
|
if (listZContentInfo.Count == 0) // If there are no items left in the list
|
||||||
|
_AllByPrimaryKey.Remove(ContentID.ToString()); // remove the list
|
||||||
}
|
}
|
||||||
public virtual ZContent Get()
|
public virtual ZContent Get()
|
||||||
{
|
{
|
||||||
@ -143,8 +158,10 @@ namespace VEPROMS.CSLA.Library
|
|||||||
}
|
}
|
||||||
public static void Refresh(ZContent tmp)
|
public static void Refresh(ZContent tmp)
|
||||||
{
|
{
|
||||||
ZContentInfo tmpInfo = GetExistingByPrimaryKey(tmp.ContentID);
|
string key = tmp.ContentID.ToString();
|
||||||
if (tmpInfo == null) return;
|
ConvertListToDictionary();
|
||||||
|
if (_AllByPrimaryKey.ContainsKey(key))
|
||||||
|
foreach (ZContentInfo tmpInfo in _AllByPrimaryKey[key])
|
||||||
tmpInfo.RefreshFields(tmp);
|
tmpInfo.RefreshFields(tmp);
|
||||||
}
|
}
|
||||||
private void RefreshFields(ZContent tmp)
|
private void RefreshFields(ZContent tmp)
|
||||||
@ -164,7 +181,7 @@ namespace VEPROMS.CSLA.Library
|
|||||||
if (tmp == null)
|
if (tmp == null)
|
||||||
{
|
{
|
||||||
tmp = DataPortal.Fetch<ZContentInfo>(new PKCriteria(contentID));
|
tmp = DataPortal.Fetch<ZContentInfo>(new PKCriteria(contentID));
|
||||||
_AllList.Add(tmp);
|
if (!_AllList.Contains(tmp)) _AllList.Add(tmp);
|
||||||
}
|
}
|
||||||
if (tmp.ErrorMessage == "No Record Found")
|
if (tmp.ErrorMessage == "No Record Found")
|
||||||
{
|
{
|
||||||
@ -181,6 +198,7 @@ namespace VEPROMS.CSLA.Library
|
|||||||
#region Data Access Portal
|
#region Data Access Portal
|
||||||
internal ZContentInfo(SafeDataReader dr)
|
internal ZContentInfo(SafeDataReader dr)
|
||||||
{
|
{
|
||||||
|
_MyZContentInfoUnique = ++_ZContentInfoUnique;
|
||||||
if (_MyLog.IsDebugEnabled) _MyLog.DebugFormat("[{0}] ZContentInfo.Constructor", GetHashCode());
|
if (_MyLog.IsDebugEnabled) _MyLog.DebugFormat("[{0}] ZContentInfo.Constructor", GetHashCode());
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
@ -52,13 +52,17 @@ namespace VEPROMS.CSLA.Library
|
|||||||
#endregion
|
#endregion
|
||||||
#region Collection
|
#region Collection
|
||||||
protected static List<ZTransition> _AllList = new List<ZTransition>();
|
protected static List<ZTransition> _AllList = new List<ZTransition>();
|
||||||
private static Dictionary<string, ZTransition> _AllByPrimaryKey = new Dictionary<string, ZTransition>();
|
private static Dictionary<string, List<ZTransition>> _AllByPrimaryKey = new Dictionary<string, List<ZTransition>>();
|
||||||
private static void ConvertListToDictionary()
|
private static void ConvertListToDictionary()
|
||||||
{
|
{
|
||||||
List<ZTransition> remove = new List<ZTransition>();
|
List<ZTransition> remove = new List<ZTransition>();
|
||||||
foreach (ZTransition tmp in _AllList)
|
foreach (ZTransition tmp in _AllList)
|
||||||
{
|
{
|
||||||
_AllByPrimaryKey[tmp.TransitionID.ToString()]=tmp; // Primary Key
|
if (!_AllByPrimaryKey.ContainsKey(tmp.TransitionID.ToString()))
|
||||||
|
{
|
||||||
|
_AllByPrimaryKey[tmp.TransitionID.ToString()] = new List<ZTransition>(); // Add new list for PrimaryKey
|
||||||
|
}
|
||||||
|
_AllByPrimaryKey[tmp.TransitionID.ToString()].Add(tmp); // Add to Primary Key list
|
||||||
remove.Add(tmp);
|
remove.Add(tmp);
|
||||||
}
|
}
|
||||||
foreach (ZTransition tmp in remove)
|
foreach (ZTransition tmp in remove)
|
||||||
@ -68,7 +72,7 @@ namespace VEPROMS.CSLA.Library
|
|||||||
{
|
{
|
||||||
ConvertListToDictionary();
|
ConvertListToDictionary();
|
||||||
string key = transitionID.ToString();
|
string key = transitionID.ToString();
|
||||||
if (_AllByPrimaryKey.ContainsKey(key)) return _AllByPrimaryKey[key];
|
if (_AllByPrimaryKey.ContainsKey(key)) return _AllByPrimaryKey[key][0];
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
#endregion
|
#endregion
|
||||||
@ -152,7 +156,8 @@ namespace VEPROMS.CSLA.Library
|
|||||||
private bool _CheckingBrokenRules = false;
|
private bool _CheckingBrokenRules = false;
|
||||||
public IVEHasBrokenRules HasBrokenRules
|
public IVEHasBrokenRules HasBrokenRules
|
||||||
{
|
{
|
||||||
get {
|
get
|
||||||
|
{
|
||||||
if (_CheckingBrokenRules) return null;
|
if (_CheckingBrokenRules) return null;
|
||||||
if ((IsDirty || !IsNew) && BrokenRulesCollection.Count > 0) return this;
|
if ((IsDirty || !IsNew) && BrokenRulesCollection.Count > 0) return this;
|
||||||
try
|
try
|
||||||
@ -248,14 +253,25 @@ namespace VEPROMS.CSLA.Library
|
|||||||
#region Factory Methods
|
#region Factory Methods
|
||||||
public int CurrentEditLevel
|
public int CurrentEditLevel
|
||||||
{ get { return EditLevel; } }
|
{ get { return EditLevel; } }
|
||||||
|
private static int _ZTransitionUnique = 0;
|
||||||
|
private int _MyZTransitionUnique;
|
||||||
|
public int MyZTransitionUnique
|
||||||
|
{
|
||||||
|
get { return _MyZTransitionUnique; }
|
||||||
|
}
|
||||||
protected ZTransition()
|
protected ZTransition()
|
||||||
{/* require use of factory methods */
|
{/* require use of factory methods */
|
||||||
|
_MyZTransitionUnique = ++_ZTransitionUnique;
|
||||||
_AllList.Add(this);
|
_AllList.Add(this);
|
||||||
}
|
}
|
||||||
public void Dispose()
|
public void Dispose()
|
||||||
{
|
{
|
||||||
_AllList.Remove(this);
|
_AllList.Remove(this);
|
||||||
_AllByPrimaryKey.Remove(TransitionID.ToString());
|
if (!_AllByPrimaryKey.ContainsKey(TransitionID.ToString())) return;
|
||||||
|
List<ZTransition> listZTransition = _AllByPrimaryKey[TransitionID.ToString()]; // Get the list of items
|
||||||
|
listZTransition.Remove(this); // Remove the item from the list
|
||||||
|
if (listZTransition.Count == 0) //If there are no items left in the list
|
||||||
|
_AllByPrimaryKey.Remove(TransitionID.ToString()); // remove the list
|
||||||
}
|
}
|
||||||
public static ZTransition New()
|
public static ZTransition New()
|
||||||
{
|
{
|
||||||
@ -311,7 +327,7 @@ namespace VEPROMS.CSLA.Library
|
|||||||
if (tmp == null)
|
if (tmp == null)
|
||||||
{
|
{
|
||||||
tmp = DataPortal.Fetch<ZTransition>(new PKCriteria(transitionID));
|
tmp = DataPortal.Fetch<ZTransition>(new PKCriteria(transitionID));
|
||||||
_AllList.Add(tmp);
|
if (!_AllList.Contains(tmp)) _AllList.Add(tmp);
|
||||||
}
|
}
|
||||||
if (tmp.ErrorMessage == "No Record Found") tmp = null;
|
if (tmp.ErrorMessage == "No Record Found") tmp = null;
|
||||||
return tmp;
|
return tmp;
|
||||||
|
@ -37,13 +37,17 @@ namespace VEPROMS.CSLA.Library
|
|||||||
#endregion
|
#endregion
|
||||||
#region Collection
|
#region Collection
|
||||||
protected static List<ZTransitionInfo> _AllList = new List<ZTransitionInfo>();
|
protected static List<ZTransitionInfo> _AllList = new List<ZTransitionInfo>();
|
||||||
private static Dictionary<string, ZTransitionInfo> _AllByPrimaryKey = new Dictionary<string, ZTransitionInfo>();
|
private static Dictionary<string, List<ZTransitionInfo>> _AllByPrimaryKey = new Dictionary<string, List<ZTransitionInfo>>();
|
||||||
private static void ConvertListToDictionary()
|
private static void ConvertListToDictionary()
|
||||||
{
|
{
|
||||||
List<ZTransitionInfo> remove = new List<ZTransitionInfo>();
|
List<ZTransitionInfo> remove = new List<ZTransitionInfo>();
|
||||||
foreach (ZTransitionInfo tmp in _AllList)
|
foreach (ZTransitionInfo tmp in _AllList)
|
||||||
{
|
{
|
||||||
_AllByPrimaryKey[tmp.TransitionID.ToString()]=tmp; // Primary Key
|
if (!_AllByPrimaryKey.ContainsKey(tmp.TransitionID.ToString()))
|
||||||
|
{
|
||||||
|
_AllByPrimaryKey[tmp.TransitionID.ToString()] = new List<ZTransitionInfo>(); // Add new list for PrimaryKey
|
||||||
|
}
|
||||||
|
_AllByPrimaryKey[tmp.TransitionID.ToString()].Add(tmp); // Add to Primary Key list
|
||||||
remove.Add(tmp);
|
remove.Add(tmp);
|
||||||
}
|
}
|
||||||
foreach (ZTransitionInfo tmp in remove)
|
foreach (ZTransitionInfo tmp in remove)
|
||||||
@ -53,7 +57,7 @@ namespace VEPROMS.CSLA.Library
|
|||||||
{
|
{
|
||||||
ConvertListToDictionary();
|
ConvertListToDictionary();
|
||||||
string key = transitionID.ToString();
|
string key = transitionID.ToString();
|
||||||
if (_AllByPrimaryKey.ContainsKey(key)) return _AllByPrimaryKey[key];
|
if (_AllByPrimaryKey.ContainsKey(key)) return _AllByPrimaryKey[key][0];
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
#endregion
|
#endregion
|
||||||
@ -128,14 +132,25 @@ namespace VEPROMS.CSLA.Library
|
|||||||
}
|
}
|
||||||
#endregion
|
#endregion
|
||||||
#region Factory Methods
|
#region Factory Methods
|
||||||
|
private static int _ZTransitionInfoUnique = 0;
|
||||||
|
private int _MyZTransitionInfoUnique;
|
||||||
|
public int MyZTransitionInfoUnique
|
||||||
|
{
|
||||||
|
get { return _MyZTransitionInfoUnique; }
|
||||||
|
}
|
||||||
private ZTransitionInfo()
|
private ZTransitionInfo()
|
||||||
{/* require use of factory methods */
|
{/* require use of factory methods */
|
||||||
|
_MyZTransitionInfoUnique = ++_ZTransitionInfoUnique;
|
||||||
_AllList.Add(this);
|
_AllList.Add(this);
|
||||||
}
|
}
|
||||||
public void Dispose()
|
public void Dispose()
|
||||||
{
|
{
|
||||||
_AllList.Remove(this);
|
_AllList.Remove(this);
|
||||||
_AllByPrimaryKey.Remove(TransitionID.ToString());
|
if (!_AllByPrimaryKey.ContainsKey(TransitionID.ToString())) return;
|
||||||
|
List<ZTransitionInfo> listZTransitionInfo = _AllByPrimaryKey[TransitionID.ToString()]; // Get the list of items
|
||||||
|
listZTransitionInfo.Remove(this); // Remove the item from the list
|
||||||
|
if (listZTransitionInfo.Count == 0) // If there are no items left in the list
|
||||||
|
_AllByPrimaryKey.Remove(TransitionID.ToString()); // remove the list
|
||||||
}
|
}
|
||||||
public virtual ZTransition Get()
|
public virtual ZTransition Get()
|
||||||
{
|
{
|
||||||
@ -143,8 +158,10 @@ namespace VEPROMS.CSLA.Library
|
|||||||
}
|
}
|
||||||
public static void Refresh(ZTransition tmp)
|
public static void Refresh(ZTransition tmp)
|
||||||
{
|
{
|
||||||
ZTransitionInfo tmpInfo = GetExistingByPrimaryKey(tmp.TransitionID);
|
string key = tmp.TransitionID.ToString();
|
||||||
if (tmpInfo == null) return;
|
ConvertListToDictionary();
|
||||||
|
if (_AllByPrimaryKey.ContainsKey(key))
|
||||||
|
foreach (ZTransitionInfo tmpInfo in _AllByPrimaryKey[key])
|
||||||
tmpInfo.RefreshFields(tmp);
|
tmpInfo.RefreshFields(tmp);
|
||||||
}
|
}
|
||||||
private void RefreshFields(ZTransition tmp)
|
private void RefreshFields(ZTransition tmp)
|
||||||
@ -164,7 +181,7 @@ namespace VEPROMS.CSLA.Library
|
|||||||
if (tmp == null)
|
if (tmp == null)
|
||||||
{
|
{
|
||||||
tmp = DataPortal.Fetch<ZTransitionInfo>(new PKCriteria(transitionID));
|
tmp = DataPortal.Fetch<ZTransitionInfo>(new PKCriteria(transitionID));
|
||||||
_AllList.Add(tmp);
|
if (!_AllList.Contains(tmp)) _AllList.Add(tmp);
|
||||||
}
|
}
|
||||||
if (tmp.ErrorMessage == "No Record Found")
|
if (tmp.ErrorMessage == "No Record Found")
|
||||||
{
|
{
|
||||||
@ -181,6 +198,7 @@ namespace VEPROMS.CSLA.Library
|
|||||||
#region Data Access Portal
|
#region Data Access Portal
|
||||||
internal ZTransitionInfo(SafeDataReader dr)
|
internal ZTransitionInfo(SafeDataReader dr)
|
||||||
{
|
{
|
||||||
|
_MyZTransitionInfoUnique = ++_ZTransitionInfoUnique;
|
||||||
if (_MyLog.IsDebugEnabled) _MyLog.DebugFormat("[{0}] ZTransitionInfo.Constructor", GetHashCode());
|
if (_MyLog.IsDebugEnabled) _MyLog.DebugFormat("[{0}] ZTransitionInfo.Constructor", GetHashCode());
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
Loading…
x
Reference in New Issue
Block a user