B2022-083: Support Conditional RO Values (v2.1) [Part-2]

This commit is contained in:
Jake
2022-07-28 10:03:07 +00:00
parent bcbc52c774
commit 6dff9463ad
10 changed files with 2722 additions and 735 deletions

View File

@@ -353,11 +353,11 @@ namespace VEPROMS.CSLA.Library
if (!string.IsNullOrEmpty(rc.roid) && Regex.IsMatch(accPageKey, @".*\.[A-Z]") && rc.children != null && rc.children.Count() > 0)
{
// Check if AccPageID/Key has a return value specific extension. Try to find the RoChild record with the specific return value type,
// If not found then return the first/default return value type in the list of children
// If not found Or the specific extension value is (Null or Empty), then just return the first/default return value type in the list of children
var accPageExt = Convert.ToString(accPageKey.ToCharArray().LastOrDefault());
var roExt = Extensions.Where(x => x.AccPageExt.Equals(accPageExt)).SingleOrDefault();
return (rc.children.Where(x => x.roid.Substring(12, 4) == roExt.RoidExt).Any()) ? rc.children.Where(x => x.roid.Substring(12, 4) == roExt.RoidExt).Single() : rc.children.First();
return (rc.children.Where(x => x.roid.Substring(12, 4) == roExt.RoidExt && !string.IsNullOrEmpty(x.value)).Any()) ? rc.children.Where(x => x.roid.Substring(12, 4) == roExt.RoidExt).Single() : rc.children.First();
}
return rc; // If RoChild is not found, then a default (ROFSTLookup.rochild) object will be returned, but its ID will be -1
@@ -421,6 +421,7 @@ namespace VEPROMS.CSLA.Library
}
public string GetRoValue(string roid)
{
return GetRoChild(roid).value;
@@ -603,13 +604,11 @@ namespace VEPROMS.CSLA.Library
public void LoadChildren(ref ROFSTLookup.rochild child)
{
// If Children is null then it hasn't been loaded yet
//if (child.children == null || child.children.Length <= 0)
if (child.children == null)
{
if (!string.IsNullOrEmpty(child.appid))
child = GetRoChild12(child.roid, true);
else
//child.children = GetRoChildrenByRoid(child.roid, true);
child.children = GetRoChildrenByRoid(child.roid, false);
}
}
@@ -617,9 +616,7 @@ namespace VEPROMS.CSLA.Library
public void LoadChildren(ref ROFSTLookup.rodbi db)
{
// If Children is null then it hasn't been loaded yet
//if (child.children == null || child.children.Length <= 0)
if (db.children == null)
//db.children = GetRoChildrenByID(db.ID, db.dbiID, true);
db.children = GetRoChildrenByID(db.ID, db.dbiID, false);
}
@@ -1957,10 +1954,11 @@ namespace VEPROMS.CSLA.Library
if (!string.IsNullOrEmpty(roid))
{
rc.roid = FormatRoidKey(roid).Substring(0, 12);
DocVersionConfig dvc = (_myDocVersionInfo != null) ? _myDocVersionInfo.DocVersionConfig : null;
rc.roid = FormatRoidKey(roid).Substring(0, 12);
if (dvc != null) dvc.SelectedSlave = this.SelectedSlave;
switch (rc.roid)
{
case "FFFF00000001":