예제 #1
0
        /// <summary>
        /// Gets the name of the organisation to perform conflict check.
        /// </summary>
        /// <param name="clientId">The client id.</param>
        /// <returns></returns>
        private string GetOrganisationName(Guid clientId)
        {
            string name = string.Empty;
            ContactServiceClient contactService = null;

            try
            {
                contactService = new ContactServiceClient();
                OrganisationReturnValue returnValue = contactService.GetOrganisation(_logonSettings.LogonId, clientId);

                if (returnValue.Success)
                {
                    if (returnValue.Organisation != null)
                    {
                        name = returnValue.Organisation.Name;
                    }
                }
                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 organisation to perform conflict check.
        /// </summary>
        /// <param name="clientId">The client id.</param>
        /// <returns></returns>
        private string GetOrganisationName(Guid clientId)
        {
            string name = string.Empty;
            ContactServiceClient contactService = null;

            try
            {
                contactService = new ContactServiceClient();
                OrganisationReturnValue returnValue = contactService.GetOrganisation(_logonSettings.LogonId, clientId);

                if (returnValue.Success)
                {
                    if (returnValue.Organisation != null)
                    {
                        name = returnValue.Organisation.Name;
                    }
                }
                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();
                }
            }
        }