Adding Using statement, The Backup and Restore BAT files are now build with the database name you specified in the settings
This commit is contained in:
parent
21a5b9a05d
commit
671c3aa137
@ -108,8 +108,12 @@ namespace DataLoader
|
|||||||
//Format.UpdateFormats(_FmtAllPath, _GenmacAllPath);
|
//Format.UpdateFormats(_FmtAllPath, _GenmacAllPath);
|
||||||
Format.UpdateFormats(frmMain.MySettings.FormatFolder, frmMain.MySettings.GenMacFolder);
|
Format.UpdateFormats(frmMain.MySettings.FormatFolder, frmMain.MySettings.GenMacFolder);
|
||||||
|
|
||||||
Format baseFormat = Format.Get(1);
|
//Format baseFormat = Format.Get(1);
|
||||||
sysFolder = Folder.MakeFolder(null, dbConn, "VEPROMS", "VEPROMS", "VEPROMS", baseFormat, d.InnerXml, DateTime.Now, "Migration");
|
//sysFolder = Folder.MakeFolder(null, dbConn, "VEPROMS", "VEPROMS", "VEPROMS", baseFormat, d.InnerXml, DateTime.Now, "Migration");
|
||||||
|
using (Format baseFormat = Format.Get(1))
|
||||||
|
{
|
||||||
|
sysFolder = Folder.MakeFolder(null, dbConn, "VEPROMS", "VEPROMS", "VEPROMS", baseFormat, d.InnerXml, DateTime.Now, "Migration");
|
||||||
|
}
|
||||||
|
|
||||||
// This is to test the vln Libraries
|
// This is to test the vln Libraries
|
||||||
List<Folder> lfldr = vlnDataPathFolders();
|
List<Folder> lfldr = vlnDataPathFolders();
|
||||||
|
@ -276,8 +276,8 @@ namespace DataLoader
|
|||||||
try
|
try
|
||||||
{
|
{
|
||||||
//TextConvert.ResetSpecialCharacters();
|
//TextConvert.ResetSpecialCharacters();
|
||||||
System.Diagnostics.Process[] wordProcesses = WordDoc.WordProcesses;
|
|
||||||
//MyFrmErrors.Clear();
|
//MyFrmErrors.Clear();
|
||||||
|
System.Diagnostics.Process[] wordProcesses = WordDoc.WordProcesses;
|
||||||
if (!FormatsOnly && wordProcesses.Length > 0)
|
if (!FormatsOnly && wordProcesses.Length > 0)
|
||||||
{
|
{
|
||||||
AddError("{0} copies of MS Word are running", wordProcesses.Length);
|
AddError("{0} copies of MS Word are running", wordProcesses.Length);
|
||||||
@ -322,19 +322,22 @@ namespace DataLoader
|
|||||||
{
|
{
|
||||||
TimeSpan ts = new TimeSpan();
|
TimeSpan ts = new TimeSpan();
|
||||||
DocVersionInfoList vl = DocVersionInfoList.Get();
|
DocVersionInfoList vl = DocVersionInfoList.Get();
|
||||||
DocVersion v = null;
|
//DocVersion v = null;
|
||||||
MyInfo = "Computer Name: " + SystemInformation.ComputerName.ToUpper();
|
MyInfo = "Computer Name: " + SystemInformation.ComputerName.ToUpper();
|
||||||
foreach (DocVersionInfo vi in vl)
|
foreach (DocVersionInfo vi in vl)
|
||||||
{
|
{
|
||||||
if (!MySettings.OnlyThisSet || (vi.Title.ToUpper() == MySettings.ProcedureSetPath.ToUpper())) // is this the procedure set we want to convert?
|
if (!MySettings.OnlyThisSet || (vi.Title.ToUpper() == MySettings.ProcedureSetPath.ToUpper())) // is this the procedure set we want to convert?
|
||||||
{
|
{
|
||||||
v = DocVersion.Get(vi.VersionID);
|
using (DocVersion v = DocVersion.Get(vi.VersionID))
|
||||||
Status = "Load " + v.Title + " - " + v.Name;
|
{
|
||||||
lblCurSetFolder.Text = v.Title;
|
//v = DocVersion.Get(vi.VersionID);
|
||||||
lblCurSetFolder.Visible = true;
|
Status = "Load " + v.Title + " - " + v.Name;
|
||||||
lblProcessing.Visible = true;
|
lblCurSetFolder.Text = v.Title;
|
||||||
MyInfo = "Data Set: " + v.Title;
|
lblCurSetFolder.Visible = true;
|
||||||
ts += ldr.MigrateDocVersion(v, true);
|
lblProcessing.Visible = true;
|
||||||
|
MyInfo = "Data Set: " + v.Title;
|
||||||
|
ts += ldr.MigrateDocVersion(v, true);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
string ConversionTime = string.Format("Conversion completion time: {0:D2}:{1:D2}:{2:D2}.{3}", ts.Hours, ts.Minutes, ts.Seconds, ts.Milliseconds);
|
string ConversionTime = string.Format("Conversion completion time: {0:D2}:{1:D2}:{2:D2}.{3}", ts.Hours, ts.Minutes, ts.Seconds, ts.Milliseconds);
|
||||||
@ -362,9 +365,9 @@ namespace DataLoader
|
|||||||
script=script.Replace("{DBName}", MySettings.DBName);
|
script=script.Replace("{DBName}", MySettings.DBName);
|
||||||
script=script.Replace("{DBPath}", MySettings.DBPath);
|
script=script.Replace("{DBPath}", MySettings.DBPath);
|
||||||
SQLScriptRunner ssr = new SQLScriptRunner(script, MySettings.ConnectionString.Replace("{DBName}", dbName));
|
SQLScriptRunner ssr = new SQLScriptRunner(script, MySettings.ConnectionString.Replace("{DBName}", dbName));
|
||||||
ssr.InfoMessage += new SQLScriptRunnerEvent(ssr_InfoMessage);
|
ssr.InfoMessage += new SQLScriptRunnerEvent(ssr_InfoMessage);
|
||||||
ssr.Run();
|
ssr.Run();
|
||||||
Status = String.Format("Script '{0}' Complete", scriptName);
|
Status = String.Format("Script '{0}' Complete", scriptName);
|
||||||
}
|
}
|
||||||
private void Backup(string suffix)
|
private void Backup(string suffix)
|
||||||
{
|
{
|
||||||
@ -652,15 +655,13 @@ namespace DataLoader
|
|||||||
string pause = "pause";
|
string pause = "pause";
|
||||||
string bckupFileName = MySettings.BackupFileName;
|
string bckupFileName = MySettings.BackupFileName;
|
||||||
if (!bckupFileName.EndsWith(".bak")) bckupFileName += ".bak";
|
if (!bckupFileName.EndsWith(".bak")) bckupFileName += ".bak";
|
||||||
string backupPath = MySettings.LogFilePath + @"\" + bckupFileName;
|
string backupPath = MySettings.LogFilePath + @"\" + bckupFileName + "'\"";
|
||||||
string bckupcmd = "sqlcmd -E -S.\\sqlexpress -Q \"backup database [VEPROMS] to disk = '" + backupPath + "'\"";
|
string bckupcmd = string.Format("sqlcmd -E -S.\\sqlexpress -Q \"backup database [{0}] to disk = '{1}",MySettings.DBName,backupPath);
|
||||||
string rstorecmd = "sqlcmd -E -S.\\sqlexpress -Q \"restore database [VEPROMS] from disk = '" + backupPath + "'\"";
|
string rstorecmd = string.Format("sqlcmd -E -S.\\sqlexpress -Q \"restore database [{0}] from disk = '{1}",MySettings.DBName,backupPath);
|
||||||
//StreamWriter fsbackup = new StreamWriter(_LogFilePath + @"\BackupVEPROMS.bat");
|
|
||||||
StreamWriter fsbackup = new StreamWriter(MySettings.LogFilePath + @"\Backup" + bckupFileName.Substring(0,bckupFileName.Length-4) + ".bat");
|
StreamWriter fsbackup = new StreamWriter(MySettings.LogFilePath + @"\Backup" + bckupFileName.Substring(0,bckupFileName.Length-4) + ".bat");
|
||||||
fsbackup.WriteLine(bckupcmd);
|
fsbackup.WriteLine(bckupcmd);
|
||||||
fsbackup.WriteLine(pause);
|
fsbackup.WriteLine(pause);
|
||||||
fsbackup.Close();
|
fsbackup.Close();
|
||||||
//StreamWriter fsrestore = new StreamWriter(_LogFilePath + @"\RestoreVEPROMS.bat");
|
|
||||||
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(rstorecmd);
|
||||||
fsrestore.WriteLine(pause);
|
fsrestore.WriteLine(pause);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user