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

@@ -192,11 +192,17 @@ namespace VEPROMS.CSLA.Library
get
{
CanReadProperty("FormatContents",true);
if (_FormatContentCount > 0 && _FormatContents == null)
if (_FormatContentCount < 0 || (_FormatContentCount > 0 && _FormatContents == null))
_FormatContents = ContentInfoList.GetByFormatID(_FormatID);
if (_FormatContentCount < 0)
_FormatContentCount = _FormatContents.Count;
return _FormatContents;
}
}
internal void RefreshFormatContents()
{
_FormatContentCount = -1; // This will cause the data to be requeried
}
private int _FormatDocVersionCount = 0;
/// <summary>
/// Count of FormatDocVersions for this Format
@@ -218,11 +224,17 @@ namespace VEPROMS.CSLA.Library
get
{
CanReadProperty("FormatDocVersions",true);
if (_FormatDocVersionCount > 0 && _FormatDocVersions == null)
if (_FormatDocVersionCount < 0 || (_FormatDocVersionCount > 0 && _FormatDocVersions == null))
_FormatDocVersions = DocVersionInfoList.GetByFormatID(_FormatID);
if (_FormatDocVersionCount < 0)
_FormatDocVersionCount = _FormatDocVersions.Count;
return _FormatDocVersions;
}
}
internal void RefreshFormatDocVersions()
{
_FormatDocVersionCount = -1; // This will cause the data to be requeried
}
private int _FormatFolderCount = 0;
/// <summary>
/// Count of FormatFolders for this Format
@@ -244,11 +256,17 @@ namespace VEPROMS.CSLA.Library
get
{
CanReadProperty("FormatFolders",true);
if (_FormatFolderCount > 0 && _FormatFolders == null)
if (_FormatFolderCount < 0 || (_FormatFolderCount > 0 && _FormatFolders == null))
_FormatFolders = FolderInfoList.GetByFormatID(_FormatID);
if (_FormatFolderCount < 0)
_FormatFolderCount = _FormatFolders.Count;
return _FormatFolders;
}
}
internal void RefreshFormatFolders()
{
_FormatFolderCount = -1; // This will cause the data to be requeried
}
private int _ChildFormatCount = 0;
/// <summary>
/// Count of ChildFormats for this Format
@@ -270,11 +288,17 @@ namespace VEPROMS.CSLA.Library
get
{
CanReadProperty("ChildFormats",true);
if (_ChildFormatCount > 0 && _ChildFormats == null)
if (_ChildFormatCount < 0 || (_ChildFormatCount > 0 && _ChildFormats == null))
_ChildFormats = FormatInfoList.GetChildren(_FormatID);
if (_ChildFormatCount < 0)
_ChildFormatCount = _ChildFormats.Count;
return _ChildFormats;
}
}
internal void RefreshChildFormats()
{
_ChildFormatCount = -1; // This will cause the data to be requeried
}
// TODO: Replace base FormatInfo.ToString function as necessary
/// <summary>
/// Overrides Base ToString
@@ -316,7 +340,13 @@ namespace VEPROMS.CSLA.Library
}
private void RefreshFields(Format tmp)
{
_ParentID = tmp.ParentID;
if (_ParentID != tmp.ParentID)
{
MyParent.RefreshChildFormats(); // Update List for old value
_ParentID = tmp.ParentID; // Update the value
_MyParent = null; // Reset list so that the next line gets a new list
MyParent.RefreshChildFormats(); // Update List for new value
}
_Name = tmp.Name;
_Description = tmp.Description;
_Data = tmp.Data;