Exemple #1
0
        private void BindPartner()
        {
            EarnerServiceClient earnerService = null;

            try
            {
                PartnerSearchCriteria criteria = new PartnerSearchCriteria();
                earnerService = new EarnerServiceClient();

                CollectionRequest collectionRequest = new CollectionRequest();
                collectionRequest.ForceRefresh = true;
                collectionRequest.StartRow     = 0;
                collectionRequest.RowCount     = 0;

                PartnerSearchReturnValue returnValue = new PartnerSearchReturnValue();
                returnValue = earnerService.PartnerSearch(_logonSettings.LogonId, collectionRequest, criteria);

                if (returnValue.Success)
                {
                    foreach (PartnerSearchItem partner in returnValue.Partners.Rows)
                    {
                        ListItem item = new ListItem();
                        item.Text  = CommonFunctions.MakeFullName(partner.PersonTitle, partner.Name, partner.Surname);
                        item.Value = partner.PartnerId.ToString();
                        _ddlPartner.Items.Add(item);
                    }
                    _ddlPartner.Items.Insert(0, new ListItem("All Partners", ""));
                }
                else
                {
                    throw new Exception(returnValue.Message);
                }
            }
            catch (System.ServiceModel.EndpointNotFoundException)
            {
                _lblMessage.Text     = DataConstants.WSEndPointErrorMessage;
                _lblMessage.CssClass = "errorMessage";
            }
            catch (Exception ex)
            {
                _lblMessage.CssClass = "errorMessage";
                _lblMessage.Text     = ex.Message;
            }
            finally
            {
                if (earnerService != null)
                {
                    if (earnerService.State != System.ServiceModel.CommunicationState.Faulted)
                    {
                        earnerService.Close();
                    }
                }
            }
        }
        /// <summary>
        /// Gets the fee earners.
        /// </summary>
        private void GetFeeEarners()
        {
            EarnerServiceClient earnerService = null;

            try
            {
                earnerService = new EarnerServiceClient();

                PartnerSearchCriteria criteria          = new PartnerSearchCriteria();
                CollectionRequest     collectionRequest = new CollectionRequest();

                PartnerSearchReturnValue returnValue = new PartnerSearchReturnValue();
                returnValue = earnerService.PartnerSearch(_logonId, collectionRequest, criteria);

                if (returnValue.Success)
                {
                    _ddlFeeEarner.Items.Clear();
                    foreach (PartnerSearchItem partner in returnValue.Partners.Rows)
                    {
                        ListItem item = new ListItem();
                        item.Text  = CommonFunctions.MakeFullName(partner.PersonTitle, partner.Name, partner.Surname);
                        item.Value = partner.PartnerId.ToString();
                        _ddlFeeEarner.Items.Add(item);
                    }
                    _ddlFeeEarner.Items.Insert(0, new ListItem("All Partners", ""));
                }
                else
                {
                    throw new Exception(returnValue.Message);
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
            finally
            {
                if (earnerService != null)
                {
                    if (earnerService.State != System.ServiceModel.CommunicationState.Faulted)
                    {
                        earnerService.Close();
                    }
                }
            }
        }
        private void LoadMatterFeeEarner(Guid ProjectID)
        {
            MatterServiceClient matterService = new MatterServiceClient();
            try
            {
                MatterReturnValue matterReturnValue = new MatterReturnValue();
                matterReturnValue = matterService.GetMatter(_logonSettings.LogonId, ProjectID);

                if (matterReturnValue.Success)
                {
                    if (matterReturnValue != null)
                    {
                        if (matterReturnValue.Matter.FeeEarnerMemberId != null)
                        {
                            EarnerServiceClient partnerClient = new EarnerServiceClient();
                            try
                            {
                                PartnerSearchCriteria partnerCriteria = new PartnerSearchCriteria();
                                CollectionRequest collectionRequest = new CollectionRequest();
                                collectionRequest.StartRow = 0;

                                PartnerSearchReturnValue partnerReturnValue = partnerClient.PartnerSearch(_logonSettings.LogonId, collectionRequest, partnerCriteria);

                                if (partnerReturnValue.Success)
                                {
                                    if (partnerReturnValue.Partners != null)
                                    {
                                        for (int i = 0; i < partnerReturnValue.Partners.Rows.Length; i++)
                                        {
                                            if (partnerReturnValue.Partners.Rows[i].PartnerId.ToString() == matterReturnValue.Matter.FeeEarnerMemberId.ToString())
                                            {
                                                _txtAttendees.Text = CommonFunctions.MakeFullName(partnerReturnValue.Partners.Rows[i].PersonTitle, partnerReturnValue.Partners.Rows[i].Name, partnerReturnValue.Partners.Rows[i].Surname);
                                                _hdnAttendeesMemberId.Value = partnerReturnValue.Partners.Rows[i].PartnerId.ToString() + ";";
                                            }

                                        }
                                    }
                                }
                                else
                                {
                                    _lblError.Text = partnerReturnValue.Message;
                                }
                            }
                            catch (Exception ex)
                            {
                                throw ex;
                            }
                            finally
                            {
                                if (partnerClient.State != System.ServiceModel.CommunicationState.Faulted)
                                    partnerClient.Close();
                            }

                        }
                    }

                }

            }
            catch (Exception ex)
            {
                throw ex;
            }
            finally
            {
                if (matterService.State != System.ServiceModel.CommunicationState.Faulted)
                    matterService.Close();
            }
        }
        private void BindPartner()
        {
            EarnerServiceClient earnerService = null;
            try
            {
                PartnerSearchCriteria criteria = new PartnerSearchCriteria();
                earnerService = new EarnerServiceClient();

                CollectionRequest collectionRequest = new CollectionRequest();
                collectionRequest.ForceRefresh = true;
                collectionRequest.StartRow = 0;
                collectionRequest.RowCount = 0;

                PartnerSearchReturnValue returnValue = new PartnerSearchReturnValue();
                returnValue = earnerService.PartnerSearch(_logonSettings.LogonId, collectionRequest, criteria);

                if (returnValue.Success)
                {
                    foreach (PartnerSearchItem partner in returnValue.Partners.Rows)
                    {
                        ListItem item = new ListItem();
                        item.Text = CommonFunctions.MakeFullName(partner.PersonTitle, partner.Name, partner.Surname);
                        item.Value = partner.PartnerId.ToString();
                        _ddlPartner.Items.Add(item);
                    }
                    _ddlPartner.Items.Insert(0, new ListItem("All Partners", ""));
                }
                else
                {
                    throw new Exception(returnValue.Message);
                }
            }
            catch (System.ServiceModel.EndpointNotFoundException)
            {
                _lblMessage.Text = DataConstants.WSEndPointErrorMessage;
                _lblMessage.CssClass = "errorMessage";
            }
            catch (Exception ex)
            {
                _lblMessage.CssClass = "errorMessage";
                _lblMessage.Text = ex.Message;
            }
            finally
            {
                if (earnerService != null)
                {
                    if (earnerService.State != System.ServiceModel.CommunicationState.Faulted)
                        earnerService.Close();
                }
            }
        }
        /// <summary>
        /// Gets the fee earners.
        /// </summary>
        private void GetFeeEarners()
        {
            EarnerServiceClient earnerService = null;
            try
            {
                earnerService = new EarnerServiceClient();

                PartnerSearchCriteria criteria = new PartnerSearchCriteria();
                CollectionRequest collectionRequest = new CollectionRequest();

                PartnerSearchReturnValue returnValue = new PartnerSearchReturnValue();
                returnValue = earnerService.PartnerSearch(_logonId, collectionRequest, criteria);

                if (returnValue.Success)
                {
                    _ddlFeeEarner.Items.Clear();
                    foreach (PartnerSearchItem partner in returnValue.Partners.Rows)
                    {
                        ListItem item = new ListItem();
                        item.Text = CommonFunctions.MakeFullName(partner.PersonTitle, partner.Name, partner.Surname);
                        item.Value = partner.PartnerId.ToString();
                        _ddlFeeEarner.Items.Add(item);
                    }
                    _ddlFeeEarner.Items.Insert(0, new ListItem("All Partners", ""));
                }
                else
                {
                    throw new Exception(returnValue.Message);
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
            finally
            {
                if (earnerService != null)
                {
                    if (earnerService.State != System.ServiceModel.CommunicationState.Faulted)
                        earnerService.Close();
                }
            }
        }
        private void LoadMatterFeeEarner(Guid ProjectID)
        {
            MatterServiceClient matterService = new MatterServiceClient();

            try
            {
                MatterReturnValue matterReturnValue = new MatterReturnValue();
                matterReturnValue = matterService.GetMatter(_logonSettings.LogonId, ProjectID);

                if (matterReturnValue.Success)
                {
                    if (matterReturnValue != null)
                    {
                        if (matterReturnValue.Matter.FeeEarnerMemberId != null)
                        {
                            EarnerServiceClient partnerClient = new EarnerServiceClient();
                            try
                            {
                                PartnerSearchCriteria partnerCriteria   = new PartnerSearchCriteria();
                                CollectionRequest     collectionRequest = new CollectionRequest();
                                collectionRequest.StartRow = 0;

                                PartnerSearchReturnValue partnerReturnValue = partnerClient.PartnerSearch(_logonSettings.LogonId, collectionRequest, partnerCriteria);

                                if (partnerReturnValue.Success)
                                {
                                    if (partnerReturnValue.Partners != null)
                                    {
                                        for (int i = 0; i < partnerReturnValue.Partners.Rows.Length; i++)
                                        {
                                            if (partnerReturnValue.Partners.Rows[i].PartnerId.ToString() == matterReturnValue.Matter.FeeEarnerMemberId.ToString())
                                            {
                                                _txtAttendees.Text          = CommonFunctions.MakeFullName(partnerReturnValue.Partners.Rows[i].PersonTitle, partnerReturnValue.Partners.Rows[i].Name, partnerReturnValue.Partners.Rows[i].Surname);
                                                _hdnAttendeesMemberId.Value = partnerReturnValue.Partners.Rows[i].PartnerId.ToString() + ";";
                                            }
                                        }
                                    }
                                }
                                else
                                {
                                    _lblError.Text = partnerReturnValue.Message;
                                }
                            }
                            catch (Exception ex)
                            {
                                throw ex;
                            }
                            finally
                            {
                                if (partnerClient.State != System.ServiceModel.CommunicationState.Faulted)
                                {
                                    partnerClient.Close();
                                }
                            }
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
            finally
            {
                if (matterService.State != System.ServiceModel.CommunicationState.Faulted)
                {
                    matterService.Close();
                }
            }
        }