This commit is contained in:
parent
aeb64e2479
commit
99b6a97fd3
@ -39,40 +39,81 @@ namespace DataLoader
|
||||
// Get DataPath
|
||||
string sDP = cfg.ReadString("menu", "DataPath");
|
||||
// Split DataPath into directories
|
||||
|
||||
// Get the current list of folders so that if it already exists, just get the 'Folder', otherwise
|
||||
// make it. It was done this way because there was no way to get the Folder given a name/Title.
|
||||
FolderInfoList fil = FolderInfoList.Get();
|
||||
|
||||
foreach (string s1 in sDP.Split(";".ToCharArray()))
|
||||
{
|
||||
if (s1.Length > 0)
|
||||
{
|
||||
string[] s2 = s1.Split(",".ToCharArray());
|
||||
Folder fld = Folder.MakeFolder(sysFolder, dbConn, s2[1], s2[0], FolderName(s2[0]), null, null, DateTime.Now, "Migration");
|
||||
Folder fld = GetFolderFromName(s2[1], s2[0], fil);
|
||||
if (fld == null)
|
||||
fld = Folder.MakeFolder(sysFolder, dbConn, s2[1], s2[0], FolderName(s2[0]), null, null, DateTime.Now, "Migration");
|
||||
dpf.Add(fld);
|
||||
}
|
||||
}
|
||||
return dpf;
|
||||
}
|
||||
private Folder GetFolderFromName(string name, string title, FolderInfoList fil)
|
||||
{
|
||||
Folder fld = null;
|
||||
foreach (FolderInfo fi in fil)
|
||||
{
|
||||
if (fi.Name.ToUpper() == name.ToUpper() && fi.Title.ToUpper() == title.ToUpper())
|
||||
{
|
||||
fld = Folder.Get(fi.FolderID);
|
||||
return fld;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
private string FolderName(string Path)
|
||||
{
|
||||
int ind = Path.LastIndexOf("\\");
|
||||
if (ind == Path.Length-1 || ind < 0) return Path;
|
||||
return Path.Substring(ind + 1);
|
||||
}
|
||||
private DocVersion GetDocVersionFromName(Folder fld, string f)
|
||||
{
|
||||
DocVersion dv = null;
|
||||
DocVersionInfoList dvil = DocVersionInfoList.GetByFolderID(fld.FolderID);
|
||||
foreach (DocVersionInfo dvi in dvil)
|
||||
{
|
||||
if (dvi.Name.ToUpper() == f.ToUpper())
|
||||
{
|
||||
dv = DocVersion.Get(dvi.VersionID);
|
||||
return dv;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
private object cslaObject(vlnObject vb, Connection dbConn, Object parfld, TreeNode tn)
|
||||
{
|
||||
switch (vb.Type)
|
||||
{
|
||||
case "plant":
|
||||
case "set":
|
||||
Folder fld = Folder.MakeFolder((Folder)parfld, dbConn, vb.Title, vb.Path, FolderName(vb.Path), null, null, DateTime.Now, "Migration");
|
||||
// if folder exists... get the Folder object, otherwise create it.
|
||||
FolderInfoList fil = FolderInfoList.Get();
|
||||
Folder fld = GetFolderFromName(vb.Title, vb.Path, fil);
|
||||
if (fld==null) fld = Folder.MakeFolder((Folder)parfld, dbConn, vb.Title, vb.Path, FolderName(vb.Path), null, null, DateTime.Now, "Migration");
|
||||
tn.Tag = fld;
|
||||
return (object) fld;
|
||||
case "version":
|
||||
// see if version exists for the input folder, parfld.
|
||||
DocVersion v = GetDocVersionFromName((Folder)parfld, vb.Title);
|
||||
if (v == null)
|
||||
{
|
||||
ConfigFile cfg = new ConfigFile();
|
||||
|
||||
XmlDocument d = cfg.IniToXml(vb.Path + "\\proc.ini");
|
||||
//DocVersionConfig fld_cfg = new DocVersionConfig(d == null ? "" : d.InnerXml);
|
||||
FolderConfig fld_cfg = (d==null)?null:new FolderConfig(d.InnerXml);
|
||||
FolderConfig fld_cfg = (d == null) ? null : new FolderConfig(d.InnerXml);
|
||||
// translate curset.dat into xml & add to d (somehow).
|
||||
string csfile = string.Format("{0}\\curset.dat",vb.Path);
|
||||
string csfile = string.Format("{0}\\curset.dat", vb.Path);
|
||||
string defPlantFmt = null;
|
||||
if (File.Exists(csfile))
|
||||
{
|
||||
@ -108,9 +149,10 @@ namespace DataLoader
|
||||
}
|
||||
else
|
||||
format = FormatInfo.Get(1);
|
||||
DocVersion v;
|
||||
using(Format fmt = format.Get())
|
||||
|
||||
using (Format fmt = format.Get())
|
||||
v = DocVersion.MakeDocVersion(tmpfld, (int)DocVersionType(vb.Path.ToLower()), vb.Title, vb.Path.ToLower(), null, fmt, fld_cfg == null ? null : fld_cfg.ToString(), DateTime.Now, "Migration");
|
||||
}
|
||||
tn.Tag = v;
|
||||
MigrateDocVersion(v, false);
|
||||
return (object)v;
|
||||
@ -152,7 +194,6 @@ namespace DataLoader
|
||||
{
|
||||
if (vb.Type != "version")
|
||||
{
|
||||
//if(frmMain.MySettings.OnlyThisSet)
|
||||
vb.LoadChildren(vs.GetChildren(vb.ToString()));
|
||||
List<vlnObject> lv = vb.Children;
|
||||
foreach (vlnObject vbc in lv)
|
||||
|
@ -106,6 +106,7 @@ namespace DataLoader
|
||||
frmMain.Status = "Load All Formats";
|
||||
//LoadAllFormats();
|
||||
//Format.UpdateFormats(_FmtAllPath, _GenmacAllPath);
|
||||
|
||||
Format.UpdateFormats(frmMain.MySettings.FormatFolder, frmMain.MySettings.GenMacFolder);
|
||||
|
||||
//Format baseFormat = Format.Get(1);
|
||||
@ -139,6 +140,43 @@ namespace DataLoader
|
||||
}
|
||||
return true;
|
||||
}
|
||||
public bool LoadFoldersIntoExisting(string s)
|
||||
{
|
||||
try
|
||||
{
|
||||
frmMain.Status = "Getting Connection";
|
||||
// get the connection and annotations from the existing database.
|
||||
dbConn = Connection.GetByName("Default");
|
||||
//dbConn = Connection.MakeConnection("Default", "Default", frmMain.MySettings.ConnectionString.Replace("{DBName}",frmMain.MySettings.DBName), 1, null, DateTime.Now, "Migration");
|
||||
|
||||
frmMain.Status = "Getting AnnotationTypes";
|
||||
CommentType = AnnotationType.GetByName("Comment"); // .MakeAnnotationType("Comment", null);
|
||||
MigrationErrorType = AnnotationType.GetByName("Migration Error");
|
||||
VerificationRequiredType = AnnotationType.GetByName("Verification Required");
|
||||
|
||||
List<Folder> lfldr = vlnDataPathFolders(); // get plant level list.
|
||||
|
||||
List<vlnObject> dp2 = new List<vlnObject>();
|
||||
foreach (Folder fldr in lfldr)
|
||||
{
|
||||
TreeNode tn = frmMain.TV.Nodes.Add(fldr.Name);
|
||||
tn.Tag = fldr;
|
||||
vlnObject vb = new vlnObject(null, "datapath", fldr.Name, fldr.Title);
|
||||
dp2.Add(vb);
|
||||
vlnServer vs = new vlnServer();
|
||||
frmMain.Status = "Loading " + fldr.Name;
|
||||
MigrateChildren(vb, vs, dbConn, fldr, tn);
|
||||
tn.Expand();
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
log.ErrorFormat("Could not load data, error = {0}", ex.Message);
|
||||
//return false;
|
||||
throw new Exception("Error in LoadFolders", ex);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
public void ClearData()
|
||||
{
|
||||
Database.PurgeData();
|
||||
|
@ -176,14 +176,8 @@ namespace DataLoader
|
||||
//Console.WriteLine("number {0}", number);
|
||||
//Console.WriteLine("Item Key {0} List {1}", Item.CacheCountPrimaryKey, Item.CacheCountList);
|
||||
//Console.WriteLine("ItemInfo Key {0} List {1}", ItemInfo.CacheCountPrimaryKey, ItemInfo.CacheCountList);
|
||||
if (!convertProcedures || (docver.VersionType != (int)VEPROMS.CSLA.Library.VersionTypeEnum.WorkingDraft && docver.VersionType != (int)VEPROMS.CSLA.Library.VersionTypeEnum.Approved))
|
||||
{
|
||||
cont = Content.New(number, TextConvert.ConvertText(dr["Title"].ToString(), do_cvt), 0, null, ci == null ? null : ci.ToString(), dts, userid);
|
||||
itm = Item.MakeItem(FromItem, cont, dts, userid);
|
||||
}
|
||||
else
|
||||
{
|
||||
DocVersionInfo dvi = DocVersionInfo.Get(docver.VersionID);
|
||||
dvi.ResetProcedures(); // need this to clear out Procedures so that they are retrieved (resolves a caching problem)
|
||||
foreach (ItemInfo ii in dvi.Procedures)
|
||||
{
|
||||
if (ii.MyContent.Number == number)
|
||||
@ -191,8 +185,17 @@ namespace DataLoader
|
||||
//Console.WriteLine(number);
|
||||
itm = ii.Get();
|
||||
cont = ii.MyContent.Get();
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (!convertProcedures || (docver.VersionType != (int)VEPROMS.CSLA.Library.VersionTypeEnum.WorkingDraft && docver.VersionType != (int)VEPROMS.CSLA.Library.VersionTypeEnum.Approved))
|
||||
{
|
||||
// if this procedure already exists for this docversion, just use it.
|
||||
if (itm == null && cont == null)
|
||||
{
|
||||
cont = Content.New(number, TextConvert.ConvertText(dr["Title"].ToString(), do_cvt), 0, null, ci == null ? null : ci.ToString(), dts, userid);
|
||||
itm = Item.MakeItem(FromItem, cont, dts, userid);
|
||||
}
|
||||
}
|
||||
if (convertProcedures /* && number == "001\\u8209?007"/* && number == "0POP05-EO-EC00"*/)
|
||||
{
|
||||
@ -359,7 +362,6 @@ namespace DataLoader
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
private Item MigrateProcedures(OleDbConnection cn, string pth, DocVersion docver, bool convertProcedures, FormatInfo activeFormat)
|
||||
{
|
||||
|
||||
@ -403,6 +405,7 @@ namespace DataLoader
|
||||
}
|
||||
//GC.Collect();
|
||||
}
|
||||
ds.Dispose();
|
||||
da.Dispose();
|
||||
}
|
||||
catch (Exception ex)
|
||||
|
@ -108,6 +108,7 @@ namespace DataLoader
|
||||
MigrateRoFstGraphics(roDbpath, rofstinfo.ROFSTLookup.myHdr.myDbs[i].children, rodb);
|
||||
}
|
||||
}
|
||||
ROImageInfo.FlagImagesZipped();
|
||||
}
|
||||
|
||||
private string NewROName(string roName)
|
||||
@ -180,7 +181,9 @@ namespace DataLoader
|
||||
byte[] ab = r.ReadBytes((int)fsIn.Length);
|
||||
r.Close();
|
||||
fsIn.Close();
|
||||
roImg = ROImage.MakeROImage(rodb, imgname, ab, null, fi.LastWriteTimeUtc, "Migration");
|
||||
ConfigInfo ci = new ConfigInfo(null);
|
||||
ci.AddItem("Image", "Size", ab.Length.ToString());
|
||||
roImg = ROImage.MakeROImage(rodb, imgname, ROImageInfo.Compress(ab), ci.ToString(), fi.LastWriteTimeUtc, "Migration");
|
||||
}
|
||||
}
|
||||
AddToAvailable(roImg, rodb.RODbID, imgname, fi.LastWriteTimeUtc);
|
||||
|
@ -96,7 +96,8 @@ namespace DataLoader
|
||||
{
|
||||
MyFrmErrors.Add(value, MessageType.Error);
|
||||
_MyLog.ErrorFormat(value);
|
||||
tsslError.Text = string.Format("{0} Errors", MyFrmErrors.ErrorCount); }
|
||||
tsslError.Text = string.Format("{0} Errors", MyFrmErrors.ErrorCount);
|
||||
}
|
||||
}
|
||||
public string MyWarning
|
||||
{
|
||||
@ -132,13 +133,13 @@ namespace DataLoader
|
||||
}
|
||||
public void AddError(Exception ex, string format, params object[] objs)
|
||||
{
|
||||
StringBuilder sb = new StringBuilder( string.Format(format, 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("\r\n" + "".PadRight((++indent) * 2, ' ') + string.Format("{0} - {1}", ex.GetType().Name, ex.Message));
|
||||
sb.Append(ex.StackTrace);
|
||||
ex=ex.InnerException;
|
||||
ex = ex.InnerException;
|
||||
}
|
||||
MyError = sb.ToString();
|
||||
}
|
||||
@ -210,7 +211,7 @@ namespace DataLoader
|
||||
{
|
||||
case "Volian.CSLA.Library.FolderInfo":
|
||||
FolderInfo fld = (FolderInfo)o;
|
||||
if (fld.ChildFolderCount>0)
|
||||
if (fld.ChildFolderCount > 0)
|
||||
tn.Checked = ldr.LoadChildren(fld, tn); // load docversions.
|
||||
break;
|
||||
default:
|
||||
@ -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,19 +362,18 @@ 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.Run();
|
||||
@ -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);
|
||||
@ -523,8 +530,8 @@ namespace DataLoader
|
||||
{
|
||||
get
|
||||
{
|
||||
if(_MySettings==null)
|
||||
_MySettings=new DataLoaderSettings();
|
||||
if (_MySettings == null)
|
||||
_MySettings = new DataLoaderSettings();
|
||||
return _MySettings;
|
||||
}
|
||||
set { _MySettings = value; }
|
||||
@ -556,7 +563,7 @@ namespace DataLoader
|
||||
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.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;
|
||||
@ -575,7 +582,7 @@ namespace DataLoader
|
||||
}
|
||||
private void OpenSettings()
|
||||
{
|
||||
DataLoaderSettings tmpDLS = (DataLoaderSettings) MySettings.Clone();
|
||||
DataLoaderSettings tmpDLS = (DataLoaderSettings)MySettings.Clone();
|
||||
frmPG myPG = new frmPG("Data Loader Settings", tmpDLS);
|
||||
if (myPG.ShowDialog() == DialogResult.OK)
|
||||
{
|
||||
@ -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();
|
||||
@ -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";
|
||||
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";
|
||||
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";
|
||||
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";
|
||||
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";
|
||||
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";
|
||||
@ -930,7 +937,7 @@ namespace DataLoader
|
||||
{
|
||||
Status = "Backing up Data";
|
||||
Backup("_Fixed");
|
||||
MyInfo="Backup Complete";
|
||||
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);
|
||||
|
Loading…
x
Reference in New Issue
Block a user