/// <summary> /// Adds a new service. /// </summary> /// <param name="oHostSecurityToken">HostSecurityToken obtained when security provider of IWS is called</param> /// <param name="serviceAddress">The service address.</param> /// <param name="serviceAdditionalElement">The service additional element.</param> /// <param name="serviceInfo">The service info.</param> /// <param name="serviceContactInfo">The service contact info.</param> /// <param name="serviceContactAddress">The service contact address.</param> /// <param name="ServiceContactAdditionalElement">The service contact additional element.</param> /// <param name="conflictNoteSummary">The conflict note summary.</param> /// <param name="conflictNoteContent">Content of the conflict note.</param> /// <returns></returns> public ReturnValue SaveService(HostSecurityToken oHostSecurityToken, Address serviceAddress, AdditionalAddressElement[] serviceAdditionalElement, ServiceInfo serviceInfo, ServiceContact serviceContactInfo, Address serviceContactAddress, AdditionalAddressElement[] ServiceContactAdditionalElement, string conflictNoteSummary, string conflictNoteContent) { ReturnValue returnValue = null; if (Functions.ValidateIWSToken(oHostSecurityToken)) { oContactService = new ContactService(); returnValue = oContactService.SaveService(Functions.GetLogonIdFromToken(oHostSecurityToken), serviceAddress, serviceAdditionalElement, serviceInfo, serviceContactInfo, serviceContactAddress, ServiceContactAdditionalElement, conflictNoteSummary, conflictNoteContent); } else { returnValue = new ReturnValue(); returnValue.Success = false; returnValue.Message = "Invalid Token"; } return(returnValue); }
/// <summary> /// Create Service contract /// </summary> private void CreateServiceContact(string conflictNoteSummary, string conflictNoteContent) { ContactServiceClient contactService = null; try { ServiceContact serviceContactInfo = new ServiceContact(); serviceContactInfo.ServiceId = new Guid(Convert.ToString(ViewState["ServiceId"])); serviceContactInfo.ServiceName = Convert.ToString(ViewState["ServiceName"]); serviceContactInfo.SurName = _cdContactDetails.SurName; serviceContactInfo.ForeName = _cdContactDetails.ForeName; serviceContactInfo.Title = _cdContactDetails.Title; if (_cdContactDetails.Sex != string.Empty) { serviceContactInfo.Sex = int.Parse(_cdContactDetails.Sex); } serviceContactInfo.Position = _cdContactDetails.Position; //Get the address details Address address = new Address(); address = _addressDetails.Address; contactService = new ContactServiceClient(); ReturnValue returnValue = contactService.SaveServiceContact(_logonSettings.LogonId, address, _aadContactInfo.AdditionalDetails, serviceContactInfo, conflictNoteSummary, conflictNoteContent); if (returnValue.Success) { _wizardContact.Visible = true; Session["SuccessMesage"] = "Service 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> /// Méthode pour charger un contact depuis le model (service contacts) /// On accède au service de façon très simple par un new, pas d'IOC ici... /// </summary> private void ChargeContact() { ServiceContact service = new ServiceContact(); Contact Contact = service.Charger(); if (Contact != null) { this.ID = Contact.ID; this.Nom = Contact.Nom; this.Prenom = Contact.Prenom; this.Age = Contact.Age; this.Homme = Contact.Homme; } }
/// <summary> /// Saves the service contact. /// </summary> /// <param name="logonId">Logon id obtained when logging on to the logon service.</param> /// <param name="contactAddress">The contact address.</param> /// <param name="additionalElement">The additional element.</param> /// <param name="serviceContact">The service contact.</param> /// <param name="conflictNoteSummary">The conflict note summary.</param> /// <param name="conflictNoteContent">Content of the conflict note.</param> /// <returns></returns> public ReturnValue SaveServiceContact(Guid logonId, Address contactAddress, AdditionalAddressElement[] additionalElement, ServiceContact serviceContact, string conflictNoteSummary, string conflictNoteContent) { ReturnValue returnValue = new ReturnValue(); try { // Get the logged on user from the current logons and add their // ApplicationSettings the list of concurrent sessions. Host.LoadLoggedOnUser(logonId); try { Functions.RestrictRekoopIntegrationUser(UserInformation.Instance.DbUid); switch (UserInformation.Instance.UserType) { case DataConstants.UserType.Staff: // Can do everything break; case DataConstants.UserType.Client: case DataConstants.UserType.ThirdParty: if (!ApplicationSettings.Instance.IsUser(additionalElement[0].MemberId, additionalElement[0].OrganisationId)) throw new Exception("Access denied"); break; default: throw new Exception("Access denied"); } SrvServiceContact serviceContactSrv = new SrvServiceContact(); SrvAddress srvAddress = new SrvAddress(); this.SetAddressValue(srvAddress, contactAddress); // Save Additional Address Info to Address Object if (additionalElement != null) { for (int i = 0; i <= 9; i++) { srvAddress.AdditionalInfoElements[i].AddressElementText = additionalElement[i].ElementText; } } serviceContactSrv.Addresses.Add(srvAddress); serviceContactSrv.ServiceId = serviceContact.ServiceId; serviceContactSrv.Person.ForeName = serviceContact.ForeName; serviceContactSrv.Person.Surname = serviceContact.SurName; serviceContactSrv.Person.Title = serviceContact.Title; serviceContactSrv.Position = serviceContact.Position; serviceContactSrv.Person.Sex = serviceContact.Sex; //These two notes fields are mandatory and have defined //default values serviceContactSrv.ConflictNoteSummary = conflictNoteSummary; serviceContactSrv.ConflictNoteContent = conflictNoteContent; string errorMessage; returnValue.Success = serviceContactSrv.Save(out errorMessage); returnValue.Message = errorMessage; } finally { // Remove the logged on user's ApplicationSettings from the // list of concurrent sessions Host.UnloadLoggedOnUser(); } } catch (System.Data.SqlClient.SqlException) { returnValue.Success = false; returnValue.Message = Functions.SQLErrorMessage; } catch (Exception ex) { returnValue.Success = false; returnValue.Message = ex.Message; } return returnValue; }
/// <summary> /// Adds a new service. /// </summary> /// <param name="logonId">Logon id obtained when logging on to the logon service.</param> /// <param name="serviceAddress">The service address.</param> /// <param name="serviceAdditionalElement">The service additional element.</param> /// <param name="serviceInfo">The service info.</param> /// <param name="serviceContactInfo">The service contact info.</param> /// <param name="serviceContactAddress">The service contact address.</param> /// <param name="ServiceContactAdditionalElement">The service contact additional element.</param> /// <param name="conflictNoteSummary">The conflict note summary.</param> /// <param name="conflictNoteContent">Content of the conflict note.</param> /// <returns></returns> public ReturnValue SaveService(Guid logonId, Address serviceAddress, AdditionalAddressElement[] serviceAdditionalElement, ServiceInfo serviceInfo, ServiceContact serviceContactInfo, Address serviceContactAddress, AdditionalAddressElement[] ServiceContactAdditionalElement, string conflictNoteSummary, string conflictNoteContent) { ReturnValue returnValue = new ReturnValue(); try { // Get the logged on user from the current logons and add their // ApplicationSettings the list of concurrent sessions. Host.LoadLoggedOnUser(logonId); try { Functions.RestrictRekoopIntegrationUser(UserInformation.Instance.DbUid); switch (UserInformation.Instance.UserType) { case DataConstants.UserType.Staff: // Can do everything break; case DataConstants.UserType.Client: case DataConstants.UserType.ThirdParty: if (!ApplicationSettings.Instance.IsUser(serviceAdditionalElement[0].MemberId, serviceAdditionalElement[0].OrganisationId)) throw new Exception("Access denied"); break; default: throw new Exception("Access denied"); } SrvService service = new SrvService(); SrvAddress srvAddress = new SrvAddress(); this.SetAddressValue(srvAddress, serviceAddress); // Save Additional Address Info to Address Object if (serviceAdditionalElement != null) { for (int i = 0; i <= 9; i++) { srvAddress.AdditionalInfoElements[i].AddressElementText = serviceAdditionalElement[i].ElementText; } } service.Addresses.Add(srvAddress); service.Name = serviceInfo.ServiceName; service.NetId = SrvServiceCommon.GenerateNumericPassword(6); service.NetPassword = SrvServiceCommon.GenerateStringPassword(10); service.Organisation.IndustryId = serviceInfo.IndustryId; service.Addresses[0].AddressTypeId = Convert.ToInt32(DataConstants.SystemAddressTypes.Main); service.Addresses[0].MemberId = DataConstants.DummyGuid; service.Addresses[0].OrganisationId = DataConstants.DummyGuid; service.ServiceContact[0].Description = serviceContactInfo.Description; service.ServiceContact[0].Position = serviceContactInfo.Position; service.ServiceContact[0].Person.ForeName = serviceContactInfo.ForeName; service.ServiceContact[0].Person.Surname = serviceContactInfo.SurName; service.ServiceContact[0].Person.Title = serviceContactInfo.Title; service.ServiceContact[0].Person.Sex = serviceContactInfo.Sex; service.ServiceContact[0].ConflictNoteContent = conflictNoteContent; service.ServiceContact[0].ConflictNoteSummary = conflictNoteSummary; SrvAddress contactAddress = new SrvAddress(); this.SetAddressValue(contactAddress, serviceContactAddress); // Save Additional Address Info to Address Object if (ServiceContactAdditionalElement != null) { for (int i = 0; i <= 9; i++) { contactAddress.AdditionalInfoElements[i].AddressElementText = ServiceContactAdditionalElement[i].ElementText; } } service.ServiceContact[0].Addresses.Add(contactAddress); service.ServiceContact[0].Addresses[0].MemberId = DataConstants.DummyGuid; service.ServiceContact[0].Addresses[0].OrganisationId = DataConstants.DummyGuid; string errorMessage; returnValue.Success = service.Save(out errorMessage); returnValue.Message = errorMessage; } finally { // Remove the logged on user's ApplicationSettings from the // list of concurrent sessions Host.UnloadLoggedOnUser(); } } catch (System.Data.SqlClient.SqlException) { returnValue.Success = false; returnValue.Message = Functions.SQLErrorMessage; } catch (Exception ex) { returnValue.Success = false; returnValue.Message = ex.Message; } return returnValue; }
/// <summary> /// Create Service contract /// </summary> private void CreateServiceContact(string conflictNoteSummary, string conflictNoteContent) { ContactServiceClient contactService = null; try { ServiceContact serviceContactInfo = new ServiceContact(); serviceContactInfo.ServiceId = new Guid(Convert.ToString(ViewState["ServiceId"])); serviceContactInfo.ServiceName = Convert.ToString(ViewState["ServiceName"]); serviceContactInfo.SurName = _cdContactDetails.SurName; serviceContactInfo.ForeName = _cdContactDetails.ForeName; serviceContactInfo.Title = _cdContactDetails.Title; if (_cdContactDetails.Sex!=string.Empty) serviceContactInfo.Sex = int.Parse(_cdContactDetails.Sex); serviceContactInfo.Position = _cdContactDetails.Position; //Get the address details Address address = new Address(); address = _addressDetails.Address; contactService = new ContactServiceClient(); ReturnValue returnValue = contactService.SaveServiceContact(_logonSettings.LogonId, address, _aadContactInfo.AdditionalDetails, serviceContactInfo, conflictNoteSummary, conflictNoteContent); if (returnValue.Success) { _wizardContact.Visible = true; Session["SuccessMesage"] = "Service 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 Service /// </summary> private void CreateService(string conflictNoteSummary, string conflictNoteContent) { ContactServiceClient contactService = null; try { ServiceInfo serviceInfo = new ServiceInfo(); serviceInfo.ServiceName = _txtServiceName.Text; serviceInfo.IndustryId = Convert.ToInt32(_ddlIndustry.SelectedValue); //Get the address details Address serviceAddress = _addressDetails.Address; // Stores Service contact details entered by the user ServiceContact serviceContactInfo = new ServiceContact(); serviceContactInfo.ServiceName = _ssService.ServiceText; serviceContactInfo.SurName = _cdServiceContactDetails.SurName; serviceContactInfo.ForeName = _cdServiceContactDetails.ForeName; serviceContactInfo.Title = _cdServiceContactDetails.Title; serviceContactInfo.Sex = Convert.ToInt32(false); serviceContactInfo.Position = _cdServiceContactDetails.Position; serviceContactInfo.Description = _cdServiceContactDetails.Description; //Get the address details Address contactAddress = _addressServiceDetails.Address; contactService = new ContactServiceClient(); ReturnValue returnValue = contactService.SaveService(_logonSettings.LogonId, serviceAddress, _aadServiceAddressInfo.AdditionalDetails, serviceInfo, serviceContactInfo, contactAddress, _aadContactInfo.AdditionalDetails, conflictNoteSummary, conflictNoteContent); if (returnValue.Success) { _wizardContact.Visible = true; Session["SuccessMesage"] = "Service 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> /// Saves the service contact. /// </summary> /// <param name="oHostSecurityToken">HostSecurityToken obtained when security provider of IWS is called</param> /// <param name="contactAddress">The contact address.</param> /// <param name="additionalElement">The additional element.</param> /// <param name="serviceContact">The service contact.</param> /// <param name="conflictNoteSummary">The conflict note summary.</param> /// <param name="conflictNoteContent">Content of the conflict note.</param> /// <returns></returns> public ReturnValue SaveServiceContact(HostSecurityToken oHostSecurityToken, Address contactAddress, AdditionalAddressElement[] additionalElement, ServiceContact serviceContact, string conflictNoteSummary, string conflictNoteContent) { ReturnValue returnValue = null; if (Functions.ValidateIWSToken(oHostSecurityToken)) { oContactService = new ContactService(); returnValue = oContactService.SaveServiceContact(Functions.GetLogonIdFromToken(oHostSecurityToken), contactAddress, additionalElement, serviceContact, conflictNoteSummary, conflictNoteContent); } else { returnValue = new ReturnValue(); returnValue.Success = false; returnValue.Message = "Invalid Token"; } return returnValue; }
public NouveauContact(ServiceContact serviceContact) { InitializeComponent(); this.serviceContact = serviceContact; }
/// <summary> /// Create Service /// </summary> private void CreateService(string conflictNoteSummary, string conflictNoteContent) { ContactServiceClient contactService = null; try { ServiceInfo serviceInfo = new ServiceInfo(); serviceInfo.ServiceName = _txtServiceName.Text; serviceInfo.IndustryId = Convert.ToInt32(_ddlIndustry.SelectedValue); //Get the address details Address serviceAddress = _addressDetails.Address; // Stores Service contact details entered by the user ServiceContact serviceContactInfo = new ServiceContact(); serviceContactInfo.ServiceName = _ssService.ServiceText; serviceContactInfo.SurName = _cdServiceContactDetails.SurName; serviceContactInfo.ForeName = _cdServiceContactDetails.ForeName; serviceContactInfo.Title = _cdServiceContactDetails.Title; serviceContactInfo.Sex = Convert.ToInt32(false); serviceContactInfo.Position = _cdServiceContactDetails.Position; serviceContactInfo.Description = _cdServiceContactDetails.Description; //Get the address details Address contactAddress = _addressServiceDetails.Address; contactService = new ContactServiceClient(); ReturnValue returnValue = contactService.SaveService(_logonSettings.LogonId, serviceAddress, _aadServiceAddressInfo.AdditionalDetails, serviceInfo, serviceContactInfo, contactAddress, _aadContactInfo.AdditionalDetails, conflictNoteSummary, conflictNoteContent); if (returnValue.Success) { _wizardContact.Visible = true; Session["SuccessMesage"] = "Service 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(); } } } }