Multiple return values were check uppercase ROID against a mixed case ROID and returning the wrong selection.

If the return value from rolookup is a Unit RO, convert it to it's value.
This commit is contained in:
Rich 2013-11-25 12:36:19 +00:00
parent 3dcf918262
commit 36bf0cda84

View File

@ -252,6 +252,21 @@ namespace VEPROMS.CSLA.Library
s2 = s2.Replace("-", @"\u8209?");
return s2;
}
private string FixUnitROs(string val)
{
if (val.StartsWith("<U-"))
{
if (val.ToUpper() == "<U-TEXT>") val = _ROFstInfo.docVer.DocVersionConfig.Unit_Text;
else if (val.ToUpper() == "<U-NUMBER>") val = _ROFstInfo.docVer.DocVersionConfig.Unit_Number;
else if (val.ToUpper() == "<U-NAME>") val = _ROFstInfo.docVer.DocVersionConfig.Unit_Name;
else if (val.ToUpper() == "<U-ID>") val = _ROFstInfo.docVer.DocVersionConfig.Unit_ID;
else if (val.ToUpper() == "<U-OTHER TEXT>") val = _ROFstInfo.docVer.DocVersionConfig.Other_Unit_Text;
else if (val.ToUpper() == "<U-OTHER NUMBER>") val = _ROFstInfo.docVer.DocVersionConfig.Other_Unit_Number;
else if (val.ToUpper() == "<U-OTHER NAME>") val = _ROFstInfo.docVer.DocVersionConfig.Other_Unit_Name;
else if (val.ToUpper() == "<U-OTHER ID>") val = _ROFstInfo.docVer.DocVersionConfig.Other_Unit_ID;
}
return val;
}
// this only gets rochild values. Later we may want another
// dictionary to get groups.
public string GetRoValue(string ROID16)
@ -263,14 +278,14 @@ namespace VEPROMS.CSLA.Library
{
rochild rochld = (rochild)dicRos[ROID.ToUpper()];
if (rochld.value != null && rochld.value != string.Empty)
return rochld.value;
return FixUnitROs( rochld.value);
if (rochld.children != null)
{
foreach (rochild child in rochld.children)
if (child.roid.ToUpper() == ROID16 || (child.roid.EndsWith("0041") && ROID16.EndsWith("0000")))
return child.value;
if (child.roid.ToUpper() == ROID16.ToUpper() || (child.roid.EndsWith("0041") && ROID16.EndsWith("0000")))
return FixUnitROs(child.value);
// if there isn't a specific match for multi-return values, default to the first child.
return rochld.children[0].value;
return FixUnitROs(rochld.children[0].value);
}
}
//if (ROID == "FFFF00000001") return _ROFstInfo.ROFstAssociations[0].MyDocVersion.DocVersionConfig.Unit_Number;