Updated DocVersionInfo property name

Added parameter to ROFSTLookup constructor to support passing DocVersionInfo object
Changed FixUnitROs method to use new property name
Changed GetRoValue method to use new property name
This commit is contained in:
Rich 2014-02-07 17:36:07 +00:00
parent 8bc76fae5f
commit 7ab6604534

View File

@ -92,32 +92,32 @@ namespace VEPROMS.CSLA.Library
private ROFstInfo _ROFstInfo; private ROFstInfo _ROFstInfo;
private int _SelectedSlave; private int _SelectedSlave;
private DocVersionInfo _DocVersionInfo; private DocVersionInfo _MyDocVersionInfo;
public DocVersionInfo DocVersionInfo public DocVersionInfo MyDocVersionInfo
{ {
get { return _DocVersionInfo; } get { return _MyDocVersionInfo; }
set set
{ {
_DocVersionInfo = value; _MyDocVersionInfo = value;
if (_DocVersionInfo.DocVersionConfig.SelectedSlave != _SelectedSlave) if (_MyDocVersionInfo.DocVersionConfig.SelectedSlave != _SelectedSlave)
{ {
_SelectedSlave = _DocVersionInfo.DocVersionConfig.SelectedSlave; _SelectedSlave = _MyDocVersionInfo.DocVersionConfig.SelectedSlave;
Reset(); Reset();
} }
} }
} }
public ROFSTLookup(ROFst rofst) public ROFSTLookup(ROFst rofst, DocVersionInfo dvi)
{ {
_ROFst = rofst; _ROFst = rofst;
_ROFstInfo = null; _ROFstInfo = null;
using (ROFstInfo rfi = ROFstInfo.GetJustROFst(_ROFst.ROFstID)) using (ROFstInfo rfi = ROFstInfo.GetJustROFst(_ROFst.ROFstID))
{ {
_DocVersionInfo = rfi.docVer;//==null?null: DocVersionInfo.Get(rfi.docVer.VersionID); _MyDocVersionInfo = dvi;//==null?null: DocVersionInfo.Get(rfi.docVer.VersionID);
} }
ParseIntoDictionary(rofst.ROLookup); ParseIntoDictionary(rofst.ROLookup);
} }
public ROFSTLookup(ROFstInfo rofstinfo) public ROFSTLookup(ROFstInfo rofstinfo, DocVersionInfo dvi)
{ {
_ROFstInfo = rofstinfo; _ROFstInfo = rofstinfo;
_ROFst = null; _ROFst = null;
@ -125,14 +125,14 @@ namespace VEPROMS.CSLA.Library
// to a docversion. One example of this is when updating ro.fst and comparing the original // to a docversion. One example of this is when updating ro.fst and comparing the original
// with the new to find differences. The docversioninfo is only used to get unit/master // with the new to find differences. The docversioninfo is only used to get unit/master
// slave info, thus is not needed to compare the raw values. // slave info, thus is not needed to compare the raw values.
_DocVersionInfo = _ROFstInfo.docVer;//==null?null: DocVersionInfo.Get(_ROFstInfo.docVer.VersionID); _MyDocVersionInfo = dvi;//==null?null: DocVersionInfo.Get(_ROFstInfo.docVer.VersionID);
ParseIntoDictionary(rofstinfo.ROLookup); ParseIntoDictionary(rofstinfo.ROLookup);
} }
public ROFSTLookup(string filePath) public ROFSTLookup(string filePath)
{ {
_ROFstInfo = null; _ROFstInfo = null;
_ROFst = null; _ROFst = null;
_DocVersionInfo = null; _MyDocVersionInfo = null;
FileInfo rofstFile = new FileInfo(filePath); FileInfo rofstFile = new FileInfo(filePath);
FileStream fs = rofstFile.Open(FileMode.Open, FileAccess.Read, FileShare.ReadWrite); FileStream fs = rofstFile.Open(FileMode.Open, FileAccess.Read, FileShare.ReadWrite);
byte[] buf = new byte[rofstFile.Length]; byte[] buf = new byte[rofstFile.Length];
@ -258,14 +258,14 @@ namespace VEPROMS.CSLA.Library
{ {
if (val.StartsWith("<U-")) if (val.StartsWith("<U-"))
{ {
if (val.ToUpper() == "<U-TEXT>") val = _ROFstInfo.docVer.DocVersionConfig.Unit_Text; if (val.ToUpper() == "<U-TEXT>") val = MyDocVersionInfo.DocVersionConfig.Unit_Text;
else if (val.ToUpper() == "<U-NUMBER>") val = _ROFstInfo.docVer.DocVersionConfig.Unit_Number; else if (val.ToUpper() == "<U-NUMBER>") val = MyDocVersionInfo.DocVersionConfig.Unit_Number;
else if (val.ToUpper() == "<U-NAME>") val = _ROFstInfo.docVer.DocVersionConfig.Unit_Name; else if (val.ToUpper() == "<U-NAME>") val = MyDocVersionInfo.DocVersionConfig.Unit_Name;
else if (val.ToUpper() == "<U-ID>") val = _ROFstInfo.docVer.DocVersionConfig.Unit_ID; else if (val.ToUpper() == "<U-ID>") val = MyDocVersionInfo.DocVersionConfig.Unit_ID;
else if (val.ToUpper() == "<U-OTHER TEXT>") val = _ROFstInfo.docVer.DocVersionConfig.Other_Unit_Text; else if (val.ToUpper() == "<U-OTHER TEXT>") val = MyDocVersionInfo.DocVersionConfig.Other_Unit_Text;
else if (val.ToUpper() == "<U-OTHER NUMBER>") val = _ROFstInfo.docVer.DocVersionConfig.Other_Unit_Number; else if (val.ToUpper() == "<U-OTHER NUMBER>") val = MyDocVersionInfo.DocVersionConfig.Other_Unit_Number;
else if (val.ToUpper() == "<U-OTHER NAME>") val = _ROFstInfo.docVer.DocVersionConfig.Other_Unit_Name; else if (val.ToUpper() == "<U-OTHER NAME>") val = MyDocVersionInfo.DocVersionConfig.Other_Unit_Name;
else if (val.ToUpper() == "<U-OTHER ID>") val = _ROFstInfo.docVer.DocVersionConfig.Other_Unit_ID; else if (val.ToUpper() == "<U-OTHER ID>") val = MyDocVersionInfo.DocVersionConfig.Other_Unit_ID;
} }
return val; return val;
} }
@ -299,14 +299,14 @@ namespace VEPROMS.CSLA.Library
//if (ROID == "FFFF00000007") return _ROFstInfo.ROFstAssociations[0].MyDocVersion.DocVersionConfig.Unit_Name; //if (ROID == "FFFF00000007") return _ROFstInfo.ROFstAssociations[0].MyDocVersion.DocVersionConfig.Unit_Name;
//if (ROID == "FFFF00000008") return _ROFstInfo.ROFstAssociations[0].MyDocVersion.DocVersionConfig.Other_Unit_Name; //if (ROID == "FFFF00000008") return _ROFstInfo.ROFstAssociations[0].MyDocVersion.DocVersionConfig.Other_Unit_Name;
//new stuff //new stuff
if (ROID == "FFFF00000001") return _ROFstInfo.docVer.DocVersionConfig.Unit_Number; if (ROID == "FFFF00000001") return MyDocVersionInfo.DocVersionConfig.Unit_Number;// _ROFstInfo.docVer.DocVersionConfig.Unit_Number;
if (ROID == "FFFF00000002") return _ROFstInfo.docVer.DocVersionConfig.Other_Unit_Number; if (ROID == "FFFF00000002") return MyDocVersionInfo.DocVersionConfig.Other_Unit_Number;// _ROFstInfo.docVer.DocVersionConfig.Other_Unit_Number;
if (ROID == "FFFF00000003") return _ROFstInfo.docVer.DocVersionConfig.Unit_Text; if (ROID == "FFFF00000003") return MyDocVersionInfo.DocVersionConfig.Unit_Text;// _ROFstInfo.docVer.DocVersionConfig.Unit_Text;
if (ROID == "FFFF00000004") return _ROFstInfo.docVer.DocVersionConfig.Other_Unit_Text; if (ROID == "FFFF00000004") return MyDocVersionInfo.DocVersionConfig.Other_Unit_Text;// _ROFstInfo.docVer.DocVersionConfig.Other_Unit_Text;
if (ROID == "FFFF00000005") return _ROFstInfo.docVer.DocVersionConfig.Unit_ID; if (ROID == "FFFF00000005") return MyDocVersionInfo.DocVersionConfig.Unit_ID;// _ROFstInfo.docVer.DocVersionConfig.Unit_ID;
if (ROID == "FFFF00000006") return _ROFstInfo.docVer.DocVersionConfig.Other_Unit_ID; if (ROID == "FFFF00000006") return MyDocVersionInfo.DocVersionConfig.Other_Unit_ID;// _ROFstInfo.docVer.DocVersionConfig.Other_Unit_ID;
if (ROID == "FFFF00000007") return _ROFstInfo.docVer.DocVersionConfig.Unit_Name; if (ROID == "FFFF00000007") return MyDocVersionInfo.DocVersionConfig.Unit_Name;// _ROFstInfo.docVer.DocVersionConfig.Unit_Name;
if (ROID == "FFFF00000008") return _ROFstInfo.docVer.DocVersionConfig.Other_Unit_Name; if (ROID == "FFFF00000008") return MyDocVersionInfo.DocVersionConfig.Other_Unit_Name;// _ROFstInfo.docVer.DocVersionConfig.Other_Unit_Name;
//end new stuff //end new stuff
if (ROID.StartsWith("FFFF")) return "?"; // string.Format("Invalid Unit RO '{0}'", ROID); if (ROID.StartsWith("FFFF")) return "?"; // string.Format("Invalid Unit RO '{0}'", ROID);
return "?"; // string.Format("Invalid RO '{0}'", ROID); return "?"; // string.Format("Invalid RO '{0}'", ROID);
@ -768,7 +768,7 @@ namespace VEPROMS.CSLA.Library
lstRoValues = new List<string>(); lstRoValues = new List<string>();
multiRoValues = new List<string>(); multiRoValues = new List<string>();
DictROVar = new Dictionary<string, string>(); // set up a dictionary of RO defined Variables DictROVar = new Dictionary<string, string>(); // set up a dictionary of RO defined Variables
string tmp = ProcessRO(_DocVersionInfo==null?roval:_DocVersionInfo.ProcessDocVersionSpecificInfo(roval), false); string tmp = ProcessRO(_MyDocVersionInfo==null?roval:_MyDocVersionInfo.ProcessDocVersionSpecificInfo(roval), false);
if (tmp != null && lstRoValues.Count == 0) // was not a multiple return value if (tmp != null && lstRoValues.Count == 0) // was not a multiple return value
lstRoValues.Add(tmp); lstRoValues.Add(tmp);
return lstRoValues; return lstRoValues;
@ -845,7 +845,7 @@ namespace VEPROMS.CSLA.Library
private string ProcessConditional(string cnd, string opt, int lencnd, int lenopt, bool multiRtnVal) private string ProcessConditional(string cnd, string opt, int lencnd, int lenopt, bool multiRtnVal)
{ {
// equaluate condition // equaluate condition
string stat = (_DocVersionInfo != null) ? this._DocVersionInfo.Evaluate(cnd, lencnd) : ""; string stat = (_MyDocVersionInfo != null) ? this._MyDocVersionInfo.Evaluate(cnd, lencnd) : "";
int ls = stat.Length;//strlen(stat); int ls = stat.Length;//strlen(stat);
if (ls == 0) if (ls == 0)
return ""; // if evaluation not defined then return an empty string - no matches can be made return ""; // if evaluation not defined then return an empty string - no matches can be made