Added Error Handling and Reporting

This commit is contained in:
Rich 2009-11-04 17:15:29 +00:00
parent cd04644e2f
commit f26cc50c3c
13 changed files with 265 additions and 86 deletions

View File

@ -63,6 +63,7 @@ namespace DataLoader
if (convertProcedures) if (convertProcedures)
{ {
ShowMissingTransitions(); ShowMissingTransitions();
frmMain.Status = string.Format("{0}\r\nConversion completed in {1} seconds.", pth, TimeSpan.FromTicks(lTime).TotalSeconds);
log.InfoFormat("Completed Migration of {0}", pth); log.InfoFormat("Completed Migration of {0}", pth);
MessageBox.Show("Completed Migration of " + pth); MessageBox.Show("Completed Migration of " + pth);
@ -70,6 +71,8 @@ namespace DataLoader
dicTrans_ItemDone.Clear(); dicTrans_ItemDone.Clear();
dicTrans_ItemDone = null; dicTrans_ItemDone = null;
} }
else
frmMain.Status = string.Format("{0}\r\nDone.", pth);
cn.Close(); cn.Close();
if (itm != null) if (itm != null)
{ {

View File

@ -78,7 +78,7 @@ namespace DataLoader
// if need landscape set too: bool landscape = (stype[1] == 'L'); // if need landscape set too: bool landscape = (stype[1] == 'L');
d.SetLineSpacing(lpi); // if need landscape set too: , landscape); ; d.SetLineSpacing(lpi); // if need landscape set too: , landscape); ;
} }
string temppath = Path.GetTempFileName(); //string temppath = Path.GetTempFileName();
/* 16-bit's type[1] used the following codes to represent the respective lpi setting /* 16-bit's type[1] used the following codes to represent the respective lpi setting
* *
* char far typestr[] = "*pP46f7L"; * char far typestr[] = "*pP46f7L";
@ -118,7 +118,8 @@ namespace DataLoader
} }
} }
else else
log.ErrorFormat("Missing rtf file: {0}", fname); //log.ErrorFormat("Missing rtf file: {0}", fname);
frmMain.AddError("Missing rtf file: {0}", fname);
return docid; return docid;
} }
private int SaveWordDoc(string temppath, string stype) private int SaveWordDoc(string temppath, string stype)
@ -150,6 +151,7 @@ namespace DataLoader
catch (IOException exio) catch (IOException exio)
{ {
Console.WriteLine("IO: {0} - {1}", exio.GetType().Name, exio.Message); Console.WriteLine("IO: {0} - {1}", exio.GetType().Name, exio.Message);
frmMain.AddError(exio, "SaveTheDoc('{0}','{1}')", temppath, title);
Wait(2); Wait(2);
return 0; return 0;
} }
@ -157,6 +159,7 @@ namespace DataLoader
{ {
log.Error("Save Word Doc"); log.Error("Save Word Doc");
log.ErrorFormat("{0}\r\n\r\n{1}", ex.Message, ex.InnerException); log.ErrorFormat("{0}\r\n\r\n{1}", ex.Message, ex.InnerException);
frmMain.AddError(ex, "SaveTheDoc('{0}','{1}')", temppath, title);
return -1; return -1;
} }

View File

@ -35,22 +35,38 @@ namespace DataLoader
string path = "c:\\development\\fmtall\\" + format + "all.xml"; string path = "c:\\development\\fmtall\\" + format + "all.xml";
if (File.Exists(path)) if (File.Exists(path))
{
try
{ {
xd = new XmlDocument(); xd = new XmlDocument();
xd.Load(path); xd.Load(path);
fmtdata = xd.OuterXml; fmtdata = xd.OuterXml;
} }
catch(Exception ex)
{
frmMain.AddError(ex, "AddFormatToDB('{0}','{1}')", parent.Name, path);
return null;
}
}
// Do we need genmac - only if non-subformat // Do we need genmac - only if non-subformat
if (!issub) if (!issub)
{ {
path = "c:\\development\\genmacall\\" + format + ".svg"; path = "c:\\development\\genmacall\\" + format + ".svg";
if (File.Exists(path)) if (File.Exists(path))
{
try
{ {
XmlDocument xdg = new XmlDocument(); XmlDocument xdg = new XmlDocument();
xdg.Load(path); xdg.Load(path);
genmacdata = xdg.OuterXml; genmacdata = xdg.OuterXml;
} }
catch (Exception ex)
{
frmMain.AddError(ex, "AddFormatToDB('{0}','{1}')", parent.Name, path);
return null;
}
}
} }
// Get the name & then create the record. // Get the name & then create the record.
if (Userid == null || Userid == "") Userid = "Migration"; if (Userid == null || Userid == "") Userid = "Migration";
@ -79,7 +95,7 @@ namespace DataLoader
// Load base format. // Load base format.
basefmt = AddFormatToDB(null, "base", false, DateTime.Now, "Migration"); basefmt = AddFormatToDB(null, "base", false, DateTime.Now, "Migration");
if (basefmt == null) return;
// now loop through all files... If there is an _ in the name, it's a subformat // 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. // (for example, AEP_00.xml) skip it in main loop, it's handled for each format.
DirectoryInfo di = new DirectoryInfo(@"c:\development\fmtall"); DirectoryInfo di = new DirectoryInfo(@"c:\development\fmtall");
@ -95,7 +111,8 @@ namespace DataLoader
try try
{ {
parent = AddFormatToDB(basefmt, fmtname, issub, DateTime.Now, "Migration"); parent = AddFormatToDB(basefmt, fmtname, issub, DateTime.Now, "Migration");
if (parent != null)
{
// now see if there are any subformats associated with this, if so // now see if there are any subformats associated with this, if so
// add them here... // add them here...
DirectoryInfo sdi = new DirectoryInfo("c:\\development\\fmtall"); DirectoryInfo sdi = new DirectoryInfo("c:\\development\\fmtall");
@ -103,20 +120,24 @@ namespace DataLoader
foreach (FileInfo sfi in sfis) foreach (FileInfo sfi in sfis)
{ {
string nm = sfi.Name.Substring(0, sfi.Name.Length - 7); string nm = sfi.Name.Substring(0, sfi.Name.Length - 7);
Console.WriteLine("Processing {0}", sfi.Name); //Console.WriteLine("Processing {0}", sfi.Name);
frmMain.Status = string.Format("Processing Format {0}", sfi.Name);
try try
{ {
Format subfmt = AddFormatToDB(parent, nm, true, DateTime.Now, "Migration"); AddFormatToDB(parent, nm, true, DateTime.Now, "Migration");
} }
catch (Exception ex) catch (Exception ex)
{ {
Console.WriteLine("{0} - {1}", ex.GetType().Name, ex.Message); frmMain.AddError(ex, "LoadAllFormats() '{0}'", sfi.Name);
//Console.WriteLine("{0} - {1}", ex.GetType().Name, ex.Message);
}
} }
} }
} }
catch (Exception ex) catch (Exception ex)
{ {
Console.WriteLine("{0} - {1}", ex.GetType().Name, ex.Message); frmMain.AddError(ex, "LoadAllFormats() '{0}'", fi.Name);
//Console.WriteLine("{0} - {1}", ex.GetType().Name, ex.Message);
} }
} }
} }
@ -152,6 +173,7 @@ namespace DataLoader
catch (Exception ex) catch (Exception ex)
{ {
log.ErrorFormat("Error getting xml version of format {0}", ex.Message); log.ErrorFormat("Error getting xml version of format {0}", ex.Message);
frmMain.AddError(ex, "GetFormat('{0}')", format);
} }
FormatInfo recInfo = FormatInfo.Get(rec.FormatID); FormatInfo recInfo = FormatInfo.Get(rec.FormatID);
return recInfo; return recInfo;

View File

@ -86,6 +86,7 @@ namespace DataLoader
catch (Exception ex) catch (Exception ex)
{ {
log.ErrorFormat("error in convert curset.dat, ex = {0}", ex.Message); log.ErrorFormat("error in convert curset.dat, ex = {0}", ex.Message);
frmMain.AddError(ex, "error in convert curset.dat");
} }
} }
string titlepath = vb.Path + "\\" + "Title"; string titlepath = vb.Path + "\\" + "Title";

View File

@ -120,7 +120,8 @@ namespace DataLoader
catch (Exception ex) catch (Exception ex)
{ {
log.ErrorFormat("Could not load data, error = {0}", ex.Message); log.ErrorFormat("Could not load data, error = {0}", ex.Message);
return false; //return false;
throw ex;
} }
return true; return true;
} }
@ -186,6 +187,7 @@ namespace DataLoader
{ {
log.ErrorFormat("Bad Date/Time {0} {1}. Set to NOW.", date, time); log.ErrorFormat("Bad Date/Time {0} {1}. Set to NOW.", date, time);
log.ErrorFormat("{0}\r\n\r\n{1}", ex.Message, ex.InnerException); log.ErrorFormat("{0}\r\n\r\n{1}", ex.Message, ex.InnerException);
frmMain.AddError(ex, "Bad Date/Time {0} {1}", date, time);
//log.ErrorFormat(ex.StackTrace); //log.ErrorFormat(ex.StackTrace);
return dts; return dts;
} }

View File

@ -29,12 +29,18 @@ namespace DataLoader
public static readonly log4net.ILog _MyLog = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType); public static readonly log4net.ILog _MyLog = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
//public static readonly log4net.ILog log = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType); //public static readonly log4net.ILog log = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
#endregion #endregion
public static int HandleCount
{
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)
{ {
dicOldStepSequence = new Dictionary<object, string>(); dicOldStepSequence = new Dictionary<object, string>();
Stack<int> SubSectLevels = new Stack<int>(); // levels of subsections Stack<int> SubSectLevels = new Stack<int>(); // levels of subsections
ProcFileName = dr["Entry"].ToString(); ProcFileName = dr["Entry"].ToString();
ProcNumber = dr["Number"].ToString(); ProcNumber = dr["Number"].ToString();
frmMain.Status = "Processing Procedure " + ProcNumber + " - " + ProcFileName;
DateTime dts = GetDTS(dr["Date"].ToString(), dr["Time"].ToString()); DateTime dts = GetDTS(dr["Date"].ToString(), dr["Time"].ToString());
string userid = dr["initials"].ToString().Trim(); string userid = dr["initials"].ToString().Trim();
if (userid == null || userid == "") userid = "Migration"; if (userid == null || userid == "") userid = "Migration";
@ -72,6 +78,7 @@ namespace DataLoader
DbtOk(dr["entry"].ToString(),pth); DbtOk(dr["entry"].ToString(),pth);
// See if there is PSI and if so, add it to the xml. // See if there is PSI and if so, add it to the xml.
OleDbDataAdapter dapsi = new OleDbDataAdapter("select * from [" + dr["entry"] + "] where [STEP] is null", cn); OleDbDataAdapter dapsi = new OleDbDataAdapter("select * from [" + dr["entry"] + "] where [STEP] is null", cn);
int handleBefore = HandleCount;
try try
{ {
dapsi.Fill(ds); dapsi.Fill(ds);
@ -79,7 +86,26 @@ namespace DataLoader
catch (Exception ex) catch (Exception ex)
{ {
Console.WriteLine(ex.Message); Console.WriteLine(ex.Message);
Application.Exit(); //Application.Exit();
throw ex; // Exit from Data Loader
}
int handleAfter = HandleCount;
if (!RunWithDB2K && handleAfter - handleBefore > 10)
{
string msg = "It appears that handles are being created and not cleared.";
if (dB2KInstalled())
{
msg += "\r\n\r\nThis is most likely because dB2K is installed." +
"\r\n\r\nUninstall dB2K and run again.";
if (MessageBox.Show(msg + "\r\n\r\nDo you want to continue?", "Run with dB2K",
MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
RunWithDB2K = true;
}
else
{
msg += "\r\n\r\nCall Volian for support.";
}
if (!RunWithDB2K)throw new Exception(msg);
} }
dt = ds.Tables[0]; dt = ds.Tables[0];
@ -140,7 +166,7 @@ namespace DataLoader
foreach(ItemInfo ii in dvi.Procedures){ foreach(ItemInfo ii in dvi.Procedures){
if (ii.MyContent.Number == number) if (ii.MyContent.Number == number)
{ {
Console.WriteLine(number); //Console.WriteLine(number);
itm = ii.Get(); itm = ii.Get();
cont = ii.MyContent.Get(); cont = ii.MyContent.Get();
} }
@ -173,6 +199,7 @@ namespace DataLoader
{ {
log.ErrorFormat("{0}\r\n\r\n{1}", ex.Message, ex.InnerException); log.ErrorFormat("{0}\r\n\r\n{1}", ex.Message, ex.InnerException);
log.Error(ex.StackTrace); log.Error(ex.StackTrace);
frmMain.AddError(ex, "MigrateProcedure - {0}", ProcFileName);
} }
da.Dispose(); da.Dispose();
@ -237,6 +264,13 @@ namespace DataLoader
ds.Dispose(); ds.Dispose();
return itm; return itm;
} }
private bool dB2KInstalled()
{
Microsoft.Win32.RegistryKey key = Microsoft.Win32.Registry.LocalMachine.OpenSubKey(@"software\dBase\dB2K");
bool retval = key != null;
key.Close();
return retval;
}
private Item MigrateProcedures(OleDbConnection cn, string pth, DocVersion docver, bool convertProcedures) private Item MigrateProcedures(OleDbConnection cn, string pth, DocVersion docver, bool convertProcedures)
{ {
Item FirstItm = null; Item FirstItm = null;
@ -260,6 +294,7 @@ namespace DataLoader
catch (Exception ex) catch (Exception ex)
{ {
_MyLog.ErrorFormat("MigrateProcedures - {0} - {1}\r\n\r\n{2}", pth,ex.Message, ex.InnerException); _MyLog.ErrorFormat("MigrateProcedures - {0} - {1}\r\n\r\n{2}", pth,ex.Message, ex.InnerException);
throw ex;
} }
return FirstItm; return FirstItm;
} }

View File

@ -46,6 +46,7 @@ namespace DataLoader
} }
catch (Exception ex) catch (Exception ex)
{ {
frmMain.AddError(ex, "migrateRos");
log.Error("Error getting RO Usages"); log.Error("Error getting RO Usages");
log.ErrorFormat("proc number = {0}, oldstepsequence = {1}",ProcNumber, seqcvt); log.ErrorFormat("proc number = {0}, oldstepsequence = {1}",ProcNumber, seqcvt);
do do
@ -89,6 +90,7 @@ namespace DataLoader
} }
catch (Exception ex) catch (Exception ex)
{ {
frmMain.AddError(ex, "MigrateRos '{0}' '{1}' {2}", ProcNumber, seqcvt, instance);
log.Error("Error setting RO data in text field"); log.Error("Error setting RO data in text field");
log.ErrorFormat("Error Message = {0}", ex.Message); log.ErrorFormat("Error Message = {0}", ex.Message);
log.ErrorFormat("proc number = {0}, oldstepsequence = {1}, instance = {2}", ProcNumber, seqcvt, instance); log.ErrorFormat("proc number = {0}, oldstepsequence = {1}, instance = {2}", ProcNumber, seqcvt, instance);

View File

@ -164,7 +164,7 @@ namespace DataLoader
} }
} }
else else
Console.WriteLine(string.Format("{0}", imgfile), "Cannot Find Image File"); frmMain.AddError("Cannot Find Image File {0}", imgfile);
} }
} }
} }

View File

@ -43,7 +43,7 @@ namespace DataLoader
// Find the docstyle based on the section type (step[1]) & the 'type' from the dbf // Find the docstyle based on the section type (step[1]) & the 'type' from the dbf
// record sectype[0]) // record sectype[0])
string dstyleindx = ((stpseq == null || stpseq == "") ? " " : stpseq.Substring(1, 1)) + ((SecType==null||SecType == "") ? " " : SecType.Substring(0, 1)); string dstyleindx = ((stpseq == null || stpseq == "") ? " " : stpseq.Substring(1, 1)) + ((SecType==null||SecType == "") ? " " : SecType.Substring(0, 1));
int docstyleindx = GetDocStyleIndx(dstyleindx, format, procitem, docver); int docstyleindx = GetDocStyleIndx(dstyleindx, format, procitem, docver,Number,Title);
// tack on the column mode - add to config xml for node. // tack on the column mode - add to config xml for node.
if (stpseq != null && stpseq.Substring(1, 1) == "0" && stpseq.Substring(5, 1) != " ") if (stpseq != null && stpseq.Substring(1, 1) == "0" && stpseq.Substring(5, 1) != " ")
@ -122,6 +122,7 @@ namespace DataLoader
} }
catch (Exception ex) catch (Exception ex)
{ {
frmMain.AddError(ex, "Save Section");
log.Error("Save Section"); log.Error("Save Section");
log.ErrorFormat("oldstepsequence = {0}", stpseq); log.ErrorFormat("oldstepsequence = {0}", stpseq);
log.ErrorFormat("{0}\r\n\r\n{1}", ex.Message, ex.InnerException); log.ErrorFormat("{0}\r\n\r\n{1}", ex.Message, ex.InnerException);
@ -182,12 +183,13 @@ namespace DataLoader
} }
catch (Exception ex) catch (Exception ex)
{ {
frmMain.AddError(ex, "OldToNew {0}", lkup);
Console.WriteLine(string.Format("Error in oldtonew {0}", lkup)); Console.WriteLine(string.Format("Error in oldtonew {0}", lkup));
Console.WriteLine(string.Format("Error = {0}", ex.Message)); Console.WriteLine(string.Format("Error = {0}", ex.Message));
} }
return retval; return retval;
} }
private int GetDocStyleIndx(string dstyleindx, FormatInfo format, Item procitem, DocVersion docver) private int GetDocStyleIndx(string dstyleindx, FormatInfo format, Item procitem, DocVersion docver, string Number, string Title)
{ {
// get the format, if format is set, use it, otherwise walk // get the format, if format is set, use it, otherwise walk
if (format == null) if (format == null)
@ -199,7 +201,9 @@ namespace DataLoader
{ {
if ((ds.OldToNew & docstyle)>0) return (int)ds.Index; if ((ds.OldToNew & docstyle)>0) return (int)ds.Index;
} }
return 0; frmMain.AddError("Bad OldToNew Document Style {0}:{1} dStyleIndex = '{2}'\r\n{3} - Missing OldToNew {4}",
procitem.DisplayNumber, (Number ?? "") == "" ? Title : Number, dstyleindx, format, docstyle);
return 0; // Default is Zero
} }
private FormatInfo GetFormat(Item procitem, DocVersion docver) private FormatInfo GetFormat(Item procitem, DocVersion docver)
{ {
@ -255,6 +259,7 @@ namespace DataLoader
} }
catch (Exception ex) catch (Exception ex)
{ {
frmMain.AddError(ex, "Error getting long section title");
log.ErrorFormat("Error getting long section title {0}", ex.Message); log.ErrorFormat("Error getting long section title {0}", ex.Message);
} }
da.Dispose(); da.Dispose();
@ -532,6 +537,8 @@ namespace DataLoader
LoadSection(ds, da, FileName);// Try Again LoadSection(ds, da, FileName);// Try Again
break; break;
default: // Unrecognized error default: // Unrecognized error
frmMain.AddError(ex, "Unrecognized error in LoadSection {0}", FileName);
Console.WriteLine("Unrecognized error: error = {0}", ex.Message);
log.ErrorFormat("File - {0}.DBF\r\n\r\n{1}\r\n\r\n{2}", FileName, ex.Message, ex.InnerException); log.ErrorFormat("File - {0}.DBF\r\n\r\n{1}\r\n\r\n{2}", FileName, ex.Message, ex.InnerException);
break; break;
} }

View File

@ -143,6 +143,8 @@ namespace DataLoader
} }
catch (Exception ex) catch (Exception ex)
{ {
frmMain.AddError(ex, "AddStep {0}",stpseq);
//Console.WriteLine("{0} {1}", ex.GetType().Name, ex.Message);
log.Error("Save Step"); log.Error("Save Step");
log.ErrorFormat("oldstepsequence = {0}", stpseq); log.ErrorFormat("oldstepsequence = {0}", stpseq);
log.ErrorFormat("{0}\r\n\r\n{1}", ex.Message, ex.InnerException); log.ErrorFormat("{0}\r\n\r\n{1}", ex.Message, ex.InnerException);
@ -208,7 +210,7 @@ namespace DataLoader
if ((nxttok = tkstring.IndexOf("\x1")) > -1) // Comment if ((nxttok = tkstring.IndexOf("\x1")) > -1) // Comment
{ {
// add the comment to annotation table. Set type to comment. // add the comment to annotation table. Set type to comment.
Console.WriteLine("Comment text: {0}", tkstring.Substring(nxttok + 1)); log.InfoFormat("Comment text: {0}", tkstring.Substring(nxttok + 1));
Annotation annot = Annotation.MakeAnnotation(item, CommentType, null, tkstring.Substring(nxttok + 1), null, dts, userid); Annotation annot = Annotation.MakeAnnotation(item, CommentType, null, tkstring.Substring(nxttok + 1), null, dts, userid);
} }
} }
@ -239,6 +241,8 @@ namespace DataLoader
} }
catch (Exception ex) catch (Exception ex)
{ {
//Console.WriteLine("Subtexts: {0} {1}", ex.GetType().Name, ex.Message);
frmMain.AddError(ex, "AddStep 2 {0}", stpseq);
log.Error("Save Step part 2"); log.Error("Save Step part 2");
log.ErrorFormat("oldstepsequence = {0}", stpseq); log.ErrorFormat("oldstepsequence = {0}", stpseq);
log.ErrorFormat("{0}\r\n\r\n{1}", ex.Message, ex.InnerException); log.ErrorFormat("{0}\r\n\r\n{1}", ex.Message, ex.InnerException);
@ -375,6 +379,8 @@ namespace DataLoader
} }
catch (Exception ex) catch (Exception ex)
{ {
//Console.WriteLine("{0} {1}", ex.GetType().Name, ex.Message);
frmMain.AddError(ex, "MigrateStep");
log.Error("PROCESS STEP"); log.Error("PROCESS STEP");
log.ErrorFormat("{0}\r\n\r\n{1}", ex.Message, ex.InnerException); log.ErrorFormat("{0}\r\n\r\n{1}", ex.Message, ex.InnerException);
log.ErrorFormat(ex.StackTrace); log.ErrorFormat(ex.StackTrace);

View File

@ -64,6 +64,7 @@ namespace DataLoader
} }
catch (Exception ex) catch (Exception ex)
{ {
frmMain.AddError(ex,"Error converting transition type '{0}'",dr["TYPE"].ToString());
log.Error("Error converting transition type"); log.Error("Error converting transition type");
log.ErrorFormat("type from database = {0}", dr["TYPE"].ToString()); log.ErrorFormat("type from database = {0}", dr["TYPE"].ToString());
log.ErrorFormat("{0}\r\n\r\n{1}", ex.Message, ex.InnerException); log.ErrorFormat("{0}\r\n\r\n{1}", ex.Message, ex.InnerException);
@ -167,6 +168,7 @@ namespace DataLoader
} }
catch (Exception ex) catch (Exception ex)
{ {
frmMain.AddError(ex, "Error addition transition record");
log.Error("Error addition transition record"); log.Error("Error addition transition record");
log.ErrorFormat("{0}\r\n\r\n{1}", ex.Message, ex.InnerException); log.ErrorFormat("{0}\r\n\r\n{1}", ex.Message, ex.InnerException);
} }
@ -204,6 +206,7 @@ namespace DataLoader
} }
catch (Exception ex) catch (Exception ex)
{ {
frmMain.AddError(ex, "Error getting transitions '{0}' '{1}'", ProcNumber, seqcvt);
log.Error("Error getting transitions"); log.Error("Error getting transitions");
log.ErrorFormat("from number = {0} oldstepsequence = {1}", ProcNumber, seqcvt); log.ErrorFormat("from number = {0} oldstepsequence = {1}", ProcNumber, seqcvt);
log.ErrorFormat("{0}\r\n\r\n{1}", ex.Message, ex.InnerException); log.ErrorFormat("{0}\r\n\r\n{1}", ex.Message, ex.InnerException);
@ -269,10 +272,11 @@ namespace DataLoader
private void ShowMissingTransitions() private void ShowMissingTransitions()
{ {
if (dicTrans_ItemIds.Keys.Count > 0) if (dicTrans_ItemIds.Keys.Count > 0)
log.Warn("Missing Transitions from Dictionary"); //log.Warn("Missing Transitions from Dictionary");
foreach (string s in dicTrans_ItemIds.Keys) foreach (string s in dicTrans_ItemIds.Keys)
{ {
log.WarnFormat("{0} - {1}", s, dicTrans_ItemIds[s]); //log.WarnFormat("{0} - {1}", s, dicTrans_ItemIds[s]);
frmMain.AddError("Missing Transition Destination {0} - {1}", s, dicTrans_ItemIds[s].ItemID);
//AddItemAnnotation(dicTrans_ItemIds[s]); //AddItemAnnotation(dicTrans_ItemIds[s]);
} }
foreach (string s in dicTrans_MigrationErrors.Keys) foreach (string s in dicTrans_MigrationErrors.Keys)

View File

@ -30,6 +30,7 @@ namespace DataLoader
private void InitializeComponent() private void InitializeComponent()
{ {
this.sc = new System.Windows.Forms.SplitContainer(); this.sc = new System.Windows.Forms.SplitContainer();
this.cbFormatsOnly = new System.Windows.Forms.CheckBox();
this.btnBrowseVeProms = new System.Windows.Forms.Button(); this.btnBrowseVeProms = new System.Windows.Forms.Button();
this.tbVePromsPath = new System.Windows.Forms.TextBox(); this.tbVePromsPath = new System.Windows.Forms.TextBox();
this.btnCtTok = new System.Windows.Forms.Button(); this.btnCtTok = new System.Windows.Forms.Button();
@ -59,7 +60,7 @@ namespace DataLoader
this.fbd = new System.Windows.Forms.FolderBrowserDialog(); this.fbd = new System.Windows.Forms.FolderBrowserDialog();
this.statusStrip1 = new System.Windows.Forms.StatusStrip(); this.statusStrip1 = new System.Windows.Forms.StatusStrip();
this.toolStripStatusLabel1 = new System.Windows.Forms.ToolStripStatusLabel(); this.toolStripStatusLabel1 = new System.Windows.Forms.ToolStripStatusLabel();
this.cbFormatsOnly = new System.Windows.Forms.CheckBox(); this.tsslError = new System.Windows.Forms.ToolStripStatusLabel();
this.sc.Panel1.SuspendLayout(); this.sc.Panel1.SuspendLayout();
this.sc.Panel2.SuspendLayout(); this.sc.Panel2.SuspendLayout();
this.sc.SuspendLayout(); this.sc.SuspendLayout();
@ -70,7 +71,7 @@ namespace DataLoader
// //
this.sc.Dock = System.Windows.Forms.DockStyle.Fill; this.sc.Dock = System.Windows.Forms.DockStyle.Fill;
this.sc.Location = new System.Drawing.Point(0, 0); this.sc.Location = new System.Drawing.Point(0, 0);
this.sc.Margin = new System.Windows.Forms.Padding(2, 2, 2, 2); this.sc.Margin = new System.Windows.Forms.Padding(2);
this.sc.Name = "sc"; this.sc.Name = "sc";
this.sc.Orientation = System.Windows.Forms.Orientation.Horizontal; this.sc.Orientation = System.Windows.Forms.Orientation.Horizontal;
// //
@ -111,10 +112,21 @@ namespace DataLoader
this.sc.SplitterWidth = 3; this.sc.SplitterWidth = 3;
this.sc.TabIndex = 46; this.sc.TabIndex = 46;
// //
// cbFormatsOnly
//
this.cbFormatsOnly.AutoSize = true;
this.cbFormatsOnly.Location = new System.Drawing.Point(477, 195);
this.cbFormatsOnly.Margin = new System.Windows.Forms.Padding(2);
this.cbFormatsOnly.Name = "cbFormatsOnly";
this.cbFormatsOnly.Size = new System.Drawing.Size(87, 17);
this.cbFormatsOnly.TabIndex = 73;
this.cbFormatsOnly.Text = "Formats Only";
this.cbFormatsOnly.UseVisualStyleBackColor = true;
//
// btnBrowseVeProms // btnBrowseVeProms
// //
this.btnBrowseVeProms.Location = new System.Drawing.Point(478, 29); this.btnBrowseVeProms.Location = new System.Drawing.Point(478, 29);
this.btnBrowseVeProms.Margin = new System.Windows.Forms.Padding(2, 2, 2, 2); this.btnBrowseVeProms.Margin = new System.Windows.Forms.Padding(2);
this.btnBrowseVeProms.Name = "btnBrowseVeProms"; this.btnBrowseVeProms.Name = "btnBrowseVeProms";
this.btnBrowseVeProms.Size = new System.Drawing.Size(119, 19); this.btnBrowseVeProms.Size = new System.Drawing.Size(119, 19);
this.btnBrowseVeProms.TabIndex = 72; this.btnBrowseVeProms.TabIndex = 72;
@ -125,7 +137,7 @@ namespace DataLoader
// tbVePromsPath // tbVePromsPath
// //
this.tbVePromsPath.Location = new System.Drawing.Point(2, 29); this.tbVePromsPath.Location = new System.Drawing.Point(2, 29);
this.tbVePromsPath.Margin = new System.Windows.Forms.Padding(2, 2, 2, 2); this.tbVePromsPath.Margin = new System.Windows.Forms.Padding(2);
this.tbVePromsPath.Name = "tbVePromsPath"; this.tbVePromsPath.Name = "tbVePromsPath";
this.tbVePromsPath.Size = new System.Drawing.Size(464, 20); this.tbVePromsPath.Size = new System.Drawing.Size(464, 20);
this.tbVePromsPath.TabIndex = 71; this.tbVePromsPath.TabIndex = 71;
@ -163,7 +175,7 @@ namespace DataLoader
// btnBrowseVesam // btnBrowseVesam
// //
this.btnBrowseVesam.Location = new System.Drawing.Point(478, 58); this.btnBrowseVesam.Location = new System.Drawing.Point(478, 58);
this.btnBrowseVesam.Margin = new System.Windows.Forms.Padding(2, 2, 2, 2); this.btnBrowseVesam.Margin = new System.Windows.Forms.Padding(2);
this.btnBrowseVesam.Name = "btnBrowseVesam"; this.btnBrowseVesam.Name = "btnBrowseVesam";
this.btnBrowseVesam.Size = new System.Drawing.Size(119, 19); this.btnBrowseVesam.Size = new System.Drawing.Size(119, 19);
this.btnBrowseVesam.TabIndex = 67; this.btnBrowseVesam.TabIndex = 67;
@ -205,7 +217,7 @@ namespace DataLoader
this.cbLazy.Checked = true; this.cbLazy.Checked = true;
this.cbLazy.CheckState = System.Windows.Forms.CheckState.Checked; this.cbLazy.CheckState = System.Windows.Forms.CheckState.Checked;
this.cbLazy.Location = new System.Drawing.Point(477, 174); this.cbLazy.Location = new System.Drawing.Point(477, 174);
this.cbLazy.Margin = new System.Windows.Forms.Padding(2, 2, 2, 2); this.cbLazy.Margin = new System.Windows.Forms.Padding(2);
this.cbLazy.Name = "cbLazy"; this.cbLazy.Name = "cbLazy";
this.cbLazy.Size = new System.Drawing.Size(75, 17); this.cbLazy.Size = new System.Drawing.Size(75, 17);
this.cbLazy.TabIndex = 63; this.cbLazy.TabIndex = 63;
@ -215,7 +227,7 @@ namespace DataLoader
// btnConvertSelected // btnConvertSelected
// //
this.btnConvertSelected.Location = new System.Drawing.Point(2, 197); this.btnConvertSelected.Location = new System.Drawing.Point(2, 197);
this.btnConvertSelected.Margin = new System.Windows.Forms.Padding(2, 2, 2, 2); this.btnConvertSelected.Margin = new System.Windows.Forms.Padding(2);
this.btnConvertSelected.Name = "btnConvertSelected"; this.btnConvertSelected.Name = "btnConvertSelected";
this.btnConvertSelected.Size = new System.Drawing.Size(160, 19); this.btnConvertSelected.Size = new System.Drawing.Size(160, 19);
this.btnConvertSelected.TabIndex = 62; this.btnConvertSelected.TabIndex = 62;
@ -226,7 +238,7 @@ namespace DataLoader
// btnLoadTreeDB // btnLoadTreeDB
// //
this.btnLoadTreeDB.Location = new System.Drawing.Point(0, 0); this.btnLoadTreeDB.Location = new System.Drawing.Point(0, 0);
this.btnLoadTreeDB.Margin = new System.Windows.Forms.Padding(2, 2, 2, 2); this.btnLoadTreeDB.Margin = new System.Windows.Forms.Padding(2);
this.btnLoadTreeDB.Name = "btnLoadTreeDB"; this.btnLoadTreeDB.Name = "btnLoadTreeDB";
this.btnLoadTreeDB.Size = new System.Drawing.Size(118, 19); this.btnLoadTreeDB.Size = new System.Drawing.Size(118, 19);
this.btnLoadTreeDB.TabIndex = 60; this.btnLoadTreeDB.TabIndex = 60;
@ -240,7 +252,7 @@ namespace DataLoader
this.cbPurgeData.Checked = true; this.cbPurgeData.Checked = true;
this.cbPurgeData.CheckState = System.Windows.Forms.CheckState.Checked; this.cbPurgeData.CheckState = System.Windows.Forms.CheckState.Checked;
this.cbPurgeData.Location = new System.Drawing.Point(477, 153); this.cbPurgeData.Location = new System.Drawing.Point(477, 153);
this.cbPurgeData.Margin = new System.Windows.Forms.Padding(2, 2, 2, 2); this.cbPurgeData.Margin = new System.Windows.Forms.Padding(2);
this.cbPurgeData.Name = "cbPurgeData"; this.cbPurgeData.Name = "cbPurgeData";
this.cbPurgeData.Size = new System.Drawing.Size(119, 17); this.cbPurgeData.Size = new System.Drawing.Size(119, 17);
this.cbPurgeData.TabIndex = 59; this.cbPurgeData.TabIndex = 59;
@ -259,7 +271,7 @@ namespace DataLoader
// pbStep // pbStep
// //
this.pbStep.Location = new System.Drawing.Point(159, 150); this.pbStep.Location = new System.Drawing.Point(159, 150);
this.pbStep.Margin = new System.Windows.Forms.Padding(2, 2, 2, 2); this.pbStep.Margin = new System.Windows.Forms.Padding(2);
this.pbStep.Name = "pbStep"; this.pbStep.Name = "pbStep";
this.pbStep.Size = new System.Drawing.Size(308, 15); this.pbStep.Size = new System.Drawing.Size(308, 15);
this.pbStep.TabIndex = 57; this.pbStep.TabIndex = 57;
@ -267,7 +279,7 @@ namespace DataLoader
// pbSect // pbSect
// //
this.pbSect.Location = new System.Drawing.Point(159, 131); this.pbSect.Location = new System.Drawing.Point(159, 131);
this.pbSect.Margin = new System.Windows.Forms.Padding(2, 2, 2, 2); this.pbSect.Margin = new System.Windows.Forms.Padding(2);
this.pbSect.Name = "pbSect"; this.pbSect.Name = "pbSect";
this.pbSect.Size = new System.Drawing.Size(307, 15); this.pbSect.Size = new System.Drawing.Size(307, 15);
this.pbSect.TabIndex = 56; this.pbSect.TabIndex = 56;
@ -275,7 +287,7 @@ namespace DataLoader
// pbProc // pbProc
// //
this.pbProc.Location = new System.Drawing.Point(159, 111); this.pbProc.Location = new System.Drawing.Point(159, 111);
this.pbProc.Margin = new System.Windows.Forms.Padding(2, 2, 2, 2); this.pbProc.Margin = new System.Windows.Forms.Padding(2);
this.pbProc.Name = "pbProc"; this.pbProc.Name = "pbProc";
this.pbProc.Size = new System.Drawing.Size(308, 15); this.pbProc.Size = new System.Drawing.Size(308, 15);
this.pbProc.TabIndex = 55; this.pbProc.TabIndex = 55;
@ -286,7 +298,7 @@ namespace DataLoader
this.cbSaveDoc.Checked = true; this.cbSaveDoc.Checked = true;
this.cbSaveDoc.CheckState = System.Windows.Forms.CheckState.Checked; this.cbSaveDoc.CheckState = System.Windows.Forms.CheckState.Checked;
this.cbSaveDoc.Location = new System.Drawing.Point(478, 111); this.cbSaveDoc.Location = new System.Drawing.Point(478, 111);
this.cbSaveDoc.Margin = new System.Windows.Forms.Padding(2, 2, 2, 2); this.cbSaveDoc.Margin = new System.Windows.Forms.Padding(2);
this.cbSaveDoc.Name = "cbSaveDoc"; this.cbSaveDoc.Name = "cbSaveDoc";
this.cbSaveDoc.Size = new System.Drawing.Size(77, 17); this.cbSaveDoc.Size = new System.Drawing.Size(77, 17);
this.cbSaveDoc.TabIndex = 54; this.cbSaveDoc.TabIndex = 54;
@ -298,7 +310,7 @@ namespace DataLoader
// //
this.cbSaveRTF.AutoSize = true; this.cbSaveRTF.AutoSize = true;
this.cbSaveRTF.Location = new System.Drawing.Point(478, 132); this.cbSaveRTF.Location = new System.Drawing.Point(478, 132);
this.cbSaveRTF.Margin = new System.Windows.Forms.Padding(2, 2, 2, 2); this.cbSaveRTF.Margin = new System.Windows.Forms.Padding(2);
this.cbSaveRTF.Name = "cbSaveRTF"; this.cbSaveRTF.Name = "cbSaveRTF";
this.cbSaveRTF.Size = new System.Drawing.Size(75, 17); this.cbSaveRTF.Size = new System.Drawing.Size(75, 17);
this.cbSaveRTF.TabIndex = 53; this.cbSaveRTF.TabIndex = 53;
@ -309,7 +321,7 @@ namespace DataLoader
// btnBrowse // btnBrowse
// //
this.btnBrowse.Location = new System.Drawing.Point(478, 84); this.btnBrowse.Location = new System.Drawing.Point(478, 84);
this.btnBrowse.Margin = new System.Windows.Forms.Padding(2, 2, 2, 2); this.btnBrowse.Margin = new System.Windows.Forms.Padding(2);
this.btnBrowse.Name = "btnBrowse"; this.btnBrowse.Name = "btnBrowse";
this.btnBrowse.Size = new System.Drawing.Size(56, 19); this.btnBrowse.Size = new System.Drawing.Size(56, 19);
this.btnBrowse.TabIndex = 52; this.btnBrowse.TabIndex = 52;
@ -320,7 +332,7 @@ namespace DataLoader
// tbSource // tbSource
// //
this.tbSource.Location = new System.Drawing.Point(70, 84); this.tbSource.Location = new System.Drawing.Point(70, 84);
this.tbSource.Margin = new System.Windows.Forms.Padding(2, 2, 2, 2); this.tbSource.Margin = new System.Windows.Forms.Padding(2);
this.tbSource.Name = "tbSource"; this.tbSource.Name = "tbSource";
this.tbSource.Size = new System.Drawing.Size(397, 20); this.tbSource.Size = new System.Drawing.Size(397, 20);
this.tbSource.TabIndex = 51; this.tbSource.TabIndex = 51;
@ -357,7 +369,7 @@ namespace DataLoader
// btnConvert // btnConvert
// //
this.btnConvert.Location = new System.Drawing.Point(2, 85); this.btnConvert.Location = new System.Drawing.Point(2, 85);
this.btnConvert.Margin = new System.Windows.Forms.Padding(2, 2, 2, 2); this.btnConvert.Margin = new System.Windows.Forms.Padding(2);
this.btnConvert.Name = "btnConvert"; this.btnConvert.Name = "btnConvert";
this.btnConvert.Size = new System.Drawing.Size(56, 40); this.btnConvert.Size = new System.Drawing.Size(56, 40);
this.btnConvert.TabIndex = 46; this.btnConvert.TabIndex = 46;
@ -369,7 +381,7 @@ namespace DataLoader
this.tv.CheckBoxes = true; this.tv.CheckBoxes = true;
this.tv.Dock = System.Windows.Forms.DockStyle.Bottom; this.tv.Dock = System.Windows.Forms.DockStyle.Bottom;
this.tv.Location = new System.Drawing.Point(0, 7); this.tv.Location = new System.Drawing.Point(0, 7);
this.tv.Margin = new System.Windows.Forms.Padding(2, 2, 2, 2); this.tv.Margin = new System.Windows.Forms.Padding(2);
this.tv.Name = "tv"; this.tv.Name = "tv";
this.tv.Size = new System.Drawing.Size(622, 210); this.tv.Size = new System.Drawing.Size(622, 210);
this.tv.TabIndex = 24; this.tv.TabIndex = 24;
@ -379,29 +391,30 @@ namespace DataLoader
// statusStrip1 // statusStrip1
// //
this.statusStrip1.Items.AddRange(new System.Windows.Forms.ToolStripItem[] { this.statusStrip1.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
this.toolStripStatusLabel1}); this.toolStripStatusLabel1,
this.statusStrip1.Location = new System.Drawing.Point(0, 418); this.tsslError});
this.statusStrip1.Location = new System.Drawing.Point(0, 400);
this.statusStrip1.Name = "statusStrip1"; this.statusStrip1.Name = "statusStrip1";
this.statusStrip1.Size = new System.Drawing.Size(622, 22); this.statusStrip1.Size = new System.Drawing.Size(622, 40);
this.statusStrip1.TabIndex = 47; this.statusStrip1.TabIndex = 47;
this.statusStrip1.Text = "statusStrip1"; this.statusStrip1.Text = "statusStrip1";
// //
// toolStripStatusLabel1 // toolStripStatusLabel1
// //
this.toolStripStatusLabel1.AutoSize = false;
this.toolStripStatusLabel1.ImageAlign = System.Drawing.ContentAlignment.TopLeft;
this.toolStripStatusLabel1.Name = "toolStripStatusLabel1"; this.toolStripStatusLabel1.Name = "toolStripStatusLabel1";
this.toolStripStatusLabel1.Size = new System.Drawing.Size(105, 17); this.toolStripStatusLabel1.Size = new System.Drawing.Size(300, 35);
this.toolStripStatusLabel1.Text = "Status Information"; this.toolStripStatusLabel1.Text = "Status Information";
this.toolStripStatusLabel1.TextAlign = System.Drawing.ContentAlignment.TopLeft;
// //
// cbFormatsOnly // tsslError
// //
this.cbFormatsOnly.AutoSize = true; this.tsslError.AutoSize = false;
this.cbFormatsOnly.Location = new System.Drawing.Point(477, 195); this.tsslError.Name = "tsslError";
this.cbFormatsOnly.Margin = new System.Windows.Forms.Padding(2); this.tsslError.Size = new System.Drawing.Size(300, 35);
this.cbFormatsOnly.Name = "cbFormatsOnly"; this.tsslError.Text = "No Errors";
this.cbFormatsOnly.Size = new System.Drawing.Size(87, 17); this.tsslError.TextAlign = System.Drawing.ContentAlignment.TopLeft;
this.cbFormatsOnly.TabIndex = 73;
this.cbFormatsOnly.Text = "Formats Only";
this.cbFormatsOnly.UseVisualStyleBackColor = true;
// //
// frmLoader // frmLoader
// //
@ -410,9 +423,9 @@ namespace DataLoader
this.ClientSize = new System.Drawing.Size(622, 440); this.ClientSize = new System.Drawing.Size(622, 440);
this.Controls.Add(this.statusStrip1); this.Controls.Add(this.statusStrip1);
this.Controls.Add(this.sc); this.Controls.Add(this.sc);
this.Margin = new System.Windows.Forms.Padding(2, 2, 2, 2); this.Margin = new System.Windows.Forms.Padding(2);
this.Name = "frmLoader"; this.Name = "frmLoader";
this.Text = "frmLoader"; this.Text = "PROMS-2010 Data Loader";
this.Load += new System.EventHandler(this.frmLoader_Load); this.Load += new System.EventHandler(this.frmLoader_Load);
this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.frmLoader_FormClosing); this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.frmLoader_FormClosing);
this.sc.Panel1.ResumeLayout(false); this.sc.Panel1.ResumeLayout(false);
@ -459,5 +472,6 @@ namespace DataLoader
private System.Windows.Forms.Button btnBrowseVeProms; private System.Windows.Forms.Button btnBrowseVeProms;
private System.Windows.Forms.TextBox tbVePromsPath; private System.Windows.Forms.TextBox tbVePromsPath;
private System.Windows.Forms.CheckBox cbFormatsOnly; private System.Windows.Forms.CheckBox cbFormatsOnly;
private System.Windows.Forms.ToolStripStatusLabel tsslError;
} }
} }

View File

@ -60,7 +60,44 @@ namespace DataLoader
Application.DoEvents(); Application.DoEvents();
} }
} }
private frmErrors _MyFrmErrors = null;
public frmErrors MyFrmErrors
{
get
{
if (_MyFrmErrors == null)
{
_MyFrmErrors = new frmErrors(this);
_MyFrmErrors.FormClosing += new FormClosingEventHandler(_MyFrmErrors_FormClosing);
}
return _MyFrmErrors;
}
}
void _MyFrmErrors_FormClosing(object sender, FormClosingEventArgs e)
{
_MyFrmErrors = null;
}
public string MyError
{
get { return tsslError.Text; }
set { MyFrmErrors.Add(value); tsslError.Text = string.Format("{0} Errors", MyFrmErrors.MyErrors.Count); }
}
public void AddError(string format, params object[] objs)
{
MyError = string.Format(format, objs);
}
public void AddError(Exception ex, string format, params object[] objs)
{
StringBuilder sb = new StringBuilder( string.Format(format, objs));
int indent = 0;
while (ex != null)
{
sb.Append("\r\n" + "".PadRight((++indent)*2,' ') + string.Format("{0} - {1}",ex.GetType().Name,ex.Message));
ex=ex.InnerException;
}
MyError = sb.ToString();
}
public string tbSourceText { get { return tbSource.Text; } set { tbSource.Text = value; } } public string tbSourceText { get { return tbSource.Text; } set { tbSource.Text = value; } }
public frmLoader() public frmLoader()
@ -184,17 +221,45 @@ namespace DataLoader
ldr.ClearData(); ldr.ClearData();
bool suc = ldr.LoadFolders(tbVePromsPath.Text); bool suc = ldr.LoadFolders(tbVePromsPath.Text);
} }
private System.Diagnostics.Process [] WordProcesses
{
get
{
return System.Diagnostics.Process.GetProcessesByName("WINWORD");
}
}
private void btnConvert_Click(object sender, System.EventArgs e) private void btnConvert_Click(object sender, System.EventArgs e)
{ {
try
{
System.Diagnostics.Process[] wordProcesses = WordProcesses;
MyFrmErrors.Clear();
if (wordProcesses.Length > 0)
{
AddError("{0} copies of MS Word are running", wordProcesses.Length);
if (MessageBox.Show("MS Word is Running and must be stopped", "MS Word is Running", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
{
TerminateProcesses(wordProcesses);
MyFrmErrors.Clear();
}
else
return;
}
Database.LoggingInfo = false; Database.LoggingInfo = false;
bool success = true; bool success = true;
// if purge data, purge it all & reload folders & security. // if purge data, purge it all & reload folders & security.
if (cbPurgeData.Checked) if (cbPurgeData.Checked)
{ {
Status = "Purging Data";
ldr.ClearData(); ldr.ClearData();
Status = "Loading Folders";
success = ldr.LoadFolders(tbVePromsPath.Text); success = ldr.LoadFolders(tbVePromsPath.Text);
if (success) success = ldr.LoadSecurity(tbVesamPath.Text, tbVePromsPath.Text); if (success)
{
Status = "Loading Security";
success = ldr.LoadSecurity(tbVesamPath.Text, tbVePromsPath.Text);
}
if (cbFormatsOnly.Checked) if (cbFormatsOnly.Checked)
{ {
MessageBox.Show("Formats Loaded"); MessageBox.Show("Formats Loaded");
@ -211,7 +276,8 @@ namespace DataLoader
if (vi.Title.ToUpper() == tbSource.Text.ToUpper()) // is this the procedure set we want to convert? if (vi.Title.ToUpper() == tbSource.Text.ToUpper()) // is this the procedure set we want to convert?
{ {
v = DocVersion.Get(vi.VersionID); v = DocVersion.Get(vi.VersionID);
ts+=ldr.MigrateDocVersion(v, true); Status = "Load " + v.Title + " - " + v.Name;
ts += ldr.MigrateDocVersion(v, true);
} }
//v = DocVersion.Get(vi.VersionID); //v = DocVersion.Get(vi.VersionID);
//bool convertProcedures = (vi.Title.ToUpper() == tbSource.Text.ToUpper()); //bool convertProcedures = (vi.Title.ToUpper() == tbSource.Text.ToUpper());
@ -221,6 +287,19 @@ namespace DataLoader
MessageBox.Show(string.Format("{0} seconds", ts.TotalSeconds)); MessageBox.Show(string.Format("{0} seconds", ts.TotalSeconds));
} }
} }
catch (Exception ex)
{
AddError("===================== Fatal Error ==========================\r\n{0} - {1}", ex.GetType().Name, ex.Message);
MessageBox.Show(ex.Message, "Fatal Error During Loading", MessageBoxButtons.OK, MessageBoxIcon.Error);
_MyLog.Fatal(ex.Message);
}
}
private void TerminateProcesses(System.Diagnostics.Process [] wordProcesses)
{
foreach (System.Diagnostics.Process proc in wordProcesses)
proc.Kill();
}
public void UpdateLabels(int incPrc, int incSec, int incStp) public void UpdateLabels(int incPrc, int incSec, int incStp)
{ {
if (incPrc == 0 && incSec == 0 && incStp == 0)//Reset if (incPrc == 0 && incSec == 0 && incStp == 0)//Reset
@ -241,6 +320,7 @@ namespace DataLoader
catch (Exception ex) catch (Exception ex)
{ {
_MyLog.ErrorFormat("{0}\r\n\r\n{1}", ex.Message, ex.InnerException); _MyLog.ErrorFormat("{0}\r\n\r\n{1}", ex.Message, ex.InnerException);
AddError(ex, "UpdateLabels");
} }
} }
//Database.LoggingInfo = (pbProc.Value > 153 && pbSect.Value > 11 && pbStep.Value > 61); //Database.LoggingInfo = (pbProc.Value > 153 && pbSect.Value > 11 && pbStep.Value > 61);