B2022-020 Insert RO was returning the applicability information instead of the resolved RO Return value when the return value contained a question mark. Also will add to error log if the return value fails to parse the parent/child information with the regular expression

This commit is contained in:
John Jenko 2022-01-25 17:26:11 +00:00
parent e9ade37861
commit 9022b2e026

View File

@ -14,7 +14,7 @@ namespace VEPROMS.CSLA.Library
public class ROFSTLookup public class ROFSTLookup
{ {
#region Log4Net #region Log4Net
private static readonly log4net.ILog log = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType); private static readonly log4net.ILog _MyLog = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
#endregion #endregion
#region Structs #region Structs
[Serializable] [Serializable]
@ -95,6 +95,12 @@ namespace VEPROMS.CSLA.Library
private DocVersionInfo _MyDocVersionInfo; private DocVersionInfo _MyDocVersionInfo;
private ItemInfo _MyItemInfo; // B2022-020 to pass information into error log if needed
public ItemInfo MyItemInfo
{
get { return _MyItemInfo; }
set { _MyItemInfo = value; }
}
public DocVersionInfo MyDocVersionInfo public DocVersionInfo MyDocVersionInfo
{ {
get { return _MyDocVersionInfo; } get { return _MyDocVersionInfo; }
@ -118,7 +124,7 @@ namespace VEPROMS.CSLA.Library
{ _OtherChild = value;} { _OtherChild = value;}
} }
public ROFSTLookup(ROFst rofst, DocVersionInfo dvi) public ROFSTLookup(ROFst rofst, DocVersionInfo dvi)
{ {
_ROFst = rofst; _ROFst = rofst;
_ROFstInfo = null; _ROFstInfo = null;
@ -320,9 +326,9 @@ namespace VEPROMS.CSLA.Library
// B2021-093 Don't look for child RO values if "roval" is null // B2021-093 Don't look for child RO values if "roval" is null
if (roval == null) return null; if (roval == null) return null;
//string childName = MyDocVersionInfo.DocVersionConfig.Unit_Name; //string childName = MyDocVersionInfo.DocVersionConfig.Unit_Name;
MatchCollection mm = Regex.Matches(roval, "(<APL [^<?]+) /APL>"); MatchCollection mm = Regex.Matches(roval, "(<APL [^<]+) /APL>"); // B2022-020 remove a un-needed question mark that was in the search criteria
if (mm.Count > 1) if (mm.Count == 0) // B2022-020 will now write in error log if there is a problem
Console.WriteLine("Matches {0}", mm.Count); _MyLog.WarnFormat("Parent/Child Values not parable for <APL ... /APL>\r\nItemId={0}\r\nROValue={1} ",MyDocVersionInfo.ItemID,roval);
StringBuilder sb = new StringBuilder(); StringBuilder sb = new StringBuilder();
int lastIndex = 0; int lastIndex = 0;
// Get selected child Idx // Get selected child Idx
@ -333,7 +339,6 @@ namespace VEPROMS.CSLA.Library
foreach (Match m in mm) foreach (Match m in mm)
{ {
sb.Append(roval.Substring(lastIndex, m.Index - lastIndex)); sb.Append(roval.Substring(lastIndex, m.Index - lastIndex));
Console.WriteLine("Index={0},Length={1},value={2}",m.Index,m.Length,m.Value);
string aplString = m.Value; string aplString = m.Value;
string chldValStr = string.Format("UnitIdx={0} Value=", selChldIdx); string chldValStr = string.Format("UnitIdx={0} Value=", selChldIdx);
int offsetIdx = aplString.IndexOf(chldValStr);//m.Value.IndexOf(chldValStr); int offsetIdx = aplString.IndexOf(chldValStr);//m.Value.IndexOf(chldValStr);