diff --git a/PROMS/DataLoader/ConfigInfo.cs b/PROMS/DataLoader/ConfigInfo.cs
index 054d3986..c296f8c7 100644
--- a/PROMS/DataLoader/ConfigInfo.cs
+++ b/PROMS/DataLoader/ConfigInfo.cs
@@ -21,7 +21,7 @@ namespace DataLoader
{
xmldoc = new XmlDocument();
if (xml == null)
- xmldoc.LoadXml("");
+ xmldoc.LoadXml("");
else
xmldoc.LoadXml(xml);
}
@@ -30,7 +30,7 @@ namespace DataLoader
{
xmldoc = new XmlDocument();
if (xml == null)
- xmldoc.LoadXml("");
+ xmldoc.LoadXml("");
else
xmldoc.LoadXml(xml);
AddItem(ename, aname.Replace(' ','_'), avalue);
diff --git a/PROMS/DataLoader/CurSet.cs b/PROMS/DataLoader/CurSet.cs
index c458037b..79529e92 100644
--- a/PROMS/DataLoader/CurSet.cs
+++ b/PROMS/DataLoader/CurSet.cs
@@ -15,7 +15,7 @@ using System.Text;
using System.Windows.Forms;
using System.Xml;
using System.Xml.Serialization;
-using Volian.CSLA.Library;
+using VEPROMS.CSLA.Library;
namespace Utils
{
@@ -26,10 +26,12 @@ namespace Utils
{
private int NUMCBTEXTYPE = 5; // number of changebar text types.
public string PathName;
+ private string DefaultPlantFmt;
public CurSet(string pname)
{
PathName = pname;
+ DefaultPlantFmt = null;
}
private string ReadTheString(BinaryReader bw, int maxlen)
@@ -62,7 +64,7 @@ namespace Utils
}
catch (Exception e)
{
- DataLoader.frmLoader.log.ErrorFormat("Error migrating Curset.dat, error = {0}", e.Message);
+ DataLoader.frmLoader.log.ErrorFormat("Error migrating {0} Curset.dat, error = {1}", PathName, e.Message);
return cfg;
}
@@ -83,6 +85,7 @@ namespace Utils
cfg.Print_Pagination=(FolderConfig.PrintPagination) br.ReadSByte();
tmpstring = ReadTheString(br,4); // DefaultPrinter not used
cfg.Format_Plant = ReadTheString(br,10);
+ DefaultPlantFmt = cfg.Format_Plant;
tmpstring = ReadTheString(br, 128); // DefaultDestFName not used
tmpsbyte = br.ReadSByte(); // DefaultPlotterType not used
tmpsbyte = br.ReadSByte(); // DefaultPlotterPort not used
@@ -95,16 +98,20 @@ namespace Utils
tmpsbyte = br.ReadSByte(); // DontPrintStatusTree not used
cfg.Print_UserFormat = ReadTheString(br, 10);
tmpsbyte = br.ReadSByte();
- cfg.Print_DisableDuplex = tmpsbyte == 0 ? false : true;
+ //cfg.Print_Duplex = tmpsbyte == 0 ? true : false;
br.Close();
}
catch(Exception e)
{
if(br!=null) br.Close();
- DataLoader.frmLoader.log.ErrorFormat("Error migrating Curset.dat, error = {0}", e.Message);
+ DataLoader.frmLoader.log.ErrorFormat("Error migrating {0} Curset.dat, error = {1}", PathName, e.Message);
}
fs.Close();
return cfg;
}
+ public string GetDefFmt()
+ {
+ return DefaultPlantFmt;
+ }
}
}
diff --git a/PROMS/DataLoader/DocVersions.cs b/PROMS/DataLoader/DocVersions.cs
index a2f7df0a..bffdd875 100644
--- a/PROMS/DataLoader/DocVersions.cs
+++ b/PROMS/DataLoader/DocVersions.cs
@@ -19,43 +19,57 @@ using System.Collections.Generic;
using System.Xml;
using System.IO;
using System.Text;
-using Volian.CSLA.Library;
+using VEPROMS.CSLA.Library;
namespace DataLoader
{
- public partial class frmLoader : Form
+ public partial class Loader
{
- private Int32 MigrateDocVersion(string pth)
+ public Item MigrateDocVersion(DocVersion docver)
{
-
- Int32 iStructureID = 0;
+ string pth = docver.Title;
// 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)....
+ Database.LogInfoFormat("Before ROFST");
rofst = new ROFST(pth + "\\ro.fst");
// Migrate library documents
+ Database.LogInfoFormat("Before MigrateLibDocs");
MigrateLibDocs(cn, pth);
// Initialize Dictionaries
- dicTrans_StrDone = new Dictionary();
- dicTrans_StrIds = new Dictionary();
+ dicTrans_ItemDone = new Dictionary();
+ dicTrans_ItemIds = new Dictionary();
+
+ // Create a 'dummy' content record. This will be used for any transitions 'to'
+ // that don't exist when dbf is processed. At end, use this to see if there
+ // are missing transitions.
+ TransDummyCont = Content.MakeContent(null, "DUMMY CONTENT FOR TRANSITION MIGRATION", null, null, null);
+
// Process Procedures
- iStructureID = MigrateProcedures(cn,pth);
+ Item itm = MigrateProcedures(cn,pth,docver);
// 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);
+ 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;
+ dicTrans_ItemDone.Clear();
+ dicTrans_ItemDone = null;
+ if (itm != null)
+ {
+ docver.MyItem = itm;
+ docver.Title = "";
+ if (!docver.IsSavable) ErrorRpt.ErrorReport(docver);
+ docver.Save();
+ }
+ return itm;
}
- private Volian.CSLA.Library.VersionTypeEnum DocVersionType(string s)
+ private VEPROMS.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;
+ if (s.EndsWith("approved")) return VEPROMS.CSLA.Library.VersionTypeEnum.Approved;
+ if (s.EndsWith("chgsht")) return VEPROMS.CSLA.Library.VersionTypeEnum.Revision;
+ if (s.EndsWith("tmpchg")) return VEPROMS.CSLA.Library.VersionTypeEnum.Temporary;
+ return VEPROMS.CSLA.Library.VersionTypeEnum.WorkingDraft;
}
}
}
\ No newline at end of file
diff --git a/PROMS/DataLoader/Documents.cs b/PROMS/DataLoader/Documents.cs
index cea9db33..3baa20e7 100644
--- a/PROMS/DataLoader/Documents.cs
+++ b/PROMS/DataLoader/Documents.cs
@@ -20,13 +20,13 @@ using System.Xml;
using System.IO;
using System.Text;
using Volian.MSWord;
-using Volian.CSLA.Library;
+using VEPROMS.CSLA.Library;
namespace DataLoader
{
- public partial class frmLoader : Form
+ public partial class Loader
{
- private void SaveSectionDocument(string fname, string stpseq, ref byte ctype, ref int cid)
+ private void SaveSectionDocument(string fname, string stpseq, ref int cid)
{
int docid = SaveWordDoc(fname);
switch (docid)
@@ -40,7 +40,6 @@ namespace DataLoader
log.ErrorFormat("Could not complete save of word document, oldstepsequence = {0}", stpseq);
break;
default:
- ctype = 2;
cid = docid;
break;
}
@@ -50,7 +49,7 @@ namespace DataLoader
int docid = 0;
if (System.IO.File.Exists(fname))
{
- if (cbSaveDoc.Checked)
+ if (frmMain.cbSaveDocChecked)
{
WordDoc d = new WordDoc(fname);
string temppath = Path.GetTempFileName();
@@ -62,10 +61,12 @@ namespace DataLoader
}
else
{
- if (cbSaveRTF.Checked)
+ if (frmMain.cbSaveRTFChecked)
docid = SaveDoc(fname, title, ci);
}
}
+ else
+ log.ErrorFormat("Missing rtf file: {0}", fname);
return docid;
}
private int SaveWordDoc(string temppath)
@@ -81,8 +82,8 @@ namespace DataLoader
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());
+ string t1 = (title == null || title == "") ? null : title;
+ Document doc = Document.MakeDocument(t1, ByteArray, null, ci == null ? null : ci.ToString(), DateTime.Now, "Migration");
return doc.DocID;
}
// for an io exception, keep trying
@@ -110,5 +111,5 @@ namespace DataLoader
}
return done;
}
- }
+ }
}
\ No newline at end of file
diff --git a/PROMS/DataLoader/ErrorReport.cs b/PROMS/DataLoader/ErrorReport.cs
new file mode 100644
index 00000000..1f273629
--- /dev/null
+++ b/PROMS/DataLoader/ErrorReport.cs
@@ -0,0 +1,28 @@
+using System;
+using System.Collections.Generic;
+using System.Text;
+using System.Windows.Forms;
+using VEPROMS.CSLA.Library;
+using Csla.Validation;
+
+namespace DataLoader
+{
+ public static class ErrorRpt
+ {
+ public static void ErrorReport(IVEHasBrokenRules mybr)
+ {
+ string smess = mybr.GetType().Name;
+ IVEHasBrokenRules hbr = mybr.HasBrokenRules;
+ if (hbr == null) smess += "\n Unknown Error";
+ else
+ {
+ smess += "\n In object" + hbr.GetType().Name;
+ foreach (BrokenRule br in hbr.BrokenRules)
+ {
+ smess += "\n" + br.Property + " - " + br.Description;
+ }
+ }
+ MessageBox.Show(smess);
+ }
+ }
+}
diff --git a/PROMS/DataLoader/FolderTreeNode.cs b/PROMS/DataLoader/FolderTreeNode.cs
index f65671e9..92775a14 100644
--- a/PROMS/DataLoader/FolderTreeNode.cs
+++ b/PROMS/DataLoader/FolderTreeNode.cs
@@ -10,7 +10,7 @@
using System;
using System.Collections.Generic;
using System.Text;
-using Volian.CSLA.Library;
+using VEPROMS.CSLA.Library;
using Csla;
using System.Windows.Forms;
@@ -69,7 +69,7 @@ namespace DataLoader
ftp = new FolderTreeNode(fi.ParentID.ToString());
dicMissing.Add(fi.ParentID, ftp);
dicExists.Add(fi.ParentID, ftp);
- if (fi.DocVersionCount > 0)
+ if (fi.FolderDocVersionCount > 0)
{
TreeNode tn = new TreeNode("dummy");
tn.Tag = "dummy";
@@ -87,7 +87,7 @@ namespace DataLoader
else
{
ft = new FolderTreeNode(fi);
- if (fi.DocVersionCount > 0)
+ if (fi.FolderDocVersionCount > 0)
{
TreeNode tn = new TreeNode("dummy");
tn.Tag = "dummy";
diff --git a/PROMS/DataLoader/Formats.cs b/PROMS/DataLoader/Formats.cs
new file mode 100644
index 00000000..15f42fde
--- /dev/null
+++ b/PROMS/DataLoader/Formats.cs
@@ -0,0 +1,145 @@
+// ========================================================================
+// 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.Xml.XPath;
+using System.IO;
+using System.Text;
+using VEPROMS.CSLA.Library;
+
+namespace DataLoader
+{
+ public partial class Loader
+ {
+
+ private Format AddFormatToDB(Format parent, string format, bool issub, DateTime Dts, string Userid)
+ {
+ string fmtdata = null;
+ string genmacdata = null;
+ XmlDocument xd = null;
+
+ string path = "e:\\fmtall\\" + format + "all.xml";
+ if (File.Exists(path))
+ {
+ xd = new XmlDocument();
+ xd.Load(path);
+ fmtdata = xd.OuterXml;
+ }
+
+ // Do we need genmac - only if non-subformat
+ if (!issub)
+ {
+ path = "e:\\genmacall\\" + format + ".svg";
+ if (File.Exists(path))
+ {
+ XmlDocument xdg = new XmlDocument();
+ xdg.Load(path);
+ genmacdata = xdg.OuterXml;
+ }
+ }
+ // Get the name & then create the record.
+ if (Userid == null || Userid == "") Userid = "Migration";
+
+ string nmattr = "Default";
+
+ // use xpath to get name.
+ if (parent != null)
+ {
+ XmlNode nmnode = xd.SelectSingleNode("//FormatData");
+ if (nmnode is XmlElement)
+ {
+ XmlElement xm = (XmlElement)nmnode;
+ nmattr = xm.GetAttribute("Name");
+ }
+ }
+ // use the format name if base or non sub. If it's a sub, remove the "_".
+ string fname = issub ? format.Replace("_", "") : format;
+ Format rec = Format.MakeFormat(parent, fname, nmattr, fmtdata, genmacdata, Dts, Userid);
+ return rec;
+ }
+ public void LoadAllFormats()
+ {
+ Format basefmt = null;
+ Format parent = null;
+
+ // Load base format.
+ basefmt = AddFormatToDB(null, "base", false, DateTime.Now, "Migration");
+
+ // now loop through all files... If there is an _ in the name, it's a subformat
+ // (for example, AEP_00.xml) skip it in main loop, it's handled for each format.
+ DirectoryInfo di = new DirectoryInfo("e:\\fmtall");
+ FileInfo[] fis = di.GetFiles("*.xml");
+
+ foreach (FileInfo fi in fis)
+ {
+ bool issub = (fi.Name.IndexOf("_") > 0) ? true : false;
+ if (!issub && fi.Name.ToLower()!="baseall.xml")
+ {
+ string fmtname = fi.Name.Substring(0, fi.Name.Length - 7);
+ // remove the all.xml part of the filename.
+ parent = AddFormatToDB(basefmt, fmtname, issub, DateTime.Now, "Migration");
+
+ // now see if there are any subformats associated with this, if so
+ // add them here...
+ DirectoryInfo sdi = new DirectoryInfo("e:\\fmtall");
+ FileInfo[] sfis = di.GetFiles(fmtname+"_*.xml");
+ foreach (FileInfo sfi in sfis)
+ {
+ string nm = sfi.Name.Substring(0, sfi.Name.Length-7);
+ Format subfmt = AddFormatToDB(parent, nm, true, DateTime.Now, "Migration");
+ }
+ }
+ }
+ }
+ public Format GetFormat(string format)
+ {
+ Format parent = null;
+ Format rec = null;
+
+ // get base
+ Format baseparent = Format.Get(1);
+
+ // if there is no format - what should be done? maybe nothing.
+ if (format == null || format == "") return null;
+
+ try
+ {
+ if (format.IndexOf(' ') > -1) // will have spaces if it's a user format
+ {
+ string part1 = format.Substring(0, format.IndexOf(' '));
+ string part2 = format.Substring(format.LastIndexOf(' ') + 1, 2);
+ format = part1 + part2;
+
+ // get the parent format's id (for example, AEP for AEP00).
+ parent = Format.GetExistingByParentID_Name(baseparent.FormatID, part1);
+ }
+ else
+ parent = baseparent;
+
+ // see if the format has been added, if not go get it.
+ rec = Format.GetExistingByParentID_Name(parent.FormatID, format);
+ }
+ catch (Exception ex)
+ {
+ log.ErrorFormat("Error getting xml version of format {0}", ex.Message);
+ }
+ return rec;
+ }
+
+ }
+}
\ No newline at end of file
diff --git a/PROMS/DataLoader/GroupProp.cs b/PROMS/DataLoader/GroupProp.cs
index 5e21bea1..3b467dc3 100644
--- a/PROMS/DataLoader/GroupProp.cs
+++ b/PROMS/DataLoader/GroupProp.cs
@@ -6,7 +6,7 @@ using System.Drawing;
using System.Text;
using System.Windows.Forms;
using Csla;
-using Volian.CSLA.Library;
+using VEPROMS.CSLA.Library;
namespace DataLoader
{
@@ -39,6 +39,7 @@ namespace DataLoader
}
private void btnSave_Click(object sender, EventArgs e)
{
+ if (!grp.IsSavable) ErrorRpt.ErrorReport(grp);
grp.Save();
}
}
diff --git a/PROMS/DataLoader/LibDoc.cs b/PROMS/DataLoader/LibDoc.cs
index 770f7040..e770186b 100644
--- a/PROMS/DataLoader/LibDoc.cs
+++ b/PROMS/DataLoader/LibDoc.cs
@@ -26,28 +26,9 @@ using Org.Mentalis.Files;
namespace DataLoader
{
- public partial class frmLoader : Form
+ public partial class Loader
{
- 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
@@ -56,15 +37,15 @@ namespace DataLoader
// 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);
+ frmMain.UpdateLabelsLibDocs(0, 0);
if (Directory.Exists(pth + "\\rtffiles"))
{
DirectoryInfo di = new DirectoryInfo(pth + "\\RTFFILES");
FileInfo[] fis = di.GetFiles("DOC_*.LIB");
- pbProc.Maximum = fis.Length;
+ frmMain.UpdateLabelsSetProc(fis.Length);
foreach (FileInfo fi in fis)
{
- UpdateLabelsLibDocs(1, 0);
+ frmMain.UpdateLabelsLibDocs(1, 0);
dicLibDocSect[fi.Name.Substring(0, 8).ToUpper()] = MigrateLibDoc(fi);
}
}
@@ -72,10 +53,10 @@ namespace DataLoader
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;
+ frmMain.UpdateLabelsSetSect(ds_doc.Tables[0].Rows.Count);
foreach (DataRow dr_doc in ds_doc.Tables[0].Rows)
{
- UpdateLabelsLibDocs(0, 1);
+ frmMain.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());
@@ -150,4 +131,5 @@ namespace DataLoader
return tmpRtfFileName;
}
}
+
}
\ No newline at end of file
diff --git a/PROMS/DataLoader/LoadConfig.cs b/PROMS/DataLoader/LoadConfig.cs
index 627b8f07..2d3f7e2f 100644
--- a/PROMS/DataLoader/LoadConfig.cs
+++ b/PROMS/DataLoader/LoadConfig.cs
@@ -19,7 +19,7 @@ using System.Collections.Generic;
using System.Xml;
using System.IO;
using System.Text;
-using Volian.CSLA.Library;
+using VEPROMS.CSLA.Library;
namespace Config
{
@@ -177,6 +177,22 @@ namespace Config
return null;
}
XmlDocument d = IniToXml(inipath);
+ // see if default image file extension was set, if not make it TIF
+ XmlNode gr = d.SelectSingleNode("//Graphics");
+ XmlNode ext = null;
+ if (gr != null) ext = gr.SelectSingleNode("@defaultext");
+ if (ext == null)
+ {
+ // if the graphics node doesn't exist, make it.
+ if (gr == null)
+ {
+ gr = d.CreateElement("Graphics");
+ d.DocumentElement.AppendChild(gr);
+ }
+ XmlAttribute xa = d.CreateAttribute("defaultext");
+ xa.Value = "TIF";
+ gr.Attributes.Append(xa);
+ }
return d;
}
diff --git a/PROMS/DataLoader/LoadTreeDB.cs b/PROMS/DataLoader/LoadTreeDB.cs
index b1cefd92..712d8160 100644
--- a/PROMS/DataLoader/LoadTreeDB.cs
+++ b/PROMS/DataLoader/LoadTreeDB.cs
@@ -19,7 +19,7 @@ using System.Collections.Generic;
using System.Xml;
using System.IO;
using System.Text;
-using Volian.CSLA.Library;
+using VEPROMS.CSLA.Library;
using vlnObjectLibrary;
using vlnServerLibrary;
using Org.Mentalis.Files;
@@ -28,7 +28,7 @@ using Utils;
namespace DataLoader
{
- public partial class frmLoader : Form
+ public partial class Loader
{
private List vlnDataPathFolders() // was vlnDataPath
{
@@ -44,34 +44,44 @@ namespace DataLoader
if (s1.Length > 0)
{
string[] s2 = s1.Split(",".ToCharArray());
- Folder fld = Folder.MakeFolder(sysFolder.FolderID, dbConn.DBID, s2[1], s2[0], null);
+ Folder fld = Folder.MakeFolder(sysFolder, dbConn, s2[1], s2[0], FolderName(s2[0]), null, null, DateTime.Now, "Migration");
dpf.Add(fld);
}
}
return dpf;
}
- private int cslaObject(vlnObject vb, int dbid, int parentid, TreeNode tn)
+ private string FolderName(string Path)
+ {
+ int ind = Path.LastIndexOf("\\");
+ if (ind == Path.Length-1 || ind < 0) return Path;
+ return Path.Substring(ind + 1);
+ }
+ private object cslaObject(vlnObject vb, Connection dbConn, Object parfld, TreeNode tn)
{
switch (vb.Type)
{
case "plant":
case "set":
- Folder fld = Folder.MakeFolder(parentid, dbid, vb.Title, vb.Path, string.Empty);
+ Folder fld = Folder.MakeFolder((Folder)parfld, dbConn, vb.Title, vb.Path, FolderName(vb.Path), null, null, DateTime.Now, "Migration");
tn.Tag = fld;
- return fld.FolderID;
+ return (object) fld;
case "version":
ConfigFile cfg = new ConfigFile();
XmlDocument d = cfg.IniToXml(vb.Path + "\\proc.ini");
- FolderConfig fld_cfg = new FolderConfig(d==null?"":d.InnerXml);
+ //DocVersionConfig fld_cfg = new DocVersionConfig(d == null ? "" : d.InnerXml);
+ FolderConfig fld_cfg = (d==null)?null:new FolderConfig(d.InnerXml);
// translate curset.dat into xml & add to d (somehow).
string csfile = string.Format("{0}\\curset.dat",vb.Path);
+ string defPlantFmt = null;
if (File.Exists(csfile))
{
CurSet cs = new CurSet(csfile);
try
{
+ if (fld_cfg == null) fld_cfg = new FolderConfig();
fld_cfg = cs.Convert(fld_cfg);
+ defPlantFmt = cs.GetDefFmt();
}
catch (Exception ex)
{
@@ -87,13 +97,21 @@ namespace DataLoader
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());
+ Folder tmpfld = (Folder)parfld;
+ Format format = null;
+ if (defPlantFmt != null && defPlantFmt != "")
+ {
+ format = GetFormat(defPlantFmt);
+ }
+ else
+ format = Format.Get(1);
+ DocVersion v = DocVersion.MakeDocVersion(tmpfld, (int)DocVersionType(vb.Path.ToLower()), thetitle, vb.Path.ToLower(), null, format, fld_cfg == null ? null : fld_cfg.ToString(), DateTime.Now, "Migration");
tn.Tag = v;
- return v.VersionID;
+ return (object) v;
}
return 0;
}
- private void MigrateChildren(vlnObject vb, vlnServer vs, int dbid, int parentid, TreeNode tn)
+ private void MigrateChildren(vlnObject vb, vlnServer vs, Connection dbConn, Object parent, TreeNode tn)
{
if (vb.Type != "version")
{
@@ -102,10 +120,12 @@ namespace DataLoader
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);
+ object idc = cslaObject(vbc, dbConn, parent, tnc);
+ frmMain.Status = "Loading " + vbc.Title;
+ MigrateChildren(vbc, vs, dbConn, idc, tnc);
}
}
+ frmMain.Status = " ";
}
}
}
\ No newline at end of file
diff --git a/PROMS/DataLoader/LoadTreeNh.cs b/PROMS/DataLoader/LoadTreeNh.cs
index 83e44b49..b76e5b01 100644
--- a/PROMS/DataLoader/LoadTreeNh.cs
+++ b/PROMS/DataLoader/LoadTreeNh.cs
@@ -20,21 +20,21 @@ using System.Collections.Generic;
using System.Xml;
using System.IO;
using System.Text;
-using Volian.CSLA.Library;
+using VEPROMS.CSLA.Library;
namespace DataLoader
{
- public partial class frmLoader : Form
+ public partial class Loader
{
- private bool LoadChildren(FolderInfo fld, TreeNode tn)
+ public bool LoadChildren(FolderInfo fld, TreeNode tn)
{
tn.Nodes.Clear();
bool bLoaded = true;
- foreach (DocVersionInfo fdv in fld.DocVersions)
+ foreach (DocVersionInfo fdv in fld.FolderDocVersions)
{
TreeNode tnc = tn.Nodes.Add(fdv.Title);
tnc.Tag = fdv;
- tnc.Checked = fdv.StructureID != 0;
+ tnc.Checked = fdv.ItemID != 0;
bLoaded &= tnc.Checked;
}
return bLoaded;
diff --git a/PROMS/DataLoader/Loader.cs b/PROMS/DataLoader/Loader.cs
new file mode 100644
index 00000000..ef84e511
--- /dev/null
+++ b/PROMS/DataLoader/Loader.cs
@@ -0,0 +1,212 @@
+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 VEPROMS.CSLA.Library;
+using Config;
+
+namespace DataLoader
+{
+ public partial class Loader
+ {
+ #region ClassProperties
+ private int wms = 500;
+ private static int EDDATA = 0x01;
+ private static int PH = 0x02;
+ private static int TOC = 0x04;
+ private static int AUTOIND = 0x08;
+ private static int AUTOGEN = 0x40;
+
+ private static int STP_MULT_CHGID = 1;
+ private static int STP_LNK_SEQ = 2;
+ private static int STP_OVR_TAB = 3;
+
+ private string ProcFileName;
+ private string ProcNumber;
+ private ROFST rofst;
+ private int EditSectId;
+ private Dictionary dicLibDocRef;
+
+ // have a few variables for storing the database id record & the system record.
+ public Connection dbConn;
+ public Folder sysFolder;
+ public AnnotationType CommentType; // this holds the annotationtype of comment for future use
+ public Document MissingDocument=null; // make a document if there is a missing rtf file
+ // any missing will use this.
+ private Content TransDummyCont;
+ // the following two dictionaries are used to handle migration of the
+ // transitions... dicTrans_ItemDone gets an entry for procnumber, sequence
+ // number and the new item id as a step or section is created (transitions
+ // can go to steps or sections). When a transition is encountered, check this
+ // dictionary to see if the step or section was migrated & use the item
+ // for the step or section if it was migrated. When a transition is migrated where
+ // the 'to' has not been migrated yet, check if an entry exists in dicTrans_ItemIds,
+ // if so, use the item listed here. If no entry exists in dicTrans_ItemIds, create
+ // an item table record and use the id as part of the 'to', and add an entry to
+ // dicTrans_ItemIds to flag that the record was already created. As migrating sections
+ // and steps, check this dicTrans_ItemIds to see if the item record has already
+ // been create, if so use it and remove it from the dicTrans_ItemIds dictionary,
+ // otherwise, create a new item record.
+ private Dictionary dicTrans_ItemDone;
+ private Dictionary dicTrans_ItemIds;
+ private Dictionary