diff --git a/PROMS/DataLoader/App.config b/PROMS/DataLoader/App.config
new file mode 100644
index 00000000..9c834cfe
--- /dev/null
+++ b/PROMS/DataLoader/App.config
@@ -0,0 +1,71 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/PROMS/DataLoader/ClassDiagram1.cd b/PROMS/DataLoader/ClassDiagram1.cd
new file mode 100644
index 00000000..0519ecba
--- /dev/null
+++ b/PROMS/DataLoader/ClassDiagram1.cd
@@ -0,0 +1 @@
+
\ No newline at end of file
diff --git a/PROMS/DataLoader/ConfigInfo.cs b/PROMS/DataLoader/ConfigInfo.cs
new file mode 100644
index 00000000..054d3986
--- /dev/null
+++ b/PROMS/DataLoader/ConfigInfo.cs
@@ -0,0 +1,79 @@
+// ========================================================================
+// Copyright 2006 - Volian Enterprises, Inc. All rights reserved.
+// Volian Enterprises - Proprietary Information - DO NOT COPY OR DISTRIBUTE
+// ------------------------------------------------------------------------
+// $Workfile: $ $Revision: $
+// $Author: $ $Date: $
+//
+// $History: $
+// ========================================================================
+using System;
+using System.Collections.Generic;
+using System.Text;
+using System.Xml;
+
+namespace DataLoader
+{
+ class ConfigInfo
+ {
+ private XmlDocument xmldoc;
+ public ConfigInfo(string xml)
+ {
+ xmldoc = new XmlDocument();
+ if (xml == null)
+ xmldoc.LoadXml("");
+ else
+ xmldoc.LoadXml(xml);
+ }
+
+ public ConfigInfo(string xml, string ename, string aname, string avalue)
+ {
+ xmldoc = new XmlDocument();
+ if (xml == null)
+ xmldoc.LoadXml("");
+ else
+ xmldoc.LoadXml(xml);
+ AddItem(ename, aname.Replace(' ','_'), avalue);
+ }
+ public bool AddItem(string ename, string aname, string avalue)
+ {
+ if (aname != null && aname != "")
+ {
+ //if (xmldoc == null)
+ //{
+ // xmldoc = new XmlDocument();
+ // xmldoc.AppendChild(xmldoc.CreateElement("ConfigInfo"));
+ //}
+ // see if ename element exists, use it to add attributes,
+ // otherwise, create the element.
+
+ XmlNode nxml = null;
+ XmlNodeList xl = xmldoc.DocumentElement.SelectNodes(string.Format("//{0}", ename));
+ switch (xl.Count)
+ {
+ case 0: // No nodes found
+ nxml = xmldoc.DocumentElement.AppendChild(xmldoc.CreateElement(ename));
+ break;
+ default: // Found the node
+ nxml = xl[0];
+ if (nxml.GetType() != typeof(XmlElement))
+ {
+ frmLoader.log.ErrorFormat("Invalid xml element type when migrating config data - element = {0}, name = {1} , value = {2}", ename, aname, avalue);
+ return false;
+ }
+ break;
+ }
+ XmlAttribute xa = nxml.Attributes.Append(xmldoc.CreateAttribute(aname.Replace(' ', '_')));
+ xa.Value = avalue;
+ return true;
+ }
+ return false;
+ }
+ public override string ToString()
+ {
+ if (xmldoc != null) return xmldoc.InnerXml;
+ else return null;
+ }
+
+ }
+}
diff --git a/PROMS/DataLoader/CurSet.cs b/PROMS/DataLoader/CurSet.cs
new file mode 100644
index 00000000..c458037b
--- /dev/null
+++ b/PROMS/DataLoader/CurSet.cs
@@ -0,0 +1,110 @@
+// ========================================================================
+// Copyright 2006 - Volian Enterprises, Inc. All rights reserved.
+// Volian Enterprises - Proprietary Information - DO NOT COPY OR DISTRIBUTE
+// ------------------------------------------------------------------------
+// $Workfile: $ $Revision: $
+// $Author: $ $Date: $
+//
+// $History: $
+// ========================================================================
+
+using System;
+using System.IO;
+using System.Collections;
+using System.Text;
+using System.Windows.Forms;
+using System.Xml;
+using System.Xml.Serialization;
+using Volian.CSLA.Library;
+
+namespace Utils
+{
+ ///
+ /// Summary description for CurSet.
+ ///
+ public class CurSet
+ {
+ private int NUMCBTEXTYPE = 5; // number of changebar text types.
+ public string PathName;
+
+ public CurSet(string pname)
+ {
+ PathName = pname;
+ }
+
+ private string ReadTheString(BinaryReader bw, int maxlen)
+ {
+ StringBuilder retStr = new StringBuilder(maxlen+1);
+ // read a series of characters until a null is found.
+ char ac;
+ bool done = false;
+ while(done==false)
+ {
+ ac = bw.ReadChar();
+ if (ac=='\0')
+ done=true;
+ else
+ retStr.Append(ac);
+ }
+ return retStr.ToString();
+ }
+
+ public FolderConfig Convert(FolderConfig cfg)
+ {
+ BinaryReader br;
+ ArrayList DefaultUserCBMsg = new ArrayList(2);
+ FileStream fs;
+ FileInfo fi = new FileInfo(PathName);
+ try
+ {
+ fs = fi.Open(FileMode.Open, FileAccess.Read, FileShare.ReadWrite );
+ br = new BinaryReader(fs,System.Text.ASCIIEncoding.ASCII);
+ }
+ catch (Exception e)
+ {
+ DataLoader.frmLoader.log.ErrorFormat("Error migrating Curset.dat, error = {0}", e.Message);
+ return cfg;
+ }
+
+ try
+ {
+ sbyte tmpsbyte;
+ string tmpstring;
+ tmpsbyte=br.ReadSByte(); // DefaultDestination not used
+
+ // the next byte has three settings embedded in it, the type of change
+ // bar (Print_ChangeBar), the change bar location and its text.
+ tmpsbyte= br.ReadSByte();
+ cfg.Print_ChangeBar = (FolderConfig.PrintChangeBar)((int)tmpsbyte > 2 ? 3 : (int)tmpsbyte);
+ cfg.Print_ChangeBarLoc = (FolderConfig.PrintChangeBarLoc)((tmpsbyte-3)/NUMCBTEXTYPE);
+ int ts = (tmpsbyte-3)%NUMCBTEXTYPE;
+ cfg.Print_ChangeBarText = (FolderConfig.PrintChangeBarText)((tmpsbyte-3)%NUMCBTEXTYPE);
+ cfg.Print_NumCopies=br.ReadSByte();
+ cfg.Print_Pagination=(FolderConfig.PrintPagination) br.ReadSByte();
+ tmpstring = ReadTheString(br,4); // DefaultPrinter not used
+ cfg.Format_Plant = ReadTheString(br,10);
+ tmpstring = ReadTheString(br, 128); // DefaultDestFName not used
+ tmpsbyte = br.ReadSByte(); // DefaultPlotterType not used
+ tmpsbyte = br.ReadSByte(); // DefaultPlotterPort not used
+ tmpsbyte = br.ReadSByte(); // DefaultCIEType not used.
+ for (int i=0;i<8;i++) // DefPenColors[8] not used
+ tmpsbyte = br.ReadSByte();
+ cfg.Print_Watermark = (FolderConfig.PrintWatermark)br.ReadSByte();
+ cfg.Print_UserCBMess1 = ReadTheString(br, 10);
+ cfg.Print_UserCBMess2 = ReadTheString(br, 10);
+ tmpsbyte = br.ReadSByte(); // DontPrintStatusTree not used
+ cfg.Print_UserFormat = ReadTheString(br, 10);
+ tmpsbyte = br.ReadSByte();
+ cfg.Print_DisableDuplex = tmpsbyte == 0 ? false : true;
+ br.Close();
+ }
+ catch(Exception e)
+ {
+ if(br!=null) br.Close();
+ DataLoader.frmLoader.log.ErrorFormat("Error migrating Curset.dat, error = {0}", e.Message);
+ }
+ fs.Close();
+ return cfg;
+ }
+ }
+}
diff --git a/PROMS/DataLoader/DataLoader.csproj b/PROMS/DataLoader/DataLoader.csproj
new file mode 100644
index 00000000..63725d6b
--- /dev/null
+++ b/PROMS/DataLoader/DataLoader.csproj
@@ -0,0 +1,166 @@
+
+
+ Debug
+ AnyCPU
+ 8.0.50727
+ 2.0
+ {8E239A2B-B38C-4CD5-BA0D-A41A88BD2AEE}
+ WinExe
+ Properties
+ DataLoader
+ DataLoader
+ SAK
+ SAK
+ SAK
+ SAK
+
+
+ true
+ full
+ false
+ ..\..\..\..\veproms\bin\
+ DEBUG;TRACE
+ prompt
+ 4
+
+
+ pdbonly
+ true
+ bin\Release\
+ TRACE
+ prompt
+ 4
+
+
+
+ False
+ ..\..\..\..\veproms\bin\Csla.dll
+
+
+ False
+ ..\..\..\..\veproms\bin\IniReader.dll
+
+
+ False
+ ..\..\..\..\veproms\bin\log4net.dll
+
+
+ False
+ ..\..\..\..\veproms\bin\MSWord.dll
+
+
+
+
+
+
+
+
+ False
+ ..\..\..\..\veproms\bin\vlnObject.dll
+
+
+ False
+ ..\..\..\..\veproms\bin\vlnServerLibrary.dll
+
+
+ False
+ ..\..\..\..\veproms\bin\Volian.CSLA.Library.dll
+
+
+
+
+
+
+
+ Form
+
+
+ Form
+
+
+ frmLoader.cs
+
+
+ Form
+
+
+ GroupProp.cs
+
+
+ Form
+
+
+
+
+ Form
+
+
+
+ Form
+
+
+
+
+ Designer
+ frmLoader.cs
+
+
+ Designer
+ GroupProp.cs
+
+
+ ResXFileCodeGenerator
+ Resources.Designer.cs
+ Designer
+
+
+ True
+ Resources.resx
+ True
+
+
+
+
+ SettingsSingleFileGenerator
+ Settings.Designer.cs
+
+
+ True
+ Settings.settings
+ True
+
+
+ Form
+
+
+
+
+
+ Form
+
+
+ Form
+
+
+ Form
+
+
+
+ Form
+
+
+ Form
+
+
+ Form
+
+
+
+
+
\ No newline at end of file
diff --git a/PROMS/DataLoader/DataLoader.csproj.vspscc b/PROMS/DataLoader/DataLoader.csproj.vspscc
new file mode 100644
index 00000000..f42fb8a2
--- /dev/null
+++ b/PROMS/DataLoader/DataLoader.csproj.vspscc
@@ -0,0 +1,10 @@
+""
+{
+"FILE_VERSION" = "9237"
+"ENLISTMENT_CHOICE" = "NEVER"
+"PROJECT_FILE_RELATIVE_PATH" = "relative:DataLoader"
+"NUMBER_OF_EXCLUDED_FILES" = "0"
+"ORIGINAL_PROJECT_FILE_PATH" = ""
+"NUMBER_OF_NESTED_PROJECTS" = "0"
+"SOURCE_CONTROL_SETTINGS_PROVIDER" = "PROVIDER"
+}
diff --git a/PROMS/DataLoader/DocVersions.cs b/PROMS/DataLoader/DocVersions.cs
new file mode 100644
index 00000000..a2f7df0a
--- /dev/null
+++ b/PROMS/DataLoader/DocVersions.cs
@@ -0,0 +1,61 @@
+// ========================================================================
+// Copyright 2006 - Volian Enterprises, Inc. All rights reserved.
+// Volian Enterprises - Proprietary Information - DO NOT COPY OR DISTRIBUTE
+// ------------------------------------------------------------------------
+// $Workfile: $ $Revision: $
+// $Author: $ $Date: $
+//
+// $History: $
+// ========================================================================
+using System;
+using System.Drawing;
+using System.Collections;
+using System.ComponentModel;
+using System.Windows.Forms;
+using System.Data;
+using System.Data.OleDb;
+using System.Collections.Specialized;
+using System.Collections.Generic;
+using System.Xml;
+using System.IO;
+using System.Text;
+using Volian.CSLA.Library;
+
+namespace DataLoader
+{
+ public partial class frmLoader : Form
+ {
+ private Int32 MigrateDocVersion(string pth)
+ {
+
+ Int32 iStructureID = 0;
+ // Open connection
+ OleDbConnection cn = new OleDbConnection(@"Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" + pth + ";Extended Properties=dBase III;Persist Security Info=False");
+ // load rofst (use it later)....
+ rofst = new ROFST(pth + "\\ro.fst");
+ // Migrate library documents
+ MigrateLibDocs(cn, pth);
+ // Initialize Dictionaries
+ dicTrans_StrDone = new Dictionary();
+ dicTrans_StrIds = new Dictionary();
+ // Process Procedures
+ iStructureID = MigrateProcedures(cn,pth);
+ // Show any Missing Transtitons (i.e. Transitions which have not been processed)
+ ShowMissingTransitions();
+ log.InfoFormat("Completed Migration of {0}",pth);
+ MessageBox.Show("Completed Migration of " + pth);
+ rofst.Close();
+ cn.Close();
+ dicTrans_StrDone.Clear();
+ dicTrans_StrDone = null;
+ return iStructureID;
+ }
+ private Volian.CSLA.Library.VersionTypeEnum DocVersionType(string s)
+ {
+ if (s.EndsWith("approved")) return Volian.CSLA.Library.VersionTypeEnum.Approved;
+ if (s.EndsWith("chgsht")) return Volian.CSLA.Library.VersionTypeEnum.Revision;
+ if (s.EndsWith("tmpchg")) return Volian.CSLA.Library.VersionTypeEnum.Temporary;
+ return Volian.CSLA.Library.VersionTypeEnum.WorkingDraft;
+ }
+ }
+}
\ No newline at end of file
diff --git a/PROMS/DataLoader/Documents.cs b/PROMS/DataLoader/Documents.cs
new file mode 100644
index 00000000..cea9db33
--- /dev/null
+++ b/PROMS/DataLoader/Documents.cs
@@ -0,0 +1,114 @@
+// ========================================================================
+// Copyright 2006 - Volian Enterprises, Inc. All rights reserved.
+// Volian Enterprises - Proprietary Information - DO NOT COPY OR DISTRIBUTE
+// ------------------------------------------------------------------------
+// $Workfile: $ $Revision: $
+// $Author: $ $Date: $
+//
+// $History: $
+// ========================================================================
+using System;
+using System.Drawing;
+using System.Collections;
+using System.ComponentModel;
+using System.Windows.Forms;
+using System.Data;
+using System.Data.OleDb;
+using System.Collections.Specialized;
+using System.Collections.Generic;
+using System.Xml;
+using System.IO;
+using System.Text;
+using Volian.MSWord;
+using Volian.CSLA.Library;
+
+namespace DataLoader
+{
+ public partial class frmLoader : Form
+ {
+ private void SaveSectionDocument(string fname, string stpseq, ref byte ctype, ref int cid)
+ {
+ int docid = SaveWordDoc(fname);
+ switch (docid)
+ {
+ case 0:
+ // could add the following back in - but many of these may be put out in the log, and
+ // don't supply any pertinent info.
+ //log.InfoFormat("Timing problem for save of word document, will retry. oldstepsequence = {0}", stpseq);
+ break;
+ case -1:
+ log.ErrorFormat("Could not complete save of word document, oldstepsequence = {0}", stpseq);
+ break;
+ default:
+ ctype = 2;
+ cid = docid;
+ break;
+ }
+ }
+ private int SaveWordDoc(string fname, string title, ConfigInfo ci)
+ {
+ int docid = 0;
+ if (System.IO.File.Exists(fname))
+ {
+ if (cbSaveDoc.Checked)
+ {
+ WordDoc d = new WordDoc(fname);
+ string temppath = Path.GetTempFileName();
+ string s = d.Save(temppath);
+ d.Close();
+ WaitMS(wms);
+ docid = SaveDoc(temppath, title, ci);
+ File.Delete(temppath);
+ }
+ else
+ {
+ if (cbSaveRTF.Checked)
+ docid = SaveDoc(fname, title, ci);
+ }
+ }
+ return docid;
+ }
+ private int SaveWordDoc(string temppath)
+ {
+ return SaveWordDoc(temppath, String.Empty, null);
+ }
+ private int SaveTheDoc(string temppath, string title, ConfigInfo ci)
+ {
+ try
+ {
+ FileStream fs = File.Open(temppath, FileMode.Open, FileAccess.Read, FileShare.None);
+ long len = fs.Length + 1;
+ byte[] ByteArray = new byte[len];
+ int nBytesRead = fs.Read(ByteArray, 0, (int)len);
+ fs.Close();
+ string t1 = (title == null || title == "") ? "notitle" : title;
+ Document doc = Document.MakeDocument(t1, ByteArray, null, ci == null ? null : ci.ToString());
+ return doc.DocID;
+ }
+ // for an io exception, keep trying
+ catch (IOException)
+ {
+ Wait(2);
+ return 0;
+ }
+ catch (Exception ex)
+ {
+ log.Error("Save Word Doc");
+ log.ErrorFormat("{0}\r\n\r\n{1}", ex.Message, ex.InnerException);
+ return -1;
+ }
+
+ }
+ private int SaveDoc(string temppath, string title, ConfigInfo ci)
+ {
+ int done = 0;
+ int ntry = 0;
+ while (done == 0 && ntry < 4)
+ {
+ ntry++;
+ done = SaveTheDoc(temppath, title, ci);
+ }
+ return done;
+ }
+ }
+}
\ No newline at end of file
diff --git a/PROMS/DataLoader/FolderTreeNode.cs b/PROMS/DataLoader/FolderTreeNode.cs
new file mode 100644
index 00000000..f65671e9
--- /dev/null
+++ b/PROMS/DataLoader/FolderTreeNode.cs
@@ -0,0 +1,110 @@
+// ========================================================================
+// Copyright 2006 - Volian Enterprises, Inc. All rights reserved.
+// Volian Enterprises - Proprietary Information - DO NOT COPY OR DISTRIBUTE
+// ------------------------------------------------------------------------
+// $Workfile: $ $Revision: $
+// $Author: $ $Date: $
+//
+// $History: $
+// ========================================================================
+using System;
+using System.Collections.Generic;
+using System.Text;
+using Volian.CSLA.Library;
+using Csla;
+using System.Windows.Forms;
+
+namespace DataLoader
+{
+ public class FolderTreeNode : TreeNode
+ {
+ FolderTreeNode(string s) : base(s)
+ {
+ this.Name="ID:" + s;
+ }
+ FolderTreeNode(FolderInfo folderinfo)
+ : base(folderinfo.Name)
+ {
+ _folderinfo = folderinfo;
+ this.Name = "ID:" + folderinfo.FolderID.ToString();
+ }
+ private FolderInfo _folderinfo;
+ public FolderInfo FolderInfo
+ {
+ get { return _folderinfo; }
+ set
+ {
+ _folderinfo = value;
+ }
+ }
+ private Dictionary _findTree = null;
+ private Dictionary FindTree
+ {
+ get { return _findTree; }
+ set { _findTree = value; }
+ }
+ public FolderTreeNode FindTreeNode(int folderID)
+ {
+ if (_findTree != null) return _findTree[folderID];
+ return null;
+ }
+ public static FolderTreeNode BuildTreeList()
+ {
+ FolderTreeNode root = null;
+ FolderInfoList fil = FolderInfoList.Get();
+ Dictionary dicMissing = new Dictionary();
+ Dictionary dicExists = new Dictionary();
+ foreach (FolderInfo fi in fil)
+ {
+ FolderTreeNode ftp = null;
+ if (dicExists.ContainsKey(fi.ParentID))
+ {
+ ftp = dicExists[fi.ParentID];
+ // dicNeedToLoad.Remove(ftp);
+ }
+ else
+ {
+ if (fi.ParentID != 0)
+ {
+ ftp = new FolderTreeNode(fi.ParentID.ToString());
+ dicMissing.Add(fi.ParentID, ftp);
+ dicExists.Add(fi.ParentID, ftp);
+ if (fi.DocVersionCount > 0)
+ {
+ TreeNode tn = new TreeNode("dummy");
+ tn.Tag = "dummy";
+ ftp.Nodes.Add(tn);
+ }
+ }
+ }
+ FolderTreeNode ft = null;
+ if (dicMissing.ContainsKey(fi.FolderID))
+ {
+ ft = dicMissing[fi.FolderID];
+ ft.FolderInfo = fi;
+ dicMissing.Remove(fi.FolderID);
+ }
+ else
+ {
+ ft = new FolderTreeNode(fi);
+ if (fi.DocVersionCount > 0)
+ {
+ TreeNode tn = new TreeNode("dummy");
+ tn.Tag = "dummy";
+ ft.Nodes.Add(tn);
+ }
+ dicExists.Add(fi.FolderID, ft);
+ //dicNeedToLoad.Add(ft);
+ }
+ ft.Tag = fi;
+ if (fi.ParentID == 0)
+ root = ft;
+ else
+ ftp.Nodes.Add(ft);
+ }
+ root.FindTree = dicExists;
+ return root;
+ }
+ }
+}
+
diff --git a/PROMS/DataLoader/GroupProp.Designer.cs b/PROMS/DataLoader/GroupProp.Designer.cs
new file mode 100644
index 00000000..87548d7f
--- /dev/null
+++ b/PROMS/DataLoader/GroupProp.Designer.cs
@@ -0,0 +1,110 @@
+namespace DataLoader
+{
+ partial class GroupProp
+ {
+ ///
+ /// Required designer variable.
+ ///
+ private System.ComponentModel.IContainer components = null;
+
+ ///
+ /// Clean up any resources being used.
+ ///
+ /// true if managed resources should be disposed; otherwise, false.
+ protected override void Dispose(bool disposing)
+ {
+ if (disposing && (components != null))
+ {
+ components.Dispose();
+ }
+ base.Dispose(disposing);
+ }
+
+ #region Windows Form Designer generated code
+
+ ///
+ /// Required method for Designer support - do not modify
+ /// the contents of this method with the code editor.
+ ///
+ private void InitializeComponent()
+ {
+ this.splitContainer1 = new System.Windows.Forms.SplitContainer();
+ this.lbGroups = new System.Windows.Forms.ListBox();
+ this.pg = new System.Windows.Forms.PropertyGrid();
+ this.btnSave = new System.Windows.Forms.Button();
+ this.splitContainer1.Panel1.SuspendLayout();
+ this.splitContainer1.Panel2.SuspendLayout();
+ this.splitContainer1.SuspendLayout();
+ this.SuspendLayout();
+ //
+ // splitContainer1
+ //
+ this.splitContainer1.Dock = System.Windows.Forms.DockStyle.Fill;
+ this.splitContainer1.Location = new System.Drawing.Point(0, 0);
+ this.splitContainer1.Name = "splitContainer1";
+ //
+ // splitContainer1.Panel1
+ //
+ this.splitContainer1.Panel1.Controls.Add(this.lbGroups);
+ //
+ // splitContainer1.Panel2
+ //
+ this.splitContainer1.Panel2.Controls.Add(this.pg);
+ this.splitContainer1.Panel2.Controls.Add(this.btnSave);
+ this.splitContainer1.Size = new System.Drawing.Size(629, 290);
+ this.splitContainer1.SplitterDistance = 209;
+ this.splitContainer1.TabIndex = 0;
+ //
+ // lbGroups
+ //
+ this.lbGroups.Dock = System.Windows.Forms.DockStyle.Fill;
+ this.lbGroups.FormattingEnabled = true;
+ this.lbGroups.Location = new System.Drawing.Point(0, 0);
+ this.lbGroups.Name = "lbGroups";
+ this.lbGroups.Size = new System.Drawing.Size(209, 290);
+ this.lbGroups.TabIndex = 0;
+ this.lbGroups.Click += new System.EventHandler(this.lbGroups_Click);
+ //
+ // pg
+ //
+ this.pg.Dock = System.Windows.Forms.DockStyle.Fill;
+ this.pg.Location = new System.Drawing.Point(0, 23);
+ this.pg.Name = "pg";
+ this.pg.Size = new System.Drawing.Size(416, 267);
+ this.pg.TabIndex = 0;
+ //
+ // btnSave
+ //
+ this.btnSave.Dock = System.Windows.Forms.DockStyle.Top;
+ this.btnSave.Location = new System.Drawing.Point(0, 0);
+ this.btnSave.Name = "btnSave";
+ this.btnSave.Size = new System.Drawing.Size(416, 23);
+ this.btnSave.TabIndex = 1;
+ this.btnSave.Text = "Save";
+ this.btnSave.UseVisualStyleBackColor = true;
+ this.btnSave.Click += new System.EventHandler(this.btnSave_Click);
+ //
+ // GroupProp
+ //
+ this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
+ this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
+ this.ClientSize = new System.Drawing.Size(629, 290);
+ this.Controls.Add(this.splitContainer1);
+ this.Name = "GroupProp";
+ this.Text = "GroupProp";
+ this.Load += new System.EventHandler(this.GroupProp_Load);
+ this.splitContainer1.Panel1.ResumeLayout(false);
+ this.splitContainer1.Panel2.ResumeLayout(false);
+ this.splitContainer1.ResumeLayout(false);
+ this.ResumeLayout(false);
+
+ }
+
+ #endregion
+
+ private System.Windows.Forms.SplitContainer splitContainer1;
+ private System.Windows.Forms.ListBox lbGroups;
+ private System.Windows.Forms.PropertyGrid pg;
+ private System.Windows.Forms.Button btnSave;
+ }
+}
\ No newline at end of file
diff --git a/PROMS/DataLoader/GroupProp.cs b/PROMS/DataLoader/GroupProp.cs
new file mode 100644
index 00000000..5e21bea1
--- /dev/null
+++ b/PROMS/DataLoader/GroupProp.cs
@@ -0,0 +1,45 @@
+using System;
+using System.Collections.Generic;
+using System.ComponentModel;
+using System.Data;
+using System.Drawing;
+using System.Text;
+using System.Windows.Forms;
+using Csla;
+using Volian.CSLA.Library;
+
+namespace DataLoader
+{
+ public partial class GroupProp : Form
+ {
+ GroupInfoList glst;
+ Group grp;
+ public GroupProp()
+ {
+ InitializeComponent();
+ }
+ private void GroupProp_Load(object sender, EventArgs e)
+ {
+ lbGroups.Dock = DockStyle.Fill;
+ glst = GroupInfoList.Get();
+ lbGroups.DataSource = glst;
+ lbGroups.DisplayMember = "GroupName";
+ lbGroups.ValueMember = "GID";
+ SetGroup();
+ }
+ private void lbGroups_Click(object sender, EventArgs e)
+ {
+ SetGroup();
+ Console.WriteLine("Group ID = {0}", lbGroups.SelectedValue);
+ }
+ private void SetGroup()
+ {
+ grp = glst[lbGroups.SelectedIndex].Get();
+ pg.SelectedObject = grp;
+ }
+ private void btnSave_Click(object sender, EventArgs e)
+ {
+ grp.Save();
+ }
+ }
+}
\ No newline at end of file
diff --git a/PROMS/DataLoader/GroupProp.resx b/PROMS/DataLoader/GroupProp.resx
new file mode 100644
index 00000000..19dc0dd8
--- /dev/null
+++ b/PROMS/DataLoader/GroupProp.resx
@@ -0,0 +1,120 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ text/microsoft-resx
+
+
+ 2.0
+
+
+ System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+
+
+ System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+
+
\ No newline at end of file
diff --git a/PROMS/DataLoader/LibDoc.cs b/PROMS/DataLoader/LibDoc.cs
new file mode 100644
index 00000000..770f7040
--- /dev/null
+++ b/PROMS/DataLoader/LibDoc.cs
@@ -0,0 +1,153 @@
+// ========================================================================
+// Copyright 2006 - Volian Enterprises, Inc. All rights reserved.
+// Volian Enterprises - Proprietary Information - DO NOT COPY OR DISTRIBUTE
+// ------------------------------------------------------------------------
+// $Workfile: $ $Revision: $
+// $Author: $ $Date: $
+//
+// $History: $
+// ========================================================================
+using System;
+using System.Drawing;
+using System.Collections;
+using System.ComponentModel;
+using System.Windows.Forms;
+using System.Data;
+using System.Data.OleDb;
+using System.Collections.Specialized;
+using System.Collections.Generic;
+using System.Xml;
+using System.IO;
+using System.Text;
+using Volian.MSWord;
+using vlnObjectLibrary;
+using vlnServerLibrary;
+using Org.Mentalis.Files;
+
+namespace DataLoader
+{
+ public partial class frmLoader : Form
+ {
+ private void UpdateLabelsLibDocs(int incLib, int incUsages)
+ {
+ if (incLib == 0 && incUsages == 0)//Reset
+ {
+ lblTime.Tag = DateTime.Now;
+ pbProc.Value = 0;
+ pbSect.Value = 0;
+ }
+ else
+ {
+ pbProc.Value += incLib;
+ pbSect.Value += incUsages;
+ }
+ lblProc.Text = string.Format("{0} Lib Docs", pbProc.Value);
+ lblSection.Text = string.Format("{0} Usages", pbSect.Value);
+ lblStep.Text = "";
+ TimeSpan ts = new TimeSpan(DateTime.Now.Ticks - ((DateTime)lblTime.Tag).Ticks);
+ lblTime.Text = string.Format("{0:D2}:{1:D2}:{2:D2} Elapsed", ts.Hours, ts.Minutes, ts.Seconds);
+ Application.DoEvents();
+ }
+ private void MigrateLibDocs(OleDbConnection cn, string pth)
+ {
+ // Get all of the library documents - the first list has the entire list of files
+ // found within the rtffiles folder, the second list contains usages from the 'tran'
+ // file. During processing for procedures/sections occurs, the used library documents
+ // will be migrated. After that, any remaining library documents will be added to
+ // the section table without a reference from the structuretbl.
+ Dictionary dicLibDocSect = new Dictionary();
+ UpdateLabelsLibDocs(0, 0);
+ if (Directory.Exists(pth + "\\rtffiles"))
+ {
+ DirectoryInfo di = new DirectoryInfo(pth + "\\RTFFILES");
+ FileInfo[] fis = di.GetFiles("DOC_*.LIB");
+ pbProc.Maximum = fis.Length;
+ foreach (FileInfo fi in fis)
+ {
+ UpdateLabelsLibDocs(1, 0);
+ dicLibDocSect[fi.Name.Substring(0, 8).ToUpper()] = MigrateLibDoc(fi);
+ }
+ }
+ dicLibDocRef = new Dictionary();
+ OleDbDataAdapter da_doc = new OleDbDataAdapter("select [FROMNUMBER], [FROMSEQUEN], [TONUMBER] from [tran] where [TONUMBER] LIKE 'doc_%' or [TONUMBER] like 'DOC_%'", cn);
+ DataSet ds_doc = new DataSet();
+ da_doc.Fill(ds_doc);
+ pbSect.Maximum = ds_doc.Tables[0].Rows.Count;
+ foreach (DataRow dr_doc in ds_doc.Tables[0].Rows)
+ {
+ UpdateLabelsLibDocs(0, 1);
+ string key = dr_doc["FROMNUMBER"].ToString().PadRight(20) + dr_doc["FROMSEQUEN"].ToString().PadRight(10);
+ if (!dicLibDocSect.ContainsKey(dr_doc["TONUMBER"].ToString().ToUpper()))
+ log.ErrorFormat("Error setting library document references: {0}", dr_doc["TONUMBER"].ToString().ToUpper());
+ else
+ dicLibDocRef[key] = dicLibDocSect[dr_doc["TONUMBER"].ToString().ToUpper()];
+ }
+ da_doc.Dispose();
+ }
+ private int MigrateLibDoc(FileInfo fi)
+ {
+ ConfigInfo ci = new ConfigInfo(null);
+ string title = null; // for docname, remove the '.lib', i.e. substring(0,8)
+ DateTime dts = DateTime.Now;
+ string tmpRtfFileName = GetLibDocData(fi, ci, ref title);
+ int Docid = SaveWordDoc(tmpRtfFileName, title, ci);
+ File.Delete(tmpRtfFileName);
+ return Docid;
+ }
+ private string LoadFromLib(BinaryReader br)
+ {
+ int nchar = br.ReadInt16();
+ if (nchar > 0)
+ {
+ string tmp = new string(br.ReadChars(nchar));
+ return tmp.Substring(0, tmp.Length - 1); // remove null at end.
+ }
+ return null;
+ }
+ private string GetLibDocData(FileInfo fi, ConfigInfo ci, ref string title)
+ {
+ title = null;
+ // get the number, title, etc from the file.
+ // use the path to open the file & read the title & comment
+ DateTime dts = fi.LastWriteTime;
+ FileStream fs = fi.Open(FileMode.Open, FileAccess.Read, FileShare.ReadWrite);
+ BinaryReader br = new BinaryReader(fs, System.Text.ASCIIEncoding.ASCII);
+ string tmpRtfFileName = Path.GetTempFileName();
+ FileStream tmpfile = new FileStream(tmpRtfFileName, FileMode.Create);
+ BinaryWriter bw = new BinaryWriter(tmpfile, System.Text.Encoding.ASCII);
+ int cntPage = br.ReadInt16();
+ if (cntPage != -1)
+ { // Not End of File
+ ci.AddItem("Section", "NumPages", cntPage.ToString());
+ string ldtitle = LoadFromLib(br);
+ if (ldtitle != null && ldtitle != "") title = ldtitle;
+ ci.AddItem("LibDoc", "Comment", LoadFromLib(br));
+ long l = br.BaseStream.Length - br.BaseStream.Position;
+ byte[] buf = new byte[l];
+ br.Read(buf, 0, (int)l);
+ bw.Write(buf, 0, (int)l);
+ // TODO: Check with KBR to see if she needed read/write this way
+ // I can't remember.
+ //byte ac;
+ //bool done = false;
+ //while (done == false)
+ //{
+ // if (br.PeekChar() > 0)
+ // {
+ // ac = br.ReadByte();
+ // bw.Write(ac);
+ // }
+ // else
+ // done = true;
+ //}
+ br.Close();
+ fs.Close();
+ bw.Close();
+ tmpfile.Close();
+ WaitMS(wms); // give it some time to close the tempfile before adding section
+ File.SetLastWriteTime(tmpRtfFileName, dts);
+ }
+ return tmpRtfFileName;
+ }
+ }
+}
\ No newline at end of file
diff --git a/PROMS/DataLoader/LoadConfig.cs b/PROMS/DataLoader/LoadConfig.cs
new file mode 100644
index 00000000..627b8f07
--- /dev/null
+++ b/PROMS/DataLoader/LoadConfig.cs
@@ -0,0 +1,198 @@
+// ========================================================================
+// Copyright 2006 - Volian Enterprises, Inc. All rights reserved.
+// Volian Enterprises - Proprietary Information - DO NOT COPY OR DISTRIBUTE
+// ------------------------------------------------------------------------
+// $Workfile: $ $Revision: $
+// $Author: $ $Date: $
+//
+// $History: $
+// ========================================================================
+using System;
+using System.Drawing;
+using System.Collections;
+using System.ComponentModel;
+using System.Windows.Forms;
+using System.Data;
+using System.Data.OleDb;
+using System.Collections.Specialized;
+using System.Collections.Generic;
+using System.Xml;
+using System.IO;
+using System.Text;
+using Volian.CSLA.Library;
+
+namespace Config
+{
+ public class ConfigFile
+ {
+ #region Log4Net
+ private static readonly log4net.ILog log = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
+ #endregion
+ #region MigrateStrings
+ // the following lists are used for storing the element and attribute names
+ // for migrating of ini & cfg files. The names stored in these lists are
+ // those that should be migrated. If not in this list, the data (either element
+ // or attribute name) is prefaced with a 'z'. At some point in the future, those
+ // names with a 'z' will be removed.
+ public List listIni_EleName = new List();
+ public List listIni_AttrName = new List();
+ private void SetIniEleName()
+ {
+ // veproms.ini
+ listIni_EleName.Add("graphics");
+ listIni_EleName.Add("color");
+ listIni_EleName.Add("print");
+ listIni_EleName.Add("startup");
+ listIni_EleName.Add("data integrity");
+ listIni_EleName.Add("wordprocessor");
+ listIni_EleName.Add("procedurelisttabstops");
+
+ // proc.ini
+ listIni_EleName.Add("rodefaults");
+ listIni_EleName.Add("display");
+ listIni_EleName.Add("backgrounddefaults");
+
+ // .cfg
+ listIni_EleName.Add("spelldictionary");
+ // listIni_EleName.Add("wordprocessor"); - already in here.
+ }
+
+ private void SetIniAttrName()
+ {
+ //veproms.ini
+ listIni_AttrName.Add("defaultext");
+ listIni_AttrName.Add("ro");
+ listIni_AttrName.Add("editbackground");
+ listIni_AttrName.Add("black");
+ listIni_AttrName.Add("blue");
+ listIni_AttrName.Add("green");
+ listIni_AttrName.Add("cyan");
+ listIni_AttrName.Add("red");
+ listIni_AttrName.Add("magenta");
+ listIni_AttrName.Add("brown");
+ listIni_AttrName.Add("lightgray");
+ listIni_AttrName.Add("darkgray");
+ listIni_AttrName.Add("ligthblue");
+ listIni_AttrName.Add("lightgreen");
+ listIni_AttrName.Add("lightcyan");
+ listIni_AttrName.Add("lightred");
+ listIni_AttrName.Add("lightmagenta");
+ listIni_AttrName.Add("yellow");
+ listIni_AttrName.Add("white");
+ listIni_AttrName.Add("underlinewidth");
+ listIni_AttrName.Add("verticalOffset");
+ listIni_AttrName.Add("strokewidth");
+ listIni_AttrName.Add("strokewidthbold");
+ listIni_AttrName.Add("messageboxtitle");
+ listIni_AttrName.Add("messagefile");
+ listIni_AttrName.Add("enableindexcheck");
+ listIni_AttrName.Add("wordwrap");
+ listIni_AttrName.Add("procedurenumbertab");
+ listIni_AttrName.Add("proceduretitletab");
+
+ // proc.ini
+ listIni_AttrName.Add("setpoint");
+ listIni_AttrName.Add("graphics");
+ listIni_AttrName.Add("ropath");
+ listIni_AttrName.Add("display");
+ listIni_AttrName.Add("sectiontitle");
+ listIni_AttrName.Add("sectionnumber");
+
+ // .cfg
+ listIni_AttrName.Add("custom");
+ listIni_AttrName.Add("page");
+ listIni_AttrName.Add("toolbar");
+ listIni_AttrName.Add("paragraph");
+ listIni_AttrName.Add("ruler");
+ listIni_AttrName.Add("userphone1");
+ listIni_AttrName.Add("userphone2");
+ listIni_AttrName.Add("userloc1");
+ listIni_AttrName.Add("userloc2");
+ }
+ #endregion
+ #region LoadDataCode
+ public ConfigFile()
+ {
+ }
+ public void LoadUsrCfg(User user)
+ {
+ string cmdline = System.Environment.CommandLine;
+ string cfgpath = cmdline.Substring(1, cmdline.LastIndexOf("\\") - 1) + "\\config";
+ if (!Directory.Exists(cfgpath))
+ {
+ log.Info("No user cfgs found in config directory - did not migrate any user cfgs");
+ return;
+ }
+ DirectoryInfo di = new DirectoryInfo(cfgpath);
+ FileInfo[] fis = di.GetFiles("*.cfg");
+
+ foreach (FileInfo fi in fis)
+ {
+ string cfgname = fi.Name.Substring(0, fi.Name.IndexOf("."));
+ if (cfgname.ToUpper() == user.UserID.ToUpper())
+ {
+ // Get Users table fields by reading the cfg file into a buffer & looking
+ // for the UserNetworkId and UserName fields.
+ StreamReader myReader = new StreamReader(fi.FullName);
+ string sLine;
+ string UserLogin = null;
+ string UserName = null;
+ int indx = -1;
+ while ((sLine = myReader.ReadLine()) != null && (UserLogin == null || UserName == null))
+ {
+ if (sLine.Length > 0 && sLine.Substring(0, 1) != ";")
+ {
+ if ((indx = sLine.ToLower().IndexOf("usernetworkid")) >= 0)
+ {
+ indx = sLine.IndexOf("=", indx + 13);
+ UserLogin = sLine.Substring(indx + 1, sLine.Length - indx - 1).Trim();
+ }
+ else if ((indx = sLine.ToLower().IndexOf("username")) >= 0)
+ {
+ indx = sLine.IndexOf("=", indx + 8);
+ UserName = sLine.Substring(indx + 1, sLine.Length - indx - 1).Trim();
+ }
+ }
+ }
+ myReader.Close();
+
+ // get the xml to set the config field
+ XmlDocument d = IniToXml(fi.FullName);
+ user.Config = d == null ? null : d.InnerXml;
+ user.UserLogin = UserLogin;
+ user.UserName = UserName;
+ user.CFGName = cfgname;
+ break;
+ }
+ }
+ }
+
+ public XmlDocument LoadSystemIni()
+ {
+ string cmdline = System.Environment.CommandLine;
+ string inipath = cmdline.Substring(1, cmdline.LastIndexOf("\\") - 1) + "\\veproms.ini";
+ if (!File.Exists(inipath))
+ {
+ log.InfoFormat("Did not migrate {0} - file not found", inipath);
+ return null;
+ }
+ XmlDocument d = IniToXml(inipath);
+ return d;
+ }
+
+ public XmlDocument IniToXml(string path)
+ {
+ FileInfo fi = new FileInfo(path);
+ if (fi.Exists)
+ {
+ PrivateProfile ppCfg;
+ if (listIni_AttrName == null || listIni_AttrName.Count == 0) SetIniAttrName();
+ if (listIni_EleName == null || listIni_EleName.Count == 0) SetIniEleName();
+ ppCfg = new PrivateProfile(path, listIni_EleName, listIni_AttrName);
+ return ppCfg.XML();
+ }
+ return null;
+ }
+ #endregion
+ }
+}
\ No newline at end of file
diff --git a/PROMS/DataLoader/LoadTreeDB.cs b/PROMS/DataLoader/LoadTreeDB.cs
new file mode 100644
index 00000000..b1cefd92
--- /dev/null
+++ b/PROMS/DataLoader/LoadTreeDB.cs
@@ -0,0 +1,111 @@
+// ========================================================================
+// Copyright 2006 - Volian Enterprises, Inc. All rights reserved.
+// Volian Enterprises - Proprietary Information - DO NOT COPY OR DISTRIBUTE
+// ------------------------------------------------------------------------
+// $Workfile: $ $Revision: $
+// $Author: $ $Date: $
+//
+// $History: $
+// ========================================================================
+using System;
+using System.Drawing;
+using System.Collections;
+using System.ComponentModel;
+using System.Windows.Forms;
+using System.Data;
+using System.Data.OleDb;
+using System.Collections.Specialized;
+using System.Collections.Generic;
+using System.Xml;
+using System.IO;
+using System.Text;
+using Volian.CSLA.Library;
+using vlnObjectLibrary;
+using vlnServerLibrary;
+using Org.Mentalis.Files;
+using Config;
+using Utils;
+
+namespace DataLoader
+{
+ public partial class frmLoader : Form
+ {
+ private List vlnDataPathFolders() // was vlnDataPath
+ {
+ List dpf = new List();
+ // Get path to config file
+ string sCfg = Environment.GetEnvironmentVariable("veconfig");
+ IniReader cfg = new IniReader(sCfg);
+ // Get DataPath
+ string sDP = cfg.ReadString("menu", "DataPath");
+ // Split DataPath into directories
+ foreach (string s1 in sDP.Split(";".ToCharArray()))
+ {
+ if (s1.Length > 0)
+ {
+ string[] s2 = s1.Split(",".ToCharArray());
+ Folder fld = Folder.MakeFolder(sysFolder.FolderID, dbConn.DBID, s2[1], s2[0], null);
+ dpf.Add(fld);
+ }
+ }
+ return dpf;
+ }
+ private int cslaObject(vlnObject vb, int dbid, int parentid, TreeNode tn)
+ {
+ switch (vb.Type)
+ {
+ case "plant":
+ case "set":
+ Folder fld = Folder.MakeFolder(parentid, dbid, vb.Title, vb.Path, string.Empty);
+ tn.Tag = fld;
+ return fld.FolderID;
+ case "version":
+ ConfigFile cfg = new ConfigFile();
+
+ XmlDocument d = cfg.IniToXml(vb.Path + "\\proc.ini");
+ FolderConfig fld_cfg = new FolderConfig(d==null?"":d.InnerXml);
+ // translate curset.dat into xml & add to d (somehow).
+ string csfile = string.Format("{0}\\curset.dat",vb.Path);
+ if (File.Exists(csfile))
+ {
+ CurSet cs = new CurSet(csfile);
+ try
+ {
+ fld_cfg = cs.Convert(fld_cfg);
+ }
+ catch (Exception ex)
+ {
+ log.ErrorFormat("error in convert curset.dat, ex = {0}", ex.Message);
+ }
+ }
+ string titlepath = vb.Path + "\\" + "Title";
+ FileInfo fi = new FileInfo(titlepath);
+ string thetitle = vb.Title;
+ if (File.Exists(titlepath))
+ {
+ StreamReader myReader = new StreamReader(titlepath);
+ thetitle = myReader.ReadLine();
+ myReader.Close();
+ }
+ DocVersion v = DocVersion.MakeDocVersion(parentid, (int)DocVersionType(vb.Path.ToLower()), thetitle, vb.Path, 0, fld_cfg == null ? null : fld_cfg.ToString());
+ tn.Tag = v;
+ return v.VersionID;
+ }
+ return 0;
+ }
+ private void MigrateChildren(vlnObject vb, vlnServer vs, int dbid, int parentid, TreeNode tn)
+ {
+ if (vb.Type != "version")
+ {
+ vb.LoadChildren(vs.GetChildren(vb.ToString()));
+ List lv = vb.Children;
+ foreach (vlnObject vbc in lv)
+ {
+ TreeNode tnc = tn.Nodes.Add(vbc.Title);
+ int idc = cslaObject(vbc, dbid, parentid, tnc);
+ MigrateChildren(vbc, vs, dbid, idc, tnc);
+ }
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/PROMS/DataLoader/LoadTreeNh.cs b/PROMS/DataLoader/LoadTreeNh.cs
new file mode 100644
index 00000000..83e44b49
--- /dev/null
+++ b/PROMS/DataLoader/LoadTreeNh.cs
@@ -0,0 +1,43 @@
+// ========================================================================
+// Copyright 2006 - Volian Enterprises, Inc. All rights reserved.
+// Volian Enterprises - Proprietary Information - DO NOT COPY OR DISTRIBUTE
+// ------------------------------------------------------------------------
+// $Workfile: $ $Revision: $
+// $Author: $ $Date: $
+//
+// $History: $
+// ========================================================================
+
+using System;
+using System.Drawing;
+using System.Collections;
+using System.ComponentModel;
+using System.Windows.Forms;
+using System.Data;
+using System.Data.OleDb;
+using System.Collections.Specialized;
+using System.Collections.Generic;
+using System.Xml;
+using System.IO;
+using System.Text;
+using Volian.CSLA.Library;
+
+namespace DataLoader
+{
+ public partial class frmLoader : Form
+ {
+ private bool LoadChildren(FolderInfo fld, TreeNode tn)
+ {
+ tn.Nodes.Clear();
+ bool bLoaded = true;
+ foreach (DocVersionInfo fdv in fld.DocVersions)
+ {
+ TreeNode tnc = tn.Nodes.Add(fdv.Title);
+ tnc.Tag = fdv;
+ tnc.Checked = fdv.StructureID != 0;
+ bLoaded &= tnc.Checked;
+ }
+ return bLoaded;
+ }
+ }
+}
\ No newline at end of file
diff --git a/PROMS/DataLoader/PrivateProfile.cs b/PROMS/DataLoader/PrivateProfile.cs
new file mode 100644
index 00000000..0310fce3
--- /dev/null
+++ b/PROMS/DataLoader/PrivateProfile.cs
@@ -0,0 +1,274 @@
+// ========================================================================
+// Copyright 2006 - Volian Enterprises, Inc. All rights reserved.
+// Volian Enterprises - Proprietary Information - DO NOT COPY OR DISTRIBUTE
+// ------------------------------------------------------------------------
+// $Workfile: $ $Revision: $
+// $Author: $ $Date: $
+//
+// $History: $
+// ========================================================================
+
+using System;
+using System.IO;
+using System.Xml;
+using System.Collections.Specialized;
+using System.Collections.Generic;
+
+namespace Config
+{
+ ///
+ /// PrivateProfile opens a private profile string and stores it's contents in an xml document.
+ ///
+ public class PrivateProfile
+ {
+ #region Log4Net
+ private static readonly log4net.ILog log = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
+ #endregion
+
+ private string ppName;
+ private XmlDocument ppXml;
+ private List attr;
+ private List ele;
+
+ private XmlNode AddNode(XmlNode xParent, string sName, string sValue )
+ {
+ XmlNode nd=AddNode(xParent,sName);
+ nd.Value=sValue;
+ return nd;
+ }
+ private XmlNode AddNode(XmlNode xParent, string sName)
+ {
+ XmlNode nd;
+ // Add a node
+ string tsName = sName.Replace(' ', '_');
+ nd=xParent.OwnerDocument.CreateNode(System.Xml.XmlNodeType.Element,tsName,"");
+ xParent.AppendChild(nd);
+ return nd;
+ }
+ private void AddAttribute(XmlNode xParent, string sName, string sValue )
+ {
+ XmlNode xa=xParent.Attributes.GetNamedItem(sName);
+ // bug fix. 09/15/03
+ // If there was a space after an equal sign, that space character
+ // was becomming part of the value string (reading the user.CFG file).
+ // This was giving us a "Must have semi-colon" error message.
+ // We now strip spaces before and after any Attribute that is written.
+ sValue = sValue.Trim(' ');
+ sName = sName.Replace(' ', '_');
+
+ // Add an attribute
+ if(sValue=="")
+ {
+ if(xa != null)
+ {
+ xParent.Attributes.RemoveNamedItem(sName);
+ }
+ }
+ else
+ {
+ if(xa == null)
+ {
+ xa = xParent.OwnerDocument.CreateNode(System.Xml.XmlNodeType.Attribute ,sName,"");
+ xParent.Attributes.SetNamedItem(xa);
+ }
+ xa.Value=sValue;
+ }
+
+ }
+ private XmlNode AddSection(XmlNode xParent, string sSection )
+ {
+ // get the name. If it's not in the 'migrated elements' list, then
+ // preface the name with a 'z'.
+ string elename = sSection.Substring(1, sSection.IndexOf("]") - 1);
+ while(elename.IndexOf(' ')>-1) elename = elename.Remove(elename.IndexOf(' '),1);
+ if (!ele.Contains(elename.ToLower())) elename = 'z' + elename;
+ // Add a section [name]
+ XmlNode nd = AddNode(xParent, elename);
+ //AddAttribute(nd,"name",sSection.Substring(1,sSection.IndexOf("]")-1));
+ return nd;
+ }
+ private XmlNode AddSection_UC(XmlNode xParent, string sSection )
+ {
+ // Add a section [name]
+ string name_uc = sSection.Substring(1,sSection.IndexOf("]")-1).ToUpper() + "__UC";
+ XmlNode nd =AddNode(xParent,name_uc);
+ // AddAttribute(nd,"name",name_uc);
+ return nd;
+ }
+ private void AddComment(XmlNode xParent, string sComment)
+ {
+
+ if(xParent.ChildNodes.Count > 0)
+ {
+ XmlNode ndlast=xParent.ChildNodes.Item(xParent.ChildNodes.Count-1);
+ if(ndlast.Name=="comment")
+ {
+ XmlNode xa = ndlast.Attributes.GetNamedItem("text");
+ xa.Value=xa.Value + "\r\n" + sComment;
+ return;
+ }
+ }
+ // Add a comment text
+ XmlNode nd =AddNode(xParent,"comment");
+ AddAttribute(nd,"text",sComment);
+ }
+ private void AddLine(XmlNode xParent, string sLine)
+ {
+ // Add a comment text
+ XmlNode nd =AddNode(xParent,"line");
+ AddAttribute(nd,"text",sLine);
+ }
+ private void AddParam(XmlNode xParent, string sParam)
+ {
+ int i = sParam.IndexOf("=");
+ // get the name. If it's not in the 'migrated attribute' list, then
+ // preface the name with a 'z'.
+ string attrname = sParam.Substring(0, i);
+ while (attrname.IndexOf(' ') > -1) attrname = attrname.Remove(attrname.IndexOf(' '), 1);
+ if (!attr.Contains(attrname.ToLower())) attrname = 'z' + attrname;
+ string sValue=sParam.Substring(i+1);
+ string sName = attrname.Trim(' ');
+ AddAttribute(xParent, sName, sValue);
+ }
+ private void AddParam_UC(XmlNode xParent, string sParam)
+ {
+ int i = sParam.IndexOf("=");
+ // add a param name=value
+ string sName=sParam.Substring(0,i);
+ string sValue=sParam.Substring(i+1);
+ //XmlNode nd =AddNode(xParent,"paramUC");
+ sName = sName.Trim(' ');
+ AddAttribute(xParent, sName, sValue);
+ //AddAttribute(nd,"name",sName.ToUpper()+"__UC");
+ //AddAttribute(nd,"value",sValue);
+ }
+ private void LoadXML()
+ {
+ string sLine;
+ ppXml.LoadXml("");// initialize ppXml
+ XmlNode xmlTop=ppXml.DocumentElement;
+ XmlNode xmlNd=ppXml.DocumentElement;
+ //XmlNode xmlNd_UC=ppXml.DocumentElement;
+ StreamReader myReader = new StreamReader(ppName);// Open file
+ while( (sLine = myReader.ReadLine())!= null)// read line-by-line
+ {
+ // add structure
+ try
+ {
+ if (sLine.Length > 0)
+ {
+ switch (sLine.Substring(0, 1))
+ {
+ case "[":
+ xmlNd = AddSection(xmlTop, sLine);
+ //xmlNd_UC=AddSection_UC(xmlTop, sLine);
+ break;
+ case ";":
+ //AddComment(xmlNd, sLine);
+ break;
+ default:
+ if (sLine.IndexOf("=") >= 0)
+ {
+ AddParam(xmlNd, sLine);
+ //AddParam_UC(xmlNd_UC, sLine);
+ }
+ else
+ {
+ //AddLine(xmlNd, sLine);
+ }
+ break;
+ }
+ }
+ }
+ catch (Exception ex)
+ {
+ log.ErrorFormat("error parsing .INI file: {0} - Directory: {1}", ex.Message,ppName);
+ }
+ }
+ myReader.Close();
+ }
+ public PrivateProfile(string sFileName, List listIni_EleName, List listIni_AttrName)
+ {
+ ppName=sFileName;
+ ppXml= new XmlDocument();
+ attr = listIni_AttrName;
+ ele = listIni_EleName;
+ LoadXML();
+ }
+ ~PrivateProfile()
+ {
+ // Clean-up
+ //
+ }
+ public string PrettyNode(XmlNode nd,int level)
+ {
+ string retval="";
+ string prefix=new string(' ',level*2);
+ if(nd.ChildNodes.Count > 0)
+ {
+ retval = prefix + "<" + nd.Name;
+ for(int i=0;i";
+ for(int i=0;i";
+ }
+ else
+ {
+ retval = prefix + "<" + nd.Name;
+ for(int i=0;i";
+ }
+ return retval;
+ }
+ public string PrettyXML()
+ {
+ return PrettyNode(ppXml.DocumentElement,0);
+ }
+ public XmlDocument XML()
+ {
+ // return XML Document
+ return ppXml;
+ }
+ public override string ToString()
+ {
+ // return string
+ return "";
+ }
+ public void Save()
+ {
+ SaveAs(ppName);
+ }
+ public void SaveAs(string sName)
+ {
+ }
+ public string Attr(string sPath)
+ {
+ string retval="";
+ XmlNode xn = ppXml.SelectSingleNode(sPath);
+ if(xn != null)
+ {
+ string quots = xn.Value;
+ if (quots.Substring(0,1)=="\"" && quots.Substring(quots.Length-1,1)=="\"")
+ retval = quots.Substring(1,quots.Length-2);
+ else
+ retval=xn.Value;
+ }
+ return retval;
+ }
+
+ public string Attr(string sSection, string sParameter)
+ {
+ string findstr = "/ini/sectionUC[@name='" + sSection.ToUpper() + "__UC']/paramUC[@name='" + sParameter.ToUpper() + "__UC']/@value";
+ return Attr(findstr);
+ }
+ }
+}
diff --git a/PROMS/DataLoader/Procedures.cs b/PROMS/DataLoader/Procedures.cs
new file mode 100644
index 00000000..c80ac4f9
--- /dev/null
+++ b/PROMS/DataLoader/Procedures.cs
@@ -0,0 +1,189 @@
+// ========================================================================
+// Copyright 2006 - Volian Enterprises, Inc. All rights reserved.
+// Volian Enterprises - Proprietary Information - DO NOT COPY OR DISTRIBUTE
+// ------------------------------------------------------------------------
+// $Workfile: $ $Revision: $
+// $Author: $ $Date: $
+//
+// $History: $
+// ========================================================================
+using System;
+using System.Drawing;
+using System.Collections;
+using System.ComponentModel;
+using System.Windows.Forms;
+using System.Data;
+using System.Data.OleDb;
+using System.Collections.Specialized;
+using System.Collections.Generic;
+using System.Xml;
+using System.IO;
+using System.Text;
+using Volian.CSLA.Library;
+
+namespace DataLoader
+{
+ public partial class frmLoader : Form
+ {
+ private Int32 MigrateProcedure(OleDbConnection cn, DataRow dr, Byte FromType, Int32 FromID, string pth)
+ {
+ dicOldStepSequence = new Dictionary