Added error handling to GetROFst so that the code will not crash, but messages will be added to the error log.
Added specific messages to the error log.
This commit is contained in:
parent
2f326c4c1b
commit
1e7ee2d784
@ -649,14 +649,40 @@ namespace VEPROMS.CSLA.Library
|
||||
#endregion
|
||||
public ROFstInfo GetROFst(int rodbid)
|
||||
{
|
||||
if (DocVersionAssociations == null) return null;
|
||||
if (DocVersionAssociations == null || DocVersionAssociations.Count == 0) // No RO Association for this Data
|
||||
{
|
||||
if(FirstBadRODBIDProblemDetected)
|
||||
_MyLog.ErrorFormat("<<<ERROR>>> - Missing RO Association\r\nMissing RO Association for this Folder ([{0}] - {1})",VersionID, MyFolder.Name);
|
||||
return null;
|
||||
}
|
||||
foreach (AssociationInfo dva in DocVersionAssociations)
|
||||
{
|
||||
if (dva.MyROFst.RODbID == rodbid)
|
||||
return dva.MyROFst;
|
||||
}
|
||||
if (DocVersionAssociations.Count == 1) // Different Association and ROUsage values for RODBID - default to asssociation value
|
||||
{
|
||||
if (FirstBadRODBIDProblemDetected)
|
||||
_MyLog.ErrorFormat("<<<ERROR>>> - ROUsage Does Not match Association\r\nROUsage (RODBID = {0}) does not match Association Information (RODBID = {1}) for this Folder ([2] - {3})",
|
||||
rodbid, DocVersionAssociations[0].MyROFst.RODbID, VersionID, MyFolder.Name);
|
||||
return DocVersionAssociations[0].MyROFst;
|
||||
}
|
||||
// More than one association record - Cannot guess which to return
|
||||
if (FirstBadRODBIDProblemDetected)
|
||||
_MyLog.ErrorFormat("<<<ERROR>>> - More than One Association Record\r\nROUsage (RODBID = {0}) does not match any of the {1} Associations for this Folder ([{2}] -{3})",
|
||||
rodbid, DocVersionAssociations.Count, VersionID, MyFolder.Name);
|
||||
return null;
|
||||
}
|
||||
private static List<int> _HasBadRODBIDProblem = new List<int>();
|
||||
private bool FirstBadRODBIDProblemDetected
|
||||
{
|
||||
get
|
||||
{
|
||||
if (_HasBadRODBIDProblem.Contains(VersionID)) return false;
|
||||
_HasBadRODBIDProblem.Add(VersionID);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
public bool IsFolder
|
||||
{
|
||||
get
|
||||
|
Loading…
x
Reference in New Issue
Block a user