/// <summary> /// Build Module base table /// </summary> public static bool Activate(ModuleTableType moduleType, IWin32Window own) { foreach (string tableName in TableList[moduleType]) { WizardSQLHelper.ExecuteFromFile(tableName + ".sql", null, Program.AppSet.ConnectionString, own); } return(true); }
/// <summary> /// Remove Module base table /// </summary> public static bool Remove(ModuleTableType moduleType, IWin32Window own) { foreach (string tableName in TableList[moduleType]) { var competedTableName = tableName; if (Program.AppSet.ProviderType == Provider.Postgres) { competedTableName = CurrentContext.CurrentView.Schema + "." + tableName; } WizardSQLHelper.ExecuteFromFile("supTable.sql", new string[] { competedTableName }, Program.AppSet.ConnectionString, own); } return(true); }
public static bool IsModuleActivated(ModuleTableType moduleType) { string error; foreach (string tableName in TableList[moduleType]) { if (!BindingHelper.ToBool(DataTools.ScalarCommand( string.Format("SELECT EXISTS (SELECT 1 FROM information_schema.tables WHERE table_schema = '{0}' AND table_name = '{1}');", Program.AppSet.Schema, tableName), null, Program.AppSet.ConnectionString, out error))) { return(false); } } return(true); }
/// <summary> /// Enable or disable module /// </summary> /// <param name="enable">set if true or disable module if false</param> /// <returns></returns> public static bool ToggleModuleState(bool enable, ModuleTableType moduleType, IWin32Window own) { return(enable ? Activate(moduleType, own) : Remove(moduleType, own)); }