public static ActionResult AfterDatabaseDialog(Session session) { try { return(DatabaseCustomAction.AfterDatabaseDialog(session, false)); } catch (Exception ex) { session.ShowErrorMessage(ex); throw ex; } }
public static ActionResult AfterInstallInitialize_DB(Session session) { try { return(DatabaseCustomAction.AfterInstallInitialize_DB(session)); } catch (Exception ex) { session.ShowErrorMessage(ex); throw ex; } }
public static ActionResult PatchDatabase(Session session, Dictionary <string, DatabasePatchInfo[]> featurePatchInfos) { try { return(DatabaseCustomAction.PatchDatabase(session, featurePatchInfos)); } catch (Exception ex) { session.ShowErrorMessage(ex); throw ex; } }
public static ActionResult AppSearch_DB(Session session) { try { return(DatabaseCustomAction.AppSearch_DB(session, false)); } catch (Exception ex) { session.ShowErrorMessage(ex); throw ex; } }
public static ActionResult RemoveDatabase(Session session) { try { return(DatabaseCustomAction.RemoveDatabase(session, true)); } catch (Exception ex) { session.ShowErrorMessage(ex); throw ex; } }
public static ActionResult PatchDatabase(Session session) { try { var patchInfos = new Dictionary <string, DatabasePatchInfo[]>(); patchInfos["PM"] = new DatabasePatchInfo[] { new DatabasePatchInfo(new Version(1, 2), Properties.Resources.patchbas_1_2, null), new DatabasePatchInfo(new Version(2, 0), Properties.Resources.patchbas_2_0, null) }; return(DatabaseCustomAction.PatchDatabase(session, patchInfos)); } catch (Exception ex) { session.ShowErrorMessage(ex); throw ex; } }
public static ActionResult DeployDatabase(Session session) { try { // Prepare SQL scripts var createDatabaseObjectsSql = new Dictionary <string, string>(); createDatabaseObjectsSql["CPR"] = Properties.Resources.CreatePartDatabaseObjects; createDatabaseObjectsSql["EVENT"] = CprBroker.Installers.EventBrokerInstallers.Properties.Resources.CreateEventBrokerDatabaseObjects; // Prepare lookups var lookupDataArray = new Dictionary <string, KeyValuePair <string, string>[]>(); List <KeyValuePair <string, string> > cprLookups = new List <KeyValuePair <string, string> >(); cprLookups.Add(new KeyValuePair <string, string>(typeof(CprBroker.Data.Applications.Application).Name, Properties.Resources.Application)); cprLookups.Add(new KeyValuePair <string, string>(typeof(LifecycleStatus).Name, Properties.Resources.LifecycleStatus)); cprLookups.Add(new KeyValuePair <string, string>(typeof(LogType).Name, Properties.Resources.LogType)); cprLookups.Add(new KeyValuePair <string, string>(typeof(CprBroker.Data.DataProviders.BudgetInterval).Name, Properties.Resources.BudgetEntry)); lookupDataArray["CPR"] = cprLookups.ToArray(); List <KeyValuePair <string, string> > eventLookups = new List <KeyValuePair <string, string> >(); eventLookups.Add(new KeyValuePair <string, string>(typeof(ChannelType).Name, CprBroker.Installers.EventBrokerInstallers.Properties.Resources.ChannelType)); eventLookups.Add(new KeyValuePair <string, string>(typeof(SubscriptionType).Name, CprBroker.Installers.EventBrokerInstallers.Properties.Resources.SubscriptionType)); lookupDataArray["EVENT"] = eventLookups.ToArray(); // Custom methods var customMethods = new Dictionary <string, Action <SqlConnection> >(); customMethods["CPR"] = conn => CprBroker.Providers.CPRDirect.Authority.ImportText(Properties.Resources.Authority_4357, conn); return(DatabaseCustomAction.DeployDatabase(session, createDatabaseObjectsSql, lookupDataArray, customMethods)); } catch (Exception ex) { session.ShowErrorMessage(ex); throw ex; } }
public static ActionResult RemoveDatabase(Session session, UpdateDetectionVariables updateDetectionVariables) { try { DatabaseSetupInfo databaseSetupInfo = DatabaseSetupInfo.CreateFromFeature(session, updateDetectionVariables.DatabaseFeatureName); DropDatabaseForm dropDatabaseForm = new DropDatabaseForm() { SetupInfo = databaseSetupInfo, Text = "Drop database objects", QuestionText = "Should the database objects be removed?", NoText = "No, keep the database objects", YesText = "Yes, drop the database objects" }; if (BaseForm.ShowAsDialog(dropDatabaseForm, session.InstallerWindowWrapper()) == DialogResult.Yes) { var ddl = updateDetectionVariables.SubstituteDDL(Properties.Resources.drp_tbl); if (updateDetectionVariables.TriggersEnabled) { ddl += updateDetectionVariables.SubstituteDDL(Properties.Resources.drp_trg); } if (!string.IsNullOrEmpty(updateDetectionVariables.ExtraDatabaseDropDDL)) { ddl += updateDetectionVariables.ExtraDatabaseDropDDL; } DatabaseCustomAction.ExecuteDDL(ddl, databaseSetupInfo); DatabaseCustomAction.DropDatabaseUser(databaseSetupInfo); } return(ActionResult.Success); } catch (Exception ex) { session.ShowErrorMessage(ex); throw ex; } }
public static ActionResult DeployDatabase(Session session) { try { DatabaseSetupInfo databaseSetupInfo = DatabaseSetupInfo.CreateFromFeature(session, "PM"); string sql = Properties.Resources.crebas; sql = sql.Replace("<pm-cryptpassword>", databaseSetupInfo.EncryptionKey); sql = sql.Replace("<pm-namespace>", databaseSetupInfo.Domain); var sqlDictionary = new Dictionary <string, string>(); sqlDictionary["PM"] = sql; var lookupDictinary = new Dictionary <string, KeyValuePair <string, string>[]>(); lookupDictinary["PM"] = new KeyValuePair <string, string> [0]; return(DatabaseCustomAction.DeployDatabase(session, sqlDictionary, lookupDictinary)); } catch (Exception ex) { session.ShowErrorMessage(ex); throw ex; } }
public static ActionResult RollbackDatabase(Session session, UpdateDetectionVariables updateDetectionVariables) { try { DatabaseSetupInfo databaseSetupInfo = DatabaseSetupInfo.CreateFromFeature(session, updateDetectionVariables.DatabaseFeatureName); var ddl = updateDetectionVariables.SubstituteDDL(Properties.Resources.drp_tbl); if (updateDetectionVariables.TriggersEnabled) { ddl += updateDetectionVariables.SubstituteDDL(Properties.Resources.drp_trg); } if (!string.IsNullOrEmpty(updateDetectionVariables.ExtraDatabaseDropDDL)) { ddl += updateDetectionVariables.ExtraDatabaseDropDDL; } DatabaseCustomAction.ExecuteDDL(ddl, databaseSetupInfo); DatabaseCustomAction.DropDatabaseUser(databaseSetupInfo); return(ActionResult.Success); } catch (Exception ex) { session.ShowErrorMessage(ex); throw ex; } }
public static ActionResult PatchDatabase(Session session) { try { var patchInfos = new Dictionary <string, DatabasePatchInfo[]>(); patchInfos["CPR"] = new DatabasePatchInfo[] { new DatabasePatchInfo() { Version = new Version(1, 3), SqlScript = Properties.Resources.PatchDatabase_1_3, PatchAction = conn => CprBroker.Providers.CPRDirect.Authority.ImportText(Properties.Resources.Authority_4357, conn) }, new DatabasePatchInfo() { Version = new Version(1, 3, 2), SqlScript = Properties.Resources.PatchDatabase_1_3_2, PatchAction = null }, new DatabasePatchInfo() { Version = new Version(1, 4), SqlScript = Properties.Resources.PatchDatabase_1_4, PatchAction = null }, new DatabasePatchInfo() { Version = new Version(2, 1), SqlScript = Properties.Resources.PatchDatabase_2_1, PatchAction = null }, new DatabasePatchInfo() { Version = new Version(2, 2), SqlScript = Properties.Resources.PatchDatabase_2_2, PatchAction = null }, new DatabasePatchInfo() { Version = new Version(2, 2, 1), SqlScript = Properties.Resources.PatchDatabase_2_2_1, PatchAction = null }, new DatabasePatchInfo() { Version = new Version(2, 2, 2), SqlScript = Properties.Resources.PatchDatabase_2_2_2, PatchAction = conn => DatabaseCustomAction.InsertLookup(typeof(CprBroker.Data.DataProviders.BudgetInterval).Name, Properties.Resources.BudgetEntry, conn) }, }; patchInfos["EVENT"] = new DatabasePatchInfo[] { new DatabasePatchInfo() { Version = new Version(2, 2), SqlScript = CprBroker.Installers.EventBrokerInstallers.Properties.Resources.PatchDatabase_2_2, PatchAction = null } }; var result = DatabaseCustomAction.PatchDatabase(session, patchInfos); return(ActionResult.Success); } catch (Exception ex) { session.ShowErrorMessage(ex); throw ex; } }