private void Child_DeleteSelf() { #if TRACE long startTicks = PLLog.Trace("Start", PLLOG_APPNAME, CLASS_BASE_ERRORNUMBER + 1); #endif using (var dalManager = HIS.DAL.DALFactory.GetManager()) { var dal = dalManager.GetProvider <HIS.DAL.IDataTypeDAL>(); using (BypassPropertyChecks) { dal.Delete(Id, "SomeOne", "For Some Reason", LastChanged); } } #if TRACE PLLog.Trace("End", PLLOG_APPNAME, CLASS_BASE_ERRORNUMBER + 3, startTicks); #endif }
private void Child_Update() { #if TRACE long startTicks = PLLog.Trace("Start", PLLOG_APPNAME, CLASS_BASE_ERRORNUMBER + 1); #endif using (var dalManager = HIS.DAL.DALFactory.GetManager()) { var dal = dalManager.GetProvider <HIS.DAL.IAttributeValueDAL>(); using (BypassPropertyChecks) { LastChanged = dal.Update(Id, TableId, ItemId, TypeAttributeId, Value, "SomeOne", "For Some Reason", LastChanged); } } #if TRACE PLLog.Trace("End", PLLOG_APPNAME, CLASS_BASE_ERRORNUMBER + 3, startTicks); #endif }
private void Child_Update() { #if TRACE long startTicks = PLLog.Trace("Start", PLLOG_APPNAME, CLASS_BASE_ERRORNUMBER + 1); #endif using (var dalManager = HIS.DAL.DALFactory.GetManager()) { var dal = dalManager.GetProvider <HIS.DAL.ITypeDAL>(); using (BypassPropertyChecks) { LastChanged = dal.Update(Id, Name, Characteristics, Version, Description, "SomeOne", "For Some Reason", LastChanged); } } #if TRACE PLLog.Trace("End", PLLOG_APPNAME, CLASS_BASE_ERRORNUMBER + 3, startTicks); #endif }
private void Child_Fetch(object childData) { #if TRACE long startTicks = PLLog.Trace("Start", PLLOG_APPNAME, CLASS_BASE_ERRORNUMBER + 1); #endif RaiseListChangedEvents = false; while (((IDataReader)childData).Read()) { var item = DataPortal.FetchChild <ConstrainedValueEC>(childData); Add(item); } RaiseListChangedEvents = true; #if TRACE PLLog.Trace("End", PLLOG_APPNAME, CLASS_BASE_ERRORNUMBER + 3, startTicks); #endif }
//protected override void Child_Create() //{ // // TODO: load default values // // omit this override if you have no defaults to set // base.Child_Create(); //} private void Child_Fetch(System.Data.IDataReader childData) { #if TRACE long startTicks = PLLog.Trace("Start", PLLOG_APPNAME, CLASS_BASE_ERRORNUMBER + 1); #endif Id = childData.GetGuid(0); Name = childData.GetString(1); Characteristics = childData.GetInt32(2); Version = childData.GetInt32(3); Description = childData.GetString(4); LastChanged = childData.GetDateTime(5); // TODO(crhodes): Added this to try to get things to not be dirty. MarkOld(); #if TRACE PLLog.Trace("End", PLLOG_APPNAME, CLASS_BASE_ERRORNUMBER + 3, startTicks); #endif }
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); }
protected override void DataPortal_Update() { #if TRACE long startTicks = PLLog.Trace("Start", PLLOG_APPNAME, CLASS_BASE_ERRORNUMBER + 1); #endif using (var dalManager = HIS.DAL.DALFactory.GetManager()) { var dal = dalManager.GetProvider <HIS.DAL.IAttributeDAL>(); using (BypassPropertyChecks) { LastChanged = dal.Update(Id, Name, "SomeOne", "For Some Reason", LastChanged); } } #if TRACE PLLog.Trace("End", PLLOG_APPNAME, CLASS_BASE_ERRORNUMBER + 3, startTicks); #endif }
private void Child_Insert() { #if TRACE long startTicks = PLLog.Trace("Start", PLLOG_APPNAME, CLASS_BASE_ERRORNUMBER + 1); #endif using (var dalManager = HIS.DAL.DALFactory.GetManager()) { var dal = dalManager.GetProvider <HIS.DAL.IItemDAL>(); using (BypassPropertyChecks) { LastChanged = dal.Insert(Id, Name, TypeId, "SomeOne", "For Some Reason"); } } #if TRACE PLLog.Trace("End", PLLOG_APPNAME, CLASS_BASE_ERRORNUMBER + 3, startTicks); #endif }
/// <summary> /// Process work each time the timer "Awakens" the SQLInformation DataLoadService /// </summary> public static void TakeSnapShot_IntraDay(Object state) { #if TRACE long startTicks = PLLog.Trace("Start", PLLOG_APPNAME, CLASS_BASE_ERRORNUMBER + 6); #endif System.Diagnostics.Debug.WriteLine("TakeSnapShot_IntraDay"); ExpandMask.DatabaseExpandSetting databaseExpandSetting = new ExpandMask.DatabaseExpandSetting(Data.Config.ExpandSetting_IntraDay_Database); ExpandMask.InstanceExpandSetting instanceExpandSetting = new ExpandMask.InstanceExpandSetting(Data.Config.ExpandSetting_IntraDay_Instance); PLLog.Debug( string.Format("Start instanceExpandSetting:{0} databaseExpandSetting:{1}", instanceExpandSetting.ExpandMask, databaseExpandSetting.ExpandMask), PLLOG_APPNAME, CLASS_BASE_ERRORNUMBER + 6); SMO.Helper.Load_Instances_FromSMO(Common.ApplicationDataSet.Instances, instanceExpandSetting, databaseExpandSetting); //// Only do work if a business day, otherwise wait till tomorrow. //Predictor predictor = new Predictor(Config.MCRRequestsDBConnection, true, false, true); ////Don't run on non-business days //if(predictor.IsBusinessDay(Config.CurrentDate)) //{ // PLLog.Info("Business Day", PLLOG_APPNAME, CLASS_BASE_ERRORNUMBER + 7); // try // { // Data.DB.UpdateOffices(); // GetUnprocessedRequestsFromDB(); // } // catch(Exception ex) // { // // TODO(crhodes): Determine what should happen here. Seems like we should not continue. // PLLog.Error(ex, PLLOG_APPNAME, CLASS_BASE_ERRORNUMBER + 8); // } //} //else //{ // PLLog.Info("Not a Business Day", PLLOG_APPNAME, CLASS_BASE_ERRORNUMBER + 9); //} PLLog.Trace("End", PLLOG_APPNAME, CLASS_BASE_ERRORNUMBER + 10, startTicks); }
private void DataPortal_Fetch(int criteria) { #if TRACE long startTicks = PLLog.Trace("Start", PLLOG_APPNAME, CLASS_BASE_ERRORNUMBER + 1); #endif RaiseListChangedEvents = false; // TODO: load values into memory object childData = null; foreach (var item in (List <object>)childData) { this.Add(AttributeEC.GetAttributeEC(childData)); } RaiseListChangedEvents = true; #if TRACE PLLog.Trace("End", PLLOG_APPNAME, CLASS_BASE_ERRORNUMBER + 3, startTicks); #endif }
//protected override void Child_Create() //{ // // TODO: load default values // // omit this override if you have no defaults to set // base.Child_Create(); //} private void Child_Fetch(System.Data.IDataReader childData) { #if TRACE long startTicks = PLLog.Trace("Start", PLLOG_APPNAME, CLASS_BASE_ERRORNUMBER + 1); #endif // First get the data from the retrieved record Id = childData.GetGuid(0); Name = childData.GetString(1); TypeId = childData.GetGuid(2); LastChanged = childData.GetDateTime(3); TypeName = childData.GetString(4); Characteristics = childData.GetInt32(5); Version = childData.GetInt32(6); MarkOld(); #if TRACE PLLog.Trace("End", PLLOG_APPNAME, CLASS_BASE_ERRORNUMBER + 3, startTicks); #endif }
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 LoadItems() { long startTicks; long fetchTicks; long bindingTicks; double frequency = Stopwatch.Frequency; startTicks = PLLog.Trace("Start", PLLOG_APPNAME, CLASS_BASE_ERRORNUMBER + 1); HIS.Library.ItemsERLP _Items = HIS.Library.ItemsERLP.GetEditableRootParent(); fetchTicks = PLLog.Trace("HIS.Library.ItemsERLP", PLLOG_APPNAME, CLASS_BASE_ERRORNUMBER + 1, startTicks); itemsECBLBindingSource.DataSource = _Items.Items; bindingTicks = PLLog.Trace("HIS.Library.ItemsERLP", PLLOG_APPNAME, CLASS_BASE_ERRORNUMBER + 1, fetchTicks); lblItems.Text = string.Format("Items Time {0:f4} (F:{1:f4} B:{2:f4}) seconds", (bindingTicks - startTicks) / frequency, (fetchTicks - startTicks) / frequency, (bindingTicks - fetchTicks) / frequency); // TODO(crhodes): Need to get the item_id from the selected row in the datagrid // and use that to get the AttributeValues property from that row. //attributeValuesECBLBindingSource.DataSource = ; }
//protected override void Child_Create() //{ // // TODO: load default values // // omit this override if you have no defaults to set // base.Child_Create(); //} private void Child_Fetch(System.Data.IDataReader childData) { #if TRACE long startTicks = PLLog.Trace("Start", PLLOG_APPNAME, CLASS_BASE_ERRORNUMBER + 1); #endif // First get the data from the retrieved record Id = childData.GetGuid(0); Name = childData.GetString(1); TypeId = childData.GetGuid(2); LastChanged = childData.GetDateTime(3); // Then call the Schema to get other information TypeName = HIS.Library.Common.HISSchema.GetTypeName(TypeId); Characteristics = HIS.Library.Common.HISSchema.GetTypeCharacteristics(TypeId); Version = HIS.Library.Common.HISSchema.GetTypeVersion(TypeId); MarkOld(); #if TRACE PLLog.Trace("End", PLLOG_APPNAME, CLASS_BASE_ERRORNUMBER + 3, startTicks); #endif }
public SplashScreen() { #if TRACE long startTicks = PLLog.Trace5("Enter", PLLOG_APPNAME, CLASS_BASE_ERRORNUMBER + 0); #endif try { //ThemeManager.SetThemeName(this, "DeepBlue"); InitializeComponent(); this.Width = SQLInformation.Data.Config.ScreenWidth_SplashScreen; this.Height = SQLInformation.Data.Config.ScreenHeight_SplashScreen; } catch (Exception ex) { MessageBox.Show(ex.ToString()); MessageBox.Show(ex.InnerException.ToString()); } #if TRACE PLLog.Trace5("Exit", PLLOG_APPNAME, CLASS_BASE_ERRORNUMBER + 2, startTicks); #endif }
private void GetItems() { long startTicks = PLLog.Trace("GetItems Start()", PLLOG_APPNAME, CLASS_BASE_ERRORNUMBER + 1); double beginTicks; double bindingTicks; double fetchTicks; double firstTicks = startTicks; double frequency = Stopwatch.Frequency; beginTicks = startTicks; //// Initialize the Schema so it is available when we start accessing items. //HIS.Library.HISSchema schema = HIS.Library.Common.HISSchema; itemsAll = HIS.Library.ItemsAll2.Get(); itemsECLDataGrid.ItemsSource = itemsAll.Items; fetchTicks = PLLog.Trace("ItemsAll.Get()", PLLOG_APPNAME, CLASS_BASE_ERRORNUMBER + 1, startTicks); lblLoadTimeTotal.Content = string.Format("ItemsAll.Get() Load Time ({0:f4}) seconds", (fetchTicks - startTicks) / frequency); }
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); }
// TODO(crhodes): Add Fetch overload to take where clause. Explore criteria objects. private void DataPortal_Fetch(Guid criteria) { #if TRACE long startTicks = PLLog.Trace("Start", PLLOG_APPNAME, CLASS_BASE_ERRORNUMBER + 1); #endif using (var dalManager = HIS.DAL.DALFactory.GetManager()) { var dal = dalManager.GetProvider <HIS.DAL.IAttributeDAL>(); // TODO(crhodes): Redo Fetch to take Guid directly and not a where clause. using (var data = dal.Fetch(string.Format("where attribute_id = '{0}'", criteria.ToString()))) { data.Read(); Id = data.GetGuid(0); Name = data.GetString(1); LastChanged = data.GetDateTime(2); } } #if TRACE PLLog.Trace("End", PLLOG_APPNAME, CLASS_BASE_ERRORNUMBER + 3, startTicks); #endif }
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); } }
private static string ValidateExists_String(string configString) { string configValue = ConfigurationManager.AppSettings[configString]; if (configValue == null) { throw new ApplicationException(string.Format("Missing Config File Information: {0}", configString)); } // TODO(crhodes): Decide if want to bother reporting that come Config item is empty. // Some settings, e.g. Email_CC can be empty. Don't throw exception or catch it in the // particular items that can be empty. For now just log to get a feel if this is important at all. // May just want to remove the next lines completely. if (configValue.Length <= 0) { PLLog.Info(string.Format("Empty Config File Information: {0}", configString), PLLOG_APPNAME, CLASS_BASE_ERRORNUMBER + 5); //throw new ApplicationException(string.Format("Empty Config File Information: {0}", configString)); } return(configValue); }
public DateTime Insert(Guid constrainedvaluelist_id, int datatype_id, string name, string description, int nbritems, string who, string notes) { #if TRACE long startTicks = PLLog.Trace("Start", PLLOG_APPNAME, CLASS_BASE_ERRORNUMBER + 7); #endif DateTime lastUpdateTime; using (var sqlConn = ConnectionManager <SqlConnection> .GetManager("LocalDB")) { using (var sqlCmd = sqlConn.Connection.CreateCommand()) { sqlCmd.CommandType = CommandType.StoredProcedure; sqlCmd.CommandText = "ConstrainedValueLists_Insert"; sqlCmd.Parameters.AddWithValue("@constrainedvaluelist_id", constrainedvaluelist_id); sqlCmd.Parameters.AddWithValue("@datatype_id", datatype_id); sqlCmd.Parameters.AddWithValue("@name", name); sqlCmd.Parameters.AddWithValue("@description", description); sqlCmd.Parameters.AddWithValue("@nbritems", nbritems); sqlCmd.Parameters.AddWithValue("@who", who); sqlCmd.Parameters.AddWithValue("@notes", notes); try { lastUpdateTime = (DateTime)sqlCmd.ExecuteScalar(); } catch (Exception ex) { PLLog.Error(ex, PLLOG_APPNAME, CLASS_BASE_ERRORNUMBER + 8); throw new ApplicationException("ConstrainedValueLists_Insert"); } } } #if TRACE PLLog.Trace("End", PLLOG_APPNAME, CLASS_BASE_ERRORNUMBER + 9, startTicks); #endif return(lastUpdateTime); }
public DateTime Insert(Guid attributevalue_id, int table_id, Guid item_id, Guid typeattribute_id, string value, string who, string notes) { #if TRACE long startTicks = PLLog.Trace("Start", PLLOG_APPNAME, CLASS_BASE_ERRORNUMBER + 7); #endif DateTime lastUpdateTime; using (var sqlConn = ConnectionManager <SqlConnection> .GetManager("LocalDB")) { using (var sqlCmd = sqlConn.Connection.CreateCommand()) { sqlCmd.CommandType = CommandType.StoredProcedure; sqlCmd.CommandText = "AttributeValues_Insert"; sqlCmd.Parameters.AddWithValue("@attributevalue_id", attributevalue_id); sqlCmd.Parameters.AddWithValue("@table_id", table_id); sqlCmd.Parameters.AddWithValue("@item_id", item_id); sqlCmd.Parameters.AddWithValue("@typeattribute_id", typeattribute_id); sqlCmd.Parameters.AddWithValue("@value", value); sqlCmd.Parameters.AddWithValue("@who", who); sqlCmd.Parameters.AddWithValue("@notes", notes); try { lastUpdateTime = (DateTime)sqlCmd.ExecuteScalar(); } catch (Exception ex) { PLLog.Error(ex, PLLOG_APPNAME, CLASS_BASE_ERRORNUMBER + 8); throw new ApplicationException("AttributeValues_Insert"); } } } #if TRACE PLLog.Trace("End", PLLOG_APPNAME, CLASS_BASE_ERRORNUMBER + 9, startTicks); #endif return(lastUpdateTime); }
public static void SendEmail(MailMessage message) { if (Config.SMTP_Server != "") { SmtpClient smtp = new SmtpClient(Config.SMTP_Server); try { smtp.Send(message); } catch (Exception ex) { PLLog.Error(ex, PLLOG_APPNAME, CLASS_BASE_ERRORNUMBER + 8); throw new ApplicationException("Cannot Send Email"); } } else { // TODO(crhodes): Something about no SMTP throw new ApplicationException("SMTP Server not configured"); } }
private void LoadHISSchema() { long startTicks = PLLog.Trace("HISSchema Start()", PLLOG_APPNAME, CLASS_BASE_ERRORNUMBER + 1); double beginTicks; double bindingTicks; double firstTicks = startTicks; double frequency = Stopwatch.Frequency; beginTicks = startTicks; //HIS.Library.HISSchema_ChildLoad hisSchema = HIS.Library.HISSchema_ChildLoad.Get(); hisSchema = HIS.Library.HISSchema_ChildLoad.Get(); startTicks = PLLog.Trace("HISSchemaECL_ChildLoad.Get", PLLOG_APPNAME, CLASS_BASE_ERRORNUMBER + 1, startTicks); lblLoadTimeHISSchema.Content = string.Format("HISSchemaECL_ChildLoad.Get Parent Time ({0:f4}) seconds", (startTicks - beginTicks) / frequency); beginTicks = startTicks; //HIS.Library.ConstrainedValueListsECBL _ConstrainedValueLists = hisSchema.ConstrainedValueLists; HIS.Library.ConstrainedValueListsECL _ConstrainedValueLists = hisSchema.ConstrainedValueLists; bindingTicks = PLLog.Trace("HISSchemaECL_ChildLoad.ConstrainedValueLists()", PLLOG_APPNAME, CLASS_BASE_ERRORNUMBER + 1, startTicks); //constrainedValueListsECBLBindingSource.DataSource = _ConstrainedValueLists; constrainedValueListsECLDataGrid.ItemsSource = _ConstrainedValueLists; startTicks = PLLog.Trace("HISSchemaECL_ChildLoad.ConstrainedValueLists() Binding", PLLOG_APPNAME, CLASS_BASE_ERRORNUMBER + 1, startTicks); lblConstrainedValueLists.Content = string.Format("ConstrainedValueLists Time {0:f4} ({1:f4}) seconds", (startTicks - bindingTicks) / frequency, (bindingTicks - beginTicks) / frequency); beginTicks = startTicks; HIS.Library.ConstrainedValuesECL _ConstrainedValues = hisSchema.ConstrainedValues; bindingTicks = PLLog.Trace("HISSchemaECL_ChildLoad.Tables()", PLLOG_APPNAME, CLASS_BASE_ERRORNUMBER + 1, startTicks); // This shows all the values in the ConstrainedValues //constrainedValuesECLDataGrid.ItemsSource = _ConstrainedValues; // Instead we will selective load them from the SelectionChanged event. startTicks = PLLog.Trace("HISSchemaECL_ChildLoad.ConstrainedValues() Binding", PLLOG_APPNAME, CLASS_BASE_ERRORNUMBER + 1, startTicks); lblConstrainedValues.Content = string.Format("ConstrainedValues Time {0:f4} ({1:f4}) seconds", (startTicks - bindingTicks) / frequency, (bindingTicks - beginTicks) / frequency); lblLoadTimeTotal.Content = string.Format("Total Time ({0:f4}) seconds", (startTicks - firstTicks) / frequency); }
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.OutlookAppEvents(); Common.AppEvents.OutlookApplication = Globals.ThisAddIn.Application; } Common.OutlookHelper.OutlookApplication = Globals.ThisAddIn.Application; } catch (Exception ex) { PLLog.Error(ex, Common.PROJECT_NAME); } PLLog.Trace("Exit", Common.PROJECT_NAME); }
public void ProcessUsageAttributesXML(XmlDocument doc) { PLLog.Trace("Enter Method", "ODB"); try { XmlNode element = doc.DocumentElement.SelectSingleNode("//UsageAttributes"); if (element == null) { return; } foreach (XmlNode node in element.ChildNodes) { switch (node.Name) { case "UsageAttribute": int id = int.Parse(node.Attributes.GetNamedItem("id").Value); string name = node.Attributes.GetNamedItem("name").Value; string description = node.Attributes.GetNamedItem("description").Value; // For some reason this fails with exception - Message "Invalid object name 'usageAttributes'." odbContext.UsageAttributes_Insert(id, name, description, "crhodes", ""); //UsageAttribute usageAttribute = new UsageAttribute(); //usageAttribute.usageattribute_id = id; //usageAttribute.usageattribute_name = name; //usageAttribute.usageattribute_description = description; //odbContext.UsageAttributes.InsertOnSubmit(usageAttribute); //odbContext.SubmitChanges(); break; case "ClearAll": var rows = from r in odbContext.UsageAttributes select r; foreach (UsageAttribute row in rows) { odbContext.UsageAttributes.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 ProcessItemTypesXML(XmlDocument doc) { PLLog.Trace("Enter Method", "ODB"); try { XmlNode element = doc.DocumentElement.SelectSingleNode("//ItemTypes"); foreach (XmlNode node in element.ChildNodes) { switch (node.Name) { case "ItemType": string id = node.Attributes.GetNamedItem("id").Value; string name = node.Attributes.GetNamedItem("name").Value; string group = node.Attributes.GetNamedItem("group").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); if (group == "") { ODBHelper.odbContext.ItemTypes_Insert(gid, name, null, version, description, "crhodes", ""); } else { Guid ggroup = new Guid(group); ODBHelper.odbContext.ItemTypes_Insert(gid, name, ggroup, version, description, "crhodes", ""); } break; case "ClearAll": var rows = from r in odbContext.ItemTypes select r; foreach (ItemType row in rows) { odbContext.ItemTypes.DeleteOnSubmit(row); } odbContext.SubmitChanges(); break; default: break; } } } catch (Exception ex) { PLLog.Error(ex, "ODB"); throw; } PLLog.Trace("Exit Method", "ODB"); }
public void ProcessAssociationRulesXML(XmlDocument doc) { PLLog.Trace("Enter Method", "ODB"); try { XmlNode element = doc.DocumentElement.SelectSingleNode("//AssociationRules"); if (element == null) { return; } foreach (XmlNode node in element.ChildNodes) { switch (node.Name) { case "AssociationRule": string id = node.Attributes.GetNamedItem("id").Value; if (id == "NewGuid") { id = Guid.NewGuid().ToString(); } Guid gid = new Guid(id); int tablebegin = int.Parse(node.Attributes.GetNamedItem("tablebegin").Value); Guid itembegin = new Guid(node.Attributes.GetNamedItem("itembegin").Value); int tableend = int.Parse(node.Attributes.GetNamedItem("tablebegin").Value); Guid itemend = new Guid(node.Attributes.GetNamedItem("itemend").Value); int associationtype = int.Parse(node.Attributes.GetNamedItem("associationtype").Value); //ODBHelper.odbContext.AssociationRules_Insert(gid, tablebegin, itembegin, tableend, itemend, associationtype, "crhodes", ""); //using (var ctx = ContextManager<ProjectTracker.DalLinq.PTrackerDataContext>.GetManager(ProjectTracker.DalLinq.Database.PTracker)) //{ // System.Data.Linq.Binary lastChanged = null; // ctx.DataContext.addAssignment(projectId, resourceId, assigned, role, ref lastChanged); // return lastChanged.ToArray(); //} using (var ctx = ContextManager <ODBClassesDataContext> .GetManager("ODB")) { System.Data.Linq.Binary lastChanged = null; ctx.DataContext.AssociationRules_Insert(gid, tablebegin, itembegin, tableend, itemend, associationtype, "crhodes", ""); //return lastChanged.ToArray(); } break; case "ClearAll": var rows = from r in odbContext.AssociationRules select r; foreach (AssociationRule row in rows) { odbContext.AssociationRules.DeleteOnSubmit(row); } odbContext.SubmitChanges(); break; default: break; } } } catch (Exception ex) { PLLog.Error(ex, "ODB"); throw; } PLLog.Trace("Exit Method", "ODB"); }
public void ProcessDataTypesXML(XmlDocument doc) { PLLog.Trace("Enter Method", "ODB"); try { XmlNode element = doc.DocumentElement.SelectSingleNode("//DataTypes"); if (element == null) { return; } foreach (XmlNode node in element.ChildNodes) { switch (node.Name) { case "DataType": int id = int.Parse(node.Attributes.GetNamedItem("id").Value); string name = node.Attributes.GetNamedItem("name").Value; string description = node.Attributes.GetNamedItem("description").Value; // For some reason this fails with exception: Message "Operand type clash: int is incompatible with uniqueidentifier" // Turns out it was on ActivityLog_Insert. Expected odbContext.DataTypes_Insert(id, name, description, "crhodes", ""); //DataType dataType = new DataType(); //dataType.datatype_id = id; //dataType.datatype_name = name; //dataType.datatype_description = description; //odbContext.DataTypes.InsertOnSubmit(dataType); //odbContext.SubmitChanges(); break; case "ClearAll": var rows = from r in odbContext.DataTypes select r; foreach (DataType row in rows) { odbContext.DataTypes.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"); }