Give option to import RO’s as text when the RO path of the import is different than the target procedure set

Prompts user with options on what to do with the import of a procedure that has a different RO path than the target procedure set.
This commit is contained in:
John Jenko 2016-08-09 12:33:01 +00:00
parent 0804ecc7ee
commit 1bf77667b2
4 changed files with 638 additions and 92 deletions

View File

@ -10,11 +10,13 @@ using Volian.Base.Library;
using System.Xml;
using System.IO;
using Ionic.Zip;
using System.Text.RegularExpressions;
namespace VEPROMS
{
public partial class dlgExportImport : Form
{
private bool _ConvertROsToTextDuringImport = false;
private bool _ConvertROsAndTransitionsToText = false; // set to true when Approval creates an Export file
private ItemInfo _ExternalTransitionItem = null;
public ItemInfo ExternalTransitionItem
@ -204,6 +206,13 @@ namespace VEPROMS
}
if (MyDocVersion != null) // import a procedure - a .pxml file
{
// compare the ROPath of MyDocVerion
// if no path set, display Pick RO Folder dialog
// if MyDocVersion ROPath is different than the import file ROPath, then ask user:
// - use MyDocVersion ROPath (warn resulting RO values may be be correct)
// * set oldRODbID to id in import file
// * set newRODbid to MyDocVersion rodbid
// - or convert ROs to text
TurnChangeManagerOff.Execute();
XmlDocument xd = new XmlDocument();
xd.Load(txtImport.Text);
@ -211,75 +220,107 @@ namespace VEPROMS
string rofolderpath = xd.DocumentElement.Attributes.GetNamedItem("rofolderpath").InnerText;
int rodbid = int.Parse(xd.DocumentElement.Attributes.GetNamedItem("rodbid").InnerText);
int rofstid = int.Parse(xd.DocumentElement.Attributes.GetNamedItem("rofstid").InnerText);
List<string> localROPaths = new List<string>();
RODbInfoList rolist = RODbInfoList.Get();
foreach (RODbInfo dbi in rolist)
if (MyDocVersion.DocVersionAssociationCount > 0)
{
if (dbi.FolderPath == rofolderpath && dbi.RODbID == rodbid)
// use current ROPath
MyRODb = RODb.GetJustRoDb(MyDocVersion.DocVersionAssociations[0].MyROFst.MyRODb.RODbID);
// if the current RO Path and the import file RO Path are not the same
// then ask if we should import using the current workingdraft RO Path, convert the ROs to text, or cancel the import
if (MyRODb.FolderPath != rofolderpath)
{
dlgImpHowToHandleROs dlg = new dlgImpHowToHandleROs();
dlg.ImportedROFolder = rofolderpath;
dlg.WorkingDraftROFolder = MyRODb.FolderPath;
dlg.ShowDialog(this);
if (dlg.CancelImport)
{
this.Cursor = Cursors.Default;
this.btnImport.Enabled = true; // allow user to select a different export file to import
this.btnDoImport.Enabled = true; // allow user to change mind and perform the import
return;
}
_ConvertROsToTextDuringImport = dlg.ConvertROsToText;
}
// this saves the old RO database ID and the current RO database ID so that we can change the RODBIDs in the RO links
newRODbID = MyRODb.RODbID;
oldRODbID = rodbid;
}
else
{
#region NeedToSelectROPath
// MyDocVersion does not have an RO database (ro folder path) assigned to it so we need to select an RO Path
List<string> localROPaths = new List<string>();
RODbInfoList rolist = RODbInfoList.Get();
foreach (RODbInfo dbi in rolist)
{
MyRODb = RODb.GetJustRoDb(rodbid);
oldRODbID = newRODbID = rodbid;
break;
}
if (dbi.FolderPath == rofolderpath && dbi.RODbID == rodbid)
{
MyRODb = RODb.GetJustRoDb(rodbid);
oldRODbID = newRODbID = rodbid;
break;
}
// B2016-175 have the correct (matching) RO Path but the rodbid is different (procedure came from a different SQL database)
// We can use the RO Path but we need to change the rodbid in the RO links of the procedure we are importing
else if (dbi.FolderPath == rofolderpath && dbi.RODbID != rodbid)
{
MyRODb = RODb.GetByFolderPath(rofolderpath);
newRODbID = MyRODb.RODbID;
oldRODbID = rodbid;
break;
}
else
{
DirectoryInfo di = new DirectoryInfo(dbi.FolderPath);
if (di.Exists)
localROPaths.Add(dbi.FolderPath);
}
}
if (MyRODb == null)
{
if (localROPaths.Count == 0)
{
MessageBox.Show("There has been no RO folder defined for this database.\r\n\r\nIn order to import a procedure, you need to assign a RO folder path.\r\n\r\nImport process will terminate.");
this.Cursor = Cursors.Default;
return;
}
else
{
this.Cursor = Cursors.Default;
dlgPickROFolder dlg = new dlgPickROFolder();
dlg.ImportedROFolder = rofolderpath;
dlg.LocalROFolders = localROPaths;
dlg.ShowDialog(this);
if ((dlg.SelectedROFolder ?? string.Empty) != string.Empty) // B2015-216 If the return value is null treat it like an empty string
else if (dbi.FolderPath == rofolderpath && dbi.RODbID != rodbid)
{
MyRODb = RODb.GetByFolderPath(dlg.SelectedROFolder);
RODbInfo myRODBInfo = RODbInfo.Get(MyRODb.RODbID);
oldRODbID = newRODbID = MyRODb.RODbID;
ROFstInfo fstInfo = null;
foreach (ROFstInfo tmp in myRODBInfo.RODbROFsts)
if (fstInfo == null || tmp.ROFstID > fstInfo.ROFstID)
fstInfo = tmp;
using (DocVersion dv = MyDocVersion.Get())
{
using (ROFst fst = fstInfo.Get())
{
dv.DocVersionAssociations.Add(fst);
dv.Save();
}
dv.Reset_DocVersionAssociations();
MyDocVersion.RefreshDocVersionAssociations();
}
MyRODb = RODb.GetByFolderPath(rofolderpath);
newRODbID = MyRODb.RODbID;
oldRODbID = rodbid;
break;
}
else
{
MessageBox.Show("Since you did not pick an existing RO folder defined for this database, the import process will terminate.");
this.Close();// Close the Import Window
return;
DirectoryInfo di = new DirectoryInfo(dbi.FolderPath);
if (di.Exists)
localROPaths.Add(dbi.FolderPath);
}
}
}
if (MyRODb == null)
{
if (localROPaths.Count == 0)
{
MessageBox.Show("There has been no RO folder defined for this database.\r\n\r\nIn order to import a procedure, you need to assign a RO folder path.\r\n\r\nImport process will terminate.");
this.Cursor = Cursors.Default;
return;
}
else
{
this.Cursor = Cursors.Default;
dlgPickROFolder dlg = new dlgPickROFolder();
dlg.ImportedROFolder = rofolderpath;
dlg.LocalROFolders = localROPaths;
dlg.ShowDialog(this);
if ((dlg.SelectedROFolder ?? string.Empty) != string.Empty) // B2015-216 If the return value is null treat it like an empty string
{
MyRODb = RODb.GetByFolderPath(dlg.SelectedROFolder);
RODbInfo myRODBInfo = RODbInfo.Get(MyRODb.RODbID);
oldRODbID = newRODbID = MyRODb.RODbID;
ROFstInfo fstInfo = null;
foreach (ROFstInfo tmp in myRODBInfo.RODbROFsts)
if (fstInfo == null || tmp.ROFstID > fstInfo.ROFstID)
fstInfo = tmp;
using (DocVersion dv = MyDocVersion.Get())
{
using (ROFst fst = fstInfo.Get())
{
dv.DocVersionAssociations.Add(fst);
dv.Save();
}
dv.Reset_DocVersionAssociations();
MyDocVersion.RefreshDocVersionAssociations();
}
}
else
{
MessageBox.Show("Since you did not pick an existing RO folder defined for this database, the import process will terminate.");
this.Close();// Close the Import Window
return;
}
}
}
#endregion
} // end - need to select RO Path
// use resolvedProcNum to determine if procedure is 'unique', i.e. if the procedure number exists
// and user does not overwrite or copy, then the procedure should NOT be imported. Fix for B2016-045
bool resolvedProcNum = true;
@ -288,7 +329,7 @@ namespace VEPROMS
// procedure numbers that contain a hyphen may have the hyphen represented as the unicode character
// '\u8209?' or the '-' character. If proc number is same except for hyphen representation, they
// should be considered the same procedure (fix for B2016-084)
string hyphenNum = pi.MyContent.Number == null ? "" : pi.MyContent.Number.Replace(@"\u8209?", "-").Replace("\u2011", "-").Replace("\u9586?","_").Replace("\u2572", @"\");
string hyphenNum = pi.MyContent.Number == null ? "" : pi.MyContent.Number.Replace(@"\u8209?", "-").Replace("\u2011", "-").Replace(@"\u9586?",@"\").Replace("\u2572", @"\");
string hyphenImpNum = xd.SelectSingleNode("procedure/content/@number").InnerText;
// bug fix C2015-044 - jsj
// - the cancel button would ignor the user's wishes and proceed with the import (overwriting the existing procedure)
@ -2966,34 +3007,117 @@ namespace VEPROMS
// content.Save();
// }
//}
private void AddROUsages(Content content, XmlNode xn)
private string GetMyPrefix(string text, int start, int lastIndex)
{
foreach (XmlNode nd in xn.SelectNodes("rousage"))
string defPrefix = text.Substring(start - 3, 3);
if (defPrefix != @"\v ") throw new Exception(string.Format("rtf string {0} does not match expected format", defPrefix));
string txt = text.Substring(lastIndex, start - lastIndex - 3);
int lastSlash = txt.LastIndexOf(@"\");
int lastSpace = txt.LastIndexOf(" ");
int lastCR = txt.LastIndexOf("\r");
if (lastSpace < lastCR)
lastSpace = lastCR;
if (lastSlash <= lastSpace) //this will return "\v "
return defPrefix;
txt = txt.Substring(lastSlash);
if (txt.StartsWith(@"\'")) //this is a hex
return defPrefix;
if (Regex.IsMatch(txt, @"\\u[0-9].*")) //this is unicode
return defPrefix;
return @"\v";
}
private string GetMySuffix(string text, int start)
{
string txt = text.Substring(start);
int firstSlashVeeZero = txt.IndexOf(@"\v0");
if (firstSlashVeeZero == 0 && txt.Length > 3 && txt[3] == ' ') //"\v0 "
return text.Substring(start, 4);
return text.Substring(start, firstSlashVeeZero + 3); //everything upto \v0"
}
private void ConvertImportProcedureROsToText(Content content, XmlNode xn)
{
string newvalue = "";
foreach (XmlNode nd in xn.SelectNodes("rousage"))
{
string rousageid = nd.Attributes.GetNamedItem("rousageid").InnerText;
string roid = nd.Attributes.GetNamedItem("roid").InnerText;
string config = nd.Attributes.GetNamedItem("config").InnerText;
string userid = nd.Attributes.GetNamedItem("userid").InnerText;
DateTime dts = DateTime.Parse(nd.Attributes.GetNamedItem("dts").InnerText);
if (MyDocVersion.DocVersionAssociations == null)
MyDocVersion.RefreshDocVersionAssociations();
ROFSTLookup lookup = MyDocVersion.DocVersionAssociations[0].MyROFst.GetROFSTLookup(MyDocVersion);
string roval = lookup.GetRoValue(roid);
if (roval == "?")
string findLink = @"<START\].*?\[END>";
MatchCollection ms = Regex.Matches(content.Text, findLink);
string lookFor = string.Format(@"^<START\](\\[^v \\]+)*\\v0(\\[^v '?{{}}~\\]+)*( |\\u[0-9]{{1,4}}?|\\'[0-9a-fA-F]{{2}}|\\[{{}}~])(.*?)(\\[^v'?{{}}~ \\]+)*\\v(\\[^v \\]+)* #Link:ReferencedObject:{0} .*?\[END>$", rousageid);
int lastIndex = 0;
string newText = content.Text;
foreach (Match mm in ms)
{
RoUsageInfo roui = RoUsageInfo.Get(int.Parse(rousageid));
}
else
{
RoUsage rou = RoUsage.MakeRoUsage(content, roid, config, dts, userid, MyRODb);
rou.Save();
RoUsageInfo roui = RoUsageInfo.Get(rou.ROUsageID);
string lookFor = string.Format("#Link:ReferencedObject:{0} {1} {2}[END>", rousageid, roid, oldRODbID.ToString());
string replaceWith = string.Format("#Link:ReferencedObject:{0} {1} {2}[END>", rou.ROUsageID.ToString(), roid, newRODbID.ToString());
if (lookFor != replaceWith)
int offset = mm.Index;
Match m = Regex.Match(mm.Value, lookFor, RegexOptions.Singleline);
if (m != null && m.Groups.Count > 1)
{
content.Text = content.Text.Replace(lookFor, replaceWith);
content.FixContentText(roui, roval, 0, MyDocVersion.DocVersionAssociations[0].MyROFst);
string prefix = GetMyPrefix(content.Text, mm.Index, lastIndex);
string suffix = GetMySuffix(content.Text, mm.Index + mm.Length);
int myIndex = m.Groups[4].Index + mm.Index;
int myLength = m.Groups[4].Length;
if (m.Groups[3].Value != " ")
{
myIndex = m.Groups[3].Index + mm.Index;
myLength += m.Groups[3].Length;
}
string gg = newText.Substring(myIndex, myLength);
gg = gg.Replace("{", @"\{").Replace("}", @"\}");
string part1 = newText.Substring(0, mm.Index);
string part2 = gg;
string part3 = newText.Substring(mm.Index + mm.Length);
//modify part1 based on prefix
if (prefix == @"\v ")
part1 = part1.Substring(0, part1.Length - 3);
else
part1 = part1.Substring(0, part1.Length - 3) + " ";
//modify part3 based on suffix
if (suffix == @"\v0 ")
part3 = part3.Substring(4);
else
part3 = suffix.Replace(@"\v0", "") + part3.Substring(suffix.Length);
content.Text = part1 + part2 + part3;
break; // Text has been processed
}
lastIndex = mm.Index + mm.Length;
}
}
content.Save();
}
private void AddROUsages(Content content, XmlNode xn)
{
if (_ConvertROsToTextDuringImport)
ConvertImportProcedureROsToText(content, xn);
else
{
foreach (XmlNode nd in xn.SelectNodes("rousage"))
{
string rousageid = nd.Attributes.GetNamedItem("rousageid").InnerText;
string roid = nd.Attributes.GetNamedItem("roid").InnerText;
string config = nd.Attributes.GetNamedItem("config").InnerText;
string userid = nd.Attributes.GetNamedItem("userid").InnerText;
DateTime dts = DateTime.Parse(nd.Attributes.GetNamedItem("dts").InnerText);
if (MyDocVersion.DocVersionAssociations == null)
MyDocVersion.RefreshDocVersionAssociations();
ROFSTLookup lookup = MyDocVersion.DocVersionAssociations[0].MyROFst.GetROFSTLookup(MyDocVersion);
string roval = lookup.GetRoValue(roid);
if (roval == "?")
{
RoUsageInfo roui = RoUsageInfo.Get(int.Parse(rousageid));
}
else
{
RoUsage rou = RoUsage.MakeRoUsage(content, roid, config, dts, userid, MyRODb);
rou.Save();
RoUsageInfo roui = RoUsageInfo.Get(rou.ROUsageID);
string lookFor = string.Format("#Link:ReferencedObject:{0} {1} {2}[END>", rousageid, roid, oldRODbID.ToString());
string replaceWith = string.Format("#Link:ReferencedObject:{0} {1} {2}[END>", rou.ROUsageID.ToString(), roid, newRODbID.ToString());
if (lookFor != replaceWith)
{
content.Text = content.Text.Replace(lookFor, replaceWith);
content.FixContentText(roui, roval, 0, MyDocVersion.DocVersionAssociations[0].MyROFst);
}
}
}
content.Save();
@ -3656,26 +3780,73 @@ namespace VEPROMS
XmlNode gn = xd.SelectSingleNode("C1FlexGrid/Control/IsRoTable");
if (gn.InnerText.ToLower() == "true")
{
gn = xd.SelectSingleNode("C1FlexGrid/Control/RODbId");
gn.InnerText = newRODbID.ToString();
if (_ConvertROsToTextDuringImport)
{
gn.InnerText = "False";
}
else
{
gn = xd.SelectSingleNode("C1FlexGrid/Control/RODbId");
gn.InnerText = newRODbID.ToString();
}
data = xd.OuterXml;
}
else
{
XmlNodeList nl = xd.SelectNodes("C1FlexGrid/Cells/Cell/Data");
bool modified = false;
string lookFor = string.Format(" {0}[END", oldRODbID.ToString());
string replaceWith = string.Format(" {0}[END", newRODbID.ToString());
foreach (XmlNode nn in nl)
if (_ConvertROsToTextDuringImport)
{
if (nn.InnerText.Contains("#Link:ReferencedObject:"))
string newvalue = "";
// 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 '?{{}}\\]+)*( |\\u[0-9]{{1,4}}?|\\'[0-9a-fA-F]{{2}}|\\[{{}}~])(.*?)(\\[^v'?{{}} \\]+)*\\v(\\[^v \\]+)* #Link:ReferencedObject:{0} .*?\[END&gt;$", rousageid);
string lookForXml = @"^&lt;START\](\\[^v \\]+)*\\v0(\\[^v '?{{}}\\]+)*( |\\u[0-9]{{1,4}}?|\\'[0-9a-fA-F]{{2}}|\\[{{}}~])(.*?)(\\[^v'?{{}} \\]+)*\\v(\\[^v \\]+)* #Link:ReferencedObject:.*?\[END&gt;$";
MatchCollection msg = Regex.Matches(data, findLinkXml);
int nmsg = msg.Count;
for (int i = nmsg - 1; i >= 0; i--)
{
nn.InnerText = nn.InnerText.Replace(lookFor, replaceWith);
modified = true;
Match mmg = msg[i];
Match mg = Regex.Match(mmg.Value, lookForXml);// Regex.Match(MyGrid.Data, lookForXml);
if (mg != null && mg.Groups.Count > 1)
{
int myIndex = mg.Groups[4].Index + mmg.Index;
int myLength = mg.Groups[4].Length;
if (mg.Groups[3].Value != " ")
{
myIndex = mg.Groups[3].Index + mmg.Index;
myLength += mg.Groups[3].Length;
}
string ss = data.Substring(myIndex, myLength);
if (ss != newvalue)
{
int ii = data.Substring(0, mmg.Index).LastIndexOf(@"\v");
int iil = data.Substring(mmg.Index + mg.Value.Length).IndexOf(@"\v0");
string part1 = data.Substring(0, ii); // length up to \v
string part2 = data.Substring(ii + 2, mmg.Index - (ii + 2));
string part3 = ss;
string part4 = data.Substring(mmg.Index + mg.Value.Length, iil);
string part5 = data.Substring(mmg.Index + (mg.Value.Length + iil + 3));
data = part1 + part2 + part3 + part4 + part5;
}
}
}
}
if (modified)
data = xd.OuterXml;
else
{
string lookFor = string.Format(" {0}[END", oldRODbID.ToString());
string replaceWith = string.Format(" {0}[END", newRODbID.ToString());
foreach (XmlNode nn in nl)
{
if (nn.InnerText.Contains("#Link:ReferencedObject:"))
{
nn.InnerText = nn.InnerText.Replace(lookFor, replaceWith);
modified = true;
}
}
if (modified)
data = xd.OuterXml;
}
}
string config = nd.Attributes.GetNamedItem("config").InnerText;
string userid = nd.Attributes.GetNamedItem("userid").InnerText;

View File

@ -0,0 +1,187 @@
namespace VEPROMS
{
partial class dlgImpHowToHandleROs
{
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// Clean up any resources being used.
/// </summary>
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region Windows Form Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
this.btnUseCurrentROs = new DevComponents.DotNetBar.ButtonX();
this.btnROsToText = new DevComponents.DotNetBar.ButtonX();
this.lblCurrentROs = new DevComponents.DotNetBar.LabelX();
this.lblROsToText = new DevComponents.DotNetBar.LabelX();
this.btnCancel = new DevComponents.DotNetBar.ButtonX();
this.labelX2 = new DevComponents.DotNetBar.LabelX();
this.rtbROPathInfo = new DevComponents.DotNetBar.Controls.RichTextBoxEx();
this.SuspendLayout();
//
// btnUseCurrentROs
//
this.btnUseCurrentROs.AccessibleRole = System.Windows.Forms.AccessibleRole.PushButton;
this.btnUseCurrentROs.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
this.btnUseCurrentROs.ColorTable = DevComponents.DotNetBar.eButtonColor.OrangeWithBackground;
this.btnUseCurrentROs.DialogResult = System.Windows.Forms.DialogResult.OK;
this.btnUseCurrentROs.Location = new System.Drawing.Point(12, 174);
this.btnUseCurrentROs.Name = "btnUseCurrentROs";
this.btnUseCurrentROs.Size = new System.Drawing.Size(161, 30);
this.btnUseCurrentROs.Style = DevComponents.DotNetBar.eDotNetBarStyle.StyleManagerControlled;
this.btnUseCurrentROs.TabIndex = 2;
this.btnUseCurrentROs.Text = "Use Working Draft RO Values";
this.btnUseCurrentROs.Click += new System.EventHandler(this.btnUseCurrentROs_Click);
//
// btnROsToText
//
this.btnROsToText.AccessibleRole = System.Windows.Forms.AccessibleRole.PushButton;
this.btnROsToText.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
this.btnROsToText.ColorTable = DevComponents.DotNetBar.eButtonColor.OrangeWithBackground;
this.btnROsToText.DialogResult = System.Windows.Forms.DialogResult.OK;
this.btnROsToText.Location = new System.Drawing.Point(12, 231);
this.btnROsToText.Name = "btnROsToText";
this.btnROsToText.Size = new System.Drawing.Size(161, 30);
this.btnROsToText.Style = DevComponents.DotNetBar.eDotNetBarStyle.StyleManagerControlled;
this.btnROsToText.TabIndex = 2;
this.btnROsToText.Text = "Convert RO Values to Text";
this.btnROsToText.Click += new System.EventHandler(this.btnROsToText_Click);
//
// lblCurrentROs
//
this.lblCurrentROs.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
//
//
//
this.lblCurrentROs.BackgroundStyle.CornerType = DevComponents.DotNetBar.eCornerType.Square;
this.lblCurrentROs.Location = new System.Drawing.Point(179, 174);
this.lblCurrentROs.Name = "lblCurrentROs";
this.lblCurrentROs.Size = new System.Drawing.Size(398, 30);
this.lblCurrentROs.TabIndex = 3;
this.lblCurrentROs.Text = "Use the RO values currently assigned to the Working Draft. The RO values of thi" +
"s procedure may change during the import process and will need to be verified.";
this.lblCurrentROs.UseMnemonic = false;
this.lblCurrentROs.WordWrap = true;
//
// lblROsToText
//
this.lblROsToText.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
//
//
//
this.lblROsToText.BackgroundStyle.CornerType = DevComponents.DotNetBar.eCornerType.Square;
this.lblROsToText.Location = new System.Drawing.Point(179, 231);
this.lblROsToText.Name = "lblROsToText";
this.lblROsToText.Size = new System.Drawing.Size(384, 30);
this.lblROsToText.TabIndex = 3;
this.lblROsToText.Text = "The RO Values in the imported procedure will be convert to text.";
this.lblROsToText.UseMnemonic = false;
this.lblROsToText.WordWrap = true;
//
// btnCancel
//
this.btnCancel.AccessibleRole = System.Windows.Forms.AccessibleRole.PushButton;
this.btnCancel.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
this.btnCancel.ColorTable = DevComponents.DotNetBar.eButtonColor.OrangeWithBackground;
this.btnCancel.DialogResult = System.Windows.Forms.DialogResult.Cancel;
this.btnCancel.Location = new System.Drawing.Point(12, 288);
this.btnCancel.Name = "btnCancel";
this.btnCancel.ShowSubItems = false;
this.btnCancel.Size = new System.Drawing.Size(161, 30);
this.btnCancel.Style = DevComponents.DotNetBar.eDotNetBarStyle.StyleManagerControlled;
this.btnCancel.TabIndex = 2;
this.btnCancel.Text = "Cancel";
this.btnCancel.Click += new System.EventHandler(this.btnCancel_Click);
//
// labelX2
//
this.labelX2.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
//
//
//
this.labelX2.BackgroundStyle.CornerType = DevComponents.DotNetBar.eCornerType.Square;
this.labelX2.Location = new System.Drawing.Point(179, 288);
this.labelX2.Name = "labelX2";
this.labelX2.Size = new System.Drawing.Size(209, 30);
this.labelX2.TabIndex = 3;
this.labelX2.Text = "Cancel the importing of this procedure";
this.labelX2.UseMnemonic = false;
this.labelX2.WordWrap = true;
//
// rtbROPathInfo
//
this.rtbROPathInfo.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
| System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.rtbROPathInfo.BackColorRichTextBox = System.Drawing.SystemColors.Info;
//
//
//
this.rtbROPathInfo.BackgroundStyle.Class = "RichTextBoxBorder";
this.rtbROPathInfo.BackgroundStyle.CornerType = DevComponents.DotNetBar.eCornerType.Square;
this.rtbROPathInfo.DetectUrls = false;
this.rtbROPathInfo.Font = new System.Drawing.Font("Microsoft Sans Serif", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.rtbROPathInfo.Location = new System.Drawing.Point(12, 18);
this.rtbROPathInfo.Name = "rtbROPathInfo";
this.rtbROPathInfo.ReadOnly = true;
this.rtbROPathInfo.Rtf = "{\\rtf1\\ansi\\ansicpg1252\\deff0{\\fonttbl{\\f0\\fnil\\fcharset0 Microsoft Sans Serif;}}" +
"\r\n\\viewkind4\\uc1\\pard\\lang1033\\f0\\fs18 richTextBoxEx1\\par\r\n}\r\n";
this.rtbROPathInfo.Size = new System.Drawing.Size(565, 141);
this.rtbROPathInfo.TabIndex = 5;
this.rtbROPathInfo.Text = "richTextBoxEx1";
this.rtbROPathInfo.WordWrap = false;
//
// dlgImpHowToHandleROs
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(589, 328);
this.Controls.Add(this.rtbROPathInfo);
this.Controls.Add(this.labelX2);
this.Controls.Add(this.lblROsToText);
this.Controls.Add(this.lblCurrentROs);
this.Controls.Add(this.btnCancel);
this.Controls.Add(this.btnROsToText);
this.Controls.Add(this.btnUseCurrentROs);
this.MaximizeBox = false;
this.MinimizeBox = false;
this.Name = "dlgImpHowToHandleROs";
this.ShowIcon = false;
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent;
this.Text = "Different RO Databases";
this.TopMost = true;
this.Load += new System.EventHandler(this.dlgImpHowToHandleROs_Load);
this.Resize += new System.EventHandler(this.dlgImpHowToHandleROs_Resize);
this.ResumeLayout(false);
}
#endregion
private DevComponents.DotNetBar.ButtonX btnUseCurrentROs;
private DevComponents.DotNetBar.ButtonX btnROsToText;
private DevComponents.DotNetBar.LabelX lblCurrentROs;
private DevComponents.DotNetBar.LabelX labelX2;
private DevComponents.DotNetBar.LabelX lblROsToText;
private DevComponents.DotNetBar.ButtonX btnCancel;
private DevComponents.DotNetBar.Controls.RichTextBoxEx rtbROPathInfo;
}
}

View File

@ -0,0 +1,68 @@
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
namespace VEPROMS
{
public partial class dlgImpHowToHandleROs : Form
{
private string _ImportedROFolder;
public string ImportedROFolder
{
get { return _ImportedROFolder; }
set { _ImportedROFolder = value; }
}
private string _WorkingDraftROFolder;
public string WorkingDraftROFolder
{
get { return _WorkingDraftROFolder; }
set { _WorkingDraftROFolder = value; }
}
private bool _CancelImport = true; // default to truen in case the dialog is closed with the red X in the upper right corner
public bool CancelImport
{
get { return _CancelImport; }
}
private bool _ConvertROsToText = false;
public bool ConvertROsToText
{
get { return _ConvertROsToText; }
}
public dlgImpHowToHandleROs()
{
InitializeComponent();
}
private void dlgImpHowToHandleROs_Load(object sender, EventArgs e)
{
rtbROPathInfo.Text = string.Format("The current Working Draft RO folder path is:\n\n {0}\n\nThe procedure you are trying to import is from a database that has the RO folder path:\n\n {1}\n\nSelect from the options below on how to handle the RO values when importing this procedure.", _WorkingDraftROFolder, _ImportedROFolder);
}
private void btnUseCurrentROs_Click(object sender, EventArgs e)
{
_ConvertROsToText = _CancelImport = false;
}
private void btnROsToText_Click(object sender, EventArgs e)
{
_CancelImport = false;
_ConvertROsToText = true;
}
private void btnCancel_Click(object sender, EventArgs e)
{
_CancelImport = true;
_ConvertROsToText = false;
}
private void dlgImpHowToHandleROs_Resize(object sender, EventArgs e)
{
rtbROPathInfo.Refresh();
}
}
}

View File

@ -0,0 +1,120 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
</root>