This commit is contained in:
@@ -45,35 +45,35 @@ namespace VEPROMS.CSLA.Library
|
||||
{
|
||||
foreach (ContentDetail tmp in _ContentDetails)
|
||||
{
|
||||
if(tmp.IsDirty)refreshContentDetails.Add(tmp);
|
||||
if (tmp.IsDirty) refreshContentDetails.Add(tmp);
|
||||
}
|
||||
}
|
||||
if (_ContentItems != null && _ContentItems.IsDirty)
|
||||
{
|
||||
foreach (ContentItem tmp in _ContentItems)
|
||||
{
|
||||
if(tmp.IsDirty)refreshContentItems.Add(tmp);
|
||||
if (tmp.IsDirty) refreshContentItems.Add(tmp);
|
||||
}
|
||||
}
|
||||
if (_ContentParts != null && _ContentParts.IsDirty)
|
||||
{
|
||||
foreach (ContentPart tmp in _ContentParts)
|
||||
{
|
||||
if(tmp.IsDirty)refreshContentParts.Add(tmp);
|
||||
if (tmp.IsDirty) refreshContentParts.Add(tmp);
|
||||
}
|
||||
}
|
||||
if (_ContentRoUsages != null && _ContentRoUsages.IsDirty)
|
||||
{
|
||||
foreach (ContentRoUsage tmp in _ContentRoUsages)
|
||||
{
|
||||
if(tmp.IsDirty)refreshContentRoUsages.Add(tmp);
|
||||
if (tmp.IsDirty) refreshContentRoUsages.Add(tmp);
|
||||
}
|
||||
}
|
||||
if (_ContentTransitions != null && _ContentTransitions.IsDirty)
|
||||
{
|
||||
foreach (ContentTransition tmp in _ContentTransitions)
|
||||
{
|
||||
if(tmp.IsDirty)refreshContentTransitions.Add(tmp);
|
||||
if (tmp.IsDirty) refreshContentTransitions.Add(tmp);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -92,7 +92,7 @@ namespace VEPROMS.CSLA.Library
|
||||
foreach (Content tmp in _RefreshContents)
|
||||
{
|
||||
ContentInfo.Refresh(tmp);
|
||||
if(tmp._MyFormat != null) FormatInfo.Refresh(tmp._MyFormat);
|
||||
if (tmp._MyFormat != null) FormatInfo.Refresh(tmp._MyFormat);
|
||||
}
|
||||
foreach (ContentDetail tmp in _RefreshContentDetails)
|
||||
{
|
||||
@@ -118,13 +118,17 @@ namespace VEPROMS.CSLA.Library
|
||||
#endregion
|
||||
#region Collection
|
||||
protected static List<Content> _AllList = new List<Content>();
|
||||
private static Dictionary<string, Content> _AllByPrimaryKey = new Dictionary<string, Content>();
|
||||
private static Dictionary<string, List<Content>> _AllByPrimaryKey = new Dictionary<string, List<Content>>();
|
||||
private static void ConvertListToDictionary()
|
||||
{
|
||||
List<Content> remove = new List<Content>();
|
||||
foreach (Content tmp in _AllList)
|
||||
{
|
||||
_AllByPrimaryKey[tmp.ContentID.ToString()]=tmp; // Primary Key
|
||||
if (!_AllByPrimaryKey.ContainsKey(tmp.ContentID.ToString()))
|
||||
{
|
||||
_AllByPrimaryKey[tmp.ContentID.ToString()] = new List<Content>(); // Add new list for PrimaryKey
|
||||
}
|
||||
_AllByPrimaryKey[tmp.ContentID.ToString()].Add(tmp); // Add to Primary Key list
|
||||
remove.Add(tmp);
|
||||
}
|
||||
foreach (Content tmp in remove)
|
||||
@@ -134,7 +138,7 @@ namespace VEPROMS.CSLA.Library
|
||||
{
|
||||
ConvertListToDictionary();
|
||||
string key = contentID.ToString();
|
||||
if (_AllByPrimaryKey.ContainsKey(key)) return _AllByPrimaryKey[key];
|
||||
if (_AllByPrimaryKey.ContainsKey(key)) return _AllByPrimaryKey[key][0];
|
||||
return null;
|
||||
}
|
||||
#endregion
|
||||
@@ -156,7 +160,7 @@ namespace VEPROMS.CSLA.Library
|
||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||
get
|
||||
{
|
||||
CanReadProperty("ContentID",true);
|
||||
CanReadProperty("ContentID", true);
|
||||
return _ContentID;
|
||||
}
|
||||
}
|
||||
@@ -166,13 +170,13 @@ namespace VEPROMS.CSLA.Library
|
||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||
get
|
||||
{
|
||||
CanReadProperty("Number",true);
|
||||
CanReadProperty("Number", true);
|
||||
return _Number;
|
||||
}
|
||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||
set
|
||||
{
|
||||
CanWriteProperty("Number",true);
|
||||
CanWriteProperty("Number", true);
|
||||
if (value == null) value = string.Empty;
|
||||
if (_Number != value)
|
||||
{
|
||||
@@ -187,13 +191,13 @@ namespace VEPROMS.CSLA.Library
|
||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||
get
|
||||
{
|
||||
CanReadProperty("Text",true);
|
||||
CanReadProperty("Text", true);
|
||||
return _Text;
|
||||
}
|
||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||
set
|
||||
{
|
||||
CanWriteProperty("Text",true);
|
||||
CanWriteProperty("Text", true);
|
||||
if (value == null) value = string.Empty;
|
||||
if (_Text != value)
|
||||
{
|
||||
@@ -211,13 +215,13 @@ namespace VEPROMS.CSLA.Library
|
||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||
get
|
||||
{
|
||||
CanReadProperty("Type",true);
|
||||
CanReadProperty("Type", true);
|
||||
return _Type;
|
||||
}
|
||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||
set
|
||||
{
|
||||
CanWriteProperty("Type",true);
|
||||
CanWriteProperty("Type", true);
|
||||
if (_Type != value)
|
||||
{
|
||||
_Type = value;
|
||||
@@ -231,7 +235,7 @@ namespace VEPROMS.CSLA.Library
|
||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||
get
|
||||
{
|
||||
CanReadProperty("FormatID",true);
|
||||
CanReadProperty("FormatID", true);
|
||||
if (_MyFormat != null) _FormatID = _MyFormat.FormatID;
|
||||
return _FormatID;
|
||||
}
|
||||
@@ -242,18 +246,18 @@ namespace VEPROMS.CSLA.Library
|
||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||
get
|
||||
{
|
||||
CanReadProperty("MyFormat",true);
|
||||
CanReadProperty("MyFormat", true);
|
||||
if (_MyFormat == null && _FormatID != null) _MyFormat = Format.Get((int)_FormatID);
|
||||
return _MyFormat;
|
||||
}
|
||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||
set
|
||||
{
|
||||
CanWriteProperty("MyFormat",true);
|
||||
CanWriteProperty("MyFormat", true);
|
||||
if (_MyFormat != value)
|
||||
{
|
||||
_MyFormat = value;
|
||||
_FormatID = (value == null ? null : (int?) value.FormatID);
|
||||
_FormatID = (value == null ? null : (int?)value.FormatID);
|
||||
PropertyHasChanged();
|
||||
}
|
||||
}
|
||||
@@ -264,13 +268,13 @@ namespace VEPROMS.CSLA.Library
|
||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||
get
|
||||
{
|
||||
CanReadProperty("Config",true);
|
||||
CanReadProperty("Config", true);
|
||||
return _Config;
|
||||
}
|
||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||
set
|
||||
{
|
||||
CanWriteProperty("Config",true);
|
||||
CanWriteProperty("Config", true);
|
||||
if (value == null) value = string.Empty;
|
||||
if (_Config != value)
|
||||
{
|
||||
@@ -285,13 +289,13 @@ namespace VEPROMS.CSLA.Library
|
||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||
get
|
||||
{
|
||||
CanReadProperty("DTS",true);
|
||||
CanReadProperty("DTS", true);
|
||||
return _DTS;
|
||||
}
|
||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||
set
|
||||
{
|
||||
CanWriteProperty("DTS",true);
|
||||
CanWriteProperty("DTS", true);
|
||||
if (_DTS != value)
|
||||
{
|
||||
_DTS = value;
|
||||
@@ -305,13 +309,13 @@ namespace VEPROMS.CSLA.Library
|
||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||
get
|
||||
{
|
||||
CanReadProperty("UserID",true);
|
||||
CanReadProperty("UserID", true);
|
||||
return _UserID;
|
||||
}
|
||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||
set
|
||||
{
|
||||
CanWriteProperty("UserID",true);
|
||||
CanWriteProperty("UserID", true);
|
||||
if (value == null) value = string.Empty;
|
||||
if (_UserID != value)
|
||||
{
|
||||
@@ -330,7 +334,7 @@ namespace VEPROMS.CSLA.Library
|
||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||
get
|
||||
{
|
||||
CanReadProperty("ContentDetailCount",true);
|
||||
CanReadProperty("ContentDetailCount", true);
|
||||
return _ContentDetailCount;
|
||||
}
|
||||
}
|
||||
@@ -344,10 +348,10 @@ namespace VEPROMS.CSLA.Library
|
||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||
get
|
||||
{
|
||||
CanReadProperty("ContentDetails",true);
|
||||
if(_ContentDetailCount > 0 && _ContentDetails == null)
|
||||
CanReadProperty("ContentDetails", true);
|
||||
if (_ContentDetailCount > 0 && _ContentDetails == null)
|
||||
_ContentDetails = ContentDetails.GetByContentID(ContentID);
|
||||
else if(_ContentDetails == null)
|
||||
else if (_ContentDetails == null)
|
||||
_ContentDetails = ContentDetails.New();
|
||||
return _ContentDetails;
|
||||
}
|
||||
@@ -361,7 +365,7 @@ namespace VEPROMS.CSLA.Library
|
||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||
get
|
||||
{
|
||||
CanReadProperty("ContentEntryCount",true);
|
||||
CanReadProperty("ContentEntryCount", true);
|
||||
return _ContentEntryCount;
|
||||
}
|
||||
}
|
||||
@@ -375,8 +379,8 @@ namespace VEPROMS.CSLA.Library
|
||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||
get
|
||||
{
|
||||
CanReadProperty("MyEntry",true);
|
||||
if ( _MyEntry == null) _MyEntry = Entry.New(this);
|
||||
CanReadProperty("MyEntry", true);
|
||||
if (_MyEntry == null) _MyEntry = Entry.New(this);
|
||||
return _MyEntry;
|
||||
}
|
||||
}
|
||||
@@ -389,7 +393,7 @@ namespace VEPROMS.CSLA.Library
|
||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||
get
|
||||
{
|
||||
CanReadProperty("ContentItemCount",true);
|
||||
CanReadProperty("ContentItemCount", true);
|
||||
return _ContentItemCount;
|
||||
}
|
||||
}
|
||||
@@ -403,10 +407,10 @@ namespace VEPROMS.CSLA.Library
|
||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||
get
|
||||
{
|
||||
CanReadProperty("ContentItems",true);
|
||||
if(_ContentItemCount > 0 && _ContentItems == null)
|
||||
CanReadProperty("ContentItems", true);
|
||||
if (_ContentItemCount > 0 && _ContentItems == null)
|
||||
_ContentItems = ContentItems.GetByContentID(ContentID);
|
||||
else if(_ContentItems == null)
|
||||
else if (_ContentItems == null)
|
||||
_ContentItems = ContentItems.New();
|
||||
return _ContentItems;
|
||||
}
|
||||
@@ -420,7 +424,7 @@ namespace VEPROMS.CSLA.Library
|
||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||
get
|
||||
{
|
||||
CanReadProperty("ContentPartCount",true);
|
||||
CanReadProperty("ContentPartCount", true);
|
||||
return _ContentPartCount;
|
||||
}
|
||||
}
|
||||
@@ -434,10 +438,10 @@ namespace VEPROMS.CSLA.Library
|
||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||
get
|
||||
{
|
||||
CanReadProperty("ContentParts",true);
|
||||
if(_ContentPartCount > 0 && _ContentParts == null)
|
||||
CanReadProperty("ContentParts", true);
|
||||
if (_ContentPartCount > 0 && _ContentParts == null)
|
||||
_ContentParts = ContentParts.GetByContentID(ContentID);
|
||||
else if(_ContentParts == null)
|
||||
else if (_ContentParts == null)
|
||||
_ContentParts = ContentParts.New();
|
||||
return _ContentParts;
|
||||
}
|
||||
@@ -451,7 +455,7 @@ namespace VEPROMS.CSLA.Library
|
||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||
get
|
||||
{
|
||||
CanReadProperty("ContentRoUsageCount",true);
|
||||
CanReadProperty("ContentRoUsageCount", true);
|
||||
return _ContentRoUsageCount;
|
||||
}
|
||||
}
|
||||
@@ -465,10 +469,10 @@ namespace VEPROMS.CSLA.Library
|
||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||
get
|
||||
{
|
||||
CanReadProperty("ContentRoUsages",true);
|
||||
if(_ContentRoUsageCount > 0 && _ContentRoUsages == null)
|
||||
CanReadProperty("ContentRoUsages", true);
|
||||
if (_ContentRoUsageCount > 0 && _ContentRoUsages == null)
|
||||
_ContentRoUsages = ContentRoUsages.GetByContentID(ContentID);
|
||||
else if(_ContentRoUsages == null)
|
||||
else if (_ContentRoUsages == null)
|
||||
_ContentRoUsages = ContentRoUsages.New();
|
||||
return _ContentRoUsages;
|
||||
}
|
||||
@@ -482,7 +486,7 @@ namespace VEPROMS.CSLA.Library
|
||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||
get
|
||||
{
|
||||
CanReadProperty("ContentTransitionCount",true);
|
||||
CanReadProperty("ContentTransitionCount", true);
|
||||
return _ContentTransitionCount;
|
||||
}
|
||||
}
|
||||
@@ -496,10 +500,10 @@ namespace VEPROMS.CSLA.Library
|
||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||
get
|
||||
{
|
||||
CanReadProperty("ContentTransitions",true);
|
||||
if(_ContentTransitionCount > 0 && _ContentTransitions == null)
|
||||
CanReadProperty("ContentTransitions", true);
|
||||
if (_ContentTransitionCount > 0 && _ContentTransitions == null)
|
||||
_ContentTransitions = ContentTransitions.GetByFromID(ContentID);
|
||||
else if(_ContentTransitions == null)
|
||||
else if (_ContentTransitions == null)
|
||||
_ContentTransitions = ContentTransitions.New();
|
||||
return _ContentTransitions;
|
||||
}
|
||||
@@ -513,7 +517,7 @@ namespace VEPROMS.CSLA.Library
|
||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||
get
|
||||
{
|
||||
CanReadProperty("ContentZContentCount",true);
|
||||
CanReadProperty("ContentZContentCount", true);
|
||||
return _ContentZContentCount;
|
||||
}
|
||||
}
|
||||
@@ -527,18 +531,18 @@ namespace VEPROMS.CSLA.Library
|
||||
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
|
||||
get
|
||||
{
|
||||
CanReadProperty("MyZContent",true);
|
||||
if ( _MyZContent == null) _MyZContent = ZContent.New(this);
|
||||
CanReadProperty("MyZContent", true);
|
||||
if (_MyZContent == null) _MyZContent = ZContent.New(this);
|
||||
return _MyZContent;
|
||||
}
|
||||
}
|
||||
public override bool IsDirty
|
||||
{
|
||||
get { return base.IsDirty || (_ContentDetails == null? false : _ContentDetails.IsDirty) || (_MyEntry == null? false : _MyEntry.IsDirty) || (_ContentItems == null? false : _ContentItems.IsDirty) || (_ContentParts == null? false : _ContentParts.IsDirty) || (_ContentRoUsages == null? false : _ContentRoUsages.IsDirty) || (_ContentTransitions == null? false : _ContentTransitions.IsDirty) || (_MyZContent == null? false : _MyZContent.IsDirty) || (_MyFormat == null? false : _MyFormat.IsDirty); }
|
||||
get { return base.IsDirty || (_ContentDetails == null ? false : _ContentDetails.IsDirty) || (_MyEntry == null ? false : _MyEntry.IsDirty) || (_ContentItems == null ? false : _ContentItems.IsDirty) || (_ContentParts == null ? false : _ContentParts.IsDirty) || (_ContentRoUsages == null ? false : _ContentRoUsages.IsDirty) || (_ContentTransitions == null ? false : _ContentTransitions.IsDirty) || (_MyZContent == null ? false : _MyZContent.IsDirty) || (_MyFormat == null ? false : _MyFormat.IsDirty); }
|
||||
}
|
||||
public override bool IsValid
|
||||
{
|
||||
get { return (IsNew && !IsDirty ? true : base.IsValid) && (_ContentDetails == null? true : _ContentDetails.IsValid) && (_MyEntry == null? true : _MyEntry.IsValid) && (_ContentItems == null? true : _ContentItems.IsValid) && (_ContentParts == null? true : _ContentParts.IsValid) && (_ContentRoUsages == null? true : _ContentRoUsages.IsValid) && (_ContentTransitions == null? true : _ContentTransitions.IsValid) && (_MyZContent == null? true : _MyZContent.IsValid) && (_MyFormat == null? true : _MyFormat.IsValid); }
|
||||
get { return (IsNew && !IsDirty ? true : base.IsValid) && (_ContentDetails == null ? true : _ContentDetails.IsValid) && (_MyEntry == null ? true : _MyEntry.IsValid) && (_ContentItems == null ? true : _ContentItems.IsValid) && (_ContentParts == null ? true : _ContentParts.IsValid) && (_ContentRoUsages == null ? true : _ContentRoUsages.IsValid) && (_ContentTransitions == null ? true : _ContentTransitions.IsValid) && (_MyZContent == null ? true : _MyZContent.IsValid) && (_MyFormat == null ? true : _MyFormat.IsValid); }
|
||||
}
|
||||
// TODO: Replace base Content.ToString function as necessary
|
||||
/// <summary>
|
||||
@@ -561,29 +565,30 @@ namespace VEPROMS.CSLA.Library
|
||||
#endregion
|
||||
#region ValidationRules
|
||||
[NonSerialized]
|
||||
private bool _CheckingBrokenRules=false;
|
||||
private bool _CheckingBrokenRules = false;
|
||||
public IVEHasBrokenRules HasBrokenRules
|
||||
{
|
||||
get {
|
||||
if(_CheckingBrokenRules)return null;
|
||||
get
|
||||
{
|
||||
if (_CheckingBrokenRules) return null;
|
||||
if ((IsDirty || !IsNew) && BrokenRulesCollection.Count > 0) return this;
|
||||
try
|
||||
{
|
||||
_CheckingBrokenRules=true;
|
||||
_CheckingBrokenRules = true;
|
||||
IVEHasBrokenRules hasBrokenRules = null;
|
||||
if (_ContentItems != null && (hasBrokenRules = _ContentItems.HasBrokenRules) != null) return hasBrokenRules;
|
||||
if (_ContentDetails != null && (hasBrokenRules = _ContentDetails.HasBrokenRules) != null) return hasBrokenRules;
|
||||
if (_MyEntry != null && (hasBrokenRules = _MyEntry.HasBrokenRules) != null) return hasBrokenRules;
|
||||
if (_ContentParts != null && (hasBrokenRules = _ContentParts.HasBrokenRules) != null) return hasBrokenRules;
|
||||
if (_ContentRoUsages != null && (hasBrokenRules = _ContentRoUsages.HasBrokenRules) != null) return hasBrokenRules;
|
||||
if (_ContentTransitions != null && (hasBrokenRules = _ContentTransitions.HasBrokenRules) != null) return hasBrokenRules;
|
||||
if (_MyZContent != null && (hasBrokenRules = _MyZContent.HasBrokenRules) != null) return hasBrokenRules;
|
||||
if (_MyFormat != null && (hasBrokenRules = _MyFormat.HasBrokenRules) != null) return hasBrokenRules;
|
||||
if (_ContentItems != null && (hasBrokenRules = _ContentItems.HasBrokenRules) != null) return hasBrokenRules;
|
||||
if (_ContentDetails != null && (hasBrokenRules = _ContentDetails.HasBrokenRules) != null) return hasBrokenRules;
|
||||
if (_MyEntry != null && (hasBrokenRules = _MyEntry.HasBrokenRules) != null) return hasBrokenRules;
|
||||
if (_ContentParts != null && (hasBrokenRules = _ContentParts.HasBrokenRules) != null) return hasBrokenRules;
|
||||
if (_ContentRoUsages != null && (hasBrokenRules = _ContentRoUsages.HasBrokenRules) != null) return hasBrokenRules;
|
||||
if (_ContentTransitions != null && (hasBrokenRules = _ContentTransitions.HasBrokenRules) != null) return hasBrokenRules;
|
||||
if (_MyZContent != null && (hasBrokenRules = _MyZContent.HasBrokenRules) != null) return hasBrokenRules;
|
||||
if (_MyFormat != null && (hasBrokenRules = _MyFormat.HasBrokenRules) != null) return hasBrokenRules;
|
||||
return hasBrokenRules;
|
||||
}
|
||||
finally
|
||||
{
|
||||
_CheckingBrokenRules=false;
|
||||
_CheckingBrokenRules = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -708,14 +713,25 @@ namespace VEPROMS.CSLA.Library
|
||||
#region Factory Methods
|
||||
public int CurrentEditLevel
|
||||
{ get { return EditLevel; } }
|
||||
private static int _ContentUnique = 0;
|
||||
private int _MyContentUnique;
|
||||
public int MyContentUnique
|
||||
{
|
||||
get { return _MyContentUnique; }
|
||||
}
|
||||
protected Content()
|
||||
{/* require use of factory methods */
|
||||
_MyContentUnique = ++_ContentUnique;
|
||||
_AllList.Add(this);
|
||||
}
|
||||
public void Dispose()
|
||||
{
|
||||
_AllList.Remove(this);
|
||||
_AllByPrimaryKey.Remove(ContentID.ToString());
|
||||
if (!_AllByPrimaryKey.ContainsKey(ContentID.ToString())) return;
|
||||
List<Content> listContent = _AllByPrimaryKey[ContentID.ToString()]; // Get the list of items
|
||||
listContent.Remove(this); // Remove the item from the list
|
||||
if (listContent.Count == 0) //If there are no items left in the list
|
||||
_AllByPrimaryKey.Remove(ContentID.ToString()); // remove the list
|
||||
}
|
||||
public static Content New()
|
||||
{
|
||||
@@ -794,7 +810,7 @@ namespace VEPROMS.CSLA.Library
|
||||
if (tmp == null)
|
||||
{
|
||||
tmp = DataPortal.Fetch<Content>(new PKCriteria(contentID));
|
||||
_AllList.Add(tmp);
|
||||
if (!_AllList.Contains(tmp)) _AllList.Add(tmp);
|
||||
}
|
||||
if (tmp.ErrorMessage == "No Record Found") tmp = null;
|
||||
return tmp;
|
||||
@@ -873,7 +889,7 @@ namespace VEPROMS.CSLA.Library
|
||||
}
|
||||
private void ReadData(SafeDataReader dr)
|
||||
{
|
||||
if(_MyLog.IsDebugEnabled)_MyLog.DebugFormat("[{0}] Content.ReadData", GetHashCode());
|
||||
if (_MyLog.IsDebugEnabled) _MyLog.DebugFormat("[{0}] Content.ReadData", GetHashCode());
|
||||
try
|
||||
{
|
||||
_ContentID = dr.GetInt32("ContentID");
|
||||
@@ -896,14 +912,14 @@ namespace VEPROMS.CSLA.Library
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
if(_MyLog.IsErrorEnabled)_MyLog.Error("Content.ReadData", ex);
|
||||
if (_MyLog.IsErrorEnabled) _MyLog.Error("Content.ReadData", ex);
|
||||
_ErrorMessage = ex.Message;
|
||||
throw new DbCslaException("Content.ReadData", ex);
|
||||
}
|
||||
}
|
||||
private void DataPortal_Fetch(PKCriteria criteria)
|
||||
{
|
||||
if(_MyLog.IsDebugEnabled)_MyLog.DebugFormat("[{0}] Content.DataPortal_Fetch", GetHashCode());
|
||||
if (_MyLog.IsDebugEnabled) _MyLog.DebugFormat("[{0}] Content.DataPortal_Fetch", GetHashCode());
|
||||
try
|
||||
{
|
||||
using (SqlConnection cn = Database.VEPROMS_SqlConnection)
|
||||
@@ -952,7 +968,7 @@ namespace VEPROMS.CSLA.Library
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
if(_MyLog.IsErrorEnabled)_MyLog.Error("Content.DataPortal_Fetch", ex);
|
||||
if (_MyLog.IsErrorEnabled) _MyLog.Error("Content.DataPortal_Fetch", ex);
|
||||
_ErrorMessage = ex.Message;
|
||||
throw new DbCslaException("Content.DataPortal_Fetch", ex);
|
||||
}
|
||||
@@ -973,13 +989,13 @@ namespace VEPROMS.CSLA.Library
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
if(_MyLog.IsErrorEnabled)_MyLog.Error("Content.DataPortal_Insert", ex);
|
||||
if (_MyLog.IsErrorEnabled) _MyLog.Error("Content.DataPortal_Insert", ex);
|
||||
_ErrorMessage = ex.Message;
|
||||
throw new DbCslaException("Content.DataPortal_Insert", ex);
|
||||
}
|
||||
finally
|
||||
{
|
||||
if(_MyLog.IsDebugEnabled)_MyLog.DebugFormat("[{0}] Content.DataPortal_Insert", GetHashCode());
|
||||
if (_MyLog.IsDebugEnabled) _MyLog.DebugFormat("[{0}] Content.DataPortal_Insert", GetHashCode());
|
||||
}
|
||||
}
|
||||
[Transactional(TransactionalTypes.TransactionScope)]
|
||||
@@ -988,7 +1004,7 @@ namespace VEPROMS.CSLA.Library
|
||||
if (!this.IsDirty) return;
|
||||
try
|
||||
{
|
||||
if(_MyFormat != null) _MyFormat.Update();
|
||||
if (_MyFormat != null) _MyFormat.Update();
|
||||
SqlConnection cn = (SqlConnection)ApplicationContext.LocalContext["cn"];
|
||||
using (SqlCommand cm = cn.CreateCommand())
|
||||
{
|
||||
@@ -1024,11 +1040,11 @@ namespace VEPROMS.CSLA.Library
|
||||
if (_ContentRoUsages != null) _ContentRoUsages.Update(this);
|
||||
if (_ContentTransitions != null) _ContentTransitions.Update(this);
|
||||
if (_MyZContent != null) _MyZContent.Update(this);
|
||||
if(_MyLog.IsDebugEnabled)_MyLog.DebugFormat("[{0}] Content.SQLInsert", GetHashCode());
|
||||
if (_MyLog.IsDebugEnabled) _MyLog.DebugFormat("[{0}] Content.SQLInsert", GetHashCode());
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
if(_MyLog.IsErrorEnabled)_MyLog.Error("Content.SQLInsert", ex);
|
||||
if (_MyLog.IsErrorEnabled) _MyLog.Error("Content.SQLInsert", ex);
|
||||
_ErrorMessage = ex.Message;
|
||||
throw new DbCslaException("Content.SQLInsert", ex);
|
||||
}
|
||||
@@ -1036,7 +1052,7 @@ namespace VEPROMS.CSLA.Library
|
||||
[Transactional(TransactionalTypes.TransactionScope)]
|
||||
public static byte[] Add(SqlConnection cn, ref int contentID, string number, string text, int? type, Format myFormat, string config, DateTime dts, string userID)
|
||||
{
|
||||
if(_MyLog.IsDebugEnabled)_MyLog.DebugFormat("[{0}] Content.Add", 0);
|
||||
if (_MyLog.IsDebugEnabled) _MyLog.DebugFormat("[{0}] Content.Add", 0);
|
||||
try
|
||||
{
|
||||
using (SqlCommand cm = cn.CreateCommand())
|
||||
@@ -1047,7 +1063,7 @@ namespace VEPROMS.CSLA.Library
|
||||
cm.Parameters.AddWithValue("@Number", number);
|
||||
cm.Parameters.AddWithValue("@Text", text);
|
||||
cm.Parameters.AddWithValue("@Type", type);
|
||||
if(myFormat != null)cm.Parameters.AddWithValue("@FormatID", myFormat.FormatID);
|
||||
if (myFormat != null) cm.Parameters.AddWithValue("@FormatID", myFormat.FormatID);
|
||||
cm.Parameters.AddWithValue("@Config", config);
|
||||
if (dts.Year >= 1753 && dts.Year <= 9999) cm.Parameters.AddWithValue("@DTS", dts);
|
||||
cm.Parameters.AddWithValue("@UserID", userID);
|
||||
@@ -1067,7 +1083,7 @@ namespace VEPROMS.CSLA.Library
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
if(_MyLog.IsErrorEnabled)_MyLog.Error("Content.Add", ex);
|
||||
if (_MyLog.IsErrorEnabled) _MyLog.Error("Content.Add", ex);
|
||||
throw new DbCslaException("Content.Add", ex);
|
||||
}
|
||||
}
|
||||
@@ -1075,7 +1091,7 @@ namespace VEPROMS.CSLA.Library
|
||||
protected override void DataPortal_Update()
|
||||
{
|
||||
if (!IsDirty) return; // If not dirty - nothing to do
|
||||
if(_MyLog.IsDebugEnabled)_MyLog.DebugFormat("[{0}] Content.DataPortal_Update", GetHashCode());
|
||||
if (_MyLog.IsDebugEnabled) _MyLog.DebugFormat("[{0}] Content.DataPortal_Update", GetHashCode());
|
||||
try
|
||||
{
|
||||
using (SqlConnection cn = Database.VEPROMS_SqlConnection)
|
||||
@@ -1089,7 +1105,7 @@ namespace VEPROMS.CSLA.Library
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
if(_MyLog.IsErrorEnabled)_MyLog.Error("Content.DataPortal_Update", ex);
|
||||
if (_MyLog.IsErrorEnabled) _MyLog.Error("Content.DataPortal_Update", ex);
|
||||
_ErrorMessage = ex.Message;
|
||||
if (!ex.Message.EndsWith("has been edited by another user.")) throw ex;
|
||||
}
|
||||
@@ -1098,10 +1114,10 @@ namespace VEPROMS.CSLA.Library
|
||||
internal void SQLUpdate()
|
||||
{
|
||||
if (!IsDirty) return; // If not dirty - nothing to do
|
||||
if(_MyLog.IsDebugEnabled)_MyLog.DebugFormat("[{0}] Content.SQLUpdate", GetHashCode());
|
||||
if (_MyLog.IsDebugEnabled) _MyLog.DebugFormat("[{0}] Content.SQLUpdate", GetHashCode());
|
||||
try
|
||||
{
|
||||
if(_MyFormat != null) _MyFormat.Update();
|
||||
if (_MyFormat != null) _MyFormat.Update();
|
||||
SqlConnection cn = (SqlConnection)ApplicationContext.LocalContext["cn"];
|
||||
if (base.IsDirty)
|
||||
{
|
||||
@@ -1141,7 +1157,7 @@ namespace VEPROMS.CSLA.Library
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
if(_MyLog.IsErrorEnabled)_MyLog.Error("Content.SQLUpdate", ex);
|
||||
if (_MyLog.IsErrorEnabled) _MyLog.Error("Content.SQLUpdate", ex);
|
||||
_ErrorMessage = ex.Message;
|
||||
if (!ex.Message.EndsWith("has been edited by another user.")) throw ex;
|
||||
}
|
||||
@@ -1169,7 +1185,7 @@ namespace VEPROMS.CSLA.Library
|
||||
[Transactional(TransactionalTypes.TransactionScope)]
|
||||
public static byte[] Update(SqlConnection cn, ref int contentID, string number, string text, int? type, Format myFormat, string config, DateTime dts, string userID, ref byte[] lastChanged)
|
||||
{
|
||||
if(_MyLog.IsDebugEnabled)_MyLog.DebugFormat("[{0}] Content.Update", 0);
|
||||
if (_MyLog.IsDebugEnabled) _MyLog.DebugFormat("[{0}] Content.Update", 0);
|
||||
try
|
||||
{
|
||||
using (SqlCommand cm = cn.CreateCommand())
|
||||
@@ -1181,7 +1197,7 @@ namespace VEPROMS.CSLA.Library
|
||||
cm.Parameters.AddWithValue("@Number", number);
|
||||
cm.Parameters.AddWithValue("@Text", text);
|
||||
cm.Parameters.AddWithValue("@Type", type);
|
||||
if(myFormat != null)cm.Parameters.AddWithValue("@FormatID", myFormat.FormatID);
|
||||
if (myFormat != null) cm.Parameters.AddWithValue("@FormatID", myFormat.FormatID);
|
||||
cm.Parameters.AddWithValue("@Config", config);
|
||||
if (dts.Year >= 1753 && dts.Year <= 9999) cm.Parameters.AddWithValue("@DTS", dts);
|
||||
cm.Parameters.AddWithValue("@UserID", userID);
|
||||
@@ -1198,7 +1214,7 @@ namespace VEPROMS.CSLA.Library
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
if(_MyLog.IsErrorEnabled)_MyLog.Error("Content.Update", ex);
|
||||
if (_MyLog.IsErrorEnabled) _MyLog.Error("Content.Update", ex);
|
||||
throw new DbCslaException("Content.Update", ex);
|
||||
}
|
||||
}
|
||||
@@ -1210,7 +1226,7 @@ namespace VEPROMS.CSLA.Library
|
||||
[Transactional(TransactionalTypes.TransactionScope)]
|
||||
private void DataPortal_Delete(PKCriteria criteria)
|
||||
{
|
||||
if(_MyLog.IsDebugEnabled)_MyLog.DebugFormat("[{0}] Content.DataPortal_Delete", GetHashCode());
|
||||
if (_MyLog.IsDebugEnabled) _MyLog.DebugFormat("[{0}] Content.DataPortal_Delete", GetHashCode());
|
||||
try
|
||||
{
|
||||
using (SqlConnection cn = Database.VEPROMS_SqlConnection)
|
||||
@@ -1226,7 +1242,7 @@ namespace VEPROMS.CSLA.Library
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
if(_MyLog.IsErrorEnabled)_MyLog.Error("Content.DataPortal_Delete", ex);
|
||||
if (_MyLog.IsErrorEnabled) _MyLog.Error("Content.DataPortal_Delete", ex);
|
||||
_ErrorMessage = ex.Message;
|
||||
throw new DbCslaException("Content.DataPortal_Delete", ex);
|
||||
}
|
||||
@@ -1234,7 +1250,7 @@ namespace VEPROMS.CSLA.Library
|
||||
[Transactional(TransactionalTypes.TransactionScope)]
|
||||
public static void Remove(SqlConnection cn, int contentID)
|
||||
{
|
||||
if(_MyLog.IsDebugEnabled)_MyLog.DebugFormat("[{0}] Content.Remove", 0);
|
||||
if (_MyLog.IsDebugEnabled) _MyLog.DebugFormat("[{0}] Content.Remove", 0);
|
||||
try
|
||||
{
|
||||
using (SqlCommand cm = cn.CreateCommand())
|
||||
@@ -1249,7 +1265,7 @@ namespace VEPROMS.CSLA.Library
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
if(_MyLog.IsErrorEnabled)_MyLog.Error("Content.Remove", ex);
|
||||
if (_MyLog.IsErrorEnabled) _MyLog.Error("Content.Remove", ex);
|
||||
throw new DbCslaException("Content.Remove", ex);
|
||||
}
|
||||
}
|
||||
@@ -1283,7 +1299,7 @@ namespace VEPROMS.CSLA.Library
|
||||
}
|
||||
protected override void DataPortal_Execute()
|
||||
{
|
||||
if(_MyLog.IsDebugEnabled)_MyLog.DebugFormat("[{0}] Content.DataPortal_Execute", GetHashCode());
|
||||
if (_MyLog.IsDebugEnabled) _MyLog.DebugFormat("[{0}] Content.DataPortal_Execute", GetHashCode());
|
||||
try
|
||||
{
|
||||
using (SqlConnection cn = Database.VEPROMS_SqlConnection)
|
||||
@@ -1301,7 +1317,7 @@ namespace VEPROMS.CSLA.Library
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
if(_MyLog.IsErrorEnabled)_MyLog.Error("Content.DataPortal_Execute", ex);
|
||||
if (_MyLog.IsErrorEnabled) _MyLog.Error("Content.DataPortal_Execute", ex);
|
||||
throw new DbCslaException("Content.DataPortal_Execute", ex);
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user