Added overloaded method RunScript to allow for executing a sql command from DataLoader

Made call to vesp_TurnChangeManagerOFF prior to converting a database and a call to vesp_TurnChangeManagerON after converting a database to improve adding 16-bit data to an existing 32-bit database
Made call to vesp_TurnChangeManagerOFF prior to fixing transitions and a call to vesp_TurnChangeManagerON after fixing transitions to improve adding 16-bit data to an existing 32-bit database
Modified PartialMatch method to handle cases when XTSETID.DBF entry for abbyproc does not have the .prc extension
Modified ExactMatch method to handle cases when XTSETID.DBF entry for abbyproc does not have the .prc extension
Added stored procedure stubs for vesp_TurnChangeManagerOFF and vesp_TurnChangeManagerON
This commit is contained in:
Rich 2013-04-19 13:53:08 +00:00
parent 207403d318
commit c24fd83bdf
3 changed files with 74 additions and 2 deletions

View File

@ -254,10 +254,11 @@ namespace DataLoader
if (dvi.MyFolder.Title.ToUpper().EndsWith(partial.ToUpper()))
return dvi;
}
if (path.ToUpper().EndsWith("ABBYPROC"))
return PartialMatch(path + ".prc");
}
return null;
}
private static string GetPartial(string path)
{
//Console.WriteLine(string.Format("GetPartial path = {0}",path));
@ -269,12 +270,13 @@ namespace DataLoader
else
return null;
}
private static DocVersionInfo ExactMatch(string path)
{
foreach (DocVersionInfo dvi in _DocVersions)
if (dvi.MyFolder.Title.ToUpper().EndsWith(path.ToUpper()))
return dvi;
if (path.ToUpper().EndsWith("ABBYPROC"))
return ExactMatch(path + ".prc");
return null;
}
}

View File

@ -18706,3 +18706,46 @@ GO
IF (@@Error = 0) PRINT 'Procedure Creation: vesp_ListItemsTranToAndContent Succeeded'
ELSE PRINT 'Procedure Creation: vesp_ListItemsTranToAndContent Error on Creation'
GO
/****** Object: StoredProcedure [vesp_TurnChangeManagerOFF] ******/
IF EXISTS (SELECT * FROM dbo.sysobjects WHERE id = OBJECT_ID(N'[vesp_TurnChangeManagerOFF]') AND OBJECTPROPERTY(id,N'IsProcedure') = 1)
DROP PROCEDURE [vesp_TurnChangeManagerOFF];
GO
/****** Object: StoredProcedure [dbo].[vesp_TurnChangeManagerOFF] Script Date: 03/20/2012 16:02:54 ******/
/*
exec vesp_TurnChangeManagerOFF
*/
/*****************************************************************************
Volian Enterprises - Proprietary Information - DO NOT COPY OR DISTRIBUTE
Copyright 2012 - Volian Enterprises, Inc. All rights reserved.
*****************************************************************************/
CREATE PROCEDURE [dbo].[vesp_TurnChangeManagerOFF] WITH EXECUTE AS OWNER AS
BEGIN
PRINT 'NOTHING TO DO'
END
GO
-- Display the status of Proc creation
IF (@@Error = 0) PRINT 'Procedure Creation: vesp_TurnChangeManagerOFF Succeeded'
ELSE PRINT 'Procedure Creation: vesp_TurnChangeManagerOFF Error on Creation'
GO
/****** Object: StoredProcedure [vesp_TurnChangeManagerON] ******/
IF EXISTS (SELECT * FROM dbo.sysobjects WHERE id = OBJECT_ID(N'[vesp_TurnChangeManagerON]') AND OBJECTPROPERTY(id,N'IsProcedure') = 1)
DROP PROCEDURE [vesp_TurnChangeManagerON];
GO
/****** Object: StoredProcedure [dbo].[vesp_TurnChangeManagerON] Script Date: 03/20/2012 16:02:54 ******/
/*
exec vesp_TurnChangeManagerON
*/
/*****************************************************************************
Volian Enterprises - Proprietary Information - DO NOT COPY OR DISTRIBUTE
Copyright 2012 - Volian Enterprises, Inc. All rights reserved.
*****************************************************************************/
CREATE PROCEDURE [dbo].[vesp_TurnChangeManagerON] WITH EXECUTE AS OWNER AS
BEGIN
PRINT 'NOTHING TO DO'
END
GO
-- Display the status of Proc creation
IF (@@Error = 0) PRINT 'Procedure Creation: vesp_TurnChangeManagerON Succeeded'
ELSE PRINT 'Procedure Creation: vesp_TurnChangeManagerON Error on Creation'
GO

View File

@ -392,6 +392,29 @@ namespace DataLoader
}
return ok;
}
public bool RunScript(string script)
{
bool ok = false;
Status = String.Format("Running {0}", script);
script = script.Replace("{DBName}", MySettings.DBName);
script = script.Replace("{DBPath}", MySettings.DBPath);
SQLScriptRunner ssr = new SQLScriptRunner(script, MySettings.ConnectionString.Replace("{DBName}", MySettings.DBName));
ssr.InfoMessage += new SQLScriptRunnerEvent(ssr_InfoMessage);
try
{
ssr.Run();
Status = "Script Complete";
ok = true;
}
catch (Exception ex)
{
AddInfo("====****====");
AddError(ex, "While processing database {0}", MySettings.DBName);
AddInfo("====****====");
Status = String.Format("Script {0} Failed", script);
}
return ok;
}
private void Backup(string suffix)
{
SQLScriptRunner ssrbu = new SQLScriptRunner(MySettings.DBName, MySettings.BackupFolder,
@ -868,7 +891,9 @@ namespace DataLoader
private void convertDBToolStripMenuItem_Click(object sender, EventArgs e)
{
ProcessTime = DateTime.Now;
RunScript("vesp_TurnChangeManagerOFF");
btnConvert_Click(this, new System.EventArgs());
RunScript("vesp_TurnChangeManagerON");
if (ProcessFailed) return;
MyInfo = "dBase Conversion Complete";
if (MessageBox.Show("Backup Database?", "Backup", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
@ -884,7 +909,9 @@ namespace DataLoader
{
Database.VEPROMS_Connection = MySettings.ConnectionString.Replace("{DBName}", MySettings.DBName);
ProcessTime = DateTime.Now;
RunScript("vesp_TurnChangeManagerOFF");
btnFixTransitions_Click(this, new System.EventArgs());
RunScript("vesp_TurnChangeManagerON");
MyInfo = "Fix Transtions Complete";
if (MessageBox.Show("Backup Database?", "Backup", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
{