|
|
|
@@ -73,7 +73,6 @@ namespace DataLoader
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
private frmErrors _MyFrmErrors = null;
|
|
|
|
|
|
|
|
|
|
public frmErrors MyFrmErrors
|
|
|
|
|
{
|
|
|
|
|
get
|
|
|
|
@@ -227,8 +226,6 @@ namespace DataLoader
|
|
|
|
|
tn.Expand();
|
|
|
|
|
if (o.GetType() == typeof(DocVersion)) MySettings.ProcedureSetPath = ((DocVersion)o).Title;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private void btnLoadTreeDB_Click(object sender, EventArgs e)
|
|
|
|
|
{
|
|
|
|
|
// When loading folders, i.e. the tree from dBase (old 16-bit)
|
|
|
|
@@ -247,7 +244,12 @@ namespace DataLoader
|
|
|
|
|
public DateTime 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)
|
|
|
|
|
{
|
|
|
|
@@ -563,7 +565,7 @@ namespace DataLoader
|
|
|
|
|
MySettings.GenMacFolder = Properties.Settings.Default.GenMacFolder;
|
|
|
|
|
MySettings.LoadApproved = Properties.Settings.Default.LoadApproved;
|
|
|
|
|
MySettings.Phase4Suffix = Properties.Settings.Default.Phase4;
|
|
|
|
|
|
|
|
|
|
MySettings.RedPDFs = (Properties.Settings.Default.RedPDFs == CheckState.Checked);
|
|
|
|
|
string validity = MySettings.ValidityCheck;
|
|
|
|
|
if (validity != "")
|
|
|
|
|
{
|
|
|
|
@@ -618,6 +620,7 @@ namespace DataLoader
|
|
|
|
|
Properties.Settings.Default.GenMacFolder = MySettings.GenMacFolder;
|
|
|
|
|
Properties.Settings.Default.LoadApproved = MySettings.LoadApproved;
|
|
|
|
|
Properties.Settings.Default.Phase4 = MySettings.Phase4Suffix;
|
|
|
|
|
Properties.Settings.Default.RedPDFs = MySettings.RedPDFs ? CheckState.Checked : CheckState.Unchecked;
|
|
|
|
|
Properties.Settings.Default.Save();
|
|
|
|
|
}
|
|
|
|
|
private void frmLoader_Load(object sender, EventArgs e)
|
|
|
|
@@ -747,12 +750,30 @@ namespace DataLoader
|
|
|
|
|
get { return _ProcessComplete; }
|
|
|
|
|
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)
|
|
|
|
|
{
|
|
|
|
|
MessageBuilder mb = new MessageBuilder("Performing Complete Process\r\n");
|
|
|
|
|
ProcessFailed = false;
|
|
|
|
|
ProcessComplete = true;
|
|
|
|
|
ProcessTime = DateTime.Now;
|
|
|
|
|
MessageBuilder mb = new MessageBuilder("Performing Complete Process\r\n");
|
|
|
|
|
// Phase 1 - Convert dBase to SQL
|
|
|
|
|
btnConvert_Click(this, new System.EventArgs());
|
|
|
|
|
if (ProcessFailed) return;
|
|
|
|
@@ -788,6 +809,8 @@ namespace DataLoader
|
|
|
|
|
Status = "Backing up Data";
|
|
|
|
|
Backup("");
|
|
|
|
|
mb.Append("Backup Complete");
|
|
|
|
|
mb.LastTime = ProcessTime; // Reset time to get total time.
|
|
|
|
|
mb.Append("Processing Complete");
|
|
|
|
|
Status = "Processing Complete";
|
|
|
|
|
ProcessComplete = false;
|
|
|
|
|
//Clipboard.Clear();
|
|
|
|
@@ -810,11 +833,14 @@ namespace DataLoader
|
|
|
|
|
btnConvert_Click(this, new System.EventArgs());
|
|
|
|
|
if (ProcessFailed) return;
|
|
|
|
|
MyInfo="Format Load Complete";
|
|
|
|
|
if (MessageBox.Show("Backup Database?", "Backup", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
|
|
|
|
|
{
|
|
|
|
|
Status = "Backing up Format Change Data";
|
|
|
|
|
Backup("_" + "FormatChange");
|
|
|
|
|
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)
|
|
|
|
|
{
|
|
|
|
@@ -822,20 +848,27 @@ namespace DataLoader
|
|
|
|
|
btnConvert_Click(this, new System.EventArgs());
|
|
|
|
|
if (ProcessFailed) return;
|
|
|
|
|
MyInfo="dBase Conversion Complete";
|
|
|
|
|
if (MessageBox.Show("Backup Database?", "Backup", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
|
|
|
|
|
{
|
|
|
|
|
Status = "Backing up Phase 1 Data";
|
|
|
|
|
Backup("_" + MySettings.Phase1Suffix);
|
|
|
|
|
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)
|
|
|
|
|
{
|
|
|
|
|
Database.VEPROMS_Connection = MySettings.ConnectionString.Replace("{DBName}", MySettings.DBName);
|
|
|
|
|
ProcessTime = DateTime.Now;
|
|
|
|
|
btnFixTransitions_Click(this, new System.EventArgs());
|
|
|
|
|
MyInfo="Fix Transtions Complete";
|
|
|
|
|
if (MessageBox.Show("Backup Database?", "Backup", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
|
|
|
|
|
{
|
|
|
|
|
Status = "Backing up Phase 2 Data";
|
|
|
|
|
Backup("_" + MySettings.Phase2Suffix);
|
|
|
|
|
MyInfo="Phase 2 Backup Complete";
|
|
|
|
|
}
|
|
|
|
|
Status = "Fix Transtions Complete";
|
|
|
|
|
MessageBox.Show("Fix Transtions Complete", "Status", MessageBoxButtons.OK, MessageBoxIcon.Information);
|
|
|
|
|
}
|
|
|
|
@@ -844,55 +877,63 @@ namespace DataLoader
|
|
|
|
|
ProcessTime = DateTime.Now;
|
|
|
|
|
ConvertToChangeManager();
|
|
|
|
|
MyInfo="Conversion to Change Manager Complete";
|
|
|
|
|
if (MessageBox.Show("Backup Database?", "Backup", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
|
|
|
|
|
{
|
|
|
|
|
Status = "Backing up Phase 3 Data";
|
|
|
|
|
Backup("_" + MySettings.Phase3Suffix);
|
|
|
|
|
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)
|
|
|
|
|
{
|
|
|
|
|
ProcessTime = DateTime.Now;
|
|
|
|
|
ConvertToApproval();
|
|
|
|
|
MyInfo="Conversion to Approval Complete";
|
|
|
|
|
if (MessageBox.Show("Backup Database?", "Backup", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
|
|
|
|
|
{
|
|
|
|
|
Status = "Backing up Phase 4 Data";
|
|
|
|
|
Backup("_" + MySettings.Phase4Suffix);
|
|
|
|
|
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)
|
|
|
|
|
{
|
|
|
|
|
Database.VEPROMS_Connection = MySettings.ConnectionString.Replace("{DBName}", MySettings.DBName);
|
|
|
|
|
ProcessTime = DateTime.Now;
|
|
|
|
|
LoadApprovedData();
|
|
|
|
|
Status = "Backing up Data";
|
|
|
|
|
Backup("");
|
|
|
|
|
MyInfo="Backup Complete";
|
|
|
|
|
Status = "Loading 16 Bit Approval Data Complete";
|
|
|
|
|
MessageBox.Show("Loading 16 Bit Approval Data Complete", "Status", MessageBoxButtons.OK, MessageBoxIcon.Information);
|
|
|
|
|
}
|
|
|
|
|
private void LoadApprovedData()
|
|
|
|
|
{
|
|
|
|
|
Status = "Converting 16-Bit Approved Data";
|
|
|
|
|
Database.VEPROMS_Connection = MySettings.ConnectionString.Replace("{DBName}", MySettings.DBName);
|
|
|
|
|
bool ok = ldr.BuildApprovedRevision();
|
|
|
|
|
Status = "Conversion " + (ok ? "Succeeded" : "Failed");
|
|
|
|
|
if (ok)
|
|
|
|
|
if (MessageBox.Show("Backup Database?", "Backup", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
|
|
|
|
|
{
|
|
|
|
|
Status = "Backing up Data";
|
|
|
|
|
Backup("");
|
|
|
|
|
MyInfo="Backup Complete";
|
|
|
|
|
Status = "Processing Complete";
|
|
|
|
|
}
|
|
|
|
|
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()
|
|
|
|
|
{
|
|
|
|
|
Database.VEPROMS_Connection = MySettings.ConnectionString.Replace("{DBName}", MySettings.DBName);
|
|
|
|
|
Status = "Converting 16-Bit Approved Data";
|
|
|
|
|
Database.VEPROMS_Connection = MySettings.ConnectionString.Replace("{DBName}", MySettings.DBName);
|
|
|
|
|
bool ok = ldr.BuildApprovedRevision();
|
|
|
|
|
Status = "Conversion " + (ok ? "Succeeded" : "Failed");
|
|
|
|
|
}
|
|
|
|
|
private void fixesToolStripMenuItem_Click(object sender, EventArgs e)
|
|
|
|
|
{
|
|
|
|
|
FixProceduresAndFunctions();
|
|
|
|
|
if (MessageBox.Show("Backup Database?", "Backup", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
|
|
|
|
|
{
|
|
|
|
|
Status = "Backing up Data";
|
|
|
|
|
Backup("_Fixed");
|
|
|
|
|
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()
|
|
|
|
|
{
|
|
|
|
@@ -984,13 +1025,16 @@ namespace DataLoader
|
|
|
|
|
Status = String.Format("Fixing databases complete. {0} Fixed, {1} Failures", good, bad);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
public class MessageBuilder
|
|
|
|
|
{
|
|
|
|
|
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)
|
|
|
|
|
{
|
|
|
|
|
_MyStringBulider.Append(heading);
|
|
|
|
|