/// <summary> /// Gets the industries. /// </summary> private void BindIndustries() { ContactServiceClient contactService = null; try { contactService = new ContactServiceClient(); CollectionRequest collectionRequest = new CollectionRequest(); IndustrySearchCriteria searchCriteria = new IndustrySearchCriteria(); IndustrySearchReturnValue returnValue = contactService.IndustrySearch(_logonSettings.LogonId, collectionRequest, searchCriteria); if (returnValue.Success) { //Add a blank item AppFunctions.AddDefaultToDropDownList(_ddlIndustry); //Generate the items to be displayed in the Industry drop down list //Get the main items string industryText = string.Empty; foreach (IndustrySearchItem industry in returnValue.Industries.Rows) { if (industry.ParentId == 0) { industryText = industry.Name; _ddlIndustry.Items.Add(new ListItem(industryText, industry.Id.ToString())); // Call method to get the sub items GetIndustrySubItems(returnValue.Industries.Rows, industryText, industry.Id); } } } else { throw new Exception(returnValue.Message); } } catch (System.ServiceModel.EndpointNotFoundException) { _lblError.Text = DataConstants.WSEndPointErrorMessage; _lblError.CssClass = "errorMessage"; } catch (Exception ex) { _lblError.Text = ex.Message; _lblError.CssClass = "errorMessage"; } finally { if (contactService != null) { if (contactService.State != System.ServiceModel.CommunicationState.Faulted) { contactService.Close(); } } } }
/// <summary> /// Gets the industries. /// </summary> private void GetIndustries() { ContactServiceClient contactService = null; try { contactService = new ContactServiceClient(); CollectionRequest collectionRequest = new CollectionRequest(); IndustrySearchCriteria searchCriteria = new IndustrySearchCriteria(); IndustrySearchReturnValue returnValue = contactService.IndustrySearch(_logonId, collectionRequest, searchCriteria); if (returnValue.Success) { //Add a blank item _ddlIndustry.Items.Add(new ListItem("", "0")); //Generate the items to be displayed in the Industry drop down list //Get the main items string industryText = string.Empty; foreach (IndustrySearchItem industry in returnValue.Industries.Rows) { if (industry.ParentId == 0) { industryText = industry.Name; _ddlIndustry.Items.Add(new ListItem(industryText, industry.Id.ToString())); // Call method to get the sub items GetIndustrySubItems(returnValue.Industries.Rows, industryText, industry.Id); } } } else { throw new Exception(returnValue.Message); } } catch (Exception ex) { throw ex; } finally { if (contactService != null) { if (contactService.State != System.ServiceModel.CommunicationState.Faulted) { contactService.Close(); } } } }
/// <summary> /// Gets the industries. /// </summary> private void GetIndustries() { ContactServiceClient contactService = null; try { contactService = new ContactServiceClient(); CollectionRequest collectionRequest = new CollectionRequest(); IndustrySearchCriteria searchCriteria = new IndustrySearchCriteria(); IndustrySearchReturnValue returnValue = contactService.IndustrySearch(_logonId, collectionRequest, searchCriteria); if (returnValue.Success) { //Add a blank item _ddlIndustry.Items.Add(new ListItem("", "0")); //Generate the items to be displayed in the Industry drop down list //Get the main items string industryText = string.Empty; foreach (IndustrySearchItem industry in returnValue.Industries.Rows) { if (industry.ParentId == 0) { industryText = industry.Name; _ddlIndustry.Items.Add(new ListItem(industryText, industry.Id.ToString())); // Call method to get the sub items GetIndustrySubItems(returnValue.Industries.Rows, industryText, industry.Id); } } } else { throw new Exception(returnValue.Message); } } catch (Exception ex) { throw ex; } finally { if (contactService != null) { if (contactService.State != System.ServiceModel.CommunicationState.Faulted) contactService.Close(); } } }
/// <summary> /// Gets the industries. /// </summary> private void BindIndustries() { ContactServiceClient contactService = null; try { contactService = new ContactServiceClient(); CollectionRequest collectionRequest = new CollectionRequest(); IndustrySearchCriteria searchCriteria = new IndustrySearchCriteria(); IndustrySearchReturnValue returnValue = contactService.IndustrySearch(_logonSettings.LogonId, collectionRequest, searchCriteria); if (returnValue.Success) { //Add a blank item AppFunctions.AddDefaultToDropDownList(_ddlIndustry); //Generate the items to be displayed in the Industry drop down list //Get the main items string industryText = string.Empty; foreach (IndustrySearchItem industry in returnValue.Industries.Rows) { if (industry.ParentId == 0) { industryText = industry.Name; _ddlIndustry.Items.Add(new ListItem(industryText, industry.Id.ToString())); // Call method to get the sub items GetIndustrySubItems(returnValue.Industries.Rows, industryText, industry.Id); } } } else { throw new Exception(returnValue.Message); } } catch (System.ServiceModel.EndpointNotFoundException) { _lblMessage.Text = DataConstants.WSEndPointErrorMessage; _lblMessage.CssClass = "errorMessage"; } catch (Exception ex) { _lblMessage.Text = ex.Message; _lblMessage.CssClass = "errorMessage"; } finally { if (contactService != null) { if (contactService.State != System.ServiceModel.CommunicationState.Faulted) contactService.Close(); } } }