Update related lists when related value changes.

This commit is contained in:
Rich
2008-05-01 11:01:21 +00:00
parent 26de18fb28
commit 1973b9646c
20 changed files with 561 additions and 87 deletions

View File

@@ -174,11 +174,17 @@ namespace VEPROMS.CSLA.Library
get
{
CanReadProperty("ItemAnnotations",true);
if (_ItemAnnotationCount > 0 && _ItemAnnotations == null)
if (_ItemAnnotationCount < 0 || (_ItemAnnotationCount > 0 && _ItemAnnotations == null))
_ItemAnnotations = AnnotationInfoList.GetByItemID(_ItemID);
if (_ItemAnnotationCount < 0)
_ItemAnnotationCount = _ItemAnnotations.Count;
return _ItemAnnotations;
}
}
internal void RefreshItemAnnotations()
{
_ItemAnnotationCount = -1; // This will cause the data to be requeried
}
private int _ItemDocVersionCount = 0;
/// <summary>
/// Count of ItemDocVersions for this Item
@@ -200,11 +206,17 @@ namespace VEPROMS.CSLA.Library
get
{
CanReadProperty("ItemDocVersions",true);
if (_ItemDocVersionCount > 0 && _ItemDocVersions == null)
if (_ItemDocVersionCount < 0 || (_ItemDocVersionCount > 0 && _ItemDocVersions == null))
_ItemDocVersions = DocVersionInfoList.GetByItemID(_ItemID);
if (_ItemDocVersionCount < 0)
_ItemDocVersionCount = _ItemDocVersions.Count;
return _ItemDocVersions;
}
}
internal void RefreshItemDocVersions()
{
_ItemDocVersionCount = -1; // This will cause the data to be requeried
}
private int _NextItemCount = 0;
/// <summary>
/// Count of NextItems for this Item
@@ -226,11 +238,17 @@ namespace VEPROMS.CSLA.Library
get
{
CanReadProperty("NextItems",true);
if (_NextItemCount > 0 && _NextItems == null)
if (_NextItemCount < 0 || (_NextItemCount > 0 && _NextItems == null))
_NextItems = ItemInfoList.GetNext(_ItemID);
if (_NextItemCount < 0)
_NextItemCount = _NextItems.Count;
return _NextItems;
}
}
internal void RefreshNextItems()
{
_NextItemCount = -1; // This will cause the data to be requeried
}
private int _ItemPartCount = 0;
/// <summary>
/// Count of ItemParts for this Item
@@ -252,11 +270,17 @@ namespace VEPROMS.CSLA.Library
get
{
CanReadProperty("ItemParts",true);
if (_ItemPartCount > 0 && _ItemParts == null)
if (_ItemPartCount < 0 || (_ItemPartCount > 0 && _ItemParts == null))
_ItemParts = PartInfoList.GetByItemID(_ItemID);
if (_ItemPartCount < 0)
_ItemPartCount = _ItemParts.Count;
return _ItemParts;
}
}
internal void RefreshItemParts()
{
_ItemPartCount = -1; // This will cause the data to be requeried
}
private int _ItemTransition_RangeIDCount = 0;
/// <summary>
/// Count of ItemTransitions for this Item
@@ -278,11 +302,17 @@ namespace VEPROMS.CSLA.Library
get
{
CanReadProperty("ItemTransitions_RangeID",true);
if (_ItemTransition_RangeIDCount > 0 && _ItemTransitions_RangeID == null)
if (_ItemTransition_RangeIDCount < 0 || (_ItemTransition_RangeIDCount > 0 && _ItemTransitions_RangeID == null))
_ItemTransitions_RangeID = TransitionInfoList.GetByRangeID(_ItemID);
if (_ItemTransition_RangeIDCount < 0)
_ItemTransition_RangeIDCount = _ItemTransitions_RangeID.Count;
return _ItemTransitions_RangeID;
}
}
internal void RefreshItemTransitions_RangeID()
{
_ItemTransition_RangeIDCount = -1; // This will cause the data to be requeried
}
private int _ItemTransition_ToIDCount = 0;
/// <summary>
/// Count of ItemTransitions for this Item
@@ -304,11 +334,17 @@ namespace VEPROMS.CSLA.Library
get
{
CanReadProperty("ItemTransitions_ToID",true);
if (_ItemTransition_ToIDCount > 0 && _ItemTransitions_ToID == null)
if (_ItemTransition_ToIDCount < 0 || (_ItemTransition_ToIDCount > 0 && _ItemTransitions_ToID == null))
_ItemTransitions_ToID = TransitionInfoList.GetByToID(_ItemID);
if (_ItemTransition_ToIDCount < 0)
_ItemTransition_ToIDCount = _ItemTransitions_ToID.Count;
return _ItemTransitions_ToID;
}
}
internal void RefreshItemTransitions_ToID()
{
_ItemTransition_ToIDCount = -1; // This will cause the data to be requeried
}
// TODO: Replace base ItemInfo.ToString function as necessary
/// <summary>
/// Overrides Base ToString
@@ -350,8 +386,20 @@ namespace VEPROMS.CSLA.Library
}
private void RefreshFields(Item tmp)
{
_PreviousID = tmp.PreviousID;
_ContentID = tmp.ContentID;
if (_PreviousID != tmp.PreviousID)
{
MyPrevious.RefreshNextItems(); // Update List for old value
_PreviousID = tmp.PreviousID; // Update the value
_MyPrevious = null; // Reset list so that the next line gets a new list
MyPrevious.RefreshNextItems(); // Update List for new value
}
if (_ContentID != tmp.ContentID)
{
MyContent.RefreshContentItems(); // Update List for old value
_ContentID = tmp.ContentID; // Update the value
_MyContent = null; // Reset list so that the next line gets a new list
MyContent.RefreshContentItems(); // Update List for new value
}
_DTS = tmp.DTS;
_UserID = tmp.UserID;
_ItemInfoExtension.Refresh(this);
@@ -367,7 +415,13 @@ namespace VEPROMS.CSLA.Library
}
private void RefreshFields(ContentItem tmp)
{
_PreviousID = tmp.PreviousID;
if (_PreviousID != tmp.PreviousID)
{
MyPrevious.RefreshNextItems(); // Update List for old value
_PreviousID = tmp.PreviousID; // Update the value
_MyPrevious = null; // Reset list so that the next line gets a new list
MyPrevious.RefreshNextItems(); // Update List for new value
}
_DTS = tmp.DTS;
_UserID = tmp.UserID;
_ItemInfoExtension.Refresh(this);