|
|
|
@@ -33,21 +33,21 @@ using System.Data.SqlClient;
|
|
|
|
|
[assembly: log4net.Config.XmlConfigurator(Watch = true)]
|
|
|
|
|
|
|
|
|
|
namespace DataLoader
|
|
|
|
|
{
|
|
|
|
|
public partial class frmLoader : Form
|
|
|
|
|
{
|
|
|
|
|
public partial class frmLoader : Form
|
|
|
|
|
{
|
|
|
|
|
#region Log4Net
|
|
|
|
|
public static readonly log4net.ILog _MyLog = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
|
|
|
|
|
#endregion
|
|
|
|
|
#region settings
|
|
|
|
|
private bool _FormatsOnly = false;
|
|
|
|
|
public bool FormatsOnly
|
|
|
|
|
{
|
|
|
|
|
get { return _FormatsOnly; }
|
|
|
|
|
set { _FormatsOnly = value; }
|
|
|
|
|
}
|
|
|
|
|
#endregion
|
|
|
|
|
private bool _Loading = true;
|
|
|
|
|
#region Log4Net
|
|
|
|
|
public static readonly log4net.ILog _MyLog = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
|
|
|
|
|
#endregion
|
|
|
|
|
#region settings
|
|
|
|
|
private bool _FormatsOnly = false;
|
|
|
|
|
public bool FormatsOnly
|
|
|
|
|
{
|
|
|
|
|
get { return _FormatsOnly; }
|
|
|
|
|
set { _FormatsOnly = value; }
|
|
|
|
|
}
|
|
|
|
|
#endregion
|
|
|
|
|
private bool _Loading = true;
|
|
|
|
|
|
|
|
|
|
private FolderTreeNode _topnode;
|
|
|
|
|
private bool UseVeTree = false;
|
|
|
|
@@ -59,15 +59,15 @@ namespace DataLoader
|
|
|
|
|
public int pbStepMaximum { get { return pbStep.Maximum; } set { pbStep.Maximum = value; } }
|
|
|
|
|
public int pbStepValue { get { return pbStep.Value; } set { pbStep.Value = value; } }
|
|
|
|
|
public int pbProcValue { get { return pbProc.Value; } set { pbProc.Value = value; } }
|
|
|
|
|
public int SkipProcedures
|
|
|
|
|
{
|
|
|
|
|
get { return MySettings.Skip; }
|
|
|
|
|
}
|
|
|
|
|
public int SkipProcedures
|
|
|
|
|
{
|
|
|
|
|
get { return MySettings.Skip; }
|
|
|
|
|
}
|
|
|
|
|
public string Status
|
|
|
|
|
{
|
|
|
|
|
get { return toolStripStatusLabel1.Text; }
|
|
|
|
|
set
|
|
|
|
|
{
|
|
|
|
|
set
|
|
|
|
|
{
|
|
|
|
|
toolStripStatusLabel1.Text = value;
|
|
|
|
|
Application.DoEvents();
|
|
|
|
|
}
|
|
|
|
@@ -82,66 +82,67 @@ namespace DataLoader
|
|
|
|
|
_MyFrmErrors = new frmErrors(this);
|
|
|
|
|
_MyFrmErrors.FormClosing += new FormClosingEventHandler(_MyFrmErrors_FormClosing);
|
|
|
|
|
}
|
|
|
|
|
return _MyFrmErrors;
|
|
|
|
|
return _MyFrmErrors;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
void _MyFrmErrors_FormClosing(object sender, FormClosingEventArgs e)
|
|
|
|
|
void _MyFrmErrors_FormClosing(object sender, FormClosingEventArgs e)
|
|
|
|
|
{
|
|
|
|
|
_MyFrmErrors = null;
|
|
|
|
|
}
|
|
|
|
|
public string MyError
|
|
|
|
|
{
|
|
|
|
|
get { return tsslError.Text; }
|
|
|
|
|
set
|
|
|
|
|
{
|
|
|
|
|
_MyFrmErrors = null;
|
|
|
|
|
MyFrmErrors.Add(value, MessageType.Error);
|
|
|
|
|
_MyLog.ErrorFormat(value);
|
|
|
|
|
tsslError.Text = string.Format("{0} Errors", MyFrmErrors.ErrorCount);
|
|
|
|
|
}
|
|
|
|
|
public string MyError
|
|
|
|
|
}
|
|
|
|
|
public string MyWarning
|
|
|
|
|
{
|
|
|
|
|
get { return tsslError.Text; }
|
|
|
|
|
set
|
|
|
|
|
{
|
|
|
|
|
get { return tsslError.Text; }
|
|
|
|
|
set
|
|
|
|
|
{
|
|
|
|
|
MyFrmErrors.Add(value, MessageType.Error);
|
|
|
|
|
_MyLog.ErrorFormat(value);
|
|
|
|
|
tsslError.Text = string.Format("{0} Errors", MyFrmErrors.ErrorCount); }
|
|
|
|
|
MyFrmErrors.Add(value, MessageType.Warning);
|
|
|
|
|
_MyLog.WarnFormat(value);
|
|
|
|
|
//tsslError.Text = string.Format("{0} Errors", MyFrmErrors.ErrorCount);
|
|
|
|
|
}
|
|
|
|
|
public string MyWarning
|
|
|
|
|
}
|
|
|
|
|
public string MyInfo
|
|
|
|
|
{
|
|
|
|
|
get { return tsslError.Text; }
|
|
|
|
|
set
|
|
|
|
|
{
|
|
|
|
|
get { return tsslError.Text; }
|
|
|
|
|
set
|
|
|
|
|
{
|
|
|
|
|
MyFrmErrors.Add(value, MessageType.Warning);
|
|
|
|
|
_MyLog.WarnFormat(value);
|
|
|
|
|
//tsslError.Text = string.Format("{0} Errors", MyFrmErrors.ErrorCount);
|
|
|
|
|
}
|
|
|
|
|
MyFrmErrors.Add(value, MessageType.Information);
|
|
|
|
|
_MyLog.Info(value);
|
|
|
|
|
//tsslError.Text = string.Format("{0} Errors", MyFrmErrors.ErrorCount);
|
|
|
|
|
}
|
|
|
|
|
public string MyInfo
|
|
|
|
|
}
|
|
|
|
|
public void AddError(string format, params object[] objs)
|
|
|
|
|
{
|
|
|
|
|
MyError = string.Format(format, objs);
|
|
|
|
|
}
|
|
|
|
|
public void AddWarn(string format, params object[] objs)
|
|
|
|
|
{
|
|
|
|
|
MyWarning = string.Format(format, objs);
|
|
|
|
|
}
|
|
|
|
|
public void AddInfo(string format, params object[] objs)
|
|
|
|
|
{
|
|
|
|
|
MyInfo = 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)
|
|
|
|
|
{
|
|
|
|
|
get { return tsslError.Text; }
|
|
|
|
|
set
|
|
|
|
|
{
|
|
|
|
|
MyFrmErrors.Add(value, MessageType.Information);
|
|
|
|
|
_MyLog.Info(value);
|
|
|
|
|
//tsslError.Text = string.Format("{0} Errors", MyFrmErrors.ErrorCount);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
public void AddError(string format, params object[] objs)
|
|
|
|
|
{
|
|
|
|
|
MyError = string.Format(format, objs);
|
|
|
|
|
}
|
|
|
|
|
public void AddWarn(string format, params object[] objs)
|
|
|
|
|
{
|
|
|
|
|
MyWarning = string.Format(format, objs);
|
|
|
|
|
}
|
|
|
|
|
public void AddInfo(string format, params object[] objs)
|
|
|
|
|
{
|
|
|
|
|
MyInfo = 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));
|
|
|
|
|
sb.Append(ex.StackTrace);
|
|
|
|
|
ex=ex.InnerException;
|
|
|
|
|
}
|
|
|
|
|
MyError = sb.ToString();
|
|
|
|
|
sb.Append("\r\n" + "".PadRight((++indent) * 2, ' ') + string.Format("{0} - {1}", ex.GetType().Name, ex.Message));
|
|
|
|
|
sb.Append(ex.StackTrace);
|
|
|
|
|
ex = ex.InnerException;
|
|
|
|
|
}
|
|
|
|
|
MyError = sb.ToString();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public frmLoader()
|
|
|
|
|
{
|
|
|
|
@@ -152,74 +153,74 @@ namespace DataLoader
|
|
|
|
|
}
|
|
|
|
|
private void btnConvertSelected_Click(object sender, EventArgs e)
|
|
|
|
|
{
|
|
|
|
|
if (UseVeTree)
|
|
|
|
|
{
|
|
|
|
|
VETreeNode tn = (VETreeNode)tv.SelectedNode;
|
|
|
|
|
if (tn == null)
|
|
|
|
|
{
|
|
|
|
|
MessageBox.Show("Must select a version node (working draft, approved, etc)", "No Node Selected");
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
object o = tn.VEObject;
|
|
|
|
|
if (o.GetType() != typeof(DocVersionInfo))
|
|
|
|
|
{
|
|
|
|
|
MessageBox.Show("Must select a version node (working draft, approved, etc)", "No Node Selected");
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
DocVersion v = ((DocVersionInfo)o).Get();
|
|
|
|
|
ldr.MigrateDocVersion(v);
|
|
|
|
|
if (UseVeTree)
|
|
|
|
|
{
|
|
|
|
|
VETreeNode tn = (VETreeNode)tv.SelectedNode;
|
|
|
|
|
if (tn == null)
|
|
|
|
|
{
|
|
|
|
|
MessageBox.Show("Must select a version node (working draft, approved, etc)", "No Node Selected");
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
object o = tn.VEObject;
|
|
|
|
|
if (o.GetType() != typeof(DocVersionInfo))
|
|
|
|
|
{
|
|
|
|
|
MessageBox.Show("Must select a version node (working draft, approved, etc)", "No Node Selected");
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
DocVersion v = ((DocVersionInfo)o).Get();
|
|
|
|
|
ldr.MigrateDocVersion(v);
|
|
|
|
|
if (v.MyItem != null)
|
|
|
|
|
{
|
|
|
|
|
{
|
|
|
|
|
tn.Checked = true;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
TreeNode tn = tv.SelectedNode;
|
|
|
|
|
if (tn == null)
|
|
|
|
|
{
|
|
|
|
|
MessageBox.Show("Must select a version node (working draft, approved, etc)", "No Node Selected");
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
object o = tn.Tag;
|
|
|
|
|
if (o.GetType() != typeof(DocVersion))
|
|
|
|
|
{
|
|
|
|
|
MessageBox.Show("Must select a version node (working draft, approved, etc)", "No Node Selected");
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
DocVersion v = (DocVersion)o;
|
|
|
|
|
ldr.MigrateDocVersion(v);
|
|
|
|
|
if (v.MyItem != null)
|
|
|
|
|
{
|
|
|
|
|
tn.Checked = true;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
TreeNode tn = tv.SelectedNode;
|
|
|
|
|
if (tn == null)
|
|
|
|
|
{
|
|
|
|
|
MessageBox.Show("Must select a version node (working draft, approved, etc)", "No Node Selected");
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
object o = tn.Tag;
|
|
|
|
|
if (o.GetType() != typeof(DocVersion))
|
|
|
|
|
{
|
|
|
|
|
MessageBox.Show("Must select a version node (working draft, approved, etc)", "No Node Selected");
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
DocVersion v = (DocVersion)o;
|
|
|
|
|
ldr.MigrateDocVersion(v);
|
|
|
|
|
if (v.MyItem != null)
|
|
|
|
|
{
|
|
|
|
|
tn.Checked = true;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
private void tv_BeforeExpand(object sender, TreeViewCancelEventArgs e)
|
|
|
|
|
{
|
|
|
|
|
if (UseVeTree)
|
|
|
|
|
{
|
|
|
|
|
((VETreeNode)e.Node).LoadChildren();
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
if (UseVeTree)
|
|
|
|
|
{
|
|
|
|
|
((VETreeNode)e.Node).LoadChildren();
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
TreeNode tn = e.Node;
|
|
|
|
|
object o = tn.Tag;
|
|
|
|
|
switch (o.GetType().ToString())
|
|
|
|
|
{
|
|
|
|
|
case "Volian.CSLA.Library.FolderInfo":
|
|
|
|
|
FolderInfo fld = (FolderInfo)o;
|
|
|
|
|
if (fld.ChildFolderCount>0)
|
|
|
|
|
TreeNode tn = e.Node;
|
|
|
|
|
object o = tn.Tag;
|
|
|
|
|
switch (o.GetType().ToString())
|
|
|
|
|
{
|
|
|
|
|
case "Volian.CSLA.Library.FolderInfo":
|
|
|
|
|
FolderInfo fld = (FolderInfo)o;
|
|
|
|
|
if (fld.ChildFolderCount > 0)
|
|
|
|
|
tn.Checked = ldr.LoadChildren(fld, tn); // load docversions.
|
|
|
|
|
break;
|
|
|
|
|
default:
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
default:
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
private void tv_AfterSelect(object sender, TreeViewEventArgs e)
|
|
|
|
|
{
|
|
|
|
|
if (UseVeTree) return;
|
|
|
|
|
if (UseVeTree) return;
|
|
|
|
|
|
|
|
|
|
TreeNode tn = e.Node;
|
|
|
|
|
object o = tn.Tag;
|
|
|
|
@@ -229,9 +230,9 @@ namespace DataLoader
|
|
|
|
|
private void btnLoadTreeDB_Click(object sender, EventArgs e)
|
|
|
|
|
{
|
|
|
|
|
// When loading folders, i.e. the tree from dBase (old 16-bit)
|
|
|
|
|
// always clear the data
|
|
|
|
|
// always clear the data
|
|
|
|
|
ldr.ClearData();
|
|
|
|
|
bool suc = ldr.LoadFolders(MySettings.VEPromsPath);
|
|
|
|
|
bool suc = ldr.LoadFolders(MySettings.VEPromsPath);
|
|
|
|
|
}
|
|
|
|
|
private string GetScript(string scriptName)
|
|
|
|
|
{
|
|
|
|
@@ -244,8 +245,8 @@ namespace DataLoader
|
|
|
|
|
public DateTime ProcessTime
|
|
|
|
|
{
|
|
|
|
|
get { return _ProcessTime; }
|
|
|
|
|
set
|
|
|
|
|
{
|
|
|
|
|
set
|
|
|
|
|
{
|
|
|
|
|
_ProcessTime = value;
|
|
|
|
|
// Set the Log File Name when the ProcessTime is set
|
|
|
|
|
ChangeLogFileName("LogFileAppender", MySettings.DBName + " " + ProcessTime.ToString("yyyyMMdd HHmmss") + " DMErrorLog.txt");
|
|
|
|
@@ -269,13 +270,13 @@ namespace DataLoader
|
|
|
|
|
Loader.OverrideColor = Color.Empty;
|
|
|
|
|
}
|
|
|
|
|
//if (!CheckLogPath()) return;
|
|
|
|
|
//#if (!DEBUG)
|
|
|
|
|
//#if (!DEBUG)
|
|
|
|
|
if (!VlnSettings.DebugMode)
|
|
|
|
|
{
|
|
|
|
|
DialogResult dlgrst = MessageBox.Show("The VE-PROMS data currently in SQL Server (Express) will be deleted.\r\n\nProceed with Data Conversion?", "WARNING", MessageBoxButtons.YesNo, MessageBoxIcon.Warning);
|
|
|
|
|
if (dlgrst == DialogResult.No) return;
|
|
|
|
|
}
|
|
|
|
|
//#endif
|
|
|
|
|
//#endif
|
|
|
|
|
try
|
|
|
|
|
{
|
|
|
|
|
//TextConvert.ResetSpecialCharacters();
|
|
|
|
@@ -306,11 +307,12 @@ namespace DataLoader
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
// Create Database
|
|
|
|
|
RunScript("BuildVEPROMS.Sql", "Master");
|
|
|
|
|
RunScript("PROMS2010.SQL", MySettings.DBName);
|
|
|
|
|
|
|
|
|
|
// if purge data, purge it all & reload folders & security.
|
|
|
|
|
if (MySettings.PurgeExistingData)
|
|
|
|
|
{
|
|
|
|
|
RunScript("BuildVEPROMS.Sql", "Master");
|
|
|
|
|
RunScript("PROMS2010.SQL", MySettings.DBName);
|
|
|
|
|
Status = "Purging Data";
|
|
|
|
|
ldr.ClearData();
|
|
|
|
|
Status = "Loading Folders";
|
|
|
|
@@ -321,6 +323,12 @@ namespace DataLoader
|
|
|
|
|
success = ldr.LoadSecurity(MySettings.VESamFile, MySettings.VEPromsPath);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
// check if images have been zipped & if not, zip them:
|
|
|
|
|
ROImageInfo.ZipImages();
|
|
|
|
|
success = ldr.LoadFoldersIntoExisting(MySettings.VEPromsPath);
|
|
|
|
|
}
|
|
|
|
|
if (success)
|
|
|
|
|
{
|
|
|
|
|
TimeSpan ts = new TimeSpan();
|
|
|
|
@@ -346,7 +354,7 @@ namespace DataLoader
|
|
|
|
|
string ConversionTime = string.Format("Conversion completion time: {0:D2}:{1:D2}:{2:D2}.{3}", ts.Hours, ts.Minutes, ts.Seconds, ts.Milliseconds);
|
|
|
|
|
MyInfo = ConversionTime;
|
|
|
|
|
SaveLogFiles();
|
|
|
|
|
if(!ProcessComplete) MessageBox.Show(string.Format("{0}\r\n\n({1} Total Seconds)", ConversionTime, ts.TotalSeconds));
|
|
|
|
|
if (!ProcessComplete) MessageBox.Show(string.Format("{0}\r\n\n({1} Total Seconds)", ConversionTime, ts.TotalSeconds));
|
|
|
|
|
//MessageBox.Show(string.Format("Conversion completion time: {0:D2}:{1:D2}:{2:D2}.{3}\r\n\n({4} Total Seconds)", ts.Hours, ts.Minutes, ts.Seconds, ts.Milliseconds, ts.TotalSeconds));
|
|
|
|
|
//MessageBox.Show(string.Format("{0} seconds", ts.TotalSeconds));
|
|
|
|
|
//TextConvert.ListSpecialCharacters();
|
|
|
|
@@ -354,27 +362,26 @@ namespace DataLoader
|
|
|
|
|
}
|
|
|
|
|
catch (Exception ex)
|
|
|
|
|
{
|
|
|
|
|
AddError(ex,"===================== Fatal Error ==========================\r\n{0} - {1}", ex.GetType().Name, ex.Message);
|
|
|
|
|
AddError(ex, "===================== Fatal Error ==========================\r\n{0} - {1}", ex.GetType().Name, ex.Message);
|
|
|
|
|
SaveLogFiles();
|
|
|
|
|
MessageBox.Show(ex.Message, "Fatal Error During Loading", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
|
|
|
|
_MyLog.Fatal(ex.Message);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public void RunScript(string scriptName, string dbName)
|
|
|
|
|
{
|
|
|
|
|
Status = String.Format("Running Script '{0}'", scriptName);
|
|
|
|
|
string script = GetScript(scriptName);
|
|
|
|
|
script=script.Replace("{DBName}", MySettings.DBName);
|
|
|
|
|
script=script.Replace("{DBPath}", MySettings.DBPath);
|
|
|
|
|
script = script.Replace("{DBName}", MySettings.DBName);
|
|
|
|
|
script = script.Replace("{DBPath}", MySettings.DBPath);
|
|
|
|
|
SQLScriptRunner ssr = new SQLScriptRunner(script, MySettings.ConnectionString.Replace("{DBName}", dbName));
|
|
|
|
|
ssr.InfoMessage += new SQLScriptRunnerEvent(ssr_InfoMessage);
|
|
|
|
|
ssr.InfoMessage += new SQLScriptRunnerEvent(ssr_InfoMessage);
|
|
|
|
|
ssr.Run();
|
|
|
|
|
Status = String.Format("Script '{0}' Complete", scriptName);
|
|
|
|
|
Status = String.Format("Script '{0}' Complete", scriptName);
|
|
|
|
|
}
|
|
|
|
|
private void Backup(string suffix)
|
|
|
|
|
{
|
|
|
|
|
SQLScriptRunner ssrbu = new SQLScriptRunner(MySettings.DBName, MySettings.BackupFolder,
|
|
|
|
|
SQLScriptRunner ssrbu = new SQLScriptRunner(MySettings.DBName, MySettings.BackupFolder,
|
|
|
|
|
MySettings.ConnectionString.Replace("{DBName}", "Master"), ProcessTime, suffix);
|
|
|
|
|
ssrbu.InfoMessage += new SQLScriptRunnerEvent(ssr_InfoMessage);
|
|
|
|
|
ssrbu.Run();
|
|
|
|
@@ -430,41 +437,41 @@ namespace DataLoader
|
|
|
|
|
lblTime.Text = string.Format("{0:D2}:{1:D2}:{2:D2} Elapsed", ts.Hours, ts.Minutes, ts.Seconds);
|
|
|
|
|
Application.DoEvents();
|
|
|
|
|
}
|
|
|
|
|
private void btnLoadTreeCSLA_Click(object sender, EventArgs e)
|
|
|
|
|
{
|
|
|
|
|
_topnode = FolderTreeNode.BuildTreeList();
|
|
|
|
|
tv.Nodes.Add(_topnode);
|
|
|
|
|
tv.Nodes[0].Expand();
|
|
|
|
|
UseVeTree = false;
|
|
|
|
|
}
|
|
|
|
|
private void btnVesam_Click(object sender, EventArgs e)
|
|
|
|
|
{
|
|
|
|
|
// if purge data, purge it all & reload folders.
|
|
|
|
|
if (MySettings.PurgeExistingData)
|
|
|
|
|
{
|
|
|
|
|
ldr.ClearData();
|
|
|
|
|
ldr.LoadFolders(MySettings.VEPromsPath);
|
|
|
|
|
}
|
|
|
|
|
bool sec = ldr.LoadSecurity(MySettings.VESamFile, MySettings.VEPromsPath);
|
|
|
|
|
}
|
|
|
|
|
private void btnLoadTreeCSLA_Click(object sender, EventArgs e)
|
|
|
|
|
{
|
|
|
|
|
_topnode = FolderTreeNode.BuildTreeList();
|
|
|
|
|
tv.Nodes.Add(_topnode);
|
|
|
|
|
tv.Nodes[0].Expand();
|
|
|
|
|
UseVeTree = false;
|
|
|
|
|
}
|
|
|
|
|
private void btnVesam_Click(object sender, EventArgs e)
|
|
|
|
|
{
|
|
|
|
|
// if purge data, purge it all & reload folders.
|
|
|
|
|
if (MySettings.PurgeExistingData)
|
|
|
|
|
{
|
|
|
|
|
ldr.ClearData();
|
|
|
|
|
ldr.LoadFolders(MySettings.VEPromsPath);
|
|
|
|
|
}
|
|
|
|
|
bool sec = ldr.LoadSecurity(MySettings.VESamFile, MySettings.VEPromsPath);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void btnVETree_CSLA_Click(object sender, EventArgs e)
|
|
|
|
|
{
|
|
|
|
|
tv.Nodes.Add(VETreeNode.GetFolder(1));
|
|
|
|
|
UseVeTree = true;
|
|
|
|
|
}
|
|
|
|
|
private void btnVETree_CSLA_Click(object sender, EventArgs e)
|
|
|
|
|
{
|
|
|
|
|
tv.Nodes.Add(VETreeNode.GetFolder(1));
|
|
|
|
|
UseVeTree = true;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void btnGroup_Click(object sender, EventArgs e)
|
|
|
|
|
{
|
|
|
|
|
GroupProp f = new GroupProp();
|
|
|
|
|
f.ShowDialog();
|
|
|
|
|
}
|
|
|
|
|
private void btnGroup_Click(object sender, EventArgs e)
|
|
|
|
|
{
|
|
|
|
|
GroupProp f = new GroupProp();
|
|
|
|
|
f.ShowDialog();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void btnCtTok_Click(object sender, EventArgs e)
|
|
|
|
|
{
|
|
|
|
|
frmCntTkn frm = new frmCntTkn();
|
|
|
|
|
frm.ShowDialog();
|
|
|
|
|
}
|
|
|
|
|
private void btnCtTok_Click(object sender, EventArgs e)
|
|
|
|
|
{
|
|
|
|
|
frmCntTkn frm = new frmCntTkn();
|
|
|
|
|
frm.ShowDialog();
|
|
|
|
|
}
|
|
|
|
|
public void UpdateLabelsSetProc(int prc)
|
|
|
|
|
{
|
|
|
|
|
pbProc.Maximum = prc;
|
|
|
|
@@ -485,8 +492,8 @@ namespace DataLoader
|
|
|
|
|
pbProc.Value += incLib;
|
|
|
|
|
pbSect.Value += incUsages;
|
|
|
|
|
}
|
|
|
|
|
lblProc.Text = string.Format("{0}/{1} Lib Docs", pbProc.Value,pbProc.Maximum);
|
|
|
|
|
lblSection.Text = string.Format("{0}/{1} Usages", pbSect.Value,pbSect.Maximum);
|
|
|
|
|
lblProc.Text = string.Format("{0}/{1} Lib Docs", pbProc.Value, pbProc.Maximum);
|
|
|
|
|
lblSection.Text = string.Format("{0}/{1} Usages", pbSect.Value, pbSect.Maximum);
|
|
|
|
|
lblStep.Text = "";
|
|
|
|
|
TimeSpan ts = new TimeSpan(DateTime.Now.Ticks - ProcessTime.Ticks);
|
|
|
|
|
lblTime.Text = string.Format("{0:D2}:{1:D2}:{2:D2} Elapsed", ts.Hours, ts.Minutes, ts.Seconds);
|
|
|
|
@@ -521,108 +528,108 @@ namespace DataLoader
|
|
|
|
|
private DataLoaderSettings _MySettings;
|
|
|
|
|
internal DataLoaderSettings MySettings
|
|
|
|
|
{
|
|
|
|
|
get
|
|
|
|
|
{
|
|
|
|
|
if(_MySettings==null)
|
|
|
|
|
_MySettings=new DataLoaderSettings();
|
|
|
|
|
return _MySettings;
|
|
|
|
|
get
|
|
|
|
|
{
|
|
|
|
|
if (_MySettings == null)
|
|
|
|
|
_MySettings = new DataLoaderSettings();
|
|
|
|
|
return _MySettings;
|
|
|
|
|
}
|
|
|
|
|
set { _MySettings = value; }
|
|
|
|
|
}
|
|
|
|
|
private void LoadSettings()
|
|
|
|
|
private void LoadSettings()
|
|
|
|
|
{
|
|
|
|
|
Console.WriteLine("Start");
|
|
|
|
|
if (Properties.Settings.Default["VePromsFilename"].ToString() != "")
|
|
|
|
|
MySettings.VEPromsPath = Properties.Settings.Default.VePromsFilename;
|
|
|
|
|
if (Properties.Settings.Default["VeSamFilename"].ToString() != "")
|
|
|
|
|
MySettings.VESamFile = Properties.Settings.Default.VeSamFilename;
|
|
|
|
|
if (Properties.Settings.Default["DbfPathname"].ToString() != "")
|
|
|
|
|
MySettings.ProcedureSetPath = Properties.Settings.Default.DbfPathname;
|
|
|
|
|
if (Properties.Settings.Default["BackupFileName"].ToString() != "")
|
|
|
|
|
MySettings.BackupFileName = Properties.Settings.Default.BackupFileName;
|
|
|
|
|
if (Properties.Settings.Default["BackupFolder"].ToString() != "")
|
|
|
|
|
MySettings.BackupFolder = Properties.Settings.Default.BackupFolder;
|
|
|
|
|
if (Properties.Settings.Default["LogFileLoc"].ToString() != "")
|
|
|
|
|
MySettings.LogFilePath = Properties.Settings.Default.LogFileLoc;
|
|
|
|
|
if (Properties.Settings.Default["ConnectionString"].ToString() != "")
|
|
|
|
|
MySettings.ConnectionString = Properties.Settings.Default.ConnectionString;
|
|
|
|
|
if (Properties.Settings.Default["DBName"].ToString() != "")
|
|
|
|
|
MySettings.DBName = Properties.Settings.Default.DBName;
|
|
|
|
|
if (Properties.Settings.Default["DBPath"].ToString() != "")
|
|
|
|
|
MySettings.DBPath = Properties.Settings.Default.DBPath;
|
|
|
|
|
MySettings.PurgeExistingData = (Properties.Settings.Default.PurgeData == CheckState.Checked);
|
|
|
|
|
if (Properties.Settings.Default["PDFFolder"].ToString() != "")
|
|
|
|
|
MySettings.PDFFolder = Properties.Settings.Default.PDFFolder;
|
|
|
|
|
MySettings.OnlyThisSet = (Properties.Settings.Default.OnlyThisSet == CheckState.Checked);
|
|
|
|
|
MySettings.CheckRTF = (Properties.Settings.Default.CheckRTF == CheckState.Checked);
|
|
|
|
|
MySettings.Skip = Properties.Settings.Default.Skip;
|
|
|
|
|
MySettings.ConvertTo = (AccPageConversion)Properties.Settings.Default.ConvertTo;
|
|
|
|
|
MySettings.ExecutionMode = (ExecutionMode)Properties.Settings.Default.ExecutionMode;
|
|
|
|
|
MySettings.Phase1Suffix = Properties.Settings.Default.Phase1;
|
|
|
|
|
MySettings.Phase2Suffix = Properties.Settings.Default.Phase2;
|
|
|
|
|
MySettings.Phase3Suffix = Properties.Settings.Default.Phase3;
|
|
|
|
|
MySettings.FormatFolder = Properties.Settings.Default.FormatFolder;
|
|
|
|
|
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 != "")
|
|
|
|
|
{
|
|
|
|
|
Console.WriteLine("Start");
|
|
|
|
|
if (Properties.Settings.Default["VePromsFilename"].ToString() != "")
|
|
|
|
|
MySettings.VEPromsPath = Properties.Settings.Default.VePromsFilename;
|
|
|
|
|
if (Properties.Settings.Default["VeSamFilename"].ToString() != "")
|
|
|
|
|
MySettings.VESamFile = Properties.Settings.Default.VeSamFilename;
|
|
|
|
|
if (Properties.Settings.Default["DbfPathname"].ToString() != "")
|
|
|
|
|
MySettings.ProcedureSetPath = Properties.Settings.Default.DbfPathname;
|
|
|
|
|
if (Properties.Settings.Default["BackupFileName"].ToString() != "")
|
|
|
|
|
MySettings.BackupFileName = Properties.Settings.Default.BackupFileName;
|
|
|
|
|
if (Properties.Settings.Default["BackupFolder"].ToString() != "")
|
|
|
|
|
MySettings.BackupFolder = Properties.Settings.Default.BackupFolder;
|
|
|
|
|
if (Properties.Settings.Default["LogFileLoc"].ToString() != "")
|
|
|
|
|
MySettings.LogFilePath = Properties.Settings.Default.LogFileLoc;
|
|
|
|
|
if (Properties.Settings.Default["ConnectionString"].ToString() != "")
|
|
|
|
|
MySettings.ConnectionString = Properties.Settings.Default.ConnectionString;
|
|
|
|
|
if (Properties.Settings.Default["DBName"].ToString() != "")
|
|
|
|
|
MySettings.DBName = Properties.Settings.Default.DBName;
|
|
|
|
|
if (Properties.Settings.Default["DBPath"].ToString() != "")
|
|
|
|
|
MySettings.DBPath = Properties.Settings.Default.DBPath;
|
|
|
|
|
MySettings.PurgeExistingData = (Properties.Settings.Default.PurgeData == CheckState.Checked);
|
|
|
|
|
if (Properties.Settings.Default["PDFFolder"].ToString() != "")
|
|
|
|
|
MySettings.PDFFolder = Properties.Settings.Default.PDFFolder;
|
|
|
|
|
MySettings.OnlyThisSet = (Properties.Settings.Default.OnlyThisSet == CheckState.Checked);
|
|
|
|
|
MySettings.CheckRTF = (Properties.Settings.Default.CheckRTF == CheckState.Checked);
|
|
|
|
|
MySettings.Skip = Properties.Settings.Default.Skip;
|
|
|
|
|
MySettings.ConvertTo = (AccPageConversion) Properties.Settings.Default.ConvertTo;
|
|
|
|
|
MySettings.ExecutionMode = (ExecutionMode)Properties.Settings.Default.ExecutionMode;
|
|
|
|
|
MySettings.Phase1Suffix = Properties.Settings.Default.Phase1;
|
|
|
|
|
MySettings.Phase2Suffix = Properties.Settings.Default.Phase2;
|
|
|
|
|
MySettings.Phase3Suffix = Properties.Settings.Default.Phase3;
|
|
|
|
|
MySettings.FormatFolder = Properties.Settings.Default.FormatFolder;
|
|
|
|
|
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 != "")
|
|
|
|
|
{
|
|
|
|
|
MessageBox.Show(validity, "Settings Incorrect", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
|
|
|
|
|
OpenSettings();
|
|
|
|
|
}
|
|
|
|
|
MessageBox.Show(validity, "Settings Incorrect", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
|
|
|
|
|
OpenSettings();
|
|
|
|
|
}
|
|
|
|
|
private void OpenSettings()
|
|
|
|
|
}
|
|
|
|
|
private void OpenSettings()
|
|
|
|
|
{
|
|
|
|
|
DataLoaderSettings tmpDLS = (DataLoaderSettings)MySettings.Clone();
|
|
|
|
|
frmPG myPG = new frmPG("Data Loader Settings", tmpDLS);
|
|
|
|
|
if (myPG.ShowDialog() == DialogResult.OK)
|
|
|
|
|
{
|
|
|
|
|
DataLoaderSettings tmpDLS = (DataLoaderSettings) MySettings.Clone();
|
|
|
|
|
frmPG myPG = new frmPG("Data Loader Settings", tmpDLS);
|
|
|
|
|
if (myPG.ShowDialog() == DialogResult.OK)
|
|
|
|
|
{
|
|
|
|
|
MySettings = tmpDLS;
|
|
|
|
|
SaveSettings();
|
|
|
|
|
}
|
|
|
|
|
string validity = MySettings.ValidityCheck;
|
|
|
|
|
if (validity != "")
|
|
|
|
|
{
|
|
|
|
|
processToolStripMenuItem.Enabled = false;
|
|
|
|
|
oldToolStripMenuItem.Enabled = false;
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
processToolStripMenuItem.Enabled = true;
|
|
|
|
|
oldToolStripMenuItem.Enabled = true;
|
|
|
|
|
}
|
|
|
|
|
MySettings = tmpDLS;
|
|
|
|
|
SaveSettings();
|
|
|
|
|
}
|
|
|
|
|
private void SaveSettings()
|
|
|
|
|
string validity = MySettings.ValidityCheck;
|
|
|
|
|
if (validity != "")
|
|
|
|
|
{
|
|
|
|
|
Properties.Settings.Default.DbfPathname = MySettings.ProcedureSetPath;
|
|
|
|
|
Properties.Settings.Default.VePromsFilename = MySettings.VEPromsPath;
|
|
|
|
|
Properties.Settings.Default.VeSamFilename = MySettings.VESamFile;
|
|
|
|
|
Properties.Settings.Default.DbfPathname = MySettings.ProcedureSetPath;
|
|
|
|
|
Properties.Settings.Default.BackupFileName = MySettings.BackupFileName;
|
|
|
|
|
Properties.Settings.Default.BackupFolder = MySettings.BackupFolder;
|
|
|
|
|
Properties.Settings.Default.LogFileLoc = MySettings.LogFilePath;
|
|
|
|
|
Properties.Settings.Default.ConnectionString = MySettings.ConnectionString;
|
|
|
|
|
Properties.Settings.Default.DBName = MySettings.DBName;
|
|
|
|
|
Properties.Settings.Default.DBPath = MySettings.DBPath;
|
|
|
|
|
Properties.Settings.Default.PurgeData = MySettings.PurgeExistingData ? CheckState.Checked : CheckState.Unchecked;
|
|
|
|
|
Properties.Settings.Default.PDFFolder = MySettings.PDFFolder;
|
|
|
|
|
Properties.Settings.Default.OnlyThisSet = MySettings.OnlyThisSet ? CheckState.Checked : CheckState.Unchecked;
|
|
|
|
|
Properties.Settings.Default.CheckRTF = MySettings.CheckRTF ? CheckState.Checked : CheckState.Unchecked;
|
|
|
|
|
Properties.Settings.Default.Skip = MySettings.Skip;
|
|
|
|
|
Properties.Settings.Default.ConvertTo = (int)MySettings.ConvertTo;
|
|
|
|
|
Properties.Settings.Default.ExecutionMode = (int)MySettings.ExecutionMode;
|
|
|
|
|
Properties.Settings.Default.Phase1 = MySettings.Phase1Suffix;
|
|
|
|
|
Properties.Settings.Default.Phase2 = MySettings.Phase2Suffix;
|
|
|
|
|
Properties.Settings.Default.Phase3 = MySettings.Phase3Suffix;
|
|
|
|
|
Properties.Settings.Default.FormatFolder = MySettings.FormatFolder;
|
|
|
|
|
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();
|
|
|
|
|
processToolStripMenuItem.Enabled = false;
|
|
|
|
|
oldToolStripMenuItem.Enabled = false;
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
processToolStripMenuItem.Enabled = true;
|
|
|
|
|
oldToolStripMenuItem.Enabled = true;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
private void SaveSettings()
|
|
|
|
|
{
|
|
|
|
|
Properties.Settings.Default.DbfPathname = MySettings.ProcedureSetPath;
|
|
|
|
|
Properties.Settings.Default.VePromsFilename = MySettings.VEPromsPath;
|
|
|
|
|
Properties.Settings.Default.VeSamFilename = MySettings.VESamFile;
|
|
|
|
|
Properties.Settings.Default.DbfPathname = MySettings.ProcedureSetPath;
|
|
|
|
|
Properties.Settings.Default.BackupFileName = MySettings.BackupFileName;
|
|
|
|
|
Properties.Settings.Default.BackupFolder = MySettings.BackupFolder;
|
|
|
|
|
Properties.Settings.Default.LogFileLoc = MySettings.LogFilePath;
|
|
|
|
|
Properties.Settings.Default.ConnectionString = MySettings.ConnectionString;
|
|
|
|
|
Properties.Settings.Default.DBName = MySettings.DBName;
|
|
|
|
|
Properties.Settings.Default.DBPath = MySettings.DBPath;
|
|
|
|
|
Properties.Settings.Default.PurgeData = MySettings.PurgeExistingData ? CheckState.Checked : CheckState.Unchecked;
|
|
|
|
|
Properties.Settings.Default.PDFFolder = MySettings.PDFFolder;
|
|
|
|
|
Properties.Settings.Default.OnlyThisSet = MySettings.OnlyThisSet ? CheckState.Checked : CheckState.Unchecked;
|
|
|
|
|
Properties.Settings.Default.CheckRTF = MySettings.CheckRTF ? CheckState.Checked : CheckState.Unchecked;
|
|
|
|
|
Properties.Settings.Default.Skip = MySettings.Skip;
|
|
|
|
|
Properties.Settings.Default.ConvertTo = (int)MySettings.ConvertTo;
|
|
|
|
|
Properties.Settings.Default.ExecutionMode = (int)MySettings.ExecutionMode;
|
|
|
|
|
Properties.Settings.Default.Phase1 = MySettings.Phase1Suffix;
|
|
|
|
|
Properties.Settings.Default.Phase2 = MySettings.Phase2Suffix;
|
|
|
|
|
Properties.Settings.Default.Phase3 = MySettings.Phase3Suffix;
|
|
|
|
|
Properties.Settings.Default.FormatFolder = MySettings.FormatFolder;
|
|
|
|
|
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)
|
|
|
|
|
{
|
|
|
|
|
LoadSettings();
|
|
|
|
@@ -719,13 +726,13 @@ namespace DataLoader
|
|
|
|
|
string bckupFileName = MySettings.BackupFileName;
|
|
|
|
|
if (!bckupFileName.EndsWith(".bak")) bckupFileName += ".bak";
|
|
|
|
|
string backupPath = MySettings.LogFilePath + @"\" + bckupFileName + "'\"";
|
|
|
|
|
string bckupcmd = string.Format("sqlcmd -E -S.\\sqlexpress -Q \"backup database [{0}] to disk = '{1}",MySettings.DBName,backupPath);
|
|
|
|
|
string rstorecmd = string.Format("sqlcmd -E -S.\\sqlexpress -Q \"restore database [{0}] from disk = '{1}",MySettings.DBName,backupPath);
|
|
|
|
|
StreamWriter fsbackup = new StreamWriter(MySettings.LogFilePath + @"\Backup" + bckupFileName.Substring(0,bckupFileName.Length-4) + ".bat");
|
|
|
|
|
string bckupcmd = string.Format("sqlcmd -E -S.\\sqlexpress -Q \"backup database [{0}] to disk = '{1}", MySettings.DBName, backupPath);
|
|
|
|
|
string rstorecmd = string.Format("sqlcmd -E -S.\\sqlexpress -Q \"restore database [{0}] from disk = '{1}", MySettings.DBName, backupPath);
|
|
|
|
|
StreamWriter fsbackup = new StreamWriter(MySettings.LogFilePath + @"\Backup" + bckupFileName.Substring(0, bckupFileName.Length - 4) + ".bat");
|
|
|
|
|
fsbackup.WriteLine(bckupcmd);
|
|
|
|
|
fsbackup.WriteLine(pause);
|
|
|
|
|
fsbackup.Close();
|
|
|
|
|
StreamWriter fsrestore = new StreamWriter(MySettings.LogFilePath + @"\Restore" + bckupFileName.Substring(0,bckupFileName.Length-4) + ".bat");
|
|
|
|
|
StreamWriter fsrestore = new StreamWriter(MySettings.LogFilePath + @"\Restore" + bckupFileName.Substring(0, bckupFileName.Length - 4) + ".bat");
|
|
|
|
|
fsrestore.WriteLine(rstorecmd);
|
|
|
|
|
fsrestore.WriteLine(pause);
|
|
|
|
|
fsrestore.Close();
|
|
|
|
@@ -793,7 +800,7 @@ namespace DataLoader
|
|
|
|
|
Status = "Backing up Phase 3 Data";
|
|
|
|
|
Backup("_" + MySettings.Phase3Suffix);
|
|
|
|
|
mb.Append("Phase 3 Backup Complete");
|
|
|
|
|
//Phase 4 - Convert to Approval Version
|
|
|
|
|
//Phase 4 - Convert to Approval Version
|
|
|
|
|
ConvertToApproval();
|
|
|
|
|
FixProceduresAndFunctions();
|
|
|
|
|
mb.Append("Conversion to Approval Complete");
|
|
|
|
@@ -832,12 +839,12 @@ namespace DataLoader
|
|
|
|
|
FormatsOnly = true;
|
|
|
|
|
btnConvert_Click(this, new System.EventArgs());
|
|
|
|
|
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";
|
|
|
|
|
Backup("_" + "FormatChange");
|
|
|
|
|
MyInfo="Format Change Backup Complete";
|
|
|
|
|
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);
|
|
|
|
@@ -847,12 +854,12 @@ namespace DataLoader
|
|
|
|
|
ProcessTime = DateTime.Now;
|
|
|
|
|
btnConvert_Click(this, new System.EventArgs());
|
|
|
|
|
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";
|
|
|
|
|
Backup("_" + MySettings.Phase1Suffix);
|
|
|
|
|
MyInfo="Phase 1 Backup Complete";
|
|
|
|
|
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);
|
|
|
|
@@ -862,12 +869,12 @@ namespace DataLoader
|
|
|
|
|
Database.VEPROMS_Connection = MySettings.ConnectionString.Replace("{DBName}", MySettings.DBName);
|
|
|
|
|
ProcessTime = DateTime.Now;
|
|
|
|
|
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";
|
|
|
|
|
Backup("_" + MySettings.Phase2Suffix);
|
|
|
|
|
MyInfo="Phase 2 Backup Complete";
|
|
|
|
|
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);
|
|
|
|
@@ -876,12 +883,12 @@ namespace DataLoader
|
|
|
|
|
{
|
|
|
|
|
ProcessTime = DateTime.Now;
|
|
|
|
|
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";
|
|
|
|
|
Backup("_" + MySettings.Phase3Suffix);
|
|
|
|
|
MyInfo="Phase 3 Backup Complete";
|
|
|
|
|
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);
|
|
|
|
@@ -890,12 +897,12 @@ namespace DataLoader
|
|
|
|
|
{
|
|
|
|
|
ProcessTime = DateTime.Now;
|
|
|
|
|
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";
|
|
|
|
|
Backup("_" + MySettings.Phase4Suffix);
|
|
|
|
|
MyInfo="Phase 4 Backup Complete";
|
|
|
|
|
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);
|
|
|
|
@@ -909,7 +916,7 @@ namespace DataLoader
|
|
|
|
|
{
|
|
|
|
|
Status = "Backing up Data";
|
|
|
|
|
Backup("");
|
|
|
|
|
MyInfo="Backup Complete";
|
|
|
|
|
MyInfo = "Backup Complete";
|
|
|
|
|
}
|
|
|
|
|
Status = "Processing Complete";
|
|
|
|
|
//Status = "Loading 16 Bit Approval Data Complete";
|
|
|
|
@@ -928,9 +935,9 @@ namespace DataLoader
|
|
|
|
|
FixProceduresAndFunctions();
|
|
|
|
|
if (MessageBox.Show("Backup Database?", "Backup", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
|
|
|
|
|
{
|
|
|
|
|
Status = "Backing up Data";
|
|
|
|
|
Backup("_Fixed");
|
|
|
|
|
MyInfo="Backup Complete";
|
|
|
|
|
Status = "Backing up Data";
|
|
|
|
|
Backup("_Fixed");
|
|
|
|
|
MyInfo = "Backup Complete";
|
|
|
|
|
}
|
|
|
|
|
//Status = "Processing Complete";
|
|
|
|
|
//MessageBox.Show("Fixed Stored Procedures", "Status", MessageBoxButtons.OK, MessageBoxIcon.Information);
|
|
|
|
@@ -975,7 +982,7 @@ namespace DataLoader
|
|
|
|
|
{
|
|
|
|
|
btnConvertSelected_Click(this, new EventArgs());
|
|
|
|
|
}
|
|
|
|
|
#endregion
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
private void approvalDatabasesToolStripMenuItem_Click(object sender, EventArgs e)
|
|
|
|
|
{
|
|
|
|
@@ -1021,14 +1028,14 @@ namespace DataLoader
|
|
|
|
|
bad++;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
AddInfo("\r\nFixing databases complete. {0} Fixed, {1} Failures",good,bad);
|
|
|
|
|
AddInfo("\r\nFixing databases complete. {0} Fixed, {1} Failures", good, bad);
|
|
|
|
|
Status = String.Format("Fixing databases complete. {0} Fixed, {1} Failures", good, bad);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
public class MessageBuilder
|
|
|
|
|
{
|
|
|
|
|
private StringBuilder _MyStringBulider=new StringBuilder();
|
|
|
|
|
private StringBuilder _MyStringBulider = new StringBuilder();
|
|
|
|
|
private DateTime _LastTime = DateTime.Now;
|
|
|
|
|
public DateTime LastTime
|
|
|
|
|
{
|
|
|
|
@@ -1039,9 +1046,9 @@ namespace DataLoader
|
|
|
|
|
{
|
|
|
|
|
_MyStringBulider.Append(heading);
|
|
|
|
|
}
|
|
|
|
|
public void Append(string format, params object [] args)
|
|
|
|
|
public void Append(string format, params object[] args)
|
|
|
|
|
{
|
|
|
|
|
string msg = string.Format(format,args);
|
|
|
|
|
string msg = string.Format(format, args);
|
|
|
|
|
DateTime now = DateTime.Now;
|
|
|
|
|
TimeSpan ts = TimeSpan.FromTicks(now.Ticks - _LastTime.Ticks);
|
|
|
|
|
string timestamp = string.Format("{0:D2}:{1:D2}:{2:D2}.{3:D3}", ts.Hours, ts.Minutes, ts.Seconds, ts.Milliseconds);
|
|
|
|
|