diff --git a/PROMS/VEPROMS.CSLA.Library/Extension/ContentExt.cs b/PROMS/VEPROMS.CSLA.Library/Extension/ContentExt.cs index 59946a36..85836b6e 100644 --- a/PROMS/VEPROMS.CSLA.Library/Extension/ContentExt.cs +++ b/PROMS/VEPROMS.CSLA.Library/Extension/ContentExt.cs @@ -131,7 +131,7 @@ namespace VEPROMS.CSLA.Library _Text = Text.Substring(0, g.Index) + transText + Text.Substring(g.Index + g.Length); } // see if there is a grid to update too. - if (tran.MyContent.MyGrid != null) + if (MyGrid != null) { string lookForXml = string.Format(@"<START\](\\[^v \\]+)*\\v0(\\[^v \\]+)* ([^#]*?)(\\[^v'? \\]+)*\\v(\\[^v \\]+)* #Link:Transition[^:]*?:{0} {1}( [0-9]*){{1,2}}\[END>", tran.TranType, tran.TransitionID); Match mg = Regex.Match(MyGrid.Data, lookForXml); @@ -164,7 +164,7 @@ namespace VEPROMS.CSLA.Library } } // see if there is a grid to update too. - if (rousg.MyContent.MyGrid != null) + if (MyGrid != null) { if (rotype == (int)E_ROValueType.Table) // if change in rotable data... { @@ -180,18 +180,30 @@ namespace VEPROMS.CSLA.Library MatchCollection msg = Regex.Matches(MyGrid.Data, findLinkXml); foreach (Match mmg in msg) { - int offset = 0; // crashed in substring line below if using mmg.Index; Set to 0 and it worked - KBR. - Match mg = Regex.Match(MyGrid.Data, lookForXml); + //int offset = 0; // crashed in substring line below if using mmg.Index; Set to 0 and it worked - KBR. + Match mg = Regex.Match(mmg.Value, 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); + if (g.ToString() != newvalue) + { + string prefix1 = MyGrid.Data.Substring(0,mmg.Index); + string prefix2 = mmg.Value.Substring(0,g.Index); + string suffix1 = MyGrid.Data.Substring(mmg.Index + mmg.Length); + string suffix2 = mmg.Value.Substring(g.Index + g.Length); + MyGrid.SetData(prefix1 + prefix2 + newvalue + suffix2 + suffix1); + break; + } } } } } } + public void LoadNonCachedGrid() + { + _MyGrid = GridInfo.GetNonCached(ContentID); + Console.WriteLine("LoadNonCachedGrid {0},{1},{2}",ContentID,_MyGrid==null,_MyContentInfoUnique); + } public PartInfoList LocalContentParts { get { return _ContentParts; } diff --git a/PROMS/VEPROMS.CSLA.Library/Extension/GridExt.cs b/PROMS/VEPROMS.CSLA.Library/Extension/GridExt.cs index 79ee223f..7159e2eb 100644 --- a/PROMS/VEPROMS.CSLA.Library/Extension/GridExt.cs +++ b/PROMS/VEPROMS.CSLA.Library/Extension/GridExt.cs @@ -1,6 +1,7 @@ using System; using System.Collections.Generic; using System.Text; +using Csla; namespace VEPROMS.CSLA.Library { @@ -10,5 +11,29 @@ namespace VEPROMS.CSLA.Library { RefreshFields(myGrid); } + public void SetData(string myData) + { + _Data = myData; + RemoveFromCache(this); + } + public static GridInfo GetNonCached(int contentID) + { + //if (!CanGetObject()) + // throw new System.Security.SecurityException("User not authorized to view a Grid"); + try + { + GridInfo tmp = DataPortal.Fetch(new PKCriteria(contentID)); + if (tmp.ErrorMessage == "No Record Found") + { + tmp.Dispose(); // Clean-up GridInfo + tmp = null; + } + return tmp; + } + catch (Exception ex) + { + throw new DbCslaException("Error on GridInfo.Get", ex); + } + } } } diff --git a/PROMS/VEPROMS.CSLA.Library/Extension/ItemExt.cs b/PROMS/VEPROMS.CSLA.Library/Extension/ItemExt.cs index a1317119..4c34a512 100644 --- a/PROMS/VEPROMS.CSLA.Library/Extension/ItemExt.cs +++ b/PROMS/VEPROMS.CSLA.Library/Extension/ItemExt.cs @@ -427,6 +427,8 @@ namespace VEPROMS.CSLA.Library itemInfo.ActiveSection = sectionInfo; itemInfo.MyProcedure = procInfo; itemInfo.MyDocVersion = docVersionInfo; + if (itemInfo.MyContent.ContentGridCount > 0) + itemInfo.MyContent.LoadNonCachedGrid(); if (itemInfo.MyContent.ContentPartCount > 0) foreach (PartInfo pi in itemInfo.MyContent.ContentParts) foreach (ItemInfo ii in pi.MyItems) @@ -460,6 +462,8 @@ namespace VEPROMS.CSLA.Library ROFSTLookup lookup = rofstinfo.ROFSTLookup; lookup.DocVersionInfo = docVersionInfo; //DateTime dts = DateTime.Now; + if (itemInfo.MyContent.ContentGridCount > 0) + itemInfo.MyContent.LoadNonCachedGrid(); if (itemInfo.MyContent.ContentRoUsageCount > 0) { foreach (RoUsageInfo rousage in itemInfo.MyContent.ContentRoUsages)