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:
parent
be814b9743
commit
7b177a88f6
@ -28,7 +28,33 @@ namespace DataLoader
|
||||
{
|
||||
public string _FmtAllPath;
|
||||
public string _GenmacAllPath;
|
||||
private FormatInfoList _AllFormats;
|
||||
|
||||
public FormatInfoList AllFormats
|
||||
{
|
||||
get
|
||||
{
|
||||
if (_AllFormats == null)
|
||||
_AllFormats = FormatInfoList.Get();
|
||||
return _AllFormats;
|
||||
}
|
||||
}
|
||||
private Dictionary<string, int> _LookupFormats;
|
||||
public Dictionary<string, int> LookupFormats
|
||||
{
|
||||
get
|
||||
{
|
||||
if (_LookupFormats == null)
|
||||
{
|
||||
_LookupFormats = new Dictionary<string, int>();
|
||||
foreach (FormatInfo myFormat in AllFormats)
|
||||
{
|
||||
_LookupFormats.Add(myFormat.Name, myFormat.FormatID);
|
||||
}
|
||||
}
|
||||
return _LookupFormats;
|
||||
}
|
||||
}
|
||||
private Format AddFormatToDB(Format parent, string format, bool issub, DateTime Dts, string Userid)
|
||||
{
|
||||
string fmtdata = null;
|
||||
@ -95,25 +121,22 @@ namespace DataLoader
|
||||
string fname = issub ? format.Replace("_", "") : format;
|
||||
Format rec = null;
|
||||
try
|
||||
{
|
||||
if (!LookupFormats.ContainsKey(fname))
|
||||
{
|
||||
rec = Format.MakeFormat(parent, fname, nmattr, fmtdata, genmacdata, Dts, Userid);
|
||||
}
|
||||
else
|
||||
{
|
||||
rec = Format.Get(LookupFormats[fname]);
|
||||
rec.Data = fmtdata;
|
||||
rec.GenMac = genmacdata;
|
||||
rec = rec.Save();
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
FormatInfoList lst = FormatInfoList.Get();
|
||||
foreach (FormatInfo fi in lst)
|
||||
{
|
||||
// if this is the format we're updating, update it and break.
|
||||
if (fi.Name == fname)
|
||||
{
|
||||
Format f = Format.Get(fi.FormatID);
|
||||
f.Data = fmtdata;
|
||||
f.GenMac = genmacdata;
|
||||
f.Save();
|
||||
return f;
|
||||
}
|
||||
}
|
||||
//frmMain.AddError(ex, "AddFormatToDB-make format('{0}','{1}')", parent.Name, path);
|
||||
frmMain.AddError(ex, "AddFormatToDB-make format('{0}','{1}')", parent.Name, path);
|
||||
}
|
||||
return rec;
|
||||
}
|
||||
|
@ -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);
|
||||
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)
|
||||
{
|
||||
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, g.Index) + newvalue + Text.Substring(g.Index + g.Length);
|
||||
{
|
||||
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)
|
||||
@ -64,14 +73,19 @@ namespace VEPROMS.CSLA.Library
|
||||
else
|
||||
{
|
||||
// if it's an ro within a table, need to process into an flex grid to save the grid data:
|
||||
|
||||
string findLinkXml = @"<START\].*?\[END>";
|
||||
string lookForXml = string.Format(@"<START\](\\[^v \\]+)*\\v0(\\[^v \\]+)* (.*?)(\\[^v '?\\]+)*\\v(\\[^v \\]+)* #Link:ReferencedObject:{0} .*?\[END>", rousg.ROUsageID);
|
||||
MatchCollection msg = Regex.Matches(MyGrid.Data, findLinkXml);
|
||||
foreach (Match mmg in msg)
|
||||
{
|
||||
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, g.Index) + newvalue + MyGrid.Data.Substring(g.Index + g.Length);
|
||||
MyGrid.Data = MyGrid.Data.Substring(0, offset + g.Index) + newvalue + MyGrid.Data.Substring(offset + g.Index + g.Length);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -257,7 +257,7 @@ namespace Volian.Controls.Library
|
||||
// (\\[^v' \\]+)* --> look for rtf commands but exclude \' before the \v
|
||||
// \\v(\\[^v \\]+)* --> look for rtf commands after the \v
|
||||
// if it turns out that if ro's have any embedded unicode characters this needs expanded, such as /u8209? (hard hyphen)
|
||||
string lookFor = string.Format(@"<START\](\\[^v \\]+)*\\v0(\\[^v \\]+)* (.*?)(\\[^v' \\]+)*\\v(\\[^v \\]+)* #Link:(ReferencedObject|Transition[^:]*?):.*?\[END>");
|
||||
string lookFor = string.Format(@"<START\](\\[^v \\]+)*\\v0(\\[^v \\]+)* (.*?)(\\[^v'? \\]+)*\\v(\\[^v \\]+)* #Link:(ReferencedObject|Transition[^:]*?):.*?\[END>");
|
||||
MatchCollection matches = Regex.Matches(text, lookFor);
|
||||
for (int i = matches.Count - 1; i >= 0; i--)
|
||||
{
|
||||
|
Loading…
x
Reference in New Issue
Block a user