This commit is contained in:
parent
aeb64e2479
commit
99b6a97fd3
@ -39,78 +39,120 @@ namespace DataLoader
|
|||||||
// Get DataPath
|
// Get DataPath
|
||||||
string sDP = cfg.ReadString("menu", "DataPath");
|
string sDP = cfg.ReadString("menu", "DataPath");
|
||||||
// Split DataPath into directories
|
// 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()))
|
foreach (string s1 in sDP.Split(";".ToCharArray()))
|
||||||
{
|
{
|
||||||
if (s1.Length > 0)
|
if (s1.Length > 0)
|
||||||
{
|
{
|
||||||
string[] s2 = s1.Split(",".ToCharArray());
|
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);
|
dpf.Add(fld);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return dpf;
|
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)
|
private string FolderName(string Path)
|
||||||
{
|
{
|
||||||
int ind = Path.LastIndexOf("\\");
|
int ind = Path.LastIndexOf("\\");
|
||||||
if (ind == Path.Length-1 || ind < 0) return Path;
|
if (ind == Path.Length-1 || ind < 0) return Path;
|
||||||
return Path.Substring(ind + 1);
|
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)
|
private object cslaObject(vlnObject vb, Connection dbConn, Object parfld, TreeNode tn)
|
||||||
{
|
{
|
||||||
switch (vb.Type)
|
switch (vb.Type)
|
||||||
{
|
{
|
||||||
case "plant":
|
case "plant":
|
||||||
case "set":
|
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;
|
tn.Tag = fld;
|
||||||
return (object) fld;
|
return (object) fld;
|
||||||
case "version":
|
case "version":
|
||||||
ConfigFile cfg = new ConfigFile();
|
// see if version exists for the input folder, parfld.
|
||||||
|
DocVersion v = GetDocVersionFromName((Folder)parfld, vb.Title);
|
||||||
XmlDocument d = cfg.IniToXml(vb.Path + "\\proc.ini");
|
if (v == null)
|
||||||
//DocVersionConfig fld_cfg = new DocVersionConfig(d == null ? "" : 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 defPlantFmt = null;
|
|
||||||
if (File.Exists(csfile))
|
|
||||||
{
|
|
||||||
CurSet cs = new CurSet(csfile);
|
|
||||||
try
|
|
||||||
{
|
|
||||||
if (fld_cfg == null) fld_cfg = new FolderConfig();
|
|
||||||
fld_cfg = cs.Convert(fld_cfg);
|
|
||||||
defPlantFmt = cs.GetDefFmt();
|
|
||||||
}
|
|
||||||
catch (Exception ex)
|
|
||||||
{
|
|
||||||
log.ErrorFormat("error in convert curset.dat, ex = {0}", ex.Message);
|
|
||||||
frmMain.AddError(ex, "error in convert curset.dat");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
// *** RHM 20120613 - Fix
|
|
||||||
// *** This was naming the DocVersion to the folder name
|
|
||||||
//string titlepath = vb.Path + "\\" + "Title";
|
|
||||||
//FileInfo fi = new FileInfo(titlepath);
|
|
||||||
//string thetitle = vb.Title;
|
|
||||||
//if (File.Exists(titlepath))
|
|
||||||
//{
|
|
||||||
// StreamReader myReader = new StreamReader(titlepath);
|
|
||||||
// thetitle = myReader.ReadLine();
|
|
||||||
// myReader.Close();
|
|
||||||
//}
|
|
||||||
Folder tmpfld = (Folder)parfld;
|
|
||||||
FormatInfo format = null;
|
|
||||||
if (defPlantFmt != null && defPlantFmt != "")
|
|
||||||
{
|
{
|
||||||
format = GetFormat(defPlantFmt);
|
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);
|
||||||
|
// translate curset.dat into xml & add to d (somehow).
|
||||||
|
string csfile = string.Format("{0}\\curset.dat", vb.Path);
|
||||||
|
string defPlantFmt = null;
|
||||||
|
if (File.Exists(csfile))
|
||||||
|
{
|
||||||
|
CurSet cs = new CurSet(csfile);
|
||||||
|
try
|
||||||
|
{
|
||||||
|
if (fld_cfg == null) fld_cfg = new FolderConfig();
|
||||||
|
fld_cfg = cs.Convert(fld_cfg);
|
||||||
|
defPlantFmt = cs.GetDefFmt();
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
log.ErrorFormat("error in convert curset.dat, ex = {0}", ex.Message);
|
||||||
|
frmMain.AddError(ex, "error in convert curset.dat");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// *** RHM 20120613 - Fix
|
||||||
|
// *** This was naming the DocVersion to the folder name
|
||||||
|
//string titlepath = vb.Path + "\\" + "Title";
|
||||||
|
//FileInfo fi = new FileInfo(titlepath);
|
||||||
|
//string thetitle = vb.Title;
|
||||||
|
//if (File.Exists(titlepath))
|
||||||
|
//{
|
||||||
|
// StreamReader myReader = new StreamReader(titlepath);
|
||||||
|
// thetitle = myReader.ReadLine();
|
||||||
|
// myReader.Close();
|
||||||
|
//}
|
||||||
|
Folder tmpfld = (Folder)parfld;
|
||||||
|
FormatInfo format = null;
|
||||||
|
if (defPlantFmt != null && defPlantFmt != "")
|
||||||
|
{
|
||||||
|
format = GetFormat(defPlantFmt);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
format = FormatInfo.Get(1);
|
||||||
|
|
||||||
|
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");
|
||||||
}
|
}
|
||||||
else
|
|
||||||
format = FormatInfo.Get(1);
|
|
||||||
DocVersion v;
|
|
||||||
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;
|
tn.Tag = v;
|
||||||
MigrateDocVersion(v, false);
|
MigrateDocVersion(v, false);
|
||||||
return (object)v;
|
return (object)v;
|
||||||
@ -152,18 +194,17 @@ namespace DataLoader
|
|||||||
{
|
{
|
||||||
if (vb.Type != "version")
|
if (vb.Type != "version")
|
||||||
{
|
{
|
||||||
//if(frmMain.MySettings.OnlyThisSet)
|
vb.LoadChildren(vs.GetChildren(vb.ToString()));
|
||||||
vb.LoadChildren(vs.GetChildren(vb.ToString()));
|
|
||||||
List<vlnObject> lv = vb.Children;
|
List<vlnObject> lv = vb.Children;
|
||||||
foreach (vlnObject vbc in lv)
|
foreach (vlnObject vbc in lv)
|
||||||
{
|
{
|
||||||
if (vbc.Path.ToUpper().StartsWith(OnlyThisFolder) || OnlyThisFolder.StartsWith(vbc.Path.ToUpper()))
|
if (vbc.Path.ToUpper().StartsWith(OnlyThisFolder) || OnlyThisFolder.StartsWith(vbc.Path.ToUpper()))
|
||||||
{
|
{
|
||||||
TreeNode tnc = tn.Nodes.Add(vbc.Title);
|
TreeNode tnc = tn.Nodes.Add(vbc.Title);
|
||||||
object idc = cslaObject(vbc, dbConn, parent, tnc);
|
object idc = cslaObject(vbc, dbConn, parent, tnc);
|
||||||
frmMain.Status = "Loading " + vbc.Title;
|
frmMain.Status = "Loading " + vbc.Title;
|
||||||
MigrateChildren(vbc, vs, dbConn, idc, tnc);
|
MigrateChildren(vbc, vs, dbConn, idc, tnc);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
frmMain.Status = " ";
|
frmMain.Status = " ";
|
||||||
|
@ -106,6 +106,7 @@ namespace DataLoader
|
|||||||
frmMain.Status = "Load All Formats";
|
frmMain.Status = "Load All Formats";
|
||||||
//LoadAllFormats();
|
//LoadAllFormats();
|
||||||
//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);
|
||||||
@ -139,6 +140,43 @@ namespace DataLoader
|
|||||||
}
|
}
|
||||||
return true;
|
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()
|
public void ClearData()
|
||||||
{
|
{
|
||||||
Database.PurgeData();
|
Database.PurgeData();
|
||||||
|
@ -176,22 +176,25 @@ namespace DataLoader
|
|||||||
//Console.WriteLine("number {0}", number);
|
//Console.WriteLine("number {0}", number);
|
||||||
//Console.WriteLine("Item Key {0} List {1}", Item.CacheCountPrimaryKey, Item.CacheCountList);
|
//Console.WriteLine("Item Key {0} List {1}", Item.CacheCountPrimaryKey, Item.CacheCountList);
|
||||||
//Console.WriteLine("ItemInfo Key {0} List {1}", ItemInfo.CacheCountPrimaryKey, ItemInfo.CacheCountList);
|
//Console.WriteLine("ItemInfo Key {0} List {1}", ItemInfo.CacheCountPrimaryKey, ItemInfo.CacheCountList);
|
||||||
|
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)
|
||||||
|
{
|
||||||
|
//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 (!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);
|
// if this procedure already exists for this docversion, just use it.
|
||||||
itm = Item.MakeItem(FromItem, cont, dts, userid);
|
if (itm == null && cont == null)
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
DocVersionInfo dvi = DocVersionInfo.Get(docver.VersionID);
|
|
||||||
foreach (ItemInfo ii in dvi.Procedures)
|
|
||||||
{
|
{
|
||||||
if (ii.MyContent.Number == number)
|
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);
|
||||||
//Console.WriteLine(number);
|
|
||||||
itm = ii.Get();
|
|
||||||
cont = ii.MyContent.Get();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (convertProcedures /* && number == "001\\u8209?007"/* && number == "0POP05-EO-EC00"*/)
|
if (convertProcedures /* && number == "001\\u8209?007"/* && number == "0POP05-EO-EC00"*/)
|
||||||
@ -359,7 +362,6 @@ namespace DataLoader
|
|||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
private Item MigrateProcedures(OleDbConnection cn, string pth, DocVersion docver, bool convertProcedures, FormatInfo activeFormat)
|
private Item MigrateProcedures(OleDbConnection cn, string pth, DocVersion docver, bool convertProcedures, FormatInfo activeFormat)
|
||||||
{
|
{
|
||||||
|
|
||||||
@ -403,6 +405,7 @@ namespace DataLoader
|
|||||||
}
|
}
|
||||||
//GC.Collect();
|
//GC.Collect();
|
||||||
}
|
}
|
||||||
|
ds.Dispose();
|
||||||
da.Dispose();
|
da.Dispose();
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
|
@ -108,6 +108,7 @@ namespace DataLoader
|
|||||||
MigrateRoFstGraphics(roDbpath, rofstinfo.ROFSTLookup.myHdr.myDbs[i].children, rodb);
|
MigrateRoFstGraphics(roDbpath, rofstinfo.ROFSTLookup.myHdr.myDbs[i].children, rodb);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
ROImageInfo.FlagImagesZipped();
|
||||||
}
|
}
|
||||||
|
|
||||||
private string NewROName(string roName)
|
private string NewROName(string roName)
|
||||||
@ -180,7 +181,9 @@ namespace DataLoader
|
|||||||
byte[] ab = r.ReadBytes((int)fsIn.Length);
|
byte[] ab = r.ReadBytes((int)fsIn.Length);
|
||||||
r.Close();
|
r.Close();
|
||||||
fsIn.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);
|
AddToAvailable(roImg, rodb.RODbID, imgname, fi.LastWriteTimeUtc);
|
||||||
|
@ -34,20 +34,20 @@ using System.Data.SqlClient;
|
|||||||
|
|
||||||
namespace DataLoader
|
namespace DataLoader
|
||||||
{
|
{
|
||||||
public partial class frmLoader : Form
|
public partial class frmLoader : Form
|
||||||
{
|
{
|
||||||
#region Log4Net
|
#region Log4Net
|
||||||
public static readonly log4net.ILog _MyLog = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
|
public static readonly log4net.ILog _MyLog = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
|
||||||
#endregion
|
#endregion
|
||||||
#region settings
|
#region settings
|
||||||
private bool _FormatsOnly = false;
|
private bool _FormatsOnly = false;
|
||||||
public bool FormatsOnly
|
public bool FormatsOnly
|
||||||
{
|
{
|
||||||
get { return _FormatsOnly; }
|
get { return _FormatsOnly; }
|
||||||
set { _FormatsOnly = value; }
|
set { _FormatsOnly = value; }
|
||||||
}
|
}
|
||||||
#endregion
|
#endregion
|
||||||
private bool _Loading = true;
|
private bool _Loading = true;
|
||||||
|
|
||||||
private FolderTreeNode _topnode;
|
private FolderTreeNode _topnode;
|
||||||
private bool UseVeTree = false;
|
private bool UseVeTree = false;
|
||||||
@ -59,10 +59,10 @@ namespace DataLoader
|
|||||||
public int pbStepMaximum { get { return pbStep.Maximum; } set { pbStep.Maximum = 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 pbStepValue { get { return pbStep.Value; } set { pbStep.Value = value; } }
|
||||||
public int pbProcValue { get { return pbProc.Value; } set { pbProc.Value = value; } }
|
public int pbProcValue { get { return pbProc.Value; } set { pbProc.Value = value; } }
|
||||||
public int SkipProcedures
|
public int SkipProcedures
|
||||||
{
|
{
|
||||||
get { return MySettings.Skip; }
|
get { return MySettings.Skip; }
|
||||||
}
|
}
|
||||||
public string Status
|
public string Status
|
||||||
{
|
{
|
||||||
get { return toolStripStatusLabel1.Text; }
|
get { return toolStripStatusLabel1.Text; }
|
||||||
@ -85,63 +85,64 @@ namespace DataLoader
|
|||||||
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; }
|
MyFrmErrors.Add(value, MessageType.Warning);
|
||||||
set
|
_MyLog.WarnFormat(value);
|
||||||
{
|
//tsslError.Text = string.Format("{0} Errors", MyFrmErrors.ErrorCount);
|
||||||
MyFrmErrors.Add(value, MessageType.Error);
|
|
||||||
_MyLog.ErrorFormat(value);
|
|
||||||
tsslError.Text = string.Format("{0} Errors", MyFrmErrors.ErrorCount); }
|
|
||||||
}
|
}
|
||||||
public string MyWarning
|
}
|
||||||
|
public string MyInfo
|
||||||
|
{
|
||||||
|
get { return tsslError.Text; }
|
||||||
|
set
|
||||||
{
|
{
|
||||||
get { return tsslError.Text; }
|
MyFrmErrors.Add(value, MessageType.Information);
|
||||||
set
|
_MyLog.Info(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 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; }
|
sb.Append("\r\n" + "".PadRight((++indent) * 2, ' ') + string.Format("{0} - {1}", ex.GetType().Name, ex.Message));
|
||||||
set
|
sb.Append(ex.StackTrace);
|
||||||
{
|
ex = ex.InnerException;
|
||||||
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();
|
|
||||||
}
|
}
|
||||||
|
MyError = sb.ToString();
|
||||||
|
}
|
||||||
|
|
||||||
public frmLoader()
|
public frmLoader()
|
||||||
{
|
{
|
||||||
@ -152,74 +153,74 @@ namespace DataLoader
|
|||||||
}
|
}
|
||||||
private void btnConvertSelected_Click(object sender, EventArgs e)
|
private void btnConvertSelected_Click(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
if (UseVeTree)
|
if (UseVeTree)
|
||||||
{
|
{
|
||||||
VETreeNode tn = (VETreeNode)tv.SelectedNode;
|
VETreeNode tn = (VETreeNode)tv.SelectedNode;
|
||||||
if (tn == null)
|
if (tn == null)
|
||||||
{
|
{
|
||||||
MessageBox.Show("Must select a version node (working draft, approved, etc)", "No Node Selected");
|
MessageBox.Show("Must select a version node (working draft, approved, etc)", "No Node Selected");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
object o = tn.VEObject;
|
object o = tn.VEObject;
|
||||||
if (o.GetType() != typeof(DocVersionInfo))
|
if (o.GetType() != typeof(DocVersionInfo))
|
||||||
{
|
{
|
||||||
MessageBox.Show("Must select a version node (working draft, approved, etc)", "No Node Selected");
|
MessageBox.Show("Must select a version node (working draft, approved, etc)", "No Node Selected");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
DocVersion v = ((DocVersionInfo)o).Get();
|
DocVersion v = ((DocVersionInfo)o).Get();
|
||||||
ldr.MigrateDocVersion(v);
|
ldr.MigrateDocVersion(v);
|
||||||
if (v.MyItem != null)
|
if (v.MyItem != null)
|
||||||
{
|
{
|
||||||
tn.Checked = true;
|
tn.Checked = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
TreeNode tn = tv.SelectedNode;
|
TreeNode tn = tv.SelectedNode;
|
||||||
if (tn == null)
|
if (tn == null)
|
||||||
{
|
{
|
||||||
MessageBox.Show("Must select a version node (working draft, approved, etc)", "No Node Selected");
|
MessageBox.Show("Must select a version node (working draft, approved, etc)", "No Node Selected");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
object o = tn.Tag;
|
object o = tn.Tag;
|
||||||
if (o.GetType() != typeof(DocVersion))
|
if (o.GetType() != typeof(DocVersion))
|
||||||
{
|
{
|
||||||
MessageBox.Show("Must select a version node (working draft, approved, etc)", "No Node Selected");
|
MessageBox.Show("Must select a version node (working draft, approved, etc)", "No Node Selected");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
DocVersion v = (DocVersion)o;
|
DocVersion v = (DocVersion)o;
|
||||||
ldr.MigrateDocVersion(v);
|
ldr.MigrateDocVersion(v);
|
||||||
if (v.MyItem != null)
|
if (v.MyItem != null)
|
||||||
{
|
{
|
||||||
tn.Checked = true;
|
tn.Checked = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
private void tv_BeforeExpand(object sender, TreeViewCancelEventArgs e)
|
private void tv_BeforeExpand(object sender, TreeViewCancelEventArgs e)
|
||||||
{
|
{
|
||||||
if (UseVeTree)
|
if (UseVeTree)
|
||||||
{
|
{
|
||||||
((VETreeNode)e.Node).LoadChildren();
|
((VETreeNode)e.Node).LoadChildren();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
TreeNode tn = e.Node;
|
TreeNode tn = e.Node;
|
||||||
object o = tn.Tag;
|
object o = tn.Tag;
|
||||||
switch (o.GetType().ToString())
|
switch (o.GetType().ToString())
|
||||||
{
|
{
|
||||||
case "Volian.CSLA.Library.FolderInfo":
|
case "Volian.CSLA.Library.FolderInfo":
|
||||||
FolderInfo fld = (FolderInfo)o;
|
FolderInfo fld = (FolderInfo)o;
|
||||||
if (fld.ChildFolderCount>0)
|
if (fld.ChildFolderCount > 0)
|
||||||
tn.Checked = ldr.LoadChildren(fld, tn); // load docversions.
|
tn.Checked = ldr.LoadChildren(fld, tn); // load docversions.
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
private void tv_AfterSelect(object sender, TreeViewEventArgs e)
|
private void tv_AfterSelect(object sender, TreeViewEventArgs e)
|
||||||
{
|
{
|
||||||
if (UseVeTree) return;
|
if (UseVeTree) return;
|
||||||
|
|
||||||
TreeNode tn = e.Node;
|
TreeNode tn = e.Node;
|
||||||
object o = tn.Tag;
|
object o = tn.Tag;
|
||||||
@ -229,9 +230,9 @@ namespace DataLoader
|
|||||||
private void btnLoadTreeDB_Click(object sender, EventArgs e)
|
private void btnLoadTreeDB_Click(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
// When loading folders, i.e. the tree from dBase (old 16-bit)
|
// When loading folders, i.e. the tree from dBase (old 16-bit)
|
||||||
// always clear the data
|
// always clear the data
|
||||||
ldr.ClearData();
|
ldr.ClearData();
|
||||||
bool suc = ldr.LoadFolders(MySettings.VEPromsPath);
|
bool suc = ldr.LoadFolders(MySettings.VEPromsPath);
|
||||||
}
|
}
|
||||||
private string GetScript(string scriptName)
|
private string GetScript(string scriptName)
|
||||||
{
|
{
|
||||||
@ -269,13 +270,13 @@ namespace DataLoader
|
|||||||
Loader.OverrideColor = Color.Empty;
|
Loader.OverrideColor = Color.Empty;
|
||||||
}
|
}
|
||||||
//if (!CheckLogPath()) return;
|
//if (!CheckLogPath()) return;
|
||||||
//#if (!DEBUG)
|
//#if (!DEBUG)
|
||||||
if (!VlnSettings.DebugMode)
|
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);
|
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;
|
if (dlgrst == DialogResult.No) return;
|
||||||
}
|
}
|
||||||
//#endif
|
//#endif
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
//TextConvert.ResetSpecialCharacters();
|
//TextConvert.ResetSpecialCharacters();
|
||||||
@ -306,11 +307,12 @@ namespace DataLoader
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
// Create Database
|
// Create Database
|
||||||
RunScript("BuildVEPROMS.Sql", "Master");
|
|
||||||
RunScript("PROMS2010.SQL", MySettings.DBName);
|
|
||||||
// if purge data, purge it all & reload folders & security.
|
// if purge data, purge it all & reload folders & security.
|
||||||
if (MySettings.PurgeExistingData)
|
if (MySettings.PurgeExistingData)
|
||||||
{
|
{
|
||||||
|
RunScript("BuildVEPROMS.Sql", "Master");
|
||||||
|
RunScript("PROMS2010.SQL", MySettings.DBName);
|
||||||
Status = "Purging Data";
|
Status = "Purging Data";
|
||||||
ldr.ClearData();
|
ldr.ClearData();
|
||||||
Status = "Loading Folders";
|
Status = "Loading Folders";
|
||||||
@ -321,6 +323,12 @@ namespace DataLoader
|
|||||||
success = ldr.LoadSecurity(MySettings.VESamFile, MySettings.VEPromsPath);
|
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)
|
if (success)
|
||||||
{
|
{
|
||||||
TimeSpan ts = new TimeSpan();
|
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);
|
string ConversionTime = string.Format("Conversion completion time: {0:D2}:{1:D2}:{2:D2}.{3}", ts.Hours, ts.Minutes, ts.Seconds, ts.Milliseconds);
|
||||||
MyInfo = ConversionTime;
|
MyInfo = ConversionTime;
|
||||||
SaveLogFiles();
|
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("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));
|
//MessageBox.Show(string.Format("{0} seconds", ts.TotalSeconds));
|
||||||
//TextConvert.ListSpecialCharacters();
|
//TextConvert.ListSpecialCharacters();
|
||||||
@ -354,23 +362,22 @@ namespace DataLoader
|
|||||||
}
|
}
|
||||||
catch (Exception ex)
|
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();
|
SaveLogFiles();
|
||||||
MessageBox.Show(ex.Message, "Fatal Error During Loading", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
MessageBox.Show(ex.Message, "Fatal Error During Loading", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||||
_MyLog.Fatal(ex.Message);
|
_MyLog.Fatal(ex.Message);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void RunScript(string scriptName, string dbName)
|
public void RunScript(string scriptName, string dbName)
|
||||||
{
|
{
|
||||||
Status = String.Format("Running Script '{0}'", scriptName);
|
Status = String.Format("Running Script '{0}'", scriptName);
|
||||||
string script = GetScript(scriptName);
|
string script = GetScript(scriptName);
|
||||||
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)
|
||||||
{
|
{
|
||||||
@ -430,41 +437,41 @@ namespace DataLoader
|
|||||||
lblTime.Text = string.Format("{0:D2}:{1:D2}:{2:D2} Elapsed", ts.Hours, ts.Minutes, ts.Seconds);
|
lblTime.Text = string.Format("{0:D2}:{1:D2}:{2:D2} Elapsed", ts.Hours, ts.Minutes, ts.Seconds);
|
||||||
Application.DoEvents();
|
Application.DoEvents();
|
||||||
}
|
}
|
||||||
private void btnLoadTreeCSLA_Click(object sender, EventArgs e)
|
private void btnLoadTreeCSLA_Click(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
_topnode = FolderTreeNode.BuildTreeList();
|
_topnode = FolderTreeNode.BuildTreeList();
|
||||||
tv.Nodes.Add(_topnode);
|
tv.Nodes.Add(_topnode);
|
||||||
tv.Nodes[0].Expand();
|
tv.Nodes[0].Expand();
|
||||||
UseVeTree = false;
|
UseVeTree = false;
|
||||||
}
|
}
|
||||||
private void btnVesam_Click(object sender, EventArgs e)
|
private void btnVesam_Click(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
// if purge data, purge it all & reload folders.
|
// if purge data, purge it all & reload folders.
|
||||||
if (MySettings.PurgeExistingData)
|
if (MySettings.PurgeExistingData)
|
||||||
{
|
{
|
||||||
ldr.ClearData();
|
ldr.ClearData();
|
||||||
ldr.LoadFolders(MySettings.VEPromsPath);
|
ldr.LoadFolders(MySettings.VEPromsPath);
|
||||||
}
|
}
|
||||||
bool sec = ldr.LoadSecurity(MySettings.VESamFile, MySettings.VEPromsPath);
|
bool sec = ldr.LoadSecurity(MySettings.VESamFile, MySettings.VEPromsPath);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void btnVETree_CSLA_Click(object sender, EventArgs e)
|
private void btnVETree_CSLA_Click(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
tv.Nodes.Add(VETreeNode.GetFolder(1));
|
tv.Nodes.Add(VETreeNode.GetFolder(1));
|
||||||
UseVeTree = true;
|
UseVeTree = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void btnGroup_Click(object sender, EventArgs e)
|
private void btnGroup_Click(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
GroupProp f = new GroupProp();
|
GroupProp f = new GroupProp();
|
||||||
f.ShowDialog();
|
f.ShowDialog();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void btnCtTok_Click(object sender, EventArgs e)
|
private void btnCtTok_Click(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
frmCntTkn frm = new frmCntTkn();
|
frmCntTkn frm = new frmCntTkn();
|
||||||
frm.ShowDialog();
|
frm.ShowDialog();
|
||||||
}
|
}
|
||||||
public void UpdateLabelsSetProc(int prc)
|
public void UpdateLabelsSetProc(int prc)
|
||||||
{
|
{
|
||||||
pbProc.Maximum = prc;
|
pbProc.Maximum = prc;
|
||||||
@ -485,8 +492,8 @@ namespace DataLoader
|
|||||||
pbProc.Value += incLib;
|
pbProc.Value += incLib;
|
||||||
pbSect.Value += incUsages;
|
pbSect.Value += incUsages;
|
||||||
}
|
}
|
||||||
lblProc.Text = string.Format("{0}/{1} Lib Docs", pbProc.Value,pbProc.Maximum);
|
lblProc.Text = string.Format("{0}/{1} Lib Docs", pbProc.Value, pbProc.Maximum);
|
||||||
lblSection.Text = string.Format("{0}/{1} Usages", pbSect.Value,pbSect.Maximum);
|
lblSection.Text = string.Format("{0}/{1} Usages", pbSect.Value, pbSect.Maximum);
|
||||||
lblStep.Text = "";
|
lblStep.Text = "";
|
||||||
TimeSpan ts = new TimeSpan(DateTime.Now.Ticks - ProcessTime.Ticks);
|
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);
|
lblTime.Text = string.Format("{0:D2}:{1:D2}:{2:D2} Elapsed", ts.Hours, ts.Minutes, ts.Seconds);
|
||||||
@ -523,106 +530,106 @@ namespace DataLoader
|
|||||||
{
|
{
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
if(_MySettings==null)
|
if (_MySettings == null)
|
||||||
_MySettings=new DataLoaderSettings();
|
_MySettings = new DataLoaderSettings();
|
||||||
return _MySettings;
|
return _MySettings;
|
||||||
}
|
}
|
||||||
set { _MySettings = value; }
|
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");
|
MessageBox.Show(validity, "Settings Incorrect", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
|
||||||
if (Properties.Settings.Default["VePromsFilename"].ToString() != "")
|
OpenSettings();
|
||||||
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();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
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();
|
MySettings = tmpDLS;
|
||||||
frmPG myPG = new frmPG("Data Loader Settings", tmpDLS);
|
SaveSettings();
|
||||||
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;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
private void SaveSettings()
|
string validity = MySettings.ValidityCheck;
|
||||||
|
if (validity != "")
|
||||||
{
|
{
|
||||||
Properties.Settings.Default.DbfPathname = MySettings.ProcedureSetPath;
|
processToolStripMenuItem.Enabled = false;
|
||||||
Properties.Settings.Default.VePromsFilename = MySettings.VEPromsPath;
|
oldToolStripMenuItem.Enabled = false;
|
||||||
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();
|
|
||||||
}
|
}
|
||||||
|
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)
|
private void frmLoader_Load(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
LoadSettings();
|
LoadSettings();
|
||||||
@ -719,13 +726,13 @@ namespace DataLoader
|
|||||||
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 = string.Format("sqlcmd -E -S.\\sqlexpress -Q \"backup database [{0}] to disk = '{1}",MySettings.DBName,backupPath);
|
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);
|
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");
|
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(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);
|
||||||
fsrestore.Close();
|
fsrestore.Close();
|
||||||
@ -793,7 +800,7 @@ namespace DataLoader
|
|||||||
Status = "Backing up Phase 3 Data";
|
Status = "Backing up Phase 3 Data";
|
||||||
Backup("_" + MySettings.Phase3Suffix);
|
Backup("_" + MySettings.Phase3Suffix);
|
||||||
mb.Append("Phase 3 Backup Complete");
|
mb.Append("Phase 3 Backup Complete");
|
||||||
//Phase 4 - Convert to Approval Version
|
//Phase 4 - Convert to Approval Version
|
||||||
ConvertToApproval();
|
ConvertToApproval();
|
||||||
FixProceduresAndFunctions();
|
FixProceduresAndFunctions();
|
||||||
mb.Append("Conversion to Approval Complete");
|
mb.Append("Conversion to Approval Complete");
|
||||||
@ -832,12 +839,12 @@ namespace DataLoader
|
|||||||
FormatsOnly = true;
|
FormatsOnly = true;
|
||||||
btnConvert_Click(this, new System.EventArgs());
|
btnConvert_Click(this, new System.EventArgs());
|
||||||
if (ProcessFailed) return;
|
if (ProcessFailed) return;
|
||||||
MyInfo="Format Load Complete";
|
MyInfo = "Format Load Complete";
|
||||||
if (MessageBox.Show("Backup Database?", "Backup", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
|
if (MessageBox.Show("Backup Database?", "Backup", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
|
||||||
{
|
{
|
||||||
Status = "Backing up Format Change Data";
|
Status = "Backing up Format Change Data";
|
||||||
Backup("_" + "FormatChange");
|
Backup("_" + "FormatChange");
|
||||||
MyInfo="Format Change Backup Complete";
|
MyInfo = "Format Change Backup Complete";
|
||||||
}
|
}
|
||||||
//Status = "Format Change Complete";
|
//Status = "Format Change Complete";
|
||||||
//MessageBox.Show("Format Change Complete", "Status", MessageBoxButtons.OK, MessageBoxIcon.Information);
|
//MessageBox.Show("Format Change Complete", "Status", MessageBoxButtons.OK, MessageBoxIcon.Information);
|
||||||
@ -847,12 +854,12 @@ namespace DataLoader
|
|||||||
ProcessTime = DateTime.Now;
|
ProcessTime = DateTime.Now;
|
||||||
btnConvert_Click(this, new System.EventArgs());
|
btnConvert_Click(this, new System.EventArgs());
|
||||||
if (ProcessFailed) return;
|
if (ProcessFailed) return;
|
||||||
MyInfo="dBase Conversion Complete";
|
MyInfo = "dBase Conversion Complete";
|
||||||
if (MessageBox.Show("Backup Database?", "Backup", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
|
if (MessageBox.Show("Backup Database?", "Backup", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
|
||||||
{
|
{
|
||||||
Status = "Backing up Phase 1 Data";
|
Status = "Backing up Phase 1 Data";
|
||||||
Backup("_" + MySettings.Phase1Suffix);
|
Backup("_" + MySettings.Phase1Suffix);
|
||||||
MyInfo="Phase 1 Backup Complete";
|
MyInfo = "Phase 1 Backup Complete";
|
||||||
}
|
}
|
||||||
//Status = "dBase Conversion Complete";
|
//Status = "dBase Conversion Complete";
|
||||||
//MessageBox.Show("dBase Conversion Complete", "Status", MessageBoxButtons.OK, MessageBoxIcon.Information);
|
//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);
|
Database.VEPROMS_Connection = MySettings.ConnectionString.Replace("{DBName}", MySettings.DBName);
|
||||||
ProcessTime = DateTime.Now;
|
ProcessTime = DateTime.Now;
|
||||||
btnFixTransitions_Click(this, new System.EventArgs());
|
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)
|
if (MessageBox.Show("Backup Database?", "Backup", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
|
||||||
{
|
{
|
||||||
Status = "Backing up Phase 2 Data";
|
Status = "Backing up Phase 2 Data";
|
||||||
Backup("_" + MySettings.Phase2Suffix);
|
Backup("_" + MySettings.Phase2Suffix);
|
||||||
MyInfo="Phase 2 Backup Complete";
|
MyInfo = "Phase 2 Backup Complete";
|
||||||
}
|
}
|
||||||
Status = "Fix Transtions Complete";
|
Status = "Fix Transtions Complete";
|
||||||
MessageBox.Show("Fix Transtions Complete", "Status", MessageBoxButtons.OK, MessageBoxIcon.Information);
|
MessageBox.Show("Fix Transtions Complete", "Status", MessageBoxButtons.OK, MessageBoxIcon.Information);
|
||||||
@ -876,12 +883,12 @@ namespace DataLoader
|
|||||||
{
|
{
|
||||||
ProcessTime = DateTime.Now;
|
ProcessTime = DateTime.Now;
|
||||||
ConvertToChangeManager();
|
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)
|
if (MessageBox.Show("Backup Database?", "Backup", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
|
||||||
{
|
{
|
||||||
Status = "Backing up Phase 3 Data";
|
Status = "Backing up Phase 3 Data";
|
||||||
Backup("_" + MySettings.Phase3Suffix);
|
Backup("_" + MySettings.Phase3Suffix);
|
||||||
MyInfo="Phase 3 Backup Complete";
|
MyInfo = "Phase 3 Backup Complete";
|
||||||
}
|
}
|
||||||
//Status = "Conversion to Change Manager Complete";
|
//Status = "Conversion to Change Manager Complete";
|
||||||
//MessageBox.Show("Conversion to Change Manager Complete", "Status", MessageBoxButtons.OK, MessageBoxIcon.Information);
|
//MessageBox.Show("Conversion to Change Manager Complete", "Status", MessageBoxButtons.OK, MessageBoxIcon.Information);
|
||||||
@ -890,12 +897,12 @@ namespace DataLoader
|
|||||||
{
|
{
|
||||||
ProcessTime = DateTime.Now;
|
ProcessTime = DateTime.Now;
|
||||||
ConvertToApproval();
|
ConvertToApproval();
|
||||||
MyInfo="Conversion to Approval Complete";
|
MyInfo = "Conversion to Approval Complete";
|
||||||
if (MessageBox.Show("Backup Database?", "Backup", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
|
if (MessageBox.Show("Backup Database?", "Backup", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
|
||||||
{
|
{
|
||||||
Status = "Backing up Phase 4 Data";
|
Status = "Backing up Phase 4 Data";
|
||||||
Backup("_" + MySettings.Phase4Suffix);
|
Backup("_" + MySettings.Phase4Suffix);
|
||||||
MyInfo="Phase 4 Backup Complete";
|
MyInfo = "Phase 4 Backup Complete";
|
||||||
}
|
}
|
||||||
//Status = "Conversion to Approval Complete";
|
//Status = "Conversion to Approval Complete";
|
||||||
//MessageBox.Show("Conversion to Approval Complete", "Status", MessageBoxButtons.OK, MessageBoxIcon.Information);
|
//MessageBox.Show("Conversion to Approval Complete", "Status", MessageBoxButtons.OK, MessageBoxIcon.Information);
|
||||||
@ -909,7 +916,7 @@ namespace DataLoader
|
|||||||
{
|
{
|
||||||
Status = "Backing up Data";
|
Status = "Backing up Data";
|
||||||
Backup("");
|
Backup("");
|
||||||
MyInfo="Backup Complete";
|
MyInfo = "Backup Complete";
|
||||||
}
|
}
|
||||||
Status = "Processing Complete";
|
Status = "Processing Complete";
|
||||||
//Status = "Loading 16 Bit Approval Data Complete";
|
//Status = "Loading 16 Bit Approval Data Complete";
|
||||||
@ -928,9 +935,9 @@ namespace DataLoader
|
|||||||
FixProceduresAndFunctions();
|
FixProceduresAndFunctions();
|
||||||
if (MessageBox.Show("Backup Database?", "Backup", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
|
if (MessageBox.Show("Backup Database?", "Backup", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
|
||||||
{
|
{
|
||||||
Status = "Backing up Data";
|
Status = "Backing up Data";
|
||||||
Backup("_Fixed");
|
Backup("_Fixed");
|
||||||
MyInfo="Backup Complete";
|
MyInfo = "Backup Complete";
|
||||||
}
|
}
|
||||||
//Status = "Processing Complete";
|
//Status = "Processing Complete";
|
||||||
//MessageBox.Show("Fixed Stored Procedures", "Status", MessageBoxButtons.OK, MessageBoxIcon.Information);
|
//MessageBox.Show("Fixed Stored Procedures", "Status", MessageBoxButtons.OK, MessageBoxIcon.Information);
|
||||||
@ -975,7 +982,7 @@ namespace DataLoader
|
|||||||
{
|
{
|
||||||
btnConvertSelected_Click(this, new EventArgs());
|
btnConvertSelected_Click(this, new EventArgs());
|
||||||
}
|
}
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
private void approvalDatabasesToolStripMenuItem_Click(object sender, EventArgs e)
|
private void approvalDatabasesToolStripMenuItem_Click(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
@ -1021,14 +1028,14 @@ namespace DataLoader
|
|||||||
bad++;
|
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);
|
Status = String.Format("Fixing databases complete. {0} Fixed, {1} Failures", good, bad);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
public class MessageBuilder
|
public class MessageBuilder
|
||||||
{
|
{
|
||||||
private StringBuilder _MyStringBulider=new StringBuilder();
|
private StringBuilder _MyStringBulider = new StringBuilder();
|
||||||
private DateTime _LastTime = DateTime.Now;
|
private DateTime _LastTime = DateTime.Now;
|
||||||
public DateTime LastTime
|
public DateTime LastTime
|
||||||
{
|
{
|
||||||
@ -1039,9 +1046,9 @@ namespace DataLoader
|
|||||||
{
|
{
|
||||||
_MyStringBulider.Append(heading);
|
_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;
|
DateTime now = DateTime.Now;
|
||||||
TimeSpan ts = TimeSpan.FromTicks(now.Ticks - _LastTime.Ticks);
|
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);
|
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