Exemple #1
0
        /// <summary>
        /// Gets the industry for the association role
        /// </summary>
        /// <param name="associationRoleId">The association role id.</param>
        private int GetIndustryForAssociationRole(int associationRoleId)
        {
            int industryId = -1;

            if (_hdnIsSpecialisedSearch.Value == "true")
            {
                ContactServiceClient contactService = null;
                try
                {
                    contactService = new ContactServiceClient();
                    IndustrySearchCriteria searchCriteria = new IndustrySearchCriteria();
                    searchCriteria.AssociationRoleId = associationRoleId;
                    IndustryForAssociationRoleReturnValue returnValue = contactService.GetIndustryForAssociationRole(_logonSettings.LogonId,
                                                                                                                     searchCriteria);
                    if (returnValue.Success)
                    {
                        industryId = returnValue.IndustryId;
                    }
                    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(industryId);
        }
 /// <summary>
 /// Gets the industry for the association role
 /// </summary>
 /// <param name="associationRoleId">The association role id.</param>
 private int GetIndustryForAssociationRole(int associationRoleId)
 {
     int industryId = -1;
     if (_hdnIsSpecialisedSearch.Value == "true")
     {
         ContactServiceClient contactService = null;
         try
         {
             contactService = new ContactServiceClient();
             IndustrySearchCriteria searchCriteria = new IndustrySearchCriteria();
             searchCriteria.AssociationRoleId = associationRoleId;
             IndustryForAssociationRoleReturnValue returnValue = contactService.GetIndustryForAssociationRole(_logonSettings.LogonId,
                                                              searchCriteria);
             if (returnValue.Success)
             {
                 industryId = returnValue.IndustryId;
             }
             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 industryId;
 }