This commit is contained in:
John Jenko 2010-03-31 16:48:15 +00:00
parent 8d946d1f26
commit bf33f71a1a
4 changed files with 326 additions and 82 deletions

View File

@ -34,7 +34,7 @@ namespace DataLoader
get { return System.Diagnostics.Process.GetCurrentProcess().HandleCount; }
}
private bool RunWithDB2K = false;
private Item MigrateProcedure(OleDbConnection cn, DataRow dr, Item FromItem, string pth, DocVersion docver, bool convertProcedures)
private Item MigrateProcedure(OleDbConnection cn, DataRow dr, Item FromItem, string pth, DocVersion docver, bool convertProcedures, FormatInfo activeFormat)
{
dicOldStepSequence = new Dictionary<object, string>();
Stack<int> SubSectLevels = new Stack<int>(); // levels of subsections
@ -146,8 +146,8 @@ namespace DataLoader
EditSectId = 0;
// See if no caret convert...
FormatInfo docverFormat = docver.MyDocVersionInfo.ActiveFormat;
bool do_cvt = docverFormat.PlantFormat.FormatData.SectData.ConvertCaretToDelta;
//FormatInfo docverFormat = docver.MyDocVersionInfo.ActiveFormat;
bool do_cvt = activeFormat.PlantFormat.FormatData.SectData.ConvertCaretToDelta;//docverFormat.PlantFormat.FormatData.SectData.ConvertCaretToDelta;
// pass in a 0 on MakeContent for type of procedure, i.e. procedure = 0 (on type field)
// can we save itm.ItemID in a dictionary of outside trans? ex: otrans("vehlp\procs\0POP05-EO00",itm.ItemID)?
@ -223,7 +223,7 @@ namespace DataLoader
{
//if (ProcNumber == "016-001") //"017-001") //"082-002AB")
// Console.WriteLine("016-001"); //("017-001"); //"082-002AB");
SectItm = MigrateSection(parentitem, ProcNumber, cn, drw, ds.Tables["Steps"], SectItm, dicSecCount.Count > 0 ? true : false, pth, docver);
SectItm = MigrateSection(parentitem, ProcNumber, cn, drw, ds.Tables["Steps"], SectItm, dicSecCount.Count > 0 ? true : false, pth, docver, activeFormat);
// if no children, add first child (cont)
if (addpart)
{
@ -289,7 +289,7 @@ namespace DataLoader
return false;
}
private Item MigrateProcedures(OleDbConnection cn, string pth, DocVersion docver, bool convertProcedures)
private Item MigrateProcedures(OleDbConnection cn, string pth, DocVersion docver, bool convertProcedures, FormatInfo activeFormat)
{
Item FirstItm = null;
// Loop through Set File for each Procedure
@ -307,7 +307,7 @@ namespace DataLoader
{
if (OKtoProcessDBF(dr)) // look for duplicate SET file info - jsj 2/11/10
{
FrItm = MigrateProcedure(cn, dr, FrItm, pth, docver, convertProcedures);
FrItm = MigrateProcedure(cn, dr, FrItm, pth, docver, convertProcedures, activeFormat);
if (FirstItm == null) FirstItm = FrItm;
}
}

View File

@ -29,7 +29,14 @@ namespace DataLoader
/// </summary>
private void InitializeComponent()
{
this.components = new System.ComponentModel.Container();
this.sc = new System.Windows.Forms.SplitContainer();
this.lblProms16BitLoc = new System.Windows.Forms.Label();
this.cbxOnlyThisSet = new System.Windows.Forms.CheckBox();
this.btnLogLoc = new System.Windows.Forms.Button();
this.txbLogFileLoc = new System.Windows.Forms.TextBox();
this.lblLogFileLoc = new System.Windows.Forms.Label();
this.btnFixTransitions = new System.Windows.Forms.Button();
this.lblCurSetFolder = new System.Windows.Forms.Label();
this.lblProcessing = new System.Windows.Forms.Label();
this.cbFormatsOnly = new System.Windows.Forms.CheckBox();
@ -63,7 +70,9 @@ namespace DataLoader
this.statusStrip1 = new System.Windows.Forms.StatusStrip();
this.toolStripStatusLabel1 = new System.Windows.Forms.ToolStripStatusLabel();
this.tsslError = new System.Windows.Forms.ToolStripStatusLabel();
this.btnFixTransitions = new System.Windows.Forms.Button();
this.toolTip1 = new System.Windows.Forms.ToolTip(this.components);
this.lblBackupName = new System.Windows.Forms.Label();
this.tbxBackupFileName = new System.Windows.Forms.TextBox();
this.sc.Panel1.SuspendLayout();
this.sc.Panel2.SuspendLayout();
this.sc.SuspendLayout();
@ -80,6 +89,13 @@ namespace DataLoader
//
// sc.Panel1
//
this.sc.Panel1.Controls.Add(this.tbxBackupFileName);
this.sc.Panel1.Controls.Add(this.lblBackupName);
this.sc.Panel1.Controls.Add(this.lblProms16BitLoc);
this.sc.Panel1.Controls.Add(this.cbxOnlyThisSet);
this.sc.Panel1.Controls.Add(this.btnLogLoc);
this.sc.Panel1.Controls.Add(this.txbLogFileLoc);
this.sc.Panel1.Controls.Add(this.lblLogFileLoc);
this.sc.Panel1.Controls.Add(this.btnFixTransitions);
this.sc.Panel1.Controls.Add(this.lblCurSetFolder);
this.sc.Panel1.Controls.Add(this.lblProcessing);
@ -109,19 +125,93 @@ namespace DataLoader
this.sc.Panel1.Controls.Add(this.lblSection);
this.sc.Panel1.Controls.Add(this.lblProc);
this.sc.Panel1.Controls.Add(this.btnConvert);
this.sc.Panel1.DoubleClick += new System.EventHandler(this.sc_Panel1_DoubleClick);
//
// sc.Panel2
//
this.sc.Panel2.BackColor = System.Drawing.SystemColors.Control;
this.sc.Panel2.Controls.Add(this.tv);
this.sc.Size = new System.Drawing.Size(829, 547);
this.sc.SplitterDistance = 273;
this.sc.Size = new System.Drawing.Size(886, 545);
this.sc.SplitterDistance = 313;
this.sc.TabIndex = 46;
//
// lblProms16BitLoc
//
this.lblProms16BitLoc.AutoSize = true;
this.lblProms16BitLoc.BackColor = System.Drawing.SystemColors.Control;
this.lblProms16BitLoc.Location = new System.Drawing.Point(5, 38);
this.lblProms16BitLoc.Name = "lblProms16BitLoc";
this.lblProms16BitLoc.Size = new System.Drawing.Size(143, 17);
this.lblProms16BitLoc.TabIndex = 82;
this.lblProms16BitLoc.Text = "VE-PROMS Location:";
//
// cbxOnlyThisSet
//
this.cbxOnlyThisSet.AutoSize = true;
this.cbxOnlyThisSet.BackColor = System.Drawing.SystemColors.GradientActiveCaption;
this.cbxOnlyThisSet.Location = new System.Drawing.Point(31, 149);
this.cbxOnlyThisSet.Name = "cbxOnlyThisSet";
this.cbxOnlyThisSet.Size = new System.Drawing.Size(119, 21);
this.cbxOnlyThisSet.TabIndex = 81;
this.cbxOnlyThisSet.Text = "Only This Set:";
this.cbxOnlyThisSet.UseVisualStyleBackColor = false;
this.cbxOnlyThisSet.Visible = false;
//
// btnLogLoc
//
this.btnLogLoc.BackColor = System.Drawing.SystemColors.Info;
this.btnLogLoc.Location = new System.Drawing.Point(716, 62);
this.btnLogLoc.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
this.btnLogLoc.Name = "btnLogLoc";
this.btnLogLoc.Size = new System.Drawing.Size(158, 25);
this.btnLogLoc.TabIndex = 79;
this.btnLogLoc.Text = "[1] Log File Location...";
this.btnLogLoc.UseVisualStyleBackColor = false;
this.btnLogLoc.Click += new System.EventHandler(this.LogLoc_Click);
//
// txbLogFileLoc
//
this.txbLogFileLoc.BackColor = System.Drawing.SystemColors.Info;
this.txbLogFileLoc.Location = new System.Drawing.Point(131, 63);
this.txbLogFileLoc.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
this.txbLogFileLoc.Name = "txbLogFileLoc";
this.txbLogFileLoc.Size = new System.Drawing.Size(578, 22);
this.txbLogFileLoc.TabIndex = 78;
this.txbLogFileLoc.Text = "\\\\Volian-server\\04 ve-proms files\\Active Project Files\\32 Bit VE-PROMS\\Data Migra" +
"tion";
this.toolTip1.SetToolTip(this.txbLogFileLoc, "The location to place the conversion log files.\r\nCreate a folder for each plant.\r" +
"\nType in or use the Browse button at the right.");
this.txbLogFileLoc.TextChanged += new System.EventHandler(this.txbLogFileLoc_TextChanged);
//
// lblLogFileLoc
//
this.lblLogFileLoc.AutoSize = true;
this.lblLogFileLoc.BackColor = System.Drawing.SystemColors.Info;
this.lblLogFileLoc.Location = new System.Drawing.Point(5, 66);
this.lblLogFileLoc.Name = "lblLogFileLoc";
this.lblLogFileLoc.Size = new System.Drawing.Size(120, 17);
this.lblLogFileLoc.TabIndex = 77;
this.lblLogFileLoc.Text = "Log File Location:";
//
// btnFixTransitions
//
this.btnFixTransitions.BackColor = System.Drawing.SystemColors.Info;
this.btnFixTransitions.Location = new System.Drawing.Point(8, 232);
this.btnFixTransitions.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
this.btnFixTransitions.Name = "btnFixTransitions";
this.btnFixTransitions.Size = new System.Drawing.Size(86, 44);
this.btnFixTransitions.TabIndex = 76;
this.btnFixTransitions.Text = "[3] Fix Transitions";
this.toolTip1.SetToolTip(this.btnFixTransitions, "Do this after you convert the data.\r\nThis will place the proper text in\r\nthe tran" +
"sition links.");
this.btnFixTransitions.UseVisualStyleBackColor = false;
this.btnFixTransitions.Click += new System.EventHandler(this.btnFixTransitions_Click);
//
// lblCurSetFolder
//
this.lblCurSetFolder.AutoSize = true;
this.lblCurSetFolder.ForeColor = System.Drawing.Color.Blue;
this.lblCurSetFolder.Location = new System.Drawing.Point(222, 244);
this.lblCurSetFolder.Location = new System.Drawing.Point(240, 288);
this.lblCurSetFolder.Name = "lblCurSetFolder";
this.lblCurSetFolder.Size = new System.Drawing.Size(20, 17);
this.lblCurSetFolder.TabIndex = 75;
@ -131,7 +221,7 @@ namespace DataLoader
// lblProcessing
//
this.lblProcessing.AutoSize = true;
this.lblProcessing.Location = new System.Drawing.Point(4, 244);
this.lblProcessing.Location = new System.Drawing.Point(13, 288);
this.lblProcessing.Name = "lblProcessing";
this.lblProcessing.Size = new System.Drawing.Size(221, 17);
this.lblProcessing.TabIndex = 74;
@ -141,7 +231,7 @@ namespace DataLoader
// cbFormatsOnly
//
this.cbFormatsOnly.AutoSize = true;
this.cbFormatsOnly.Location = new System.Drawing.Point(636, 240);
this.cbFormatsOnly.Location = new System.Drawing.Point(715, 284);
this.cbFormatsOnly.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
this.cbFormatsOnly.Name = "cbFormatsOnly";
this.cbFormatsOnly.Size = new System.Drawing.Size(114, 21);
@ -152,31 +242,36 @@ namespace DataLoader
//
// btnBrowseVeProms
//
this.btnBrowseVeProms.Location = new System.Drawing.Point(637, 36);
this.btnBrowseVeProms.BackColor = System.Drawing.SystemColors.Control;
this.btnBrowseVeProms.Location = new System.Drawing.Point(715, 34);
this.btnBrowseVeProms.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
this.btnBrowseVeProms.Name = "btnBrowseVeProms";
this.btnBrowseVeProms.Size = new System.Drawing.Size(159, 23);
this.btnBrowseVeProms.Size = new System.Drawing.Size(159, 25);
this.btnBrowseVeProms.TabIndex = 72;
this.btnBrowseVeProms.Text = "Browse for VeProms...";
this.btnBrowseVeProms.UseVisualStyleBackColor = true;
this.toolTip1.SetToolTip(this.btnBrowseVeProms, "Browser for the location of VE-PROMS (16-bit version)");
this.btnBrowseVeProms.UseVisualStyleBackColor = false;
this.btnBrowseVeProms.Click += new System.EventHandler(this.btnBrowseVeProms_Click);
//
// tbVePromsPath
//
this.tbVePromsPath.Location = new System.Drawing.Point(3, 36);
this.tbVePromsPath.BackColor = System.Drawing.SystemColors.Window;
this.tbVePromsPath.Location = new System.Drawing.Point(152, 36);
this.tbVePromsPath.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
this.tbVePromsPath.Name = "tbVePromsPath";
this.tbVePromsPath.Size = new System.Drawing.Size(617, 22);
this.tbVePromsPath.Size = new System.Drawing.Size(557, 22);
this.tbVePromsPath.TabIndex = 71;
this.tbVePromsPath.Text = "C:\\16bit\\VE-PROMS";
this.toolTip1.SetToolTip(this.tbVePromsPath, "Type in the location of VE-PROMS (16-bit version)\r\nOR use the Browse button at th" +
"e right.");
this.tbVePromsPath.TextChanged += new System.EventHandler(this.tbVePromsPath_TextChanged);
//
// btnCtTok
//
this.btnCtTok.Location = new System.Drawing.Point(643, 0);
this.btnCtTok.Location = new System.Drawing.Point(649, 5);
this.btnCtTok.Margin = new System.Windows.Forms.Padding(4);
this.btnCtTok.Name = "btnCtTok";
this.btnCtTok.Size = new System.Drawing.Size(128, 25);
this.btnCtTok.Size = new System.Drawing.Size(128, 23);
this.btnCtTok.TabIndex = 70;
this.btnCtTok.Text = "Count Tokens";
this.btnCtTok.UseVisualStyleBackColor = true;
@ -185,10 +280,10 @@ namespace DataLoader
//
// btnGroup
//
this.btnGroup.Location = new System.Drawing.Point(516, -4);
this.btnGroup.Location = new System.Drawing.Point(522, 5);
this.btnGroup.Margin = new System.Windows.Forms.Padding(4);
this.btnGroup.Name = "btnGroup";
this.btnGroup.Size = new System.Drawing.Size(119, 28);
this.btnGroup.Size = new System.Drawing.Size(119, 23);
this.btnGroup.TabIndex = 69;
this.btnGroup.Text = "Group/Security";
this.btnGroup.UseVisualStyleBackColor = true;
@ -197,10 +292,10 @@ namespace DataLoader
//
// btnVETree_CSLA
//
this.btnVETree_CSLA.Location = new System.Drawing.Point(331, -1);
this.btnVETree_CSLA.Location = new System.Drawing.Point(337, 5);
this.btnVETree_CSLA.Margin = new System.Windows.Forms.Padding(4);
this.btnVETree_CSLA.Name = "btnVETree_CSLA";
this.btnVETree_CSLA.Size = new System.Drawing.Size(177, 26);
this.btnVETree_CSLA.Size = new System.Drawing.Size(177, 23);
this.btnVETree_CSLA.TabIndex = 68;
this.btnVETree_CSLA.Text = "Load VETree from CSLA";
this.btnVETree_CSLA.UseVisualStyleBackColor = true;
@ -209,10 +304,10 @@ namespace DataLoader
//
// btnBrowseVesam
//
this.btnBrowseVesam.Location = new System.Drawing.Point(637, 71);
this.btnBrowseVesam.Location = new System.Drawing.Point(716, 120);
this.btnBrowseVesam.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
this.btnBrowseVesam.Name = "btnBrowseVesam";
this.btnBrowseVesam.Size = new System.Drawing.Size(159, 23);
this.btnBrowseVesam.Size = new System.Drawing.Size(159, 24);
this.btnBrowseVesam.TabIndex = 67;
this.btnBrowseVesam.Text = "Browse for Vesam...";
this.btnBrowseVesam.UseVisualStyleBackColor = true;
@ -221,17 +316,17 @@ namespace DataLoader
//
// tbVesamPath
//
this.tbVesamPath.Location = new System.Drawing.Point(151, 71);
this.tbVesamPath.Location = new System.Drawing.Point(152, 120);
this.tbVesamPath.Margin = new System.Windows.Forms.Padding(4);
this.tbVesamPath.Name = "tbVesamPath";
this.tbVesamPath.Size = new System.Drawing.Size(469, 22);
this.tbVesamPath.Size = new System.Drawing.Size(557, 22);
this.tbVesamPath.TabIndex = 66;
this.tbVesamPath.Text = "C:\\16bit\\Ve-proms\\vesam.opt";
this.tbVesamPath.Visible = false;
//
// btnVesam
//
this.btnVesam.Location = new System.Drawing.Point(3, 69);
this.btnVesam.Location = new System.Drawing.Point(4, 118);
this.btnVesam.Margin = new System.Windows.Forms.Padding(4);
this.btnVesam.Name = "btnVesam";
this.btnVesam.Size = new System.Drawing.Size(144, 26);
@ -243,10 +338,10 @@ namespace DataLoader
//
// btnLoadTreeCSLA
//
this.btnLoadTreeCSLA.Location = new System.Drawing.Point(164, 0);
this.btnLoadTreeCSLA.Location = new System.Drawing.Point(170, 5);
this.btnLoadTreeCSLA.Margin = new System.Windows.Forms.Padding(4);
this.btnLoadTreeCSLA.Name = "btnLoadTreeCSLA";
this.btnLoadTreeCSLA.Size = new System.Drawing.Size(159, 25);
this.btnLoadTreeCSLA.Size = new System.Drawing.Size(159, 23);
this.btnLoadTreeCSLA.TabIndex = 64;
this.btnLoadTreeCSLA.Text = "Load Tree from CSLA";
this.btnLoadTreeCSLA.UseVisualStyleBackColor = true;
@ -258,7 +353,7 @@ namespace DataLoader
this.cbLazy.AutoSize = true;
this.cbLazy.Checked = true;
this.cbLazy.CheckState = System.Windows.Forms.CheckState.Checked;
this.cbLazy.Location = new System.Drawing.Point(636, 214);
this.cbLazy.Location = new System.Drawing.Point(715, 259);
this.cbLazy.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
this.cbLazy.Name = "cbLazy";
this.cbLazy.Size = new System.Drawing.Size(96, 21);
@ -269,7 +364,7 @@ namespace DataLoader
//
// btnConvertSelected
//
this.btnConvertSelected.Location = new System.Drawing.Point(225, 212);
this.btnConvertSelected.Location = new System.Drawing.Point(226, 257);
this.btnConvertSelected.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
this.btnConvertSelected.Name = "btnConvertSelected";
this.btnConvertSelected.Size = new System.Drawing.Size(201, 23);
@ -281,7 +376,7 @@ namespace DataLoader
//
// btnLoadTreeDB
//
this.btnLoadTreeDB.Location = new System.Drawing.Point(0, 0);
this.btnLoadTreeDB.Location = new System.Drawing.Point(6, 5);
this.btnLoadTreeDB.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
this.btnLoadTreeDB.Name = "btnLoadTreeDB";
this.btnLoadTreeDB.Size = new System.Drawing.Size(157, 23);
@ -296,7 +391,7 @@ namespace DataLoader
this.cbPurgeData.AutoSize = true;
this.cbPurgeData.Checked = true;
this.cbPurgeData.CheckState = System.Windows.Forms.CheckState.Checked;
this.cbPurgeData.Location = new System.Drawing.Point(636, 188);
this.cbPurgeData.Location = new System.Drawing.Point(715, 232);
this.cbPurgeData.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
this.cbPurgeData.Name = "cbPurgeData";
this.cbPurgeData.Size = new System.Drawing.Size(154, 21);
@ -308,33 +403,33 @@ namespace DataLoader
// lblTime
//
this.lblTime.BackColor = System.Drawing.SystemColors.ButtonShadow;
this.lblTime.Location = new System.Drawing.Point(92, 206);
this.lblTime.Location = new System.Drawing.Point(108, 251);
this.lblTime.Name = "lblTime";
this.lblTime.Size = new System.Drawing.Size(112, 25);
this.lblTime.TabIndex = 58;
//
// pbStep
//
this.pbStep.Location = new System.Drawing.Point(212, 185);
this.pbStep.Location = new System.Drawing.Point(226, 228);
this.pbStep.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
this.pbStep.Name = "pbStep";
this.pbStep.Size = new System.Drawing.Size(411, 18);
this.pbStep.Size = new System.Drawing.Size(483, 18);
this.pbStep.TabIndex = 57;
//
// pbSect
//
this.pbSect.Location = new System.Drawing.Point(212, 161);
this.pbSect.Location = new System.Drawing.Point(226, 206);
this.pbSect.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
this.pbSect.Name = "pbSect";
this.pbSect.Size = new System.Drawing.Size(409, 18);
this.pbSect.Size = new System.Drawing.Size(483, 18);
this.pbSect.TabIndex = 56;
//
// pbProc
//
this.pbProc.Location = new System.Drawing.Point(212, 137);
this.pbProc.Location = new System.Drawing.Point(226, 182);
this.pbProc.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
this.pbProc.Name = "pbProc";
this.pbProc.Size = new System.Drawing.Size(411, 18);
this.pbProc.Size = new System.Drawing.Size(483, 18);
this.pbProc.TabIndex = 55;
//
// cbSaveDoc
@ -342,7 +437,7 @@ namespace DataLoader
this.cbSaveDoc.AutoSize = true;
this.cbSaveDoc.Checked = true;
this.cbSaveDoc.CheckState = System.Windows.Forms.CheckState.Checked;
this.cbSaveDoc.Location = new System.Drawing.Point(637, 137);
this.cbSaveDoc.Location = new System.Drawing.Point(716, 182);
this.cbSaveDoc.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
this.cbSaveDoc.Name = "cbSaveDoc";
this.cbSaveDoc.Size = new System.Drawing.Size(96, 21);
@ -355,7 +450,7 @@ namespace DataLoader
// cbSaveRTF
//
this.cbSaveRTF.AutoSize = true;
this.cbSaveRTF.Location = new System.Drawing.Point(637, 162);
this.cbSaveRTF.Location = new System.Drawing.Point(716, 207);
this.cbSaveRTF.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
this.cbSaveRTF.Name = "cbSaveRTF";
this.cbSaveRTF.Size = new System.Drawing.Size(93, 21);
@ -367,31 +462,32 @@ namespace DataLoader
//
// btnBrowse
//
this.btnBrowse.Location = new System.Drawing.Point(637, 103);
this.btnBrowse.BackColor = System.Drawing.SystemColors.GradientActiveCaption;
this.btnBrowse.Location = new System.Drawing.Point(716, 148);
this.btnBrowse.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
this.btnBrowse.Name = "btnBrowse";
this.btnBrowse.Size = new System.Drawing.Size(75, 23);
this.btnBrowse.Size = new System.Drawing.Size(158, 23);
this.btnBrowse.TabIndex = 52;
this.btnBrowse.Text = "Browse...";
this.btnBrowse.UseVisualStyleBackColor = true;
this.btnBrowse.Text = "Browse For Set...";
this.btnBrowse.UseVisualStyleBackColor = false;
this.btnBrowse.Visible = false;
this.btnBrowse.Click += new System.EventHandler(this.btnBrowse_Click);
//
// tbSource
//
this.tbSource.Location = new System.Drawing.Point(93, 103);
this.tbSource.BackColor = System.Drawing.SystemColors.GradientActiveCaption;
this.tbSource.Location = new System.Drawing.Point(152, 148);
this.tbSource.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
this.tbSource.Name = "tbSource";
this.tbSource.Size = new System.Drawing.Size(528, 22);
this.tbSource.Size = new System.Drawing.Size(557, 22);
this.tbSource.TabIndex = 51;
this.tbSource.Text = "i:\\vedata\\vewcnfp\\fp.prc";
this.tbSource.Visible = false;
this.tbSource.TextChanged += new System.EventHandler(this.tbSource_TextChanged);
//
// lblStep
//
this.lblStep.BackColor = System.Drawing.SystemColors.ButtonShadow;
this.lblStep.Location = new System.Drawing.Point(92, 181);
this.lblStep.Location = new System.Drawing.Point(108, 226);
this.lblStep.Name = "lblStep";
this.lblStep.Size = new System.Drawing.Size(112, 25);
this.lblStep.TabIndex = 49;
@ -399,7 +495,7 @@ namespace DataLoader
// lblSection
//
this.lblSection.BackColor = System.Drawing.SystemColors.ButtonShadow;
this.lblSection.Location = new System.Drawing.Point(92, 158);
this.lblSection.Location = new System.Drawing.Point(108, 203);
this.lblSection.Name = "lblSection";
this.lblSection.Size = new System.Drawing.Size(112, 23);
this.lblSection.TabIndex = 48;
@ -407,29 +503,33 @@ namespace DataLoader
// lblProc
//
this.lblProc.BackColor = System.Drawing.SystemColors.ButtonShadow;
this.lblProc.Location = new System.Drawing.Point(92, 134);
this.lblProc.Location = new System.Drawing.Point(108, 179);
this.lblProc.Name = "lblProc";
this.lblProc.Size = new System.Drawing.Size(112, 23);
this.lblProc.TabIndex = 47;
//
// btnConvert
//
this.btnConvert.Location = new System.Drawing.Point(7, 134);
this.btnConvert.BackColor = System.Drawing.SystemColors.Info;
this.btnConvert.Location = new System.Drawing.Point(8, 179);
this.btnConvert.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
this.btnConvert.Name = "btnConvert";
this.btnConvert.Size = new System.Drawing.Size(75, 49);
this.btnConvert.Size = new System.Drawing.Size(86, 49);
this.btnConvert.TabIndex = 46;
this.btnConvert.Text = "Convert Data";
this.btnConvert.Text = "[2] Convert Data";
this.toolTip1.SetToolTip(this.btnConvert, "This will convert the data found via your DataPath \r\ndefined in your cfg file \r\n(" +
"the one used with 16-bit VE-PROMS)");
this.btnConvert.UseVisualStyleBackColor = false;
this.btnConvert.Click += new System.EventHandler(this.btnConvert_Click);
//
// tv
//
this.tv.CheckBoxes = true;
this.tv.Dock = System.Windows.Forms.DockStyle.Bottom;
this.tv.Location = new System.Drawing.Point(0, 12);
this.tv.Location = new System.Drawing.Point(0, 2);
this.tv.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
this.tv.Name = "tv";
this.tv.Size = new System.Drawing.Size(829, 258);
this.tv.Size = new System.Drawing.Size(886, 226);
this.tv.TabIndex = 24;
this.tv.BeforeExpand += new System.Windows.Forms.TreeViewCancelEventHandler(this.tv_BeforeExpand);
this.tv.AfterSelect += new System.Windows.Forms.TreeViewEventHandler(this.tv_AfterSelect);
@ -439,10 +539,10 @@ namespace DataLoader
this.statusStrip1.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
this.toolStripStatusLabel1,
this.tsslError});
this.statusStrip1.Location = new System.Drawing.Point(0, 502);
this.statusStrip1.Location = new System.Drawing.Point(0, 500);
this.statusStrip1.Name = "statusStrip1";
this.statusStrip1.Padding = new System.Windows.Forms.Padding(1, 0, 19, 0);
this.statusStrip1.Size = new System.Drawing.Size(829, 45);
this.statusStrip1.Size = new System.Drawing.Size(886, 45);
this.statusStrip1.TabIndex = 47;
this.statusStrip1.Text = "statusStrip1";
//
@ -463,21 +563,33 @@ namespace DataLoader
this.tsslError.Text = "No Errors";
this.tsslError.TextAlign = System.Drawing.ContentAlignment.TopLeft;
//
// btnFixTransitions
// lblBackupName
//
this.btnFixTransitions.Location = new System.Drawing.Point(3, 187);
this.btnFixTransitions.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
this.btnFixTransitions.Name = "btnFixTransitions";
this.btnFixTransitions.Size = new System.Drawing.Size(87, 44);
this.btnFixTransitions.TabIndex = 76;
this.btnFixTransitions.Text = "Fix Transitions";
this.btnFixTransitions.Click += new System.EventHandler(this.btnFixTransitions_Click);
this.lblBackupName.AutoSize = true;
this.lblBackupName.BackColor = System.Drawing.SystemColors.Info;
this.lblBackupName.Location = new System.Drawing.Point(5, 95);
this.lblBackupName.Name = "lblBackupName";
this.lblBackupName.Size = new System.Drawing.Size(126, 17);
this.lblBackupName.TabIndex = 83;
this.lblBackupName.Text = "Backup File Name:";
//
// tbxBackupFileName
//
this.tbxBackupFileName.BackColor = System.Drawing.SystemColors.Info;
this.tbxBackupFileName.Location = new System.Drawing.Point(137, 92);
this.tbxBackupFileName.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
this.tbxBackupFileName.Name = "tbxBackupFileName";
this.tbxBackupFileName.Size = new System.Drawing.Size(268, 22);
this.tbxBackupFileName.TabIndex = 84;
this.tbxBackupFileName.Text = "VEPROMS.bck";
this.toolTip1.SetToolTip(this.tbxBackupFileName, "The file name that will be used in the backup and restore batch files\r\nthat will " +
"be created in the same folder as the conversion log files.");
//
// frmLoader
//
this.AutoScaleDimensions = new System.Drawing.SizeF(8F, 16F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(829, 547);
this.ClientSize = new System.Drawing.Size(886, 545);
this.Controls.Add(this.statusStrip1);
this.Controls.Add(this.sc);
this.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
@ -533,5 +645,13 @@ namespace DataLoader
private System.Windows.Forms.Label lblCurSetFolder;
private System.Windows.Forms.Label lblProcessing;
private System.Windows.Forms.Button btnFixTransitions;
private System.Windows.Forms.TextBox txbLogFileLoc;
private System.Windows.Forms.Label lblLogFileLoc;
private System.Windows.Forms.Button btnLogLoc;
private System.Windows.Forms.ToolTip toolTip1;
private System.Windows.Forms.CheckBox cbxOnlyThisSet;
private System.Windows.Forms.Label lblProms16BitLoc;
private System.Windows.Forms.TextBox tbxBackupFileName;
private System.Windows.Forms.Label lblBackupName;
}
}

View File

@ -134,7 +134,12 @@ namespace DataLoader
//tbSource.Text = @"G:\PromsDat\VEHP1B\SAMGS.PRC";// South Texas STPNOC
break;
default:
throw new Exception("Not configured for " + SystemInformation.ComputerName);
#if (!DEBUG)
tbSource.Text = "";
break;
#else
throw new Exception("Not configured for " + SystemInformation.ComputerName);
#endif
}
}
private void btnConvertSelected_Click(object sender, EventArgs e)
@ -232,6 +237,11 @@ namespace DataLoader
private void btnConvert_Click(object sender, System.EventArgs e)
{
if (!CheckLogPath()) return;
#if (!DEBUG)
DialogResult dlgrst = MessageBox.Show("The VE-PROMS data currently in SQL Server (Express) will be deleted.\r\n\nProceed with Data Conversion?", "WARNING", MessageBoxButtons.YesNo, MessageBoxIcon.Warning);
if (dlgrst == DialogResult.No) return;
#endif
try
{
//TextConvert.ResetSpecialCharacters();
@ -270,26 +280,34 @@ namespace DataLoader
}
if (success)
{
bool allSets = !_DeveloperMode || !cbxOnlyThisSet.Checked;
TimeSpan ts = new TimeSpan();
DocVersionInfoList vl = DocVersionInfoList.Get();
DocVersion v = null;
MyError = "Computer Name: " + SystemInformation.ComputerName.ToUpper();
foreach (DocVersionInfo vi in vl)
{
//if (vi.Title.ToUpper() == tbSource.Text.ToUpper()) // is this the procedure set we want to convert?
//{
//if (!_DeveloperMode || (cbxOnlyThisSet.Checked && vi.Title.ToUpper() == tbSource.Text.ToUpper())) // is this the procedure set we want to convert?
if (allSets || (cbxOnlyThisSet.Checked && vi.Title.ToUpper() == tbSource.Text.ToUpper())) // is this the procedure set we want to convert?
{
v = DocVersion.Get(vi.VersionID);
Status = "Load " + v.Title + " - " + v.Name;
lblCurSetFolder.Text = v.Title;
lblCurSetFolder.Visible = true;
lblProcessing.Visible = true;
MyError = "Data Set: " + v.Title;
ts += ldr.MigrateDocVersion(v, true);
//}
}
//v = DocVersion.Get(vi.VersionID);
//bool convertProcedures = (vi.Title.ToUpper() == tbSource.Text.ToUpper());
//Item itm = ldr.MigrateDocVersion(v, convertProcedures);
}
MessageBox.Show(string.Format("Conversion completion time: {0:D2}:{1:D2}:{2:D2}.{3}\r\n\n({4} Total Seconds)", ts.Hours, ts.Minutes, ts.Seconds, ts.Milliseconds, ts.TotalSeconds));
string ConversionTime = string.Format("Conversion completion time: {0:D2}:{1:D2}:{2:D2}.{3}", ts.Hours, ts.Minutes, ts.Seconds, ts.Milliseconds);
MyError = ConversionTime;
SaveLogFiles();
MessageBox.Show(string.Format("{0}\r\n\n({1} Total Seconds)", ConversionTime, ts.TotalSeconds));
//MessageBox.Show(string.Format("Conversion completion time: {0:D2}:{1:D2}:{2:D2}.{3}\r\n\n({4} Total Seconds)", ts.Hours, ts.Minutes, ts.Seconds, ts.Milliseconds, ts.TotalSeconds));
//MessageBox.Show(string.Format("{0} seconds", ts.TotalSeconds));
//TextConvert.ListSpecialCharacters();
}
@ -297,6 +315,7 @@ namespace DataLoader
catch (Exception ex)
{
AddError("===================== Fatal Error ==========================\r\n{0} - {1}", ex.GetType().Name, ex.Message);
SaveLogFiles();
MessageBox.Show(ex.Message, "Fatal Error During Loading", MessageBoxButtons.OK, MessageBoxIcon.Error);
_MyLog.Fatal(ex.Message);
}
@ -401,11 +420,6 @@ namespace DataLoader
f.ShowDialog();
}
private void tbSource_TextChanged(object sender, EventArgs e)
{
}
private void btnCtTok_Click(object sender, EventArgs e)
{
frmCntTkn frm = new frmCntTkn();
@ -454,18 +468,23 @@ namespace DataLoader
this.cbSaveRTF.CheckState = Properties.Settings.Default.LoadRTFDoc;
if (Properties.Settings.Default["VePromsFilename"] != null)
this.tbVePromsPath.Text = Properties.Settings.Default.VePromsFilename;
if (Properties.Settings.Default["LogFileLoc"].ToString() != "")
this.txbLogFileLoc.Text = Properties.Settings.Default.LogFileLoc;
if (Properties.Settings.Default["BackupFileName"].ToString() != "")
this.tbxBackupFileName.Text = Properties.Settings.Default.BackupFileName;
_Loading = false;
}
private void frmLoader_FormClosing(object sender, FormClosingEventArgs e)
{
TextConvert.MyGlitches.Save(@"C:\Temp\ConversionGlitches.xml");
Properties.Settings.Default.VeSamFilename = tbVesamPath.Text;
Properties.Settings.Default.DbfPathname = tbSource.Text;
Properties.Settings.Default.LoadWordDoc = cbSaveDoc.CheckState;
Properties.Settings.Default.LoadRTFDoc = cbSaveRTF.CheckState;
Properties.Settings.Default.PurgeData = cbPurgeData.CheckState;
Properties.Settings.Default.VePromsFilename = tbVePromsPath.Text;
Properties.Settings.Default.LogFileLoc = txbLogFileLoc.Text;
Properties.Settings.Default.BackupFileName = tbxBackupFileName.Text;
Properties.Settings.Default.Save();
}
private void btnBrowseVeProms_Click(object sender, EventArgs e)
@ -482,16 +501,118 @@ namespace DataLoader
private void btnFixTransitions_Click(object sender, EventArgs e)
{
if (!CheckLogPath()) return;
StepRTB rtb = new StepRTB();
TransitionFixer myFixer = new TransitionFixer(rtb);
TransitionFixer myFixer = new TransitionFixer(rtb,_LogFilePath);
myFixer.StatusChanged += new TransitionFixerEvent(myFixer_StatusChanged);
TimeSpan howlong = myFixer.Process();
MessageBox.Show(string.Format("Fix Transitions completion time: {0:D2}:{1:D2}:{2:D2}.{3}\r\n\n({4} Total Seconds)", howlong.Hours, howlong.Minutes, howlong.Seconds, howlong.Milliseconds, howlong.TotalSeconds));
string TransFixTime = string.Format("Fix Transitions completion time: {0:D2}:{1:D2}:{2:D2}.{3}", howlong.Hours, howlong.Minutes, howlong.Seconds, howlong.Milliseconds);
MyError = TransFixTime;
MessageBox.Show(string.Format("{0}\r\n\n({1} Total Seconds)", TransFixTime, howlong.TotalSeconds));
//MessageBox.Show(string.Format("Fix Transitions completion time: {0:D2}:{1:D2}:{2:D2}.{3}\r\n\n({4} Total Seconds)", howlong.Hours, howlong.Minutes, howlong.Seconds, howlong.Milliseconds, howlong.TotalSeconds));
CreateBackupRestoreBatchFiles();
}
void myFixer_StatusChanged(object sender, TransitionFixerEventArgs args)
{
Status = args.MyStatus;
}
private bool _DeveloperMode = false;
private void ToggleDeveloperMode()
{
DialogResult dr = MessageBox.Show((_DeveloperMode)?"Make the User Interface Less Confusing?":"Make the User Interface More Confusing?", "DataLoader UI", MessageBoxButtons.YesNo,MessageBoxIcon.Question);
if (dr == DialogResult.Yes)
{
_DeveloperMode = !_DeveloperMode;
btnLoadTreeDB.Visible = _DeveloperMode;
btnLoadTreeCSLA.Visible = _DeveloperMode;
btnVETree_CSLA.Visible = _DeveloperMode;
btnGroup.Visible = _DeveloperMode;
btnCtTok.Visible = _DeveloperMode;
btnVesam.Visible = _DeveloperMode;
tbVesamPath.Visible = _DeveloperMode;
btnBrowseVesam.Visible = _DeveloperMode;
tbSource.Visible = _DeveloperMode;
btnBrowse.Visible = _DeveloperMode;
cbSaveDoc.Visible = _DeveloperMode;
cbSaveRTF.Visible = _DeveloperMode;
cbPurgeData.Visible = _DeveloperMode;
cbLazy.Visible = _DeveloperMode;
cbFormatsOnly.Visible = _DeveloperMode;
btnConvertSelected.Visible = _DeveloperMode;
cbxOnlyThisSet.Visible = _DeveloperMode;
}
}
private void sc_Panel1_DoubleClick(object sender, EventArgs e)
{
ToggleDeveloperMode();
}
private void LogLoc_Click(object sender, EventArgs e)
{
fbd.SelectedPath = txbLogFileLoc.Text;
if (fbd.ShowDialog() == DialogResult.OK)
txbLogFileLoc.Text = fbd.SelectedPath;
}
private bool _DidLogPathCheck = false;
private string _LogFilePath = "";
private bool CheckLogPath()
{
bool rtn = false;
if (_DidLogPathCheck) return true;
try
{
_LogFilePath = txbLogFileLoc.Text;
if (!Directory.Exists(_LogFilePath))
Directory.CreateDirectory(_LogFilePath);
if (_LogFilePath.EndsWith(@"\")) _LogFilePath = _LogFilePath.Substring(0, _LogFilePath.Length - 1);
rtn = true;
_DidLogPathCheck = true;
}
catch (Exception ex)
{
MessageBox.Show(ex.Message, "Invalid Path for Log Files", MessageBoxButtons.OK, MessageBoxIcon.Error);
}
return rtn;
}
private void SaveLogFiles()
{
if (_LogFilePath == "") return;
// Save the Glitches log
if (TextConvert.MyGlitches.Glitches.Count > 0)
TextConvert.MyGlitches.Save(_LogFilePath + @"\ConversionGlitches.xml");
// Save the Error Log
if (_MyFrmErrors.ItemCount() > 0)
_MyFrmErrors.Save(_LogFilePath + @"\ConversionErrors.txt");
}
private bool _EnteredFileLoc = false;
private void txbLogFileLoc_TextChanged(object sender, EventArgs e)
{
_DidLogPathCheck = false;
}
private void CreateBackupRestoreBatchFiles()
{
string pause = "pause";
string bckupFileName = tbxBackupFileName.Text;
if (!bckupFileName.EndsWith(".bck")) bckupFileName += ".bck";
string backupPath = _LogFilePath + @"\" + bckupFileName;
string bckupcmd = "sqlcmd -E -S.\\sqlexpress -Q \"backup database [VEPROMS] to disk = '" + backupPath + "'\"";
string rstorecmd = "sqlcmd -E -S.\\sqlexpress -Q \"restore database [VEPROMS] from disk = '" + backupPath + "'\"";
StreamWriter fsbackup = new StreamWriter(_LogFilePath + @"\BackupVEPROMS.bat");
fsbackup.WriteLine(bckupcmd);
fsbackup.WriteLine(pause);
fsbackup.Close();
StreamWriter fsrestore = new StreamWriter(_LogFilePath + @"\RestoreVEPROMS.bat");
fsrestore.WriteLine(rstorecmd);
fsrestore.WriteLine(pause);
fsrestore.Close();
}
}
}

View File

@ -117,6 +117,9 @@
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<metadata name="toolTip1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>217, 17</value>
</metadata>
<metadata name="fbd.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>17, 17</value>
</metadata>