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

@@ -236,11 +236,17 @@ namespace VEPROMS.CSLA.Library
get
{
CanReadProperty("FolderAssignments",true);
if (_FolderAssignmentCount > 0 && _FolderAssignments == null)
if (_FolderAssignmentCount < 0 || (_FolderAssignmentCount > 0 && _FolderAssignments == null))
_FolderAssignments = AssignmentInfoList.GetByFolderID(_FolderID);
if (_FolderAssignmentCount < 0)
_FolderAssignmentCount = _FolderAssignments.Count;
return _FolderAssignments;
}
}
internal void RefreshFolderAssignments()
{
_FolderAssignmentCount = -1; // This will cause the data to be requeried
}
private int _FolderDocVersionCount = 0;
/// <summary>
/// Count of FolderDocVersions for this Folder
@@ -262,11 +268,17 @@ namespace VEPROMS.CSLA.Library
get
{
CanReadProperty("FolderDocVersions",true);
if (_FolderDocVersionCount > 0 && _FolderDocVersions == null)
if (_FolderDocVersionCount < 0 || (_FolderDocVersionCount > 0 && _FolderDocVersions == null))
_FolderDocVersions = DocVersionInfoList.GetByFolderID(_FolderID);
if (_FolderDocVersionCount < 0)
_FolderDocVersionCount = _FolderDocVersions.Count;
return _FolderDocVersions;
}
}
internal void RefreshFolderDocVersions()
{
_FolderDocVersionCount = -1; // This will cause the data to be requeried
}
private int _ChildFolderCount = 0;
/// <summary>
/// Count of ChildFolders for this Folder
@@ -288,11 +300,17 @@ namespace VEPROMS.CSLA.Library
get
{
CanReadProperty("ChildFolders",true);
if (_ChildFolderCount > 0 && _ChildFolders == null)
if (_ChildFolderCount < 0 || (_ChildFolderCount > 0 && _ChildFolders == null))
_ChildFolders = FolderInfoList.GetChildren(_FolderID);
if (_ChildFolderCount < 0)
_ChildFolderCount = _ChildFolders.Count;
return _ChildFolders;
}
}
internal void RefreshChildFolders()
{
_ChildFolderCount = -1; // This will cause the data to be requeried
}
// TODO: Replace base FolderInfo.ToString function as necessary
/// <summary>
/// Overrides Base ToString
@@ -334,12 +352,30 @@ namespace VEPROMS.CSLA.Library
}
private void RefreshFields(Folder tmp)
{
_ParentID = tmp.ParentID;
_DBID = tmp.DBID;
if (_ParentID != tmp.ParentID)
{
MyParent.RefreshChildFolders(); // Update List for old value
_ParentID = tmp.ParentID; // Update the value
_MyParent = null; // Reset list so that the next line gets a new list
MyParent.RefreshChildFolders(); // Update List for new value
}
if (_DBID != tmp.DBID)
{
MyConnection.RefreshConnectionFolders(); // Update List for old value
_DBID = tmp.DBID; // Update the value
_MyConnection = null; // Reset list so that the next line gets a new list
MyConnection.RefreshConnectionFolders(); // Update List for new value
}
_Name = tmp.Name;
_Title = tmp.Title;
_ShortName = tmp.ShortName;
_FormatID = tmp.FormatID;
if (_FormatID != tmp.FormatID)
{
MyFormat.RefreshFormatFolders(); // Update List for old value
_FormatID = tmp.FormatID; // Update the value
_MyFormat = null; // Reset list so that the next line gets a new list
MyFormat.RefreshFormatFolders(); // Update List for new value
}
_Config = tmp.Config;
_DTS = tmp.DTS;
_UsrID = tmp.UsrID;
@@ -357,11 +393,23 @@ namespace VEPROMS.CSLA.Library
}
private void RefreshFields(ConnectionFolder tmp)
{
_ParentID = tmp.ParentID;
if (_ParentID != tmp.ParentID)
{
MyParent.RefreshChildFolders(); // Update List for old value
_ParentID = tmp.ParentID; // Update the value
_MyParent = null; // Reset list so that the next line gets a new list
MyParent.RefreshChildFolders(); // Update List for new value
}
_Name = tmp.Name;
_Title = tmp.Title;
_ShortName = tmp.ShortName;
_FormatID = tmp.FormatID;
if (_FormatID != tmp.FormatID)
{
MyFormat.RefreshFormatFolders(); // Update List for old value
_FormatID = tmp.FormatID; // Update the value
_MyFormat = null; // Reset list so that the next line gets a new list
MyFormat.RefreshFormatFolders(); // Update List for new value
}
_Config = tmp.Config;
_DTS = tmp.DTS;
_UsrID = tmp.UsrID;
@@ -379,8 +427,20 @@ namespace VEPROMS.CSLA.Library
}
private void RefreshFields(FormatFolder tmp)
{
_ParentID = tmp.ParentID;
_DBID = tmp.DBID;
if (_ParentID != tmp.ParentID)
{
MyParent.RefreshChildFolders(); // Update List for old value
_ParentID = tmp.ParentID; // Update the value
_MyParent = null; // Reset list so that the next line gets a new list
MyParent.RefreshChildFolders(); // Update List for new value
}
if (_DBID != tmp.DBID)
{
MyConnection.RefreshConnectionFolders(); // Update List for old value
_DBID = tmp.DBID; // Update the value
_MyConnection = null; // Reset list so that the next line gets a new list
MyConnection.RefreshConnectionFolders(); // Update List for new value
}
_Name = tmp.Name;
_Title = tmp.Title;
_ShortName = tmp.ShortName;