Set the Error Log file name to include the name of the database and the current date and time
Save and Restore the setting to create Red PDFs from MSWORD Show the total Process Time for the Complete Process For individual Phases allow the user to decide if they want backups to be created Set the Database connection string from the settings for individual phases Handle null condition so that the code doesn't bomb Handle relative RO paths in the Proc.INI file Correct the total Step Count by subtracting the number of Sections
This commit is contained in:
parent
bf9985110a
commit
68d862f71f
@ -343,7 +343,7 @@ namespace DataLoader
|
|||||||
{
|
{
|
||||||
Microsoft.Win32.RegistryKey key = Microsoft.Win32.Registry.LocalMachine.OpenSubKey(@"software\dBase\dB2K");
|
Microsoft.Win32.RegistryKey key = Microsoft.Win32.Registry.LocalMachine.OpenSubKey(@"software\dBase\dB2K");
|
||||||
bool retval = key != null;
|
bool retval = key != null;
|
||||||
key.Close();
|
if(key != null)key.Close();
|
||||||
return retval;
|
return retval;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -37,8 +37,19 @@ namespace DataLoader
|
|||||||
img_prefix = ele.GetAttribute("Graphics");
|
img_prefix = ele.GetAttribute("Graphics");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (roDbpath == null || roDbpath == "" || roDbpath.ToLower() == @"..\ro")
|
DirectoryInfo di2 = new DirectoryInfo(fstPath);
|
||||||
roDbpath = fstPath.Substring(0, fstPath.LastIndexOf('\\')) + @"\ro";
|
roDbpath = roDbpath ?? "";
|
||||||
|
if (roDbpath == "")
|
||||||
|
roDbpath = @"..\ro";
|
||||||
|
while(roDbpath.StartsWith(@"..\"))
|
||||||
|
{
|
||||||
|
di2=di2.Parent;
|
||||||
|
roDbpath = roDbpath.Substring(3);
|
||||||
|
}
|
||||||
|
DirectoryInfo [] dis = di2.GetDirectories(roDbpath);
|
||||||
|
if (dis.Length > 0) roDbpath = dis[0].FullName;
|
||||||
|
//if (roDbpath == null || roDbpath == "")
|
||||||
|
// roDbpath = fstPath.Substring(0, fstPath.LastIndexOf('\\')) + @"\ro";
|
||||||
|
|
||||||
// first see if this rodb has been migrated (another dataset may have migrated it)
|
// first see if this rodb has been migrated (another dataset may have migrated it)
|
||||||
rodb = RODb.GetByFolderPath(roDbpath);
|
rodb = RODb.GetByFolderPath(roDbpath);
|
||||||
|
@ -615,7 +615,7 @@ namespace DataLoader
|
|||||||
string sQry = string.Format("Step like '[{0}]%' and Sequence='S'", dr["Step"].ToString().Substring(0, 1));
|
string sQry = string.Format("Step like '[{0}]%' and Sequence='S'", dr["Step"].ToString().Substring(0, 1));
|
||||||
DataView dv = new DataView(dt, sQry, "StepNo", DataViewRowState.CurrentRows);
|
DataView dv = new DataView(dt, sQry, "StepNo", DataViewRowState.CurrentRows);
|
||||||
Item FrItem = null;
|
Item FrItem = null;
|
||||||
frmMain.pbStepMaximum = dt.Rows.Count;
|
frmMain.pbStepMaximum = dt.Rows.Count-frmMain.pbSectMaximum;
|
||||||
int type = 6;
|
int type = 6;
|
||||||
foreach (DataRowView drv in dv)
|
foreach (DataRowView drv in dv)
|
||||||
{
|
{
|
||||||
|
@ -73,7 +73,6 @@ namespace DataLoader
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
private frmErrors _MyFrmErrors = null;
|
private frmErrors _MyFrmErrors = null;
|
||||||
|
|
||||||
public frmErrors MyFrmErrors
|
public frmErrors MyFrmErrors
|
||||||
{
|
{
|
||||||
get
|
get
|
||||||
@ -227,8 +226,6 @@ namespace DataLoader
|
|||||||
tn.Expand();
|
tn.Expand();
|
||||||
if (o.GetType() == typeof(DocVersion)) MySettings.ProcedureSetPath = ((DocVersion)o).Title;
|
if (o.GetType() == typeof(DocVersion)) MySettings.ProcedureSetPath = ((DocVersion)o).Title;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
private void btnLoadTreeDB_Click(object sender, EventArgs e)
|
private void btnLoadTreeDB_Click(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
// When loading folders, i.e. the tree from dBase (old 16-bit)
|
// When loading folders, i.e. the tree from dBase (old 16-bit)
|
||||||
@ -247,7 +244,12 @@ namespace DataLoader
|
|||||||
public DateTime ProcessTime
|
public DateTime ProcessTime
|
||||||
{
|
{
|
||||||
get { return _ProcessTime; }
|
get { return _ProcessTime; }
|
||||||
set { _ProcessTime = value; }
|
set
|
||||||
|
{
|
||||||
|
_ProcessTime = value;
|
||||||
|
// Set the Log File Name when the ProcessTime is set
|
||||||
|
ChangeLogFileName("LogFileAppender", MySettings.DBName + " " + ProcessTime.ToString("yyyyMMdd HHmmss") + " DMErrorLog.txt");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
private void btnConvert_Click(object sender, System.EventArgs e)
|
private void btnConvert_Click(object sender, System.EventArgs e)
|
||||||
{
|
{
|
||||||
@ -563,7 +565,7 @@ namespace DataLoader
|
|||||||
MySettings.GenMacFolder = Properties.Settings.Default.GenMacFolder;
|
MySettings.GenMacFolder = Properties.Settings.Default.GenMacFolder;
|
||||||
MySettings.LoadApproved = Properties.Settings.Default.LoadApproved;
|
MySettings.LoadApproved = Properties.Settings.Default.LoadApproved;
|
||||||
MySettings.Phase4Suffix = Properties.Settings.Default.Phase4;
|
MySettings.Phase4Suffix = Properties.Settings.Default.Phase4;
|
||||||
|
MySettings.RedPDFs = (Properties.Settings.Default.RedPDFs == CheckState.Checked);
|
||||||
string validity = MySettings.ValidityCheck;
|
string validity = MySettings.ValidityCheck;
|
||||||
if (validity != "")
|
if (validity != "")
|
||||||
{
|
{
|
||||||
@ -618,6 +620,7 @@ namespace DataLoader
|
|||||||
Properties.Settings.Default.GenMacFolder = MySettings.GenMacFolder;
|
Properties.Settings.Default.GenMacFolder = MySettings.GenMacFolder;
|
||||||
Properties.Settings.Default.LoadApproved = MySettings.LoadApproved;
|
Properties.Settings.Default.LoadApproved = MySettings.LoadApproved;
|
||||||
Properties.Settings.Default.Phase4 = MySettings.Phase4Suffix;
|
Properties.Settings.Default.Phase4 = MySettings.Phase4Suffix;
|
||||||
|
Properties.Settings.Default.RedPDFs = MySettings.RedPDFs ? CheckState.Checked : CheckState.Unchecked;
|
||||||
Properties.Settings.Default.Save();
|
Properties.Settings.Default.Save();
|
||||||
}
|
}
|
||||||
private void frmLoader_Load(object sender, EventArgs e)
|
private void frmLoader_Load(object sender, EventArgs e)
|
||||||
@ -747,12 +750,30 @@ namespace DataLoader
|
|||||||
get { return _ProcessComplete; }
|
get { return _ProcessComplete; }
|
||||||
set { _ProcessComplete = value; }
|
set { _ProcessComplete = value; }
|
||||||
}
|
}
|
||||||
|
static bool ChangeLogFileName(string AppenderName, string NewFilename)
|
||||||
|
{
|
||||||
|
log4net.Repository.ILoggerRepository RootRep;
|
||||||
|
RootRep = log4net.LogManager.GetRepository();
|
||||||
|
foreach (log4net.Appender.IAppender iApp in RootRep.GetAppenders())
|
||||||
|
{
|
||||||
|
if (iApp.Name.CompareTo(AppenderName) == 0
|
||||||
|
&& iApp is log4net.Appender.FileAppender)
|
||||||
|
{
|
||||||
|
log4net.Appender.FileAppender fApp = (log4net.Appender.FileAppender)iApp;
|
||||||
|
string folderPath = Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments);
|
||||||
|
fApp.File = folderPath + @"\VEPROMS\" + NewFilename;
|
||||||
|
fApp.ActivateOptions();
|
||||||
|
return true; // Appender found and name changed to NewFilename
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
private void completeToolStripMenuItem_Click(object sender, EventArgs e)
|
private void completeToolStripMenuItem_Click(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
MessageBuilder mb = new MessageBuilder("Performing Complete Process\r\n");
|
|
||||||
ProcessFailed = false;
|
ProcessFailed = false;
|
||||||
ProcessComplete = true;
|
ProcessComplete = true;
|
||||||
ProcessTime = DateTime.Now;
|
ProcessTime = DateTime.Now;
|
||||||
|
MessageBuilder mb = new MessageBuilder("Performing Complete Process\r\n");
|
||||||
// Phase 1 - Convert dBase to SQL
|
// Phase 1 - Convert dBase to SQL
|
||||||
btnConvert_Click(this, new System.EventArgs());
|
btnConvert_Click(this, new System.EventArgs());
|
||||||
if (ProcessFailed) return;
|
if (ProcessFailed) return;
|
||||||
@ -788,6 +809,8 @@ namespace DataLoader
|
|||||||
Status = "Backing up Data";
|
Status = "Backing up Data";
|
||||||
Backup("");
|
Backup("");
|
||||||
mb.Append("Backup Complete");
|
mb.Append("Backup Complete");
|
||||||
|
mb.LastTime = ProcessTime; // Reset time to get total time.
|
||||||
|
mb.Append("Processing Complete");
|
||||||
Status = "Processing Complete";
|
Status = "Processing Complete";
|
||||||
ProcessComplete = false;
|
ProcessComplete = false;
|
||||||
//Clipboard.Clear();
|
//Clipboard.Clear();
|
||||||
@ -810,11 +833,14 @@ namespace DataLoader
|
|||||||
btnConvert_Click(this, new System.EventArgs());
|
btnConvert_Click(this, new System.EventArgs());
|
||||||
if (ProcessFailed) return;
|
if (ProcessFailed) return;
|
||||||
MyInfo="Format Load Complete";
|
MyInfo="Format Load Complete";
|
||||||
|
if (MessageBox.Show("Backup Database?", "Backup", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
|
||||||
|
{
|
||||||
Status = "Backing up Format Change Data";
|
Status = "Backing up Format Change Data";
|
||||||
Backup("_" + "FormatChange");
|
Backup("_" + "FormatChange");
|
||||||
MyInfo="Format Change Backup Complete";
|
MyInfo="Format Change Backup Complete";
|
||||||
Status = "Format Change Complete";
|
}
|
||||||
MessageBox.Show("Format Change Complete", "Status", MessageBoxButtons.OK, MessageBoxIcon.Information);
|
//Status = "Format Change Complete";
|
||||||
|
//MessageBox.Show("Format Change Complete", "Status", MessageBoxButtons.OK, MessageBoxIcon.Information);
|
||||||
}
|
}
|
||||||
private void convertDBToolStripMenuItem_Click(object sender, EventArgs e)
|
private void convertDBToolStripMenuItem_Click(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
@ -822,20 +848,27 @@ namespace DataLoader
|
|||||||
btnConvert_Click(this, new System.EventArgs());
|
btnConvert_Click(this, new System.EventArgs());
|
||||||
if (ProcessFailed) return;
|
if (ProcessFailed) return;
|
||||||
MyInfo="dBase Conversion Complete";
|
MyInfo="dBase Conversion Complete";
|
||||||
|
if (MessageBox.Show("Backup Database?", "Backup", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
|
||||||
|
{
|
||||||
Status = "Backing up Phase 1 Data";
|
Status = "Backing up Phase 1 Data";
|
||||||
Backup("_" + MySettings.Phase1Suffix);
|
Backup("_" + MySettings.Phase1Suffix);
|
||||||
MyInfo="Phase 1 Backup Complete";
|
MyInfo="Phase 1 Backup Complete";
|
||||||
Status = "dBase Conversion Complete";
|
}
|
||||||
MessageBox.Show("dBase Conversion Complete", "Status", MessageBoxButtons.OK, MessageBoxIcon.Information);
|
//Status = "dBase Conversion Complete";
|
||||||
|
//MessageBox.Show("dBase Conversion Complete", "Status", MessageBoxButtons.OK, MessageBoxIcon.Information);
|
||||||
}
|
}
|
||||||
private void fixTransitionsToolStripMenuItem_Click(object sender, EventArgs e)
|
private void fixTransitionsToolStripMenuItem_Click(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
|
Database.VEPROMS_Connection = MySettings.ConnectionString.Replace("{DBName}", MySettings.DBName);
|
||||||
ProcessTime = DateTime.Now;
|
ProcessTime = DateTime.Now;
|
||||||
btnFixTransitions_Click(this, new System.EventArgs());
|
btnFixTransitions_Click(this, new System.EventArgs());
|
||||||
MyInfo="Fix Transtions Complete";
|
MyInfo="Fix Transtions Complete";
|
||||||
|
if (MessageBox.Show("Backup Database?", "Backup", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
|
||||||
|
{
|
||||||
Status = "Backing up Phase 2 Data";
|
Status = "Backing up Phase 2 Data";
|
||||||
Backup("_" + MySettings.Phase2Suffix);
|
Backup("_" + MySettings.Phase2Suffix);
|
||||||
MyInfo="Phase 2 Backup Complete";
|
MyInfo="Phase 2 Backup Complete";
|
||||||
|
}
|
||||||
Status = "Fix Transtions Complete";
|
Status = "Fix Transtions Complete";
|
||||||
MessageBox.Show("Fix Transtions Complete", "Status", MessageBoxButtons.OK, MessageBoxIcon.Information);
|
MessageBox.Show("Fix Transtions Complete", "Status", MessageBoxButtons.OK, MessageBoxIcon.Information);
|
||||||
}
|
}
|
||||||
@ -844,55 +877,63 @@ namespace DataLoader
|
|||||||
ProcessTime = DateTime.Now;
|
ProcessTime = DateTime.Now;
|
||||||
ConvertToChangeManager();
|
ConvertToChangeManager();
|
||||||
MyInfo="Conversion to Change Manager Complete";
|
MyInfo="Conversion to Change Manager Complete";
|
||||||
|
if (MessageBox.Show("Backup Database?", "Backup", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
|
||||||
|
{
|
||||||
Status = "Backing up Phase 3 Data";
|
Status = "Backing up Phase 3 Data";
|
||||||
Backup("_" + MySettings.Phase3Suffix);
|
Backup("_" + MySettings.Phase3Suffix);
|
||||||
MyInfo="Phase 3 Backup Complete";
|
MyInfo="Phase 3 Backup Complete";
|
||||||
Status = "Conversion to Change Manager Complete";
|
}
|
||||||
MessageBox.Show("Conversion to Change Manager Complete", "Status", MessageBoxButtons.OK, MessageBoxIcon.Information);
|
//Status = "Conversion to Change Manager Complete";
|
||||||
|
//MessageBox.Show("Conversion to Change Manager Complete", "Status", MessageBoxButtons.OK, MessageBoxIcon.Information);
|
||||||
}
|
}
|
||||||
private void convertToApprovalToolStripMenuItem_Click(object sender, EventArgs e)
|
private void convertToApprovalToolStripMenuItem_Click(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
ProcessTime = DateTime.Now;
|
ProcessTime = DateTime.Now;
|
||||||
ConvertToApproval();
|
ConvertToApproval();
|
||||||
MyInfo="Conversion to Approval Complete";
|
MyInfo="Conversion to Approval Complete";
|
||||||
|
if (MessageBox.Show("Backup Database?", "Backup", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
|
||||||
|
{
|
||||||
Status = "Backing up Phase 4 Data";
|
Status = "Backing up Phase 4 Data";
|
||||||
Backup("_" + MySettings.Phase4Suffix);
|
Backup("_" + MySettings.Phase4Suffix);
|
||||||
MyInfo="Phase 4 Backup Complete";
|
MyInfo="Phase 4 Backup Complete";
|
||||||
Status = "Conversion to Approval Complete";
|
}
|
||||||
MessageBox.Show("Conversion to Approval Complete", "Status", MessageBoxButtons.OK, MessageBoxIcon.Information);
|
//Status = "Conversion to Approval Complete";
|
||||||
|
//MessageBox.Show("Conversion to Approval Complete", "Status", MessageBoxButtons.OK, MessageBoxIcon.Information);
|
||||||
}
|
}
|
||||||
private void load16BitApprovalToolStripMenuItem_Click(object sender, EventArgs e)
|
private void load16BitApprovalToolStripMenuItem_Click(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
|
Database.VEPROMS_Connection = MySettings.ConnectionString.Replace("{DBName}", MySettings.DBName);
|
||||||
ProcessTime = DateTime.Now;
|
ProcessTime = DateTime.Now;
|
||||||
LoadApprovedData();
|
LoadApprovedData();
|
||||||
|
if (MessageBox.Show("Backup Database?", "Backup", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
|
||||||
|
{
|
||||||
Status = "Backing up Data";
|
Status = "Backing up Data";
|
||||||
Backup("");
|
Backup("");
|
||||||
MyInfo="Backup Complete";
|
MyInfo="Backup Complete";
|
||||||
Status = "Loading 16 Bit Approval Data Complete";
|
}
|
||||||
MessageBox.Show("Loading 16 Bit Approval Data Complete", "Status", MessageBoxButtons.OK, MessageBoxIcon.Information);
|
Status = "Processing Complete";
|
||||||
|
//Status = "Loading 16 Bit Approval Data Complete";
|
||||||
|
//MessageBox.Show("Loading 16 Bit Approval Data Complete", "Status", MessageBoxButtons.OK, MessageBoxIcon.Information);
|
||||||
}
|
}
|
||||||
private void LoadApprovedData()
|
private void LoadApprovedData()
|
||||||
{
|
{
|
||||||
|
Database.VEPROMS_Connection = MySettings.ConnectionString.Replace("{DBName}", MySettings.DBName);
|
||||||
Status = "Converting 16-Bit Approved Data";
|
Status = "Converting 16-Bit Approved Data";
|
||||||
Database.VEPROMS_Connection = MySettings.ConnectionString.Replace("{DBName}", MySettings.DBName);
|
Database.VEPROMS_Connection = MySettings.ConnectionString.Replace("{DBName}", MySettings.DBName);
|
||||||
bool ok = ldr.BuildApprovedRevision();
|
bool ok = ldr.BuildApprovedRevision();
|
||||||
Status = "Conversion " + (ok ? "Succeeded" : "Failed");
|
Status = "Conversion " + (ok ? "Succeeded" : "Failed");
|
||||||
if (ok)
|
|
||||||
{
|
|
||||||
Status = "Backing up Data";
|
|
||||||
Backup("");
|
|
||||||
MyInfo="Backup Complete";
|
|
||||||
Status = "Processing Complete";
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
private void fixesToolStripMenuItem_Click(object sender, EventArgs e)
|
private void fixesToolStripMenuItem_Click(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
FixProceduresAndFunctions();
|
FixProceduresAndFunctions();
|
||||||
|
if (MessageBox.Show("Backup Database?", "Backup", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
|
||||||
|
{
|
||||||
Status = "Backing up Data";
|
Status = "Backing up Data";
|
||||||
Backup("_Fixed");
|
Backup("_Fixed");
|
||||||
MyInfo="Backup Complete";
|
MyInfo="Backup Complete";
|
||||||
Status = "Processing Complete";
|
}
|
||||||
MessageBox.Show("Fixed Stored Procedures", "Status", MessageBoxButtons.OK, MessageBoxIcon.Information);
|
//Status = "Processing Complete";
|
||||||
|
//MessageBox.Show("Fixed Stored Procedures", "Status", MessageBoxButtons.OK, MessageBoxIcon.Information);
|
||||||
}
|
}
|
||||||
private void FixProceduresAndFunctions()
|
private void FixProceduresAndFunctions()
|
||||||
{
|
{
|
||||||
@ -984,13 +1025,16 @@ namespace DataLoader
|
|||||||
Status = String.Format("Fixing databases complete. {0} Fixed, {1} Failures", good, bad);
|
Status = String.Format("Fixing databases complete. {0} Fixed, {1} Failures", good, bad);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
public class MessageBuilder
|
public class MessageBuilder
|
||||||
{
|
{
|
||||||
private StringBuilder _MyStringBulider=new StringBuilder();
|
private StringBuilder _MyStringBulider=new StringBuilder();
|
||||||
private DateTime _LastTime=DateTime.Now;
|
private DateTime _LastTime = DateTime.Now;
|
||||||
|
public DateTime LastTime
|
||||||
|
{
|
||||||
|
get { return _LastTime; }
|
||||||
|
set { _LastTime = value; }
|
||||||
|
}
|
||||||
public MessageBuilder(string heading)
|
public MessageBuilder(string heading)
|
||||||
{
|
{
|
||||||
_MyStringBulider.Append(heading);
|
_MyStringBulider.Append(heading);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user