public IDataReader Fetch(Guid item_id) { #if TRACE long startTicks = PLLog.Trace("Start", PLLOG_APPNAME, CLASS_BASE_ERRORNUMBER + 4); #endif IDataReader reader = null; using (var sqlConn = ConnectionManager <SqlConnection> .GetManager("LocalDB")) { using (var sqlCmd = sqlConn.Connection.CreateCommand()) { sqlCmd.CommandType = CommandType.StoredProcedure; //sqlCmd.CommandText = "Item_SelectAttributeValues"; sqlCmd.CommandText = "ItemAndAttributes_SelectById"; sqlCmd.Parameters.AddWithValue("@item_id", item_id); try { reader = sqlCmd.ExecuteReader(); } catch (Exception ex) { PLLog.Error(ex, PLLOG_APPNAME, CLASS_BASE_ERRORNUMBER + 5); //throw new ApplicationException("Item_SelectAttributeValues"); throw new ApplicationException("ItemAndAttributes_SelectById"); } } } #if TRACE PLLog.Trace("End", PLLOG_APPNAME, CLASS_BASE_ERRORNUMBER + 6, startTicks); #endif return(reader); }
public System.Data.IDataReader Fetch2() { #if TRACE long startTicks = PLLog.Trace("Start", PLLOG_APPNAME, CLASS_BASE_ERRORNUMBER + 1); #endif IDataReader reader = null; using (var sqlConn = ConnectionManager <SqlConnection> .GetManager("LocalDB")) { using (var sqlCmd = sqlConn.Connection.CreateCommand()) { sqlCmd.CommandType = CommandType.StoredProcedure; sqlCmd.CommandText = "Items_Select2"; try { reader = sqlCmd.ExecuteReader(); } catch (Exception ex) { PLLog.Error(ex, PLLOG_APPNAME, CLASS_BASE_ERRORNUMBER + 2); throw new ApplicationException("Items_Select2"); } } } #if TRACE PLLog.Trace("End", PLLOG_APPNAME, CLASS_BASE_ERRORNUMBER + 3, startTicks); #endif return(reader); }
public void Delete(Guid attribute_id, string who, string notes, DateTime last_changed) { #if TRACE long startTicks = PLLog.Trace("Start", PLLOG_APPNAME, CLASS_BASE_ERRORNUMBER + 13); #endif using (var sqlConn = ConnectionManager <SqlConnection> .GetManager("LocalDB")) { using (var sqlCmd = sqlConn.Connection.CreateCommand()) { sqlCmd.CommandType = CommandType.StoredProcedure; sqlCmd.CommandText = "Attributes_Delete"; sqlCmd.Parameters.AddWithValue("@attribute_id", attribute_id); sqlCmd.Parameters.AddWithValue("@who", who); sqlCmd.Parameters.AddWithValue("@notes", notes); sqlCmd.Parameters.AddWithValue("@last_changed", last_changed); try { sqlCmd.ExecuteNonQuery(); } catch (Exception ex) { PLLog.Error(ex, PLLOG_APPNAME, CLASS_BASE_ERRORNUMBER + 14); throw new ApplicationException("Attributes_Delete"); } } } #if TRACE PLLog.Trace("End", PLLOG_APPNAME, CLASS_BASE_ERRORNUMBER + 15, startTicks); #endif }
public IDataReader Fetch(string whereClause) { #if TRACE long startTicks = PLLog.Trace("Start", PLLOG_APPNAME, CLASS_BASE_ERRORNUMBER + 4); #endif IDataReader reader = null; using (var sqlConn = ConnectionManager <SqlConnection> .GetManager("LocalDB")) { using (var sqlCmd = sqlConn.Connection.CreateCommand()) { sqlCmd.CommandType = CommandType.StoredProcedure; sqlCmd.CommandText = "ConstrainedValueLists_Select"; sqlCmd.Parameters.AddWithValue("@whereClause", whereClause); try { reader = sqlCmd.ExecuteReader(); } catch (Exception ex) { PLLog.Error(ex, PLLOG_APPNAME, CLASS_BASE_ERRORNUMBER + 5); throw new ApplicationException("ConstrainedValueLists_Select"); } } } #if TRACE PLLog.Trace("End", PLLOG_APPNAME, CLASS_BASE_ERRORNUMBER + 6, startTicks); #endif return(reader); }
private void ThisAddIn_Startup(object sender, System.EventArgs e) { PLLog.Trace("Enter", Common.PROJECT_NAME); Globals.Ribbons.Ribbon.chkDisplayEvents.Checked = Common.DisplayEvents; Globals.Ribbons.Ribbon.chkEnableAppEvents.Checked = Common.HasAppEvents; try { if (Common.HasAppEvents) { Common.AppEvents = new Events.ProjectAppEvents(); Common.AppEvents.ProjectApplication = Globals.ThisAddIn.Application; } Common.ProjectHelper.ProjectApplication = Globals.ThisAddIn.Application; // Need to do a bit more work to use CustomTask Panes in Project. (Handled by Designer normally) CustomTaskPanes = Globals.Factory.CreateCustomTaskPaneCollection(null, null, "CustomTaskPanes", "CustomTaskPanes", this); } catch (Exception ex) { PLLog.Error(ex, Common.PROJECT_NAME); } PLLog.Trace("Exit", Common.PROJECT_NAME); }
public void Update(Guid activitylog_id, int logfunction_id, int table_id, Guid item_id, string value, string who, string notes) { #if TRACE long startTicks = PLLog.Trace("Start", PLLOG_APPNAME, CLASS_BASE_ERRORNUMBER + 10); #endif using (var sqlConn = ConnectionManager <SqlConnection> .GetManager("LocalDB")) { using (var sqlCmd = sqlConn.Connection.CreateCommand()) { sqlCmd.CommandType = CommandType.StoredProcedure; sqlCmd.CommandText = "ActivityLog_Update"; sqlCmd.Parameters.AddWithValue("@activitylog_id", activitylog_id); sqlCmd.Parameters.AddWithValue("@logfunction_id", logfunction_id); sqlCmd.Parameters.AddWithValue("@table_id", table_id); sqlCmd.Parameters.AddWithValue("@item_id", item_id); sqlCmd.Parameters.AddWithValue("@value", value); sqlCmd.Parameters.AddWithValue("@who", who); sqlCmd.Parameters.AddWithValue("@notes", notes); try { sqlCmd.ExecuteNonQuery(); } catch (Exception ex) { PLLog.Error(ex, PLLOG_APPNAME, CLASS_BASE_ERRORNUMBER + 11); throw new ApplicationException("ActivityLog_Update"); } } } #if TRACE PLLog.Trace("End", PLLOG_APPNAME, CLASS_BASE_ERRORNUMBER + 12, startTicks); #endif }
public static void UpdateDataSet(this MSMO.View view, Data.ApplicationDataSet.DBViewsRow viewRow) { try { viewRow.CreateDate = view.CreateDate; //viewRow.DataSpaceUsed = view.DataSpaceUsed; try { viewRow.DateLastModified = view.DateLastModified; } catch (Exception ex) { PLLog.Warning(ex, PLLOG_APPNAME, CLASS_BASE_ERRORNUMBER + 1); } viewRow.Owner = view.Owner; } catch (Exception ex) { // TODO(crhodes): Need to wrap anything above that throws an exception // that we want to ignore, e.g. property not available because of // SQL Edition. PLLog.Error(ex, PLLOG_APPNAME, CLASS_BASE_ERRORNUMBER + 2); throw ex; } }
public static void UpdateDataSet(this MSMO.Table table, Data.ApplicationDataSet.DBTablesRow tableRow) { try { tableRow.DataSpaceUsed = table.DataSpaceUsed; try { tableRow.DateLastModified = table.DateLastModified; } catch (Exception ex) { PLLog.Warning(ex, PLLOG_APPNAME, CLASS_BASE_ERRORNUMBER + 1); } tableRow.Owner = table.Owner; tableRow.RowCount = table.RowCount; } catch (Exception ex) { // TODO(crhodes): Need to wrap anything above that throws an exception // that we want to ignore, e.g. property not available because of // SQL Edition. PLLog.Error(ex, PLLOG_APPNAME, CLASS_BASE_ERRORNUMBER + 2); throw ex; } }
public void DeleteAll(string who, string notes) { #if TRACE long startTicks = PLLog.Trace("Start", PLLOG_APPNAME, CLASS_BASE_ERRORNUMBER + 16); #endif using (var sqlConn = ConnectionManager <SqlConnection> .GetManager("LocalDB")) { using (var sqlCmd = sqlConn.Connection.CreateCommand()) { sqlCmd.CommandType = CommandType.StoredProcedure; sqlCmd.CommandText = "Items_DeleteAll"; sqlCmd.Parameters.AddWithValue("@who", who); sqlCmd.Parameters.AddWithValue("@notes", notes); try { sqlCmd.ExecuteNonQuery(); } catch (Exception ex) { PLLog.Error(ex, PLLOG_APPNAME, CLASS_BASE_ERRORNUMBER + 17); throw new ApplicationException("Items_DeleteAll"); } } } #if TRACE PLLog.Trace("End", PLLOG_APPNAME, CLASS_BASE_ERRORNUMBER + 18, startTicks); #endif }
public void ProcessLogFunctionsXML(XmlDocument doc) { PLLog.Trace("Enter Method", "ODB"); try { XmlNode element = doc.DocumentElement.SelectSingleNode("//LogFunctions"); if (element == null) { return; } foreach (XmlNode node in element.ChildNodes) { switch (node.Name) { case "LogFunction": int id = int.Parse(node.Attributes.GetNamedItem("id").Value); string name = node.Attributes.GetNamedItem("name").Value; string description = node.Attributes.GetNamedItem("description").Value; LogFunction logFunction = new LogFunction(); logFunction.logfunction_id = id; logFunction.logfunction_name = name; logFunction.logfunction_description = description; odbContext.LogFunctions.InsertOnSubmit(logFunction); odbContext.SubmitChanges(); break; case "ClearAll": var rows = from r in odbContext.LogFunctions select r; foreach (LogFunction row in rows) { odbContext.LogFunctions.DeleteOnSubmit(row); } odbContext.SubmitChanges(); break; default: PLLog.Info(string.Format("Unsupported element: {0}", node.Name), "ODB"); break; } } } catch (Exception ex) { PLLog.Error(ex, "ODB"); throw; } PLLog.Trace("Exit Method", "ODB"); }
public static void UpdateDataSet(this MSMO.StoredProcedure storedProcedure, Data.ApplicationDataSet.DBStoredProceduresRow storedProcedureRow) { try { storedProcedureRow.Owner = storedProcedure.Owner; storedProcedureRow.CreateDate = storedProcedure.CreateDate; if (Data.Config.ADSLoad_DBStoredProcedureContent) { try { storedProcedureRow.MethodName = storedProcedure.MethodName; } catch (Exception ex) { PLLog.Warning(ex, PLLOG_APPNAME, CLASS_BASE_ERRORNUMBER + 1); storedProcedureRow.MethodName = "<Exception>"; } try { storedProcedureRow.TextHeader = storedProcedure.TextHeader; } catch (Exception ex) { PLLog.Warning(ex, PLLOG_APPNAME, CLASS_BASE_ERRORNUMBER + 1); storedProcedureRow.TextHeader = "<Exception>"; } try { storedProcedureRow.TextBody = storedProcedure.TextBody; } catch (Exception ex) { PLLog.Warning(ex, PLLOG_APPNAME, CLASS_BASE_ERRORNUMBER + 1); storedProcedureRow.TextBody = "<Exception>"; } } try { storedProcedureRow.DateLastModified = storedProcedure.DateLastModified; } catch (Exception ex) { PLLog.Warning(ex, PLLOG_APPNAME, CLASS_BASE_ERRORNUMBER + 1); } } catch (Exception ex) { // TODO(crhodes): Need to wrap anything above that throws an exception // that we want to ignore, e.g. property not available because of // SQL Edition. PLLog.Error(ex, PLLOG_APPNAME, CLASS_BASE_ERRORNUMBER + 2); throw ex; } }
public static void UpdateDataSet(this MSMO.Server server, Data.ApplicationDataSet.InstancesRow instanceRow) { try { try { instanceRow.BrowserStartMode = server.BrowserStartMode.ToString(); } catch (Exception ex) { PLLog.Warning(ex, PLLOG_APPNAME, CLASS_BASE_ERRORNUMBER + 1); instanceRow.BrowserStartMode = "<Exception>"; } instanceRow.ServiceName = server.ServiceName; instanceRow.Collation = server.Collation; instanceRow.Edition = server.Edition; instanceRow.IsClustered = server.IsClustered; instanceRow.NetName = server.NetName; instanceRow.OSVersion = server.OSVersion; instanceRow.PhysicalMemory = server.PhysicalMemory; instanceRow.Platform = server.Platform; instanceRow.Processors = server.Processors; try { instanceRow.ServiceAccount = server.ServiceAccount; } catch (Exception ex) { PLLog.Warning(ex, PLLOG_APPNAME, CLASS_BASE_ERRORNUMBER + 1); instanceRow.ServiceAccount = "<Exception>"; } try { instanceRow.ServiceInstanceId = server.ServiceInstanceId; } catch (Exception ex) { PLLog.Warning(ex, PLLOG_APPNAME, CLASS_BASE_ERRORNUMBER + 1); instanceRow.ServiceInstanceId = "<Exception>"; } instanceRow.EngineEdition = server.EngineEdition.ToString(); instanceRow.Product = server.Product; instanceRow.ProductLevel = server.ProductLevel; instanceRow.Version = server.VersionString; } catch (Exception ex) { // TODO(crhodes): Need to wrap anything above that throws an exception // that we want to ignore, e.g. property not available because of // SQL Edition. PLLog.Error(ex, PLLOG_APPNAME, CLASS_BASE_ERRORNUMBER + 2); throw ex; } }
public void ProcessConstrainedValuesXML(XmlDocument doc) { PLLog.Trace("Enter Method", "ODB"); try { XmlNode element = doc.DocumentElement.SelectSingleNode("//ConstrainedValues"); foreach (XmlNode node in element.ChildNodes) { switch (node.Name) { case "ConstrainedValue": string id = node.Attributes.GetNamedItem("id").Value; Guid cvlid = new Guid(node.Attributes.GetNamedItem("cvlid").Value); string value = node.Attributes.GetNamedItem("value").Value; int ordinal = int.Parse(node.Attributes.GetNamedItem("ordinal").Value); string description = node.Attributes.GetNamedItem("description").Value; if (id == "NewGuid") { id = Guid.NewGuid().ToString(); } Guid gid = new Guid(id); ODBHelper.odbContext.ConstrainedValues_Insert(gid, cvlid, value, ordinal, description, "crhodes", ""); break; case "ClearAll": var rows = from r in odbContext.ConstrainedValues select r; foreach (ConstrainedValue row in rows) { odbContext.ConstrainedValues.DeleteOnSubmit(row); } odbContext.SubmitChanges(); break; default: break; } } } catch (Exception ex) { PLLog.Error(ex, "ODB"); throw; } PLLog.Trace("Exit Method", "ODB"); }
void ProcessItemTypeAttributesXML(XmlDocument doc) { PLLog.Trace("Enter Method", "ODB"); try { XmlNode element = doc.DocumentElement.SelectSingleNode("//ItemTypeAttributes"); foreach (XmlNode node in element.ChildNodes) { switch (node.Name) { case "ItemTypeAttribute": string id = node.Attributes.GetNamedItem("id").Value; Guid itemtype = new Guid(node.Attributes.GetNamedItem("itemtype").Value); Guid attribute = new Guid(node.Attributes.GetNamedItem("attribute").Value); int usageattributes = int.Parse(node.Attributes.GetNamedItem("usageattributes").Value); int datatype = int.Parse(node.Attributes.GetNamedItem("datatype").Value); int version = int.Parse(node.Attributes.GetNamedItem("version").Value); string description = node.Attributes.GetNamedItem("description").Value; if (id == "NewGuid") { id = Guid.NewGuid().ToString(); } Guid gid = new Guid(id); ODBHelper.odbContext.ItemTypeAttributes_Insert(gid, itemtype, attribute, usageattributes, datatype, version, description, "crhodes", ""); break; case "ClearAll": var rows = from r in odbContext.ItemTypeAttributes select r; foreach (ODB.ItemTypeAttribute row in rows) { odbContext.ItemTypeAttributes.DeleteOnSubmit(row); } odbContext.SubmitChanges(); break; default: break; } } } catch (Exception ex) { PLLog.Error(ex, "ODB"); throw; } PLLog.Trace("Exit Method", "ODB"); }
private void FetchSMOInfo() { SQLInformation.Data.ApplicationDataSet.InstancesRow instance = (SQLInformation.Data.ApplicationDataSet.InstancesRow) ((System.Data.DataRowView)instancesDataGrid.SelectedItem).Row; try { SMO.Server server = SQLInformation.SMO.Server.GetFromSMO(instance.Name_Instance); //SMO.Server server = SQLInformation.SMO.Helper.Get_Server(instance.Name_Instance); instance.ServiceName = server.ServiceName; instance.Collation = server.Collation; instance.Edition = server.Edition; instance.IsClustered = server.IsClustered; instance.NetName = server.NetName; instance.OSVersion = server.OSVersion; instance.PhysicalMemory = server.PhysicalMemory; instance.Platform = server.Platform; instance.Processors = server.Processors; try { instance.ServiceAccount = server.ServiceAccount; } catch (Exception) { } try { instance.ServiceInstanceId = server.ServiceInstanceId; } catch (Exception) { } instance.EngineEdition = server.EngineEdition.ToString(); instance.Product = server.Product; instance.ProductLevel = server.ProductLevel; instance.Version = server.VersionString; instance.SnapShotDate = DateTime.Now; UpdateDatabase(); } catch (Microsoft.SqlServer.Management.Common.ConnectionFailureException) { instance.NetName = "Cannot Connect"; instance.SnapShotDate = DateTime.Now; UpdateDatabase(); } catch (Exception ex) { MessageBox.Show(ex.ToString()); PLLog.Error(ex, PLLOG_APPNAME, CLASS_BASE_ERRORNUMBER + 2); } }
private void OnSave(object sender, RoutedEventArgs e) { int instanceExpandMask = 0; int databaseExpandMask = 0; int jobServerExpandMask = 0; try { foreach (var item in cbe_IsMonitored.SelectedItems) { instanceExpandMask += ((KeyValuePair <string, int>)item).Value; } foreach (var item in cbe_DefaultDatabaseExpandMask.SelectedItems) { databaseExpandMask += ((KeyValuePair <string, int>)item).Value; } foreach (var item in cbe_DefaultJobServerExpandMask.SelectedItems) { jobServerExpandMask += ((KeyValuePair <string, int>)item).Value; } ExpandMask.InstanceExpandSetting instanceExpandSetting = new ExpandMask.InstanceExpandSetting(instanceExpandMask); SQLInformation.Data.ApplicationDataSet.InstancesRow newInstance = Common.ApplicationDataSet.Instances.NewInstancesRow(); newInstance.ID = Guid.Parse(textEdit_ID.Text); newInstance.Name_Instance = txtEdit_Name_Instance.Text; newInstance.Port = int.Parse(tePortNumber.Text); newInstance.NetName = cbe_NetName.Text; newInstance.ADDomain = cbe_ADDomain.Text; newInstance.Environment = cbe_Environment.Text; newInstance.SecurityZone = cbe_SecurityZone.Text; newInstance.IsMonitored = instanceExpandSetting.IsMonitored; newInstance.ExpandContent = instanceExpandSetting.ExpandContent; newInstance.ExpandJobServer = instanceExpandSetting.ExpandJobServer; newInstance.ExpandStorage = instanceExpandSetting.ExpandStorage; newInstance.ExpandLogins = instanceExpandSetting.ExpandLogins; newInstance.ExpandServerRoles = instanceExpandSetting.ExpandServerRoles; newInstance.ExpandTriggers = instanceExpandSetting.ExpandTriggers; newInstance.DefaultDatabaseExpandMask = databaseExpandMask; newInstance.DefaultJobServerExpandMask = jobServerExpandMask; Common.ApplicationDataSet.Instances.AddInstancesRow(newInstance); Common.ApplicationDataSet.InstancesTA.Update(Common.ApplicationDataSet.Instances); } catch (Exception ex) { PLLog.Error(ex, PLLOG_APPNAME, CLASS_BASE_ERRORNUMBER + 2); } }
public void ProcessAssociationTypesXML(XmlDocument doc) { PLLog.Trace("Enter Method", "ODB"); try { XmlNode element = doc.DocumentElement.SelectSingleNode("//AssociationTypes"); if (element == null) { return; } foreach (XmlNode node in element.ChildNodes) { switch (node.Name) { case "AssociationType": int id = int.Parse(node.Attributes.GetNamedItem("id").Value); string name = node.Attributes.GetNamedItem("name").Value; string description = node.Attributes.GetNamedItem("description").Value; odbContext.AssociationTypes_Insert(id, name, description, "crhodes", ""); break; case "ClearAll": var rows = from r in odbContext.AssociationTypes select r; foreach (AssociationType row in rows) { odbContext.AssociationTypes.DeleteOnSubmit(row); } odbContext.SubmitChanges(); break; default: PLLog.Info(string.Format("Unsupported element: {0}", node.Name), "ODB"); break; } } } catch (Exception ex) { PLLog.Error(ex, "ODB"); throw; } PLLog.Trace("Exit Method", "ODB"); }
public void ProcessItemTypeGroupsXML(XmlDocument doc) { PLLog.Trace("Enter Method", "ODB"); try { XmlNode element = doc.DocumentElement.SelectSingleNode("//ItemTypeGroups"); foreach (XmlNode node in element.ChildNodes) { switch (node.Name) { case "ItemTypeGroup": string id = node.Attributes.GetNamedItem("id").Value; string name = node.Attributes.GetNamedItem("name").Value; string description = node.Attributes.GetNamedItem("description").Value; if (id == "NewGuid") { id = Guid.NewGuid().ToString(); } Guid gid = new Guid(id); ODBHelper.odbContext.ItemTypeGroups_Insert(gid, name, description, "crhodes", ""); break; case "ClearAll": var rows = from r in odbContext.ItemTypeGroups select r; foreach (ItemTypeGroup row in rows) { odbContext.ItemTypeGroups.DeleteOnSubmit(row); } odbContext.SubmitChanges(); break; default: break; } } } catch (Exception ex) { PLLog.Error(ex, "ODB"); throw; } PLLog.Trace("Exit Method", "ODB"); }
protected override void OnStart(string[] args) { long startTicks = PLLog.Info("Start", PLLOG_APPNAME, CLASS_BASE_ERRORNUMBER + 3); try { // Load the database. SQLInformation.Common.ApplicationDataSet.LoadApplicationDataSetFromDB(SQLInformation.Common.ApplicationDataSet); //Initialize the timer that handles period wake-ups _RequestTimer_Weekly = new Timer(Helper.TakeSnapShot_Weekly, null, Timeout.Infinite, Timeout.Infinite); _RequestTimer_Daily = new Timer(Helper.TakeSnapShot_Daily, null, Timeout.Infinite, Timeout.Infinite); _RequestTimer_IntraDay = new Timer(Helper.TakeSnapShot_IntraDay, null, Timeout.Infinite, Timeout.Infinite); // Set the time to begin execution and how often it repeats // Timer.Change() takes two arguments 1. When to start, 2. Period to continue. PLLog.Info(String.Format("Setting Weekly Request Timer StartTime:{0}: in:{1} Restart in:{2}", Config.Weekly_StartTime, Helper.GetTimeout("Weekly StartTime"), Helper.GetTimeout("Weekly RestartTime")), PLLOG_APPNAME, CLASS_BASE_ERRORNUMBER + 4); _RequestTimer_Weekly.Change(Helper.GetTimeout("Weekly StartTime"), Helper.GetTimeout("Weekly RestartTime")); PLLog.Info(String.Format("Setting Daily Request Timer StartTime:{0}: in:{1} Restart in:{2}", Config.Daily_StartTime, Helper.GetTimeout("Daily StartTime"), Helper.GetTimeout("Daily RestartTime")), PLLOG_APPNAME, CLASS_BASE_ERRORNUMBER + 4); _RequestTimer_Daily.Change(Helper.GetTimeout("Daily StartTime"), Helper.GetTimeout("Daily RestartTime")); PLLog.Info(String.Format("Setting IntraDay Request Timer StartTime:{0}: in:{1} Restart in:{2}", Config.IntraDay_StartTime, Helper.GetTimeout("IntraDay StartTime"), Helper.GetTimeout("IntraDay RestartTime")), PLLOG_APPNAME, CLASS_BASE_ERRORNUMBER + 4); _RequestTimer_IntraDay.Change(Helper.GetTimeout("IntraDay StartTime"), Helper.GetTimeout("IntraDay RestartTime")); } catch (Exception ex) { PLLog.Error(ex, PLLOG_APPNAME, CLASS_BASE_ERRORNUMBER + 5); } PLLog.Info("End", PLLOG_APPNAME, CLASS_BASE_ERRORNUMBER + 6, startTicks); }
public void ProcessTablesXML(XmlDocument doc) { PLLog.Trace("Enter Method", "ODB"); try { XmlNode element = doc.DocumentElement.SelectSingleNode("//Tables"); foreach (XmlNode node in element.ChildNodes) { switch (node.Name) { case "Table": // Hum, this works in VB ! //string id = node.Attributes("id").Value(); int id = int.Parse(node.Attributes.GetNamedItem("id").Value); string name = node.Attributes.GetNamedItem("name").Value; int version = int.Parse(node.Attributes.GetNamedItem("version").Value); string description = node.Attributes.GetNamedItem("description").Value; ODBHelper.odbContext.Tables_Insert(id, name, version, description); break; case "ClearAll": var rows = from r in odbContext.Tables select r; foreach (Table row in rows) { odbContext.Tables.DeleteOnSubmit(row); } odbContext.SubmitChanges(); break; default: break; } } } catch (Exception ex) { PLLog.Error(ex, "ODB"); throw; } PLLog.Trace("Exit Method", "ODB"); }
public static void UpdateDataSet(this MSMO.UserDefinedFunction userDefinedFunction, Data.ApplicationDataSet.DBUserDefinedFunctionsRow userDefinedFunctionRow) { try { //instanceRow.ServiceName = server.ServiceName; } catch (Exception ex) { // TODO(crhodes): Need to wrap anything above that throws an exception // that we want to ignore, e.g. property not available because of // SQL Edition. PLLog.Error(ex, PLLOG_APPNAME, CLASS_BASE_ERRORNUMBER + 2); throw ex; } }
public static void UpdateDataSet(this MSMO.ServerRole serverRole, Data.ApplicationDataSet.ServerRolesRow serverRoleRow) { try { // Determine what might change and update it } catch (Exception ex) { // TODO(crhodes): Need to wrap anything above that throws an exception // that we want to ignore, e.g. property not available because of // SQL Edition. PLLog.Error(ex, PLLOG_APPNAME, CLASS_BASE_ERRORNUMBER + 2); throw ex; } }
public static void UpdateDataSet(this MSMO.DatabaseRole databaseRole, Data.ApplicationDataSet.DBRolesRow roleRow) { try { roleRow.CreateDate = databaseRole.CreateDate; roleRow.DateLastModified = databaseRole.DateLastModified; } catch (Exception ex) { // TODO(crhodes): Need to wrap anything above that throws an exception // that we want to ignore, e.g. property not available because of // SQL Edition. PLLog.Error(ex, PLLOG_APPNAME, CLASS_BASE_ERRORNUMBER + 2); throw ex; } }
public static void UpdateDataSet(this MSMO.Server server, Data.ApplicationDataSet.InstanceInfoRow instanceRow) { try { instanceRow.PhysicalMemory = server.PhysicalMemory; //instanceRow.Platform = server.Platform; instanceRow.Processors = server.Processors; } catch (Exception ex) { // TODO(crhodes): Need to wrap anything above that throws an exception // that we want to ignore, e.g. property not available because of // SQL Edition. PLLog.Error(ex, PLLOG_APPNAME, CLASS_BASE_ERRORNUMBER + 2); throw ex; } }
public static void UpdateDataSet(this MSMO.Database database, Data.ApplicationDataSet.DatabaseInfoRow databaseRow) { try { databaseRow.IndexSpaceUsage = database.IndexSpaceUsage; databaseRow.DataSpaceUsage = database.DataSpaceUsage; databaseRow.Size = database.Size; databaseRow.SpaceAvailable = database.SpaceAvailable; } catch (Exception ex) { // TODO(crhodes): Need to wrap anything above that throws an exception // that we want to ignore, e.g. property not available because of // SQL Edition. PLLog.Error(ex, PLLOG_APPNAME, CLASS_BASE_ERRORNUMBER + 2); throw ex; } }
private void ThisAddIn_Shutdown(object sender, System.EventArgs e) { PLLog.Trace("Enter", Common.PROJECT_NAME); try { if (Common.HasAppEvents) { Common.AppEvents = null; } } catch (Exception ex) { PLLog.Error(ex, Common.PROJECT_NAME); } PLLog.Trace("Exit", Common.PROJECT_NAME); }
public DateTime Update(Guid typeattribute_id, Guid type_id, Guid attribute_id, int characteristics, int datatype_id, int version, string description, string who, string notes, DateTime last_changed) { #if TRACE long startTicks = PLLog.Trace("Start", PLLOG_APPNAME, CLASS_BASE_ERRORNUMBER + 10); #endif DateTime lastUpdateTime; using (var sqlConn = ConnectionManager <SqlConnection> .GetManager("LocalDB")) { using (var sqlCmd = sqlConn.Connection.CreateCommand()) { sqlCmd.CommandType = CommandType.StoredProcedure; sqlCmd.CommandText = "TypeAttributes_Update"; sqlCmd.Parameters.AddWithValue("@typeattribute_id", typeattribute_id); sqlCmd.Parameters.AddWithValue("@type_id", type_id); sqlCmd.Parameters.AddWithValue("@attribute_id", attribute_id); sqlCmd.Parameters.AddWithValue("@characteristics", characteristics); sqlCmd.Parameters.AddWithValue("@datatype_id", datatype_id); sqlCmd.Parameters.AddWithValue("@version", version); sqlCmd.Parameters.AddWithValue("@description", description); sqlCmd.Parameters.AddWithValue("@who", who); sqlCmd.Parameters.AddWithValue("@notes", notes); sqlCmd.Parameters.AddWithValue("@last_changed", last_changed); try { lastUpdateTime = (DateTime)sqlCmd.ExecuteScalar(); } catch (Exception ex) { PLLog.Error(ex, PLLOG_APPNAME, CLASS_BASE_ERRORNUMBER + 11); throw new ApplicationException("TypeAttributes_Update"); } } } #if TRACE PLLog.Trace("End", PLLOG_APPNAME, CLASS_BASE_ERRORNUMBER + 12, startTicks); #endif return(lastUpdateTime); }
private static Nullable <DateTime> ValidateExists_DateTime(string configString) { string configValue = ConfigurationManager.AppSettings[configString]; if (configValue == null) { return(null); } try { PLLog.Info(string.Format("Using CurrentDate {0} from Config File", configValue), PLLOG_APPNAME, CLASS_BASE_ERRORNUMBER + 0); return(Convert.ToDateTime(configValue)); } catch (Exception ex) { PLLog.Error(string.Format("Cannot convert {0} to DateTime {1}", configString, ex.ToString()), PLLOG_APPNAME, CLASS_BASE_ERRORNUMBER + 0); return(null); } }
private void ThisAddIn_Shutdown(object sender, System.EventArgs e) { PLLog.Trace("Enter", Common.PROJECT_NAME); try { if (Common.HasAppEvents) { Common.AppEvents = null; } // Need to do a bit more work to use CustomTask Panes in Project. (Handled by Designer normally) CustomTaskPanes.Dispose(); } catch (Exception ex) { PLLog.Error(ex, Common.PROJECT_NAME); } PLLog.Trace("Exit", Common.PROJECT_NAME); }
private void UpdateInfo() { SQLInformation.Data.ApplicationDataSet.InstancesRow instance = (SQLInformation.Data.ApplicationDataSet.InstancesRow) ((System.Data.DataRowView)instancesDataGrid.SelectedItem).Row; //SMO.Server server = new SMO.Server(instance.InstanceName); //server.ConnectionContext.LoginSecure = false; // SQL Authentication //server.ConnectionContext.Login = "******"; //server.ConnectionContext.Password = "******"; //server.ConnectionContext.ConnectTimeout = 10; // Seconds try { SMO.Server server = SQLInformation.SMO.Helper.GetServer(instance.Name_Instance); SMOH.Server serverH = new SMOH.Server(server); instance.ServiceName = serverH.ServiceName; instance.Collation = serverH.Collation; instance.Edition = serverH.Edition; instance.IsClustered = bool.Parse(serverH.IsClustered); instance.NetName = serverH.NetName; instance.OSVersion = serverH.OSVersion; instance.PhysicalMemory = int.Parse(serverH.PhysicalMemory); instance.Platform = serverH.Platform; instance.Processors = int.Parse(serverH.Processors); instance.ServiceAccount = serverH.ServiceAccount; instance.ServiceInstanceId = serverH.ServiceInstanceId; instance.EngineEdition = serverH.EngineEdition; instance.Product = serverH.Product; instance.ProductLevel = serverH.ProductLevel; instance.Version = serverH.VersionString; } catch (Exception ex) { PLLog.Error(ex, PLLOG_APPNAME, CLASS_BASE_ERRORNUMBER + 2); } }