Beispiel #1
0
        /// <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 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>
        /// 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();
                }
            }
        }