/// <summary> /// Gets the person. /// </summary> /// <param name="oHostSecurityToken">HostSecurityToken obtained when security provider of IWS is called</param> /// <param name="memberId">The member id.</param> /// <returns></returns> public PersonReturnValue GetPerson(HostSecurityToken oHostSecurityToken, Guid memberId) { PersonReturnValue returnValue = null; if (Functions.ValidateIWSToken(oHostSecurityToken)) { oContactService = new ContactService(); returnValue = oContactService.GetPerson(Functions.GetLogonIdFromToken(oHostSecurityToken), memberId); } else { returnValue = new PersonReturnValue(); returnValue.Success = false; returnValue.Message = "Invalid Token"; } return(returnValue); }
/// <summary> /// Gets the name of the person to perform the conflict check. /// </summary> /// <returns></returns> private string GetPersonName(Guid memberId) { string name = string.Empty; ContactServiceClient contactService = null; try { contactService = new ContactServiceClient(); PersonReturnValue returnValue = contactService.GetPerson(_logonSettings.LogonId, memberId); if (returnValue.Success) { if (returnValue.Person != null) { name = returnValue.Person.Surname; } } else { throw new Exception(returnValue.Message); } } catch (Exception ex) { throw ex; } finally { if (contactService != null) { if (contactService.State != System.ServiceModel.CommunicationState.Faulted) { contactService.Close(); } } } return(name); }
/// <summary> /// Gets the person. /// </summary> /// <param name="logonId">Logon id obtained when logging on to the logon service.</param> /// <param name="memberId">The member id.</param> /// <returns></returns> public PersonReturnValue GetPerson(Guid logonId, Guid memberId) { PersonReturnValue returnValue = new PersonReturnValue(); 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: if (!ApplicationSettings.Instance.IsUser(memberId, DataConstants.DummyGuid)) throw new Exception("Access denied"); break; case DataConstants.UserType.ThirdParty: if (!ApplicationSettings.Instance.IsUser(memberId, DataConstants.DummyGuid)) throw new Exception("Access denied"); break; default: throw new Exception("Access denied"); } DsPersons dsPersons = SrvPersonLookup.GetPerson(memberId); if (dsPersons.Persons.Rows.Count > 0) { returnValue.Person = new Person(); returnValue.Person.MemberId = dsPersons.Persons[0].MemberID; returnValue.Person.Title = dsPersons.Persons[0].PersonTitle.Trim(); returnValue.Person.ForeName = dsPersons.Persons[0].PersonName.Trim(); returnValue.Person.Surname = dsPersons.Persons[0].PersonSurname.Trim(); returnValue.Person.MaritalStatusId = dsPersons.Persons[0].MaritalID; returnValue.Person.PreviousName = dsPersons.Persons[0].personPrevName.Trim(); returnValue.Person.Occupation = dsPersons.Persons[0].personOccupation.Trim(); returnValue.Person.SalutationLettterFormal = dsPersons.Persons[0].personSalletForm.Trim(); returnValue.Person.SalutationLettterInformal = dsPersons.Persons[0].personSallet.Trim(); returnValue.Person.SalutationLettterFriendly = dsPersons.Persons[0].personSalletfriend.Trim(); returnValue.Person.SalutationEnvelope = dsPersons.Persons[0].personSalEnv.Trim(); returnValue.Person.Sex = dsPersons.Persons[0].personSex; returnValue.Person.DOB = dsPersons.Persons[0].PersonDOB; returnValue.Person.DOD = dsPersons.Persons[0].personDOD; returnValue.Person.PlaceOfBirth = dsPersons.Persons[0].personPlaceOfBirth.Trim(); returnValue.Person.BirthName = dsPersons.Persons[0].personBirthName.Trim(); returnValue.Person.EthnicityId = dsPersons.Persons[0].personEthnic; returnValue.Person.DisabilityId = dsPersons.Persons[0].personDisabled; returnValue.Person.IsInArmedForces = dsPersons.Persons[0].personInArmedForces; returnValue.Person.ArmedForcesNo = dsPersons.Persons[0].personArmedForcesNo; returnValue.Person.NINo = dsPersons.Persons[0].personNHINo; } } 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> /// Loads the contact details. /// </summary> private void LoadContact() { ContactServiceClient serviceClient = null; try { serviceClient = new ContactServiceClient(); //_contactReturnValue = serviceClient.GetGeneralContact(_logonSettings.LogonId, _memberId, _organisationId); if (_memberId != DataConstants.DummyGuid) { _personReturnValue = serviceClient.GetPerson(_logonSettings.LogonId, _memberId); if (_personReturnValue.Success) { DisplayContactData(); } else { throw new Exception(_contactReturnValue.Message); } } else if (_organisationId != DataConstants.DummyGuid) { _organisationReturnValue = serviceClient.GetOrganisation(_logonSettings.LogonId, _organisationId); if (_organisationReturnValue.Success) { DisplayContactData(); } else { throw new Exception(_contactReturnValue.Message); } } } catch (Exception ex) { throw ex; } finally { if (serviceClient != null) { if (serviceClient.State != System.ServiceModel.CommunicationState.Faulted) serviceClient.Close(); } } }
/// <summary> /// Gets the person. /// </summary> /// <param name="oHostSecurityToken">HostSecurityToken obtained when security provider of IWS is called</param> /// <param name="memberId">The member id.</param> /// <returns></returns> public PersonReturnValue GetPerson(HostSecurityToken oHostSecurityToken, Guid memberId) { PersonReturnValue returnValue = null; if (Functions.ValidateIWSToken(oHostSecurityToken)) { oContactService = new ContactService(); returnValue = oContactService.GetPerson(Functions.GetLogonIdFromToken(oHostSecurityToken), memberId); } else { returnValue = new PersonReturnValue(); returnValue.Success = false; returnValue.Message = "Invalid Token"; } return returnValue; }