Add option to fix all approval databases at once
Added Print Statements Corrected RestoreDeletedItem
This commit is contained in:
@@ -27,6 +27,7 @@ using VEPROMS.CSLA.Library;
|
||||
using Config;
|
||||
using Volian.Controls.Library;
|
||||
using Volian.Base.Library;
|
||||
using System.Data.SqlClient;
|
||||
|
||||
|
||||
[assembly: log4net.Config.XmlConfigurator(Watch = true)]
|
||||
@@ -823,6 +824,55 @@ namespace DataLoader
|
||||
}
|
||||
#endregion
|
||||
|
||||
private void approvalDatabasesToolStripMenuItem_Click(object sender, EventArgs e)
|
||||
{
|
||||
this.Cursor = Cursors.WaitCursor;
|
||||
//MySettings.ConnectionString
|
||||
//"{DBName}", dbName
|
||||
string tmp = MySettings.ConnectionString.Replace("{DBName}", "master");
|
||||
SqlConnection cn = new SqlConnection(tmp);
|
||||
cn.Open();
|
||||
SqlDataAdapter da = new SqlDataAdapter("select name, case when object_id(name + '..Items') is null then 'Not PROMS' when object_id(name + '..Revisions') is not null then 'Approval' when object_id(name + '..ContentAudits') is not null then 'Change Manager' else 'Original' end functionality from sysdatabases where name not in ('master','model','msdb','tempdb') order by name", cn);
|
||||
DataSet ds = new DataSet();
|
||||
da.Fill(ds);
|
||||
cn.Close();
|
||||
List<string> cms = new List<string>();
|
||||
StringBuilder sb = new StringBuilder();
|
||||
sb.Append("The following databases will be fixed...\r\n");
|
||||
foreach (DataRow dr in ds.Tables[0].Rows)
|
||||
{
|
||||
if (dr["functionality"].ToString() == "Approval")
|
||||
{
|
||||
cms.Add(dr["name"].ToString());
|
||||
sb.Append("\r\n " + dr["name"].ToString());
|
||||
}
|
||||
}
|
||||
this.Cursor = Cursors.Default;
|
||||
if (MessageBox.Show(sb.ToString(), "Data Loader Fixes", MessageBoxButtons.OKCancel, MessageBoxIcon.Warning) == DialogResult.OK)
|
||||
{
|
||||
int good = 0;
|
||||
int bad = 0;
|
||||
foreach (string s in cms)
|
||||
{
|
||||
try
|
||||
{
|
||||
AddInfo("\r\nFixing database {0}\r\n", s);
|
||||
RunScript("PROMSFixes.sql", s);
|
||||
good++;
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
AddInfo("====****====");
|
||||
AddError(ex, "While processing database {0}", s);
|
||||
AddInfo("====****====");
|
||||
bad++;
|
||||
}
|
||||
}
|
||||
AddInfo("\r\nFixing databases complete. {0} Fixed, {1} Failures",good,bad);
|
||||
Status = String.Format("Fixing databases complete. {0} Fixed, {1} Failures", good, bad);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
public class MessageBuilder
|
||||
|
Reference in New Issue
Block a user