This commit is contained in:
parent
7704e926df
commit
5802cfdd10
@ -41,8 +41,9 @@ namespace VEPROMS.CSLA.Library
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
public void FixContentText(RoUsageInfo rousg, string newvalue)
|
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);
|
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);
|
Match m = Regex.Match(Text, lookFor,RegexOptions.Singleline);
|
||||||
if (m != null && m.Groups.Count > 1)
|
if (m != null && m.Groups.Count > 1)
|
||||||
@ -54,13 +55,24 @@ namespace VEPROMS.CSLA.Library
|
|||||||
// see if there is a grid to update too.
|
// see if there is a grid to update too.
|
||||||
if (rousg.MyContent.MyGrid != null)
|
if (rousg.MyContent.MyGrid != null)
|
||||||
{
|
{
|
||||||
string lookForXml = string.Format(@"<START\](\\[^v \\]+)*\\v0(\\[^v \\]+)* (.*?)(\\[^v \\]+)*\\v(\\[^v \\]+)* #Link:ReferencedObject:{0} .*?\[END>", rousg.ROUsageID);
|
if (roch.type == (int)E_ROValueType.Table) // if change in rotable data...
|
||||||
Match mg = Regex.Match(MyGrid.Data, lookForXml);
|
|
||||||
if (mg != null && mg.Groups.Count > 1)
|
|
||||||
{
|
{
|
||||||
System.Text.RegularExpressions.Group g = mg.Groups[3];
|
List<string> retlist = origROFstInfo.OnROTableUpdate(this, new ROFstInfoROTableUpdateEventArgs(newvalue, MyGrid.Data));
|
||||||
if (g.ToString() != newvalue)
|
if (Text != retlist[0])Text = retlist[0];
|
||||||
MyGrid.Data = MyGrid.Data.Substring(0, g.Index) + newvalue + MyGrid.Data.Substring(g.Index + g.Length);
|
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 lookForXml = string.Format(@"<START\](\\[^v \\]+)*\\v0(\\[^v \\]+)* (.*?)(\\[^v \\]+)*\\v(\\[^v \\]+)* #Link:ReferencedObject:{0} .*?\[END>", rousg.ROUsageID);
|
||||||
|
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);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -40,6 +40,7 @@ namespace VEPROMS.CSLA.Library
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
public delegate List<string> ROFstInfoROTableUpdateEvent(object sender, ROFstInfoROTableUpdateEventArgs args);
|
||||||
public partial class ROFstInfo
|
public partial class ROFstInfo
|
||||||
{
|
{
|
||||||
#region Log4Net
|
#region Log4Net
|
||||||
@ -225,8 +226,8 @@ namespace VEPROMS.CSLA.Library
|
|||||||
|
|
||||||
foreach (string chg in chgList)
|
foreach (string chg in chgList)
|
||||||
{
|
{
|
||||||
string newvalue = newLU.GetRoValue(chg);
|
ROFSTLookup.rochild roch = newLU.GetRoChild(chg);
|
||||||
string desc = string.Format("Change in RO Values: Old value = {0}, New value = {1}", origLU.GetRoValue(chg), newvalue);
|
string desc = string.Format("Change in RO Values: Old value = {0}, New value = {1}", origLU.GetRoValue(chg), roch.value);
|
||||||
// roid's are stored in database as 16 characters long in the rousages table. They may be stored
|
// roid's are stored in database as 16 characters long in the rousages table. They may be stored
|
||||||
// as 12 characters in the ro.fst.
|
// as 12 characters in the ro.fst.
|
||||||
string padroid = chg.Length <= 12 ? chg + "0000" : chg;
|
string padroid = chg.Length <= 12 ? chg + "0000" : chg;
|
||||||
@ -236,7 +237,7 @@ namespace VEPROMS.CSLA.Library
|
|||||||
{
|
{
|
||||||
using (Content content = Content.Get(roUsg.MyContent.ContentID))
|
using (Content content = Content.Get(roUsg.MyContent.ContentID))
|
||||||
{
|
{
|
||||||
content.FixContentText(roUsg, newvalue);
|
content.FixContentText(roUsg, roch, origROFstInfo);
|
||||||
if (content.IsDirty)
|
if (content.IsDirty)
|
||||||
content.Save();
|
content.Save();
|
||||||
}
|
}
|
||||||
@ -356,6 +357,32 @@ namespace VEPROMS.CSLA.Library
|
|||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
public event ROFstInfoROTableUpdateEvent ROTableUpdate;
|
||||||
|
public List<string> OnROTableUpdate(object sender, ROFstInfoROTableUpdateEventArgs args)
|
||||||
|
{
|
||||||
|
if (ROTableUpdate != null) return ROTableUpdate(sender, args);
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
public class ROFstInfoROTableUpdateEventArgs
|
||||||
|
{
|
||||||
|
private string _ROText;
|
||||||
|
public string ROText
|
||||||
|
{
|
||||||
|
get { return _ROText; }
|
||||||
|
set { _ROText = value; }
|
||||||
|
}
|
||||||
|
private string _OldGridXml;
|
||||||
|
public string OldGridXml
|
||||||
|
{
|
||||||
|
get { return _OldGridXml; }
|
||||||
|
set { _OldGridXml = value; }
|
||||||
|
}
|
||||||
|
public ROFstInfoROTableUpdateEventArgs(string rotext, string oldgridxml)
|
||||||
|
{
|
||||||
|
_ROText = rotext;
|
||||||
|
_OldGridXml = oldgridxml;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
public partial class ROFstInfoList
|
public partial class ROFstInfoList
|
||||||
{
|
{
|
||||||
|
Loading…
x
Reference in New Issue
Block a user