Beispiel #1
0
        /// <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();
                    }
                }
            }
        }
Beispiel #2
0
        /// <summary>
        /// Binds fee earners
        /// </summary>
        private void BindFeeEarner()
        {
            EarnerServiceClient earnerService = null;

            try
            {
                CollectionRequest collectionRequest = new CollectionRequest();

                EarnerSearchCriteria criteria = new EarnerSearchCriteria();
                criteria.IncludeArchived = false;
                criteria.MultiOnly       = false;

                earnerService = new EarnerServiceClient();
                EarnerSearchReturnValue returnValue = earnerService.EarnerSearch(_logonSettings.LogonId,
                                                                                 collectionRequest, criteria);

                if (returnValue.Success)
                {
                    _ddlFeeEarner.Items.Clear();
                    foreach (EarnerSearchItem feeEarner in returnValue.Earners.Rows)
                    {
                        ListItem item = new ListItem();
                        item.Text  = CommonFunctions.MakeFullName(feeEarner.Title, feeEarner.Name, feeEarner.SurName);
                        item.Value = feeEarner.Id.ToString();
                        _ddlFeeEarner.Items.Add(item);
                    }
                }
                else
                {
                    throw new Exception(returnValue.Message);
                }
                AppFunctions.AddDefaultToDropDownList(_ddlFeeEarner);
            }
            catch (Exception ex)
            {
                throw ex;
            }
            finally
            {
                if (earnerService != null)
                {
                    if (earnerService.State != System.ServiceModel.CommunicationState.Faulted)
                    {
                        earnerService.Close();
                    }
                }
            }
        }