/// <summary> /// Create General contact for Individual and Organisation Contact Type /// </summary> private void CreateGeneralContact(string conflictNoteSummary, string conflictNoteContent) { ContactServiceClient contactService = null; try { Person person = null; Organisation organisation = null; ContactType contactType = ContactType.Individual; if (_ddlContactType.Text == "Individual") { person = new Person(); person.ForeName = _txtForename.Text; person.Surname = _txtSurname.Text; person.Title = _ddlTitle.Text; contactType = ContactType.Individual; } if (_ddlContactType.Text == "Organisation") { organisation = new Organisation(); organisation.Name = _txtOrgName.Text; contactType = ContactType.Organisation; } // Gets the address details Address address = new Address(); address = _addressDetails.Address; address.TypeId = 1; contactService = new ContactServiceClient(); ReturnValue returnValue = contactService.SaveGeneralContact(_logonSettings.LogonId, address, person, _aadContactInfo.AdditionalDetails, contactType, organisation, conflictNoteSummary, conflictNoteContent); if (returnValue.Success) { _wizardContact.Visible = true; Session["SuccessMesage"] = "General Contact saved successfully"; ResetControls(); } else { _lblError.CssClass = "errorMessage"; _lblError.Text = returnValue.Message; } } catch (Exception ex) { throw ex; } finally { if (contactService != null) { if (contactService.State != System.ServiceModel.CommunicationState.Faulted) contactService.Close(); } } }
/// <summary> /// Create General contact for Individual and Organisation Contact Type /// </summary> private void CreateGeneralContact(string conflictNoteSummary, string conflictNoteContent) { ContactServiceClient contactService = null; try { Person person = null; Organisation organisation = null; ContactType contactType = ContactType.Individual; if (_ddlContactType.Text == "Individual") { person = new Person(); person.ForeName = _txtForename.Text; person.Surname = _txtSurname.Text; person.Title = _ddlTitle.Text; contactType = ContactType.Individual; } if (_ddlContactType.Text == "Organisation") { organisation = new Organisation(); organisation.Name = _txtOrgName.Text; contactType = ContactType.Organisation; } // Gets the address details Address address = new Address(); address = _addressDetails.Address; address.TypeId = 1; contactService = new ContactServiceClient(); ReturnValue returnValue = contactService.SaveGeneralContact(_logonSettings.LogonId, address, person, _aadContactInfo.AdditionalDetails, contactType, organisation, conflictNoteSummary, conflictNoteContent); if (returnValue.Success) { _wizardContact.Visible = true; Session["SuccessMesage"] = "General Contact saved successfully"; ResetControls(); } else { _lblError.CssClass = "errorMessage"; _lblError.Text = returnValue.Message; } } catch (Exception ex) { throw ex; } finally { if (contactService != null) { if (contactService.State != System.ServiceModel.CommunicationState.Faulted) { contactService.Close(); } } } }