SourceCode/PROMS/DataLoader/frmLoader.cs
Rich 3e135d8deb Specified a different location for the Log File.
Changed code to use log Info
Changed code to append error messages rather than replace text
Added/Changed code to use Log4Net.
Changed logic for Updates to Use IDs rather than Objects for internal Updates
Added a FormatColumn token to handle DTS, Added comments to describe tokens
Added methods ParentRefU and ParentRefU2 to support otther changes
2010-12-09 22:27:22 +00:00

659 lines
23 KiB
C#

// ========================================================================
// Copyright 2006 - Volian Enterprises, Inc. All rights reserved.
// Volian Enterprises - Proprietary Information - DO NOT COPY OR DISTRIBUTE
// ------------------------------------------------------------------------
// $Workfile: $ $Revision: $
// $Author: $ $Date: $
//
// $History: $
// ========================================================================
using System;
using System.Drawing;
using System.Collections;
using System.Configuration;
using System.ComponentModel;
using System.Windows.Forms;
using System.Data;
using System.Data.OleDb;
using System.Collections.Specialized;
using System.Collections.Generic;
using System.Xml;
using System.IO;
using System.Text;
using Volian.MSWord;
using vlnObjectLibrary;
using vlnServerLibrary;
using VEPROMS.CSLA.Library;
using Config;
using Volian.Controls.Library;
using Volian.Base.Library;
[assembly: log4net.Config.XmlConfigurator(Watch = true)]
namespace DataLoader
{
public partial class frmLoader : Form
{
#region Log4Net
private static readonly log4net.ILog log = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
#endregion
private bool _Loading = true;
private FolderTreeNode _topnode;
private bool UseVeTree = false;
#region Log4Net
public static readonly log4net.ILog _MyLog = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
//public static readonly log4net.ILog log = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
#endregion
private Loader ldr;
public bool cbSaveDocChecked { get { return cbSaveDoc.Checked; } }
public bool cbSaveRTFChecked { get { return cbSaveRTF.Checked; } }
public TreeView TV { get { return tv; } }
public int pbProcMaximum { get { return pbProc.Maximum; } set { pbProc.Maximum = value; } }
public int pbSectMaximum { get { return pbSect.Maximum; } set { pbSect.Maximum = value; } }
public int pbSectValue { get { return pbSect.Value; } set { pbSect.Value = value; } }
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 string Status
{
get { return toolStripStatusLabel1.Text; }
set
{
toolStripStatusLabel1.Text = value;
Application.DoEvents();
}
}
private frmErrors _MyFrmErrors = null;
public frmErrors MyFrmErrors
{
get
{
if (_MyFrmErrors == null)
{
_MyFrmErrors = new frmErrors(this);
_MyFrmErrors.FormClosing += new FormClosingEventHandler(_MyFrmErrors_FormClosing);
}
return _MyFrmErrors;
}
}
void _MyFrmErrors_FormClosing(object sender, FormClosingEventArgs e)
{
_MyFrmErrors = null;
}
public string MyError
{
get { return tsslError.Text; }
set
{
MyFrmErrors.Add(value);
log.ErrorFormat(value);
tsslError.Text = string.Format("{0} Errors", MyFrmErrors.MyErrors.Count); }
}
public string MyWarning
{
get { return tsslError.Text; }
set
{
MyFrmErrors.Add(value);
log.WarnFormat(value);
tsslError.Text = string.Format("{0} Errors", MyFrmErrors.MyErrors.Count);
}
}
public string MyInfo
{
get { return tsslError.Text; }
set
{
MyFrmErrors.Add(value);
log.InfoFormat(value);
tsslError.Text = string.Format("{0} Errors", MyFrmErrors.MyErrors.Count);
}
}
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();
}
public string tbSourceText { get { return tbSource.Text; } set { tbSource.Text = value; } }
public frmLoader()
{
ldr = new Loader(_MyLog, this);
InitializeComponent();
MSWordToPDF.FormForPlotGraphics = this;
lblTime.Tag = DateTime.Now;
switch (SystemInformation.ComputerName.ToUpper())
{
case "KATHYXP":
//tbSource.Text = "G:\\VEIP2\\PROCS"; // basic data
//tbSource.Text = "G:\\VEFNP\\AOP1.PRC"; // test subsections, checkoffs, comments & continuous action flag
//tbSource.Text = "G:\\vecal\\eops.bck"; // test link seq STP_LNK_SEQ
tbSource.Text = "G:\\vehlp\\procs";// G:\\vewcnckl\\ckl.prc - multiple change ids.
break;
case "KATHY-VISTA":
tbSource.Text = @"c:\16bit\debug\vehlp\procs";// G:\\vewcnckl\\ckl.prc - multiple change ids.
break;
case "RHMDESKTOP":
//tbSource.Text = @"I:\UNZIPPED ACTIVE BASELINE DATA\vehlp\Procs"; // Sub-sections
tbSource.Text = @"I:\veDATA\vehlp\Procs"; // Sub-sections
break;
case "RMARK-PC":
//tbSource.Text = @"I:\UNZIPPED ACTIVE BASELINE DATA\vehlp\Procs"; // Sub-sections
tbSource.Text = @"C:\VE_PROMS Data\Plant\HLP\vehlp\Procs"; // Sub-sections
break;
case "JOHN":
tbSource.Text = @"G:\PROMSDAT\vehlp\procs";// South Texas EOPS
//tbSource.Text = @"G:\PromsDat\VEHP1B\SAMGS.PRC";// South Texas STPNOC
break;
case "JOHN-VISTA":
tbSource.Text = @"C:\16bit\PROMSDAT\vehlp\procs";// South Texas EOPS
//tbSource.Text = @"G:\PromsDat\VEHP1B\SAMGS.PRC";// South Texas STPNOC
break;
default:
break;
}
if (!VlnSettings.DebugMode)
tbSource.Text = "";
// if in debug mode, pdf output is red (checkbox1 is what controls this).
checkBox1.Checked = VlnSettings.DebugMode;
if (checkBox1.Checked)
Loader.OverrideColor = Color.Red;
else
Loader.OverrideColor = Color.Empty;
}
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 (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;
}
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;
}
}
private void tv_AfterSelect(object sender, TreeViewEventArgs e)
{
if (UseVeTree) return;
TreeNode tn = e.Node;
object o = tn.Tag;
tn.Expand();
if (o.GetType() == typeof(DocVersion)) tbSource.Text = ((DocVersion)o).Title;
}
private void btnLoadTreeDB_Click(object sender, EventArgs e)
{
// When loading folders, i.e. the tree from dBase (old 16-bit)
// always clear the data
ldr.ClearData();
bool suc = ldr.LoadFolders(tbVePromsPath.Text);
}
private void btnConvert_Click(object sender, System.EventArgs e)
{
if (!CheckLogPath()) return;
//#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
try
{
//TextConvert.ResetSpecialCharacters();
System.Diagnostics.Process[] wordProcesses = WordDoc.WordProcesses;
MyFrmErrors.Clear();
if (wordProcesses.Length > 0)
{
AddError("{0} copies of MS Word are running", wordProcesses.Length);
if (MessageBox.Show("MS Word is Running and must be stopped before proceeding.\n\nStop MS Word?", "MS Word is Running", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
{
WordDoc.TerminateProcesses(wordProcesses);
MyFrmErrors.Clear();
}
else
return;
}
Database.LoggingInfo = false;
bool success = true;
// if purge data, purge it all & reload folders & security.
if (cbPurgeData.Checked)
{
Status = "Purging Data";
ldr.ClearData();
Status = "Loading Folders";
success = ldr.LoadFolders(tbVePromsPath.Text);
if (success)
{
Status = "Loading Security";
success = ldr.LoadSecurity(tbVesamPath.Text, tbVePromsPath.Text);
}
if (cbFormatsOnly.Checked)
{
MessageBox.Show("Formats Loaded");
return;
}
}
if (success)
{
bool allSets = !_DeveloperMode || !cbxOnlyThisSet.Checked;
TimeSpan ts = new TimeSpan();
DocVersionInfoList vl = DocVersionInfoList.Get();
DocVersion v = null;
MyInfo = "Computer Name: " + SystemInformation.ComputerName.ToUpper();
foreach (DocVersionInfo vi in vl)
{
//if (!_DeveloperMode || (cbxOnlyThisSet.Checked && vi.Title.ToUpper() == tbSource.Text.ToUpper())) // is this the procedure set we want to convert?
if (allSets || (cbxOnlyThisSet.Checked && vi.Title.ToUpper() == tbSource.Text.ToUpper())) // is this the procedure set we want to convert?
{
v = DocVersion.Get(vi.VersionID);
Status = "Load " + v.Title + " - " + v.Name;
lblCurSetFolder.Text = v.Title;
lblCurSetFolder.Visible = true;
lblProcessing.Visible = true;
MyInfo = "Data Set: " + v.Title;
ts += ldr.MigrateDocVersion(v, true);
}
//v = DocVersion.Get(vi.VersionID);
//bool convertProcedures = (vi.Title.ToUpper() == tbSource.Text.ToUpper());
//Item itm = ldr.MigrateDocVersion(v, convertProcedures);
}
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();
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();
}
}
catch (Exception ex)
{
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 UpdateLabels(int incPrc, int incSec, int incStp)
{
if (incPrc == 0 && incSec == 0 && incStp == 0)//Reset
{
lblTime.Tag = DateTime.Now;
pbProc.Value = 0;
pbSect.Value = 0;
pbStep.Value = 0;
}
else
{
try
{
pbProc.Value += incPrc;
pbSect.Value += incSec;
pbStep.Value += incStp;
}
catch (Exception ex)
{
_MyLog.ErrorFormat("{0}\r\n\r\n{1}", ex.Message, ex.InnerException);
AddError(ex, "UpdateLabels");
}
}
//Database.LoggingInfo = (pbProc.Value > 153 && pbSect.Value > 11 && pbStep.Value > 61);
lblProc.Text = string.Format("{0} Procedures", pbProc.Value);
lblSection.Text = string.Format("{0} Sections", pbSect.Value);
lblStep.Text = string.Format("{0} Steps", pbStep.Value);
//pbProc.Value = iPrc;
//pbSect.Value = iSec;
//pbStep.Value = iStp;
TimeSpan ts = new TimeSpan(DateTime.Now.Ticks - ((DateTime)lblTime.Tag).Ticks);
lblTime.Text = string.Format("{0:D2}:{1:D2}:{2:D2} Elapsed", ts.Hours, ts.Minutes, ts.Seconds);
Application.DoEvents();
}
private void btnBrowse_Click(object sender, EventArgs e)
{
fbd.SelectedPath = tbSource.Text;
if (fbd.ShowDialog() == DialogResult.OK)
tbSource.Text = fbd.SelectedPath;
}
private void cbSaveRTF_Click(object sender, EventArgs e)
{
if (cbSaveRTF.Checked) cbSaveDoc.Checked = false;
}
private void cbSaveDoc_Click(object sender, EventArgs e)
{
if (cbSaveDoc.Checked) cbSaveRTF.Checked = false;
}
private void btnLoadTreeCSLA_Click(object sender, EventArgs e)
{
_topnode = FolderTreeNode.BuildTreeList();
tv.Nodes.Add(_topnode);
tv.Nodes[0].Expand();
UseVeTree = false;
}
private void btnBrowseVesam_Click(object sender, EventArgs e)
{
fbd.SelectedPath = tbVesamPath.Text;
if (fbd.ShowDialog() == DialogResult.OK)
tbVesamPath.Text = fbd.SelectedPath;
}
private void btnVesam_Click(object sender, EventArgs e)
{
// if purge data, purge it all & reload folders.
if (cbPurgeData.Checked)
{
ldr.ClearData();
ldr.LoadFolders(tbVePromsPath.Text);
}
bool sec = ldr.LoadSecurity(tbVesamPath.Text, tbVePromsPath.Text);
}
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 btnCtTok_Click(object sender, EventArgs e)
{
frmCntTkn frm = new frmCntTkn();
frm.ShowDialog();
}
public void UpdateLabelsSetProc(int prc)
{
pbProc.Maximum = prc;
}
public void UpdateLabelsSetSect(int sec)
{
pbSect.Maximum = sec;
}
public void UpdateLabelsLibDocs(int incLib, int incUsages)
{
if (incLib == 0 && incUsages == 0)//Reset
{
lblTime.Tag = DateTime.Now;
pbProc.Value = 0;
pbSect.Value = 0;
}
else
{
pbProc.Value += incLib;
pbSect.Value += incUsages;
}
lblProc.Text = string.Format("{0} Lib Docs", pbProc.Value);
lblSection.Text = string.Format("{0} Usages", pbSect.Value);
lblStep.Text = "";
TimeSpan ts = new TimeSpan(DateTime.Now.Ticks - ((DateTime)lblTime.Tag).Ticks);
lblTime.Text = string.Format("{0:D2}:{1:D2}:{2:D2} Elapsed", ts.Hours, ts.Minutes, ts.Seconds);
Application.DoEvents();
}
private void frmLoader_Load(object sender, EventArgs e)
{
if (Properties.Settings.Default["VeSamFilename"].ToString() != "")
this.tbVesamPath.Text = Properties.Settings.Default.VeSamFilename;
if (Properties.Settings.Default["DbfPathname"].ToString() != "")
this.tbSource.Text = Properties.Settings.Default.DbfPathname;
if (Properties.Settings.Default["LoadWordDoc"].ToString() != "")
this.cbSaveDoc.CheckState = Properties.Settings.Default.LoadWordDoc;
if (Properties.Settings.Default["PurgeData"].ToString() != "")
this.cbPurgeData.CheckState = Properties.Settings.Default.PurgeData;
if (Properties.Settings.Default["LoadRTFDoc"].ToString() != "")
this.cbSaveRTF.CheckState = Properties.Settings.Default.LoadRTFDoc;
if (Properties.Settings.Default["VePromsFilename"] != null)
this.tbVePromsPath.Text = Properties.Settings.Default.VePromsFilename;
if (Properties.Settings.Default["LogFileLoc"].ToString() != "")
this.txbLogFileLoc.Text = Properties.Settings.Default.LogFileLoc;
if (Properties.Settings.Default["BackupFileName"].ToString() != "")
this.tbxBackupFileName.Text = Properties.Settings.Default.BackupFileName;
_Loading = false;
MSWordToPDF.CloseWordWhenDone = false;
}
private void frmLoader_FormClosing(object sender, FormClosingEventArgs e)
{
Properties.Settings.Default.VeSamFilename = tbVesamPath.Text;
Properties.Settings.Default.DbfPathname = tbSource.Text;
Properties.Settings.Default.LoadWordDoc = cbSaveDoc.CheckState;
Properties.Settings.Default.LoadRTFDoc = cbSaveRTF.CheckState;
Properties.Settings.Default.PurgeData = cbPurgeData.CheckState;
Properties.Settings.Default.VePromsFilename = tbVePromsPath.Text;
Properties.Settings.Default.LogFileLoc = txbLogFileLoc.Text;
Properties.Settings.Default.BackupFileName = tbxBackupFileName.Text;
Properties.Settings.Default.Save();
}
private void btnBrowseVeProms_Click(object sender, EventArgs e)
{
fbd.SelectedPath = tbVePromsPath.Text;
if (fbd.ShowDialog() == DialogResult.OK)
tbVePromsPath.Text = fbd.SelectedPath;
}
private void tbVePromsPath_TextChanged(object sender, EventArgs e)
{
tbVesamPath.Text = tbVePromsPath.Text + @"\vesam.opt";
}
private void btnFixTransitions_Click(object sender, EventArgs e)
{
if (!CheckLogPath()) return;
StepRTB rtb = new StepRTB();
TransitionFixer myFixer = new TransitionFixer(rtb,_LogFilePath);
myFixer.StatusChanged += new TransitionFixerEvent(myFixer_StatusChanged);
TimeSpan howlong = myFixer.Process(cbCheckRTF.Checked);
string TransFixTime = string.Format("Fix Transitions completion time: {0:D2}:{1:D2}:{2:D2}.{3}", howlong.Hours, howlong.Minutes, howlong.Seconds, howlong.Milliseconds);
MyInfo = TransFixTime;
MessageBox.Show(string.Format("{0}\r\n\n({1} Total Seconds)", TransFixTime, howlong.TotalSeconds));
//MessageBox.Show(string.Format("Fix Transitions completion time: {0:D2}:{1:D2}:{2:D2}.{3}\r\n\n({4} Total Seconds)", howlong.Hours, howlong.Minutes, howlong.Seconds, howlong.Milliseconds, howlong.TotalSeconds));
CreateBackupRestoreBatchFiles();
}
void myFixer_StatusChanged(object sender, TransitionFixerEventArgs args)
{
Status = args.MyStatus;
}
private bool _DeveloperMode = false;
private void ToggleDeveloperMode()
{
DialogResult dr = MessageBox.Show((_DeveloperMode)?"Make the User Interface Less Confusing?":"Make the User Interface More Confusing?", "DataLoader UI", MessageBoxButtons.YesNo,MessageBoxIcon.Question);
if (dr == DialogResult.Yes)
{
_DeveloperMode = !_DeveloperMode;
btnLoadTreeDB.Visible = _DeveloperMode;
btnLoadTreeCSLA.Visible = _DeveloperMode;
btnVETree_CSLA.Visible = _DeveloperMode;
btnGroup.Visible = _DeveloperMode;
btnCtTok.Visible = _DeveloperMode;
btnVesam.Visible = _DeveloperMode;
tbVesamPath.Visible = _DeveloperMode;
btnBrowseVesam.Visible = _DeveloperMode;
tbSource.Visible = _DeveloperMode;
btnBrowse.Visible = _DeveloperMode;
cbSaveDoc.Visible = _DeveloperMode;
cbSaveRTF.Visible = _DeveloperMode;
cbPurgeData.Visible = _DeveloperMode;
cbLazy.Visible = _DeveloperMode;
cbFormatsOnly.Visible = _DeveloperMode;
btnConvertSelected.Visible = _DeveloperMode;
cbxOnlyThisSet.Visible = _DeveloperMode;
cbCheckRTF.Visible = _DeveloperMode;
}
}
private void sc_Panel1_DoubleClick(object sender, EventArgs e)
{
ToggleDeveloperMode();
}
private void LogLoc_Click(object sender, EventArgs e)
{
fbd.SelectedPath = txbLogFileLoc.Text;
if (fbd.ShowDialog() == DialogResult.OK)
txbLogFileLoc.Text = fbd.SelectedPath;
}
private bool _DidLogPathCheck = false;
private string _LogFilePath = "";
private bool CheckLogPath()
{
bool rtn = false;
if (_DidLogPathCheck) return true;
try
{
_LogFilePath = txbLogFileLoc.Text;
if (!Directory.Exists(_LogFilePath))
Directory.CreateDirectory(_LogFilePath);
if (_LogFilePath.EndsWith(@"\")) _LogFilePath = _LogFilePath.Substring(0, _LogFilePath.Length - 1);
rtn = true;
_DidLogPathCheck = true;
}
catch (Exception ex)
{
MessageBox.Show(ex.Message, "Invalid Path for Log Files", MessageBoxButtons.OK, MessageBoxIcon.Error);
}
return rtn;
}
private void SaveLogFiles()
{
if (_LogFilePath == "") return;
// Save the Glitches log
if (TextConvert.MyGlitches.Glitches.Count > 0)
TextConvert.MyGlitches.Save(_LogFilePath + @"\ConversionGlitches.xml");
// Save the Error Log
if (_MyFrmErrors.ItemCount() > 0)
_MyFrmErrors.Save(_LogFilePath + @"\ConversionErrors.txt");
}
private bool _EnteredFileLoc = false;
private void txbLogFileLoc_TextChanged(object sender, EventArgs e)
{
_DidLogPathCheck = false;
}
private void CreateBackupRestoreBatchFiles()
{
string pause = "pause";
string bckupFileName = tbxBackupFileName.Text;
if (!bckupFileName.EndsWith(".bak")) bckupFileName += ".bak";
string backupPath = _LogFilePath + @"\" + bckupFileName;
string bckupcmd = "sqlcmd -E -S.\\sqlexpress -Q \"backup database [VEPROMS] to disk = '" + backupPath + "'\"";
string rstorecmd = "sqlcmd -E -S.\\sqlexpress -Q \"restore database [VEPROMS] from disk = '" + backupPath + "'\"";
StreamWriter fsbackup = new StreamWriter(_LogFilePath + @"\BackupVEPROMS.bat");
fsbackup.WriteLine(bckupcmd);
fsbackup.WriteLine(pause);
fsbackup.Close();
StreamWriter fsrestore = new StreamWriter(_LogFilePath + @"\RestoreVEPROMS.bat");
fsrestore.WriteLine(rstorecmd);
fsrestore.WriteLine(pause);
fsrestore.Close();
}
private void checkBox1_CheckedChanged(object sender, EventArgs e)
{
VlnSettings.DebugMode = checkBox1.Checked;
if (checkBox1.Checked)
Loader.OverrideColor = Color.Red;
else
Loader.OverrideColor = Color.Empty;
}
}
}