Formats.cs - Update existing Formats

ContentExt.cs - Fixed logic to find RO value in procedure text
DisplayText.cs - Fixed logic to find Ro value in procedure text
This commit is contained in:
Rich
2011-07-19 16:40:50 +00:00
parent be814b9743
commit 7b177a88f6
3 changed files with 116 additions and 79 deletions

View File

@@ -44,13 +44,22 @@ namespace VEPROMS.CSLA.Library
public void FixContentText(RoUsageInfo rousg, ROFSTLookup.rochild roch, ROFstInfo origROFstInfo) // string newvalue)
{
string newvalue = roch.value;
string lookFor = string.Format(@"<START\](\\[^v \\]+)*\\v0(\\[^v \\]+)* ([^\[]*?)(\\[^v '?\\]+)*\\v(\\[^v \\]+)* #Link:ReferencedObject:{0} .*?\[END>", rousg.ROUsageID);
Match m = Regex.Match(Text, lookFor,RegexOptions.Singleline);
if (m != null && m.Groups.Count > 1)
string findLink = @"<START\].*?\[END>";
MatchCollection ms = Regex.Matches(Text, findLink);
string lookFor = string.Format(@"<START\](\\[^v \\]+)*\\v0(\\[^v \\]+)* (.*?)(\\[^v '?\\]+)*\\v(\\[^v \\]+)* #Link:ReferencedObject:{0} .*?\[END>", rousg.ROUsageID);
foreach (Match mm in ms)
{
System.Text.RegularExpressions.Group g = m.Groups[3];
if (g.ToString() != newvalue)
Text = Text.Substring(0, g.Index) + newvalue + Text.Substring(g.Index + g.Length);
int offset = mm.Index;
Match m = Regex.Match(mm.Value, lookFor, RegexOptions.Singleline);
if (m != null && m.Groups.Count > 1)
{
System.Text.RegularExpressions.Group g = m.Groups[3];
if (g.ToString() != newvalue)
{
Text = Text.Substring(0, offset + g.Index) + newvalue + Text.Substring(offset + g.Index + g.Length);
break; // Text has been processed
}
}
}
// see if there is a grid to update too.
if (rousg.MyContent.MyGrid != null)
@@ -58,20 +67,25 @@ namespace VEPROMS.CSLA.Library
if (roch.type == (int)E_ROValueType.Table) // if change in rotable data...
{
List<string> retlist = origROFstInfo.OnROTableUpdate(this, new ROFstInfoROTableUpdateEventArgs(newvalue, MyGrid.Data));
if (Text != retlist[0])Text = retlist[0];
if (Text != retlist[0]) Text = retlist[0];
if (MyGrid.Data != retlist[1]) MyGrid.Data = retlist[1];
}
else
{
// if it's an ro within a table, need to process into an flex grid to save the grid data:
string findLinkXml = @"&lt;START\].*?\[END&gt;";
string lookForXml = string.Format(@"&lt;START\](\\[^v \\]+)*\\v0(\\[^v \\]+)* (.*?)(\\[^v '?\\]+)*\\v(\\[^v \\]+)* #Link:ReferencedObject:{0} .*?\[END&gt;", rousg.ROUsageID);
Match mg = Regex.Match(MyGrid.Data, lookForXml);
if (mg != null && mg.Groups.Count > 1)
MatchCollection msg = Regex.Matches(MyGrid.Data, findLinkXml);
foreach (Match mmg in msg)
{
System.Text.RegularExpressions.Group g = mg.Groups[3];
if (g.ToString() != newvalue)
MyGrid.Data = MyGrid.Data.Substring(0, g.Index) + newvalue + MyGrid.Data.Substring(g.Index + g.Length);
int offset = mmg.Index;
Match mg = Regex.Match(MyGrid.Data, lookForXml);
if (mg != null && mg.Groups.Count > 1)
{
System.Text.RegularExpressions.Group g = mg.Groups[3];
if (g.ToString() != newvalue)
MyGrid.Data = MyGrid.Data.Substring(0, offset + g.Index) + newvalue + MyGrid.Data.Substring(offset + g.Index + g.Length);
}
}
}
}