Added code to handle Table ROs.

Used generic (static) VlnFlexGrid.ROTableUpdate to determine if the table contents are updated.
Added Error Handling around the code that shuts down PROMs
Added function to ROFSTLookup to retrieve the Accessory Page ID.
Corrected code to handle value changes for Table ROs
Created generic (static) VlnFlexGrid.ROTableUpdate to determine if the table contents are updated.
This commit is contained in:
Rich 2014-03-19 15:30:26 +00:00
parent cf79d6a313
commit 0376212e09
9 changed files with 200 additions and 109 deletions

View File

@ -83,9 +83,9 @@ namespace DataLoader
ContentInfo myContentInfo = ContentInfo.Get(cid); ContentInfo myContentInfo = ContentInfo.Get(cid);
DocVersionInfo dvi = myContentInfo.ContentItems[0].MyProcedure.MyDocVersion; DocVersionInfo dvi = myContentInfo.ContentItems[0].MyProcedure.MyDocVersion;
int versionId = dvi.VersionID; int versionId = dvi.VersionID;
ROFstInfo myRoFst = dvi.DocVersionAssociations[0].MyROFst;
if (!roFstLookups.ContainsKey(versionId)) if (!roFstLookups.ContainsKey(versionId))
{ {
ROFstInfo myRoFst = dvi.DocVersionAssociations[0].MyROFst;
roFstLookups.Add(versionId, myRoFst.GetROFSTLookup(dvi)); roFstLookups.Add(versionId, myRoFst.GetROFSTLookup(dvi));
} }
ROFSTLookup myLookup = roFstLookups[versionId]; ROFSTLookup myLookup = roFstLookups[versionId];
@ -94,26 +94,28 @@ namespace DataLoader
ItemInfo ii = myContentInfo.ContentItems[0]; ItemInfo ii = myContentInfo.ContentItems[0];
foreach (RoUsageInfo ru in myContentInfo.ContentRoUsages) foreach (RoUsageInfo ru in myContentInfo.ContentRoUsages)
{ {
//ROFSTLookup.rochild rocc = myLookup.GetRoChild12(ru.ROID); ROFSTLookup.rochild rocc = myLookup.GetRoChild12(ru.ROID);
//if (rocc.value == null) if (rocc.value == null)
ROFSTLookup.rochild rocc = myLookup.GetRoChild(ru.ROID); rocc = myLookup.GetRoChild(ru.ROID);
//string myValue = rocc.value;
int myType = rocc.type; int myType = rocc.type;
string myValue = myLookup.GetTranslatedRoValue(ru.ROID, ii.ActiveFormat.PlantFormat.FormatData.SectData.ConvertCaretToDelta); string myValue = myLookup.GetTranslatedRoValue(ru.ROID, ii.ActiveFormat.PlantFormat.FormatData.SectData.ConvertCaretToDelta);
myValue = myValue.Replace(@"\up2 \u8209?", @"\up2\u8209?");// Remove space between superscript command and non-breaking hyphen myValue = myValue.Replace(@"\up2 \u8209?", @"\up2\u8209?");// Remove space between superscript command and non-breaking hyphen
if (myType == 8 && myValue.Contains("\n"))
myValue = myValue.Replace("\n", "");// Remove newlines in Figure data myValue = myValue.Replace("\n", "");// Remove newlines in Figure data
string oldval = ctmp.FixContentText(ru, myValue, myType, null); myRoFst.ROTableUpdate += new ROFstInfoROTableUpdateEvent(myRoFst_ROTableUpdate);
string oldval = ctmp.FixContentText(ru, myValue, myType, myRoFst);
myRoFst.ROTableUpdate -= new ROFstInfoROTableUpdateEvent(myRoFst_ROTableUpdate);
if (ctmp.IsDirty) if (ctmp.IsDirty)
{ {
changeCount++; changeCount++;
//Console.WriteLine("'{0}', '{1}', '{2}', '{3}'", replace(oldval, @"\u8209?", "-"), replace(myValue, @"\u8209?", "-"), ru.ROID, rocc.appid); //Console.WriteLine("'{0}', '{1}', '{2}', '{3}'", replace(oldval, @"\u8209?", "-"), replace(myValue, @"\u8209?", "-"), ru.ROID, rocc.appid);
frmMain.AddInfo("'{0}','{1}','R{2}'", (oldval??"").Replace(@"\u8209?", "-"), myValue.Replace(@"\u8209?", "-"), ru.ROID); frmMain.AddInfo("'{0}','{1}','{2}','{3}','R{4}','{5}'", ii.MyDocVersion.MyFolder.Name, ii.ShortPath,
(oldval ?? "").Replace(@"\u8209?", "-"), myValue.Replace(@"\u8209?", "-"), ru.ROID, myLookup.GetAccPageID(ru.ROID));
} }
} }
if (ctmp.IsDirty) if (ctmp.IsDirty)
{ {
ctmp.DTS = DateTime.Now; //ctmp.DTS = DateTime.Now;
ctmp.Save(); ctmp.Save();
ContentInfo.Refresh(ctmp); ContentInfo.Refresh(ctmp);
} }
@ -122,5 +124,9 @@ namespace DataLoader
frmMain.AddInfo("{0} RO Values Updated", changeCount); frmMain.AddInfo("{0} RO Values Updated", changeCount);
MessageBox.Show(String.Format("{0} RO Values Updated", changeCount), "RO Value Update Complete", MessageBoxButtons.OK, MessageBoxIcon.Information); MessageBox.Show(String.Format("{0} RO Values Updated", changeCount), "RO Value Update Complete", MessageBoxButtons.OK, MessageBoxIcon.Information);
} }
private List<string> myRoFst_ROTableUpdate(object sender, ROFstInfoROTableUpdateEventArgs args)
{
return Volian.Controls.Library.VlnFlexGrid.ROTableUpdate(sender,args);
}
} }
} }

View File

@ -687,7 +687,14 @@ namespace VEPROMS
// RHM 20121010 // RHM 20121010
// Something was causing the process to remain in memory for an extended period of time // Something was causing the process to remain in memory for an extended period of time
// after printing procedures. The following lines kills the process immediately. // after printing procedures. The following lines kills the process immediately.
try
{
System.Diagnostics.Process.GetCurrentProcess().Kill(); System.Diagnostics.Process.GetCurrentProcess().Kill();
}
catch (Exception ex)
{
_MyLog.Warn("Attempting to Close", ex);
}
} }
// Get the "Procedures" Panel Heading (title). // Get the "Procedures" Panel Heading (title).
// by default the heading is "Procedures" (handled in the getting from the config) // by default the heading is "Procedures" (handled in the getting from the config)

View File

@ -161,6 +161,22 @@ namespace VEPROMS.CSLA.Library
if (dicRos != null)dicRos.Clear(); if (dicRos != null)dicRos.Clear();
dicRos = null; dicRos = null;
} }
private Dictionary<string, string> _dicROAPIDLookup;
public string GetAccPageID(string roid)
{
if(_dicROAPIDLookup==null)
{
_dicROAPIDLookup = new Dictionary<string,string>();
if (_dicROAPID == null)
BuildROAPIDDictionary();
foreach (string appid in _dicROAPID.Keys)
_dicROAPIDLookup.Add(_dicROAPID[appid].roid,appid);
}
String roidkey = roid.Substring(0, 12).ToUpper();
if(_dicROAPIDLookup.ContainsKey(roidkey))
return _dicROAPIDLookup[roidkey];
return null;
}
public List<string> GetValueDifferences(ROFSTLookup origROFst, ref List<string> delList) public List<string> GetValueDifferences(ROFSTLookup origROFst, ref List<string> delList)
{ {
// use this list to see what differences are between it and the original // use this list to see what differences are between it and the original

View File

@ -1550,12 +1550,12 @@ namespace VEPROMS.CSLA.Library
if (InfoRestored != null) if (InfoRestored != null)
InfoRestored(this); InfoRestored(this);
} }
public ItemInfo RestoreSibling(ItemAuditInfo iai) public ItemInfo RestoreSibling(ItemAuditInfo iai,ROFstInfo myRoFst)
{ {
if (iai.DeleteStatus == 0) if (iai.DeleteStatus == 0)
return null; return null;
int nextID = iai.Level == 0 ? ItemID : NextItem == null ? 0 : NextItem.ItemID; int nextID = iai.Level == 0 ? ItemID : NextItem == null ? 0 : NextItem.ItemID;
ItemInfo tmp = RestoreItem(iai); ItemInfo tmp = RestoreItem(iai, myRoFst);
if(nextID > 0) if(nextID > 0)
using (Item item = Item.Get(nextID)) ItemInfo.Refresh(item); using (Item item = Item.Get(nextID)) ItemInfo.Refresh(item);
if (iai.Level == 0) if (iai.Level == 0)
@ -1567,7 +1567,7 @@ namespace VEPROMS.CSLA.Library
tmp.OnInfoRestored(tmp); tmp.OnInfoRestored(tmp);
return tmp; return tmp;
} }
public ItemInfo RestoreItem(ItemAuditInfo iai) public ItemInfo RestoreItem(ItemAuditInfo iai, ROFstInfo myRoFst)
{ {
ItemInfo tmp2 = null; ItemInfo tmp2 = null;
try try
@ -1606,15 +1606,15 @@ namespace VEPROMS.CSLA.Library
} }
if (cont.ContentRoUsageCount > 0) if (cont.ContentRoUsageCount > 0)
{ {
ROFstInfo myrofst = tmp.MyContent.ContentItems[0].MyProcedure.MyDocVersion.DocVersionAssociations[0].MyROFst; //ROFstInfo myrofst = tmp.MyDocVersion.DocVersionAssociations[0].MyROFst;
ROFSTLookup mylookup = myrofst.GetROFSTLookup(tmp.MyContent.ContentItems[0].MyProcedure.MyDocVersion); ROFSTLookup mylookup = myRoFst.GetROFSTLookup(tmp.MyContent.ContentItems[0].MyProcedure.MyDocVersion);
foreach (ContentRoUsage ro in cont.ContentRoUsages) foreach (ContentRoUsage ro in cont.ContentRoUsages)
{ {
RoUsageInfo rou = RoUsageInfo.Get(ro.ROUsageID); RoUsageInfo rou = RoUsageInfo.Get(ro.ROUsageID);
string myvalue = mylookup.GetTranslatedRoValue(rou.ROID, tmp.ActiveFormat.PlantFormat.FormatData.SectData.ConvertCaretToDelta); string myvalue = mylookup.GetTranslatedRoValue(rou.ROID, tmp.ActiveFormat.PlantFormat.FormatData.SectData.ConvertCaretToDelta);
ROFSTLookup.rochild rocc = mylookup.GetRoChild(rou.ROID); ROFSTLookup.rochild rocc = mylookup.GetRoChild(rou.ROID);
int mytype = rocc.type; int mytype = rocc.type;
cont.FixContentText(rou, myvalue, mytype, null); cont.FixContentText(rou, myvalue, mytype, myRoFst);
} }
Content cctmp = cont; Content cctmp = cont;
if (cont.IsDirty) if (cont.IsDirty)
@ -1770,7 +1770,7 @@ namespace VEPROMS.CSLA.Library
public partial class ContentInfo public partial class ContentInfo
{ {
public static ContentInfo RestoreContent(ContentAuditInfo cai) public static ContentInfo RestoreContent(ContentAuditInfo cai,ROFstInfo myRoFst)
{ {
try try
{ {
@ -1800,14 +1800,14 @@ namespace VEPROMS.CSLA.Library
} }
ctmp.Save(); ctmp.Save();
} }
ROFstInfo myrofst = tmp.ContentItems[0].MyProcedure.MyDocVersion.DocVersionAssociations[0].MyROFst; //ROFstInfo myrofst = tmp.ContentItems[0].MyProcedure.MyDocVersion.DocVersionAssociations[0].MyROFst;
ROFSTLookup mylookup = myrofst.GetROFSTLookup(tmp.ContentItems[0].MyProcedure.MyDocVersion); ROFSTLookup mylookup = myRoFst.GetROFSTLookup(tmp.ContentItems[0].MyProcedure.MyDocVersion);
foreach(RoUsageInfo rou in tmp.ContentRoUsages) foreach(RoUsageInfo rou in tmp.ContentRoUsages)
{ {
string myvalue = mylookup.GetTranslatedRoValue(rou.ROID, tmp.ContentItems[0].ActiveFormat.PlantFormat.FormatData.SectData.ConvertCaretToDelta); string myvalue = mylookup.GetTranslatedRoValue(rou.ROID, tmp.ContentItems[0].ActiveFormat.PlantFormat.FormatData.SectData.ConvertCaretToDelta);
ROFSTLookup.rochild rocc = mylookup.GetRoChild(rou.ROID); ROFSTLookup.rochild rocc = mylookup.GetRoChild(rou.ROID);
int mytype = rocc.type; int mytype = rocc.type;
ctmp.FixContentText(rou, myvalue, mytype, null); ctmp.FixContentText(rou, myvalue, mytype, myRoFst);
} }
Content cctmp = ctmp; Content cctmp = ctmp;
if (ctmp.IsDirty) if (ctmp.IsDirty)

View File

@ -78,10 +78,18 @@ namespace VEPROMS.CSLA.Library
if (rousg.MyContent.MyGrid != null) if (rousg.MyContent.MyGrid != null)
{ {
if (rotype == (int)E_ROValueType.Table) // if change in rotable data... if (rotype == (int)E_ROValueType.Table) // if change in rotable data...
{
if (origROFstInfo != null)
{ {
List<string> retlist = origROFstInfo.OnROTableUpdate(this, new ROFstInfoROTableUpdateEventArgs(newvalue, MyGrid.Data)); List<string> retlist = origROFstInfo.OnROTableUpdate(this, new ROFstInfoROTableUpdateEventArgs(newvalue, MyGrid.Data));
if (Text != retlist[0]) Text = retlist[0]; if (MyGrid.Data != retlist[1])
if (MyGrid.Data != retlist[1]) MyGrid.Data = retlist[1]; {
MyGrid.Data = retlist[1];
retval = Text;
if (Text != retlist[0])
Text = retlist[0];
}
}
} }
else else
{ {

View File

@ -591,7 +591,10 @@ namespace Volian.Controls.Library
ContentAuditInfo cai = tn.Tag as ContentAuditInfo; ContentAuditInfo cai = tn.Tag as ContentAuditInfo;
if (MessageBox.Show(this, "Do you want to restore this content change?", "Confirm Content Change Restore", MessageBoxButtons.YesNoCancel, MessageBoxIcon.Question) == DialogResult.Yes) if (MessageBox.Show(this, "Do you want to restore this content change?", "Confirm Content Change Restore", MessageBoxButtons.YesNoCancel, MessageBoxIcon.Question) == DialogResult.Yes)
{ {
ContentInfo ci = ContentInfo.RestoreContent(cai); ROFstInfo myRoFst = MyItemInfo.MyDocVersion.DocVersionAssociations[0].MyROFst;
myRoFst.ROTableUpdate += new ROFstInfoROTableUpdateEvent(myRoFst_ROTableUpdate);
ContentInfo ci = ContentInfo.RestoreContent(cai,myRoFst);
myRoFst.ROTableUpdate += new ROFstInfoROTableUpdateEvent(myRoFst_ROTableUpdate);
RefreshRequired = true; RefreshRequired = true;
UpdateHistory(); UpdateHistory();
myRTB.Clear(); myRTB.Clear();
@ -609,8 +612,10 @@ namespace Volian.Controls.Library
ItemInfo ii = null; ItemInfo ii = null;
if (iai.Level == 2) if (iai.Level == 2)
{ {
ii = MyItemInfo.RestoreItem(iai); ROFstInfo myRoFst = MyItemInfo.MyDocVersion.DocVersionAssociations[0].MyROFst;
myRoFst.ROTableUpdate += new ROFstInfoROTableUpdateEvent(myRoFst_ROTableUpdate);
ii = MyItemInfo.RestoreItem(iai,myRoFst);
myRoFst.ROTableUpdate -= new ROFstInfoROTableUpdateEvent(myRoFst_ROTableUpdate);
//_MyEditItem.AddChild((E_FromType)fromtype, contenttype); //_MyEditItem.AddChild((E_FromType)fromtype, contenttype);
//ii.ItemParts[0].FromType //ii.ItemParts[0].FromType
//ii.MyContent.Type //ii.MyContent.Type
@ -674,7 +679,10 @@ namespace Volian.Controls.Library
} }
else else
{ {
ii = MyItemInfo.RestoreSibling(iai); ROFstInfo myRoFst = MyItemInfo.MyDocVersion.DocVersionAssociations[0].MyROFst;
myRoFst.ROTableUpdate += new ROFstInfoROTableUpdateEvent(myRoFst_ROTableUpdate);
ii = MyItemInfo.RestoreSibling(iai,myRoFst);
myRoFst.ROTableUpdate -= new ROFstInfoROTableUpdateEvent(myRoFst_ROTableUpdate);
if (ii.IsStep) if (ii.IsStep)
ii = StepInfo.Get(ii.ItemID); ii = StepInfo.Get(ii.ItemID);
else if (ii.IsSection) else if (ii.IsSection)
@ -729,7 +737,10 @@ namespace Volian.Controls.Library
if (MessageBox.Show(this, "Do you want to restore this table?", "Confirm Table Restore", MessageBoxButtons.YesNoCancel, MessageBoxIcon.Question) == DialogResult.Yes) if (MessageBox.Show(this, "Do you want to restore this table?", "Confirm Table Restore", MessageBoxButtons.YesNoCancel, MessageBoxIcon.Question) == DialogResult.Yes)
{ {
ContentAuditInfo cai = ContentAuditInfo.Get(gai.ContentAuditID); ContentAuditInfo cai = ContentAuditInfo.Get(gai.ContentAuditID);
ContentInfo ci = ContentInfo.RestoreContent(cai); ROFstInfo myRoFst = MyItemInfo.MyDocVersion.DocVersionAssociations[0].MyROFst;
myRoFst.ROTableUpdate += new ROFstInfoROTableUpdateEvent(myRoFst_ROTableUpdate);
ContentInfo ci = ContentInfo.RestoreContent(cai,myRoFst);
myRoFst.ROTableUpdate -= new ROFstInfoROTableUpdateEvent(myRoFst_ROTableUpdate);
RefreshRequired = true; RefreshRequired = true;
UpdateHistory(); UpdateHistory();
myRTB.Clear(); myRTB.Clear();
@ -737,6 +748,11 @@ namespace Volian.Controls.Library
} }
} }
} }
List<string> myRoFst_ROTableUpdate(object sender, ROFstInfoROTableUpdateEventArgs args)
{
return VlnFlexGrid.ROTableUpdate(sender, args);
}
private void DisplayTagRTF(TreeNode tn) private void DisplayTagRTF(TreeNode tn)
{ {
if (tn.Tag != null) if (tn.Tag != null)

View File

@ -1759,45 +1759,46 @@ namespace Volian.Controls.Library
public List<string> roFstInfo_ROTableUpdate(object sender, ROFstInfoROTableUpdateEventArgs args) public List<string> roFstInfo_ROTableUpdate(object sender, ROFstInfoROTableUpdateEventArgs args)
{ {
string xml = null; return VlnFlexGrid.ROTableUpdate(sender, args);
string srchtxt = null; //string xml = null;
Content content = (Content)sender; //string srchtxt = null;
using (VlnFlexGrid myGrid = new VlnFlexGrid(content.ContentItems[0])) //Content content = (Content)sender;
{ //using (VlnFlexGrid myGrid = new VlnFlexGrid(content.ContentItems[0]))
using (StringReader sr = new StringReader(args.OldGridXml)) //{
{ // using (StringReader sr = new StringReader(args.OldGridXml))
myGrid.ReadXml(sr); // {
sr.Close(); // myGrid.ReadXml(sr);
} // sr.Close();
string roid = content.ContentRoUsages[0].ROID; //myGrid.ROID; // }
int rodbid = content.ContentRoUsages[0].RODbID; //myGrid.RODbId; // string roid = content.ContentRoUsages[0].ROID; //myGrid.ROID;
////Font GridFont = myGrid.Font; // int rodbid = content.ContentRoUsages[0].RODbID; //myGrid.RODbId;
//myGrid.MergedRanges.Clear(); // ////Font GridFont = myGrid.Font;
//myGrid.Clear(); // //myGrid.MergedRanges.Clear();
//myGrid.ParseTableFromText(args.ROText); // //myGrid.Clear();
//myGrid.AutoSizeCols(); // //myGrid.ParseTableFromText(args.ROText);
//myGrid.AutoSizeRows(); // //myGrid.AutoSizeCols();
//myGrid.MakeRTFcells(); // //myGrid.AutoSizeRows();
//myGrid.RODbId = rodbid; // //myGrid.MakeRTFcells();
//myGrid.ROID = roid; // //myGrid.RODbId = rodbid;
//myGrid.IsRoTable = true; // //myGrid.ROID = roid;
myGrid.Visible = false; // //myGrid.IsRoTable = true;
myGrid.ConvertTableROToGrid(args.ROText, rodbid, roid); // myGrid.Visible = false;
myGrid.FixTableCellsHeightWidth(); // myGrid.ConvertTableROToGrid(args.ROText, rodbid, roid);
myGrid.AdjustGridControlSize(); // myGrid.FixTableCellsHeightWidth();
myGrid.Visible = true; // myGrid.AdjustGridControlSize();
using (StringWriter sw = new StringWriter()) // myGrid.Visible = true;
{ // using (StringWriter sw = new StringWriter())
myGrid.WriteXml(sw); // {
xml = sw.GetStringBuilder().ToString(); // myGrid.WriteXml(sw);
sw.Close(); // xml = sw.GetStringBuilder().ToString();
} // sw.Close();
srchtxt = myGrid.GetSearchableText(); // }
} // srchtxt = myGrid.GetSearchableText();
List<string> retlist = new List<string>(); //}
retlist.Add(srchtxt); //List<string> retlist = new List<string>();
retlist.Add(xml); //retlist.Add(srchtxt);
return retlist; //retlist.Add(xml);
//return retlist;
} }
private void rtabAdmin_Click(object sender, EventArgs e) private void rtabAdmin_Click(object sender, EventArgs e)

View File

@ -114,10 +114,10 @@ namespace Volian.Controls.Library
{ {
get get
{ {
return IsGridChanged(this._MyItemInfo.MyContent.MyGrid.Data, this.GetXMLData()); return IsGridChanged(this._MyItemInfo.MyContent.MyGrid.Data, this.GetXMLData(), true);
} }
} }
private bool IsGridChanged(string oldXml, string newXml) private bool IsGridChanged(string oldXml, string newXml, bool checkFormat)
{ {
if (this.TableCellEditor.Text.Contains("<NewID>")) if (this.TableCellEditor.Text.Contains("<NewID>"))
return false; return false;
@ -126,16 +126,16 @@ namespace Volian.Controls.Library
XmlDocument XdNew = new XmlDocument(); XmlDocument XdNew = new XmlDocument();
XdNew.LoadXml(AdjustHeightAndWidthForDPI(newXml)); XdNew.LoadXml(AdjustHeightAndWidthForDPI(newXml));
//check volian borders 1st //check volian borders 1st
if (XdNew.SelectSingleNode("C1FlexGrid/Control/MyBorderDetailString").InnerText != XdOld.SelectSingleNode("C1FlexGrid/Control/MyBorderDetailString").InnerText) if (checkFormat && XdNew.SelectSingleNode("C1FlexGrid/Control/MyBorderDetailString").InnerText != XdOld.SelectSingleNode("C1FlexGrid/Control/MyBorderDetailString").InnerText)
return true; return true;
//check row/col sizes 2nd //check row/col sizes 2nd
if (GetRowColSizeString(XdNew) != GetRowColSizeString(XdOld)) if (checkFormat && ( GetRowColSizeString(XdNew) != GetRowColSizeString(XdOld)))
return true; return true;
//check for cell data changes 3rd //check for cell data changes 3rd
if (GetCellDataString(XdNew) != GetCellDataString(XdOld)) if (GetCellDataString(XdNew) != GetCellDataString(XdOld))
return true; return true;
//check for cell format changes 4th //check for cell format changes 4th
if (GetCellFormatString(XdNew) != GetCellFormatString(XdOld)) if (checkFormat && GetCellFormatString(XdNew) != GetCellFormatString(XdOld))
return true; return true;
//check for merged cells 5th //check for merged cells 5th
if (GetCellMergeString(XdNew) != GetCellMergeString(XdOld)) if (GetCellMergeString(XdNew) != GetCellMergeString(XdOld))
@ -3589,7 +3589,43 @@ namespace Volian.Controls.Library
rtn = ofd.SafeFileName; rtn = ofd.SafeFileName;
return rtn; return rtn;
} }
public static List<string> ROTableUpdate(object sender, ROFstInfoROTableUpdateEventArgs args)
{
string xml = null;
string srchtxt = null;
Content content = (Content)sender;
bool isdirty = false;
using (VlnFlexGrid myGrid = new VlnFlexGrid(content.ContentItems[0]))
{
using (StringReader sr = new StringReader(args.OldGridXml))
{
myGrid.ReadXml(sr);
sr.Close();
}
string roid = content.ContentRoUsages[0].ROID; //myGrid.ROID;
int rodbid = content.ContentRoUsages[0].RODbID; //myGrid.RODbId;
myGrid.Visible = false;
myGrid.ConvertTableROToGrid(args.ROText, rodbid, roid);
myGrid.FixTableCellsHeightWidth();
myGrid.AdjustGridControlSize();
myGrid.Visible = true;
using (StringWriter sw = new StringWriter())
{
myGrid.WriteXml(sw);
xml = sw.GetStringBuilder().ToString();
sw.Close();
}
srchtxt = myGrid.GetSearchableText();
isdirty = myGrid.IsGridChanged(args.OldGridXml, xml, false);
}
List<string> retlist = new List<string>();
retlist.Add(srchtxt);
if(isdirty)
retlist.Add(xml);
else
retlist.Add(args.OldGridXml);
return retlist;
}
public void ConvertTableROToGrid(string valtext, int rodbid, string roid) public void ConvertTableROToGrid(string valtext, int rodbid, string roid)
{ {
VE_Font vefont = _MyItemInfo.GetItemFont(); VE_Font vefont = _MyItemInfo.GetItemFont();

View File

@ -1302,39 +1302,40 @@ namespace Volian.Controls.Library
} }
public List<string> roFstInfo_ROTableUpdate(object sender, ROFstInfoROTableUpdateEventArgs args) public List<string> roFstInfo_ROTableUpdate(object sender, ROFstInfoROTableUpdateEventArgs args)
{ {
string xml = null; return VlnFlexGrid.ROTableUpdate(sender, args);
string srchtxt = null; //string xml = null;
using (VlnFlexGrid myGrid = new VlnFlexGrid()) //string srchtxt = null;
{ //using (VlnFlexGrid myGrid = new VlnFlexGrid())
using (StringReader sr = new StringReader(args.OldGridXml)) //{
{ // using (StringReader sr = new StringReader(args.OldGridXml))
myGrid.ReadXml(sr); // {
myGrid.KeyActionTab = C1.Win.C1FlexGrid.KeyActionEnum.MoveAcross; // myGrid.ReadXml(sr);
sr.Close(); // myGrid.KeyActionTab = C1.Win.C1FlexGrid.KeyActionEnum.MoveAcross;
} // sr.Close();
string roid = myGrid.ROID; // }
int rodbid = myGrid.RODbId; // string roid = myGrid.ROID;
Font GridFont = myGrid.Font; // int rodbid = myGrid.RODbId;
myGrid.Clear(); // Font GridFont = myGrid.Font;
myGrid.ParseTableFromText(args.ROText, GridLinePattern.Single); // myGrid.Clear();
myGrid.AutoSizeCols(); // myGrid.ParseTableFromText(args.ROText, GridLinePattern.Single);
myGrid.AutoSizeRows(); // myGrid.AutoSizeCols();
myGrid.MakeRTFcells(); // myGrid.AutoSizeRows();
myGrid.RODbId = rodbid; // myGrid.MakeRTFcells();
myGrid.ROID = roid; // myGrid.RODbId = rodbid;
myGrid.IsRoTable = true; // myGrid.ROID = roid;
using (StringWriter sw = new StringWriter()) // myGrid.IsRoTable = true;
{ // using (StringWriter sw = new StringWriter())
myGrid.WriteXml(sw); // {
xml = sw.GetStringBuilder().ToString(); // myGrid.WriteXml(sw);
sw.Close(); // xml = sw.GetStringBuilder().ToString();
} // sw.Close();
srchtxt = myGrid.GetSearchableText(); // }
} // srchtxt = myGrid.GetSearchableText();
List<string> retlist = new List<string>(); //}
retlist.Add(srchtxt); //List<string> retlist = new List<string>();
retlist.Add(xml); //retlist.Add(srchtxt);
return retlist; //retlist.Add(xml);
//return retlist;
} }
private void RunROEditor(VETreeNode tn) private void RunROEditor(VETreeNode tn)