private ClientDto GetClient(int CAId) { ClientServiceClient client = new ClientServiceClient(); ClientDto clientDto = client.GetById(CAId); client.Close(); return(clientDto); }
private IList <ClientDto> GetClientList() { ClientServiceClient client = new ClientServiceClient(); Query query = new Query(); Criterion crActive = new Criterion("IsActive", true, CriteriaOperator.Equal); query.Add(crActive); EntityDtos <ClientDto> clientDtos = client.FindByQuery(query, false); client.Close(); return(clientDtos.Entities); }
/// <summary> /// Gets the address. /// </summary> /// <param name="memId">The mem id.</param> /// <param name="orgId">The org id.</param> /// <returns></returns> private string GetAddress(Guid memId, Guid orgId) { string addressLine1 = string.Empty; ClientServiceClient clientService = null; try { CollectionRequest collectionRequest = new CollectionRequest(); AddressSearchCriteria criteria = new AddressSearchCriteria(); criteria.MemberId = memId; criteria.OrganisationId = orgId; clientService = new ClientServiceClient(); AddressSearchReturnValue returnValue = clientService.GetClientAddresses(_logonSettings.LogonId, collectionRequest, criteria); if (returnValue.Success) { if (returnValue.Addresses.Rows.Length > 0) { addressLine1 = returnValue.Addresses.Rows[0].Line1; } } else { throw new Exception(returnValue.Message); } } catch (Exception ex) { throw ex; } finally { if (clientService != null) { if (clientService.State != System.ServiceModel.CommunicationState.Faulted) { clientService.Close(); } } } return(addressLine1); }
/// <summary> /// Gets the client details. /// </summary> private void GetClientDetails(string matterReference) { ClientServiceClient clientService = null; try { CollectionRequest collectionRequest = new CollectionRequest(); collectionRequest.ForceRefresh = true; ClientSearchCriteria criteria = new ClientSearchCriteria(); criteria.ClientReference = matterReference.Substring(0, 6); clientService = new ClientServiceClient(); ClientSearchReturnValue returnValue = clientService.ClientSearch(_logonSettings.LogonId, collectionRequest, criteria); if (returnValue.Success) { if (returnValue.Clients != null) { Session[SessionName.MemberId] = returnValue.Clients.Rows[0].MemberId; Session[SessionName.OrganisationId] = returnValue.Clients.Rows[0].OrganisationId; Session[SessionName.ClientRef] = returnValue.Clients.Rows[0].ClientReference; Session[SessionName.ClientName] = returnValue.Clients.Rows[0].Name; } } else { throw new Exception(returnValue.Message); } } catch (Exception ex) { throw ex; } finally { if (clientService != null) { if (clientService.State != System.ServiceModel.CommunicationState.Faulted) { clientService.Close(); } } } }
/// <summary> /// Loads the client details. /// </summary> private void LoadAddressDetails() { ClientServiceClient serviceClient = null; try { serviceClient = new ClientServiceClient(); _addressSearchReturnValue = new AddressSearchReturnValue(); CollectionRequest collectionRequest = new CollectionRequest(); AddressSearchCriteria searchCriteria = new AddressSearchCriteria(); searchCriteria.MemberId = _memId; searchCriteria.OrganisationId = _orgId; _addressSearchReturnValue = serviceClient.GetClientAddresses(_logonId, collectionRequest, searchCriteria); if (_addressSearchReturnValue.Success) { GetAddressTypes(); DisplayAddressDetails(); } else { throw new Exception(_addressSearchReturnValue.Message); } } catch (Exception ex) { throw ex; } finally { if (serviceClient != null) { if (serviceClient.State != System.ServiceModel.CommunicationState.Faulted) { serviceClient.Close(); } } } }
public List <ClientDto> GetCAList() { ClientServiceClient client = new ClientServiceClient(); //UserDto CurrentUser = (UserDto)Session[Constants.SKCURRENTUSER]; Query query = new Query(); Criterion crActive = new Criterion("IsActive", true, CriteriaOperator.Equal); query.Add(crActive); EntityDtos <ClientDto> clientDtos = client.FindByQuery(query, false); //var caDtos = client.FindAll(); List <ClientDto> caList = clientDtos.Entities.ToList(); caList.Insert(0, new ClientDto { CAId = 0, CompanyName = "[Select]", DisplayClientId = "" }); client.Close(); return(caList); }
private Common.Dto.ClientRegistration.ClientDto GetClientById() { ClientDto clientDto = null; Nullable <int> caId = null; if (!String.IsNullOrEmpty(Request.QueryString["CAId"])) { caId = Convert.ToInt32(Request.QueryString["CAId"]); } if (!String.IsNullOrEmpty(Request.Params["CAId"])) { caId = Convert.ToInt32(Request.Params["CAId"]); } if (caId != null) { ClientServiceClient clientService = new ClientServiceClient(); clientDto = clientService.GetById(Convert.ToInt32(caId)); clientService.Close(); } return(clientDto); }
/// <summary> /// Loads the client details. /// </summary> private void LoadAddressDetails() { ClientServiceClient serviceClient = null; try { serviceClient = new ClientServiceClient(); _addressSearchReturnValue = new AddressSearchReturnValue(); CollectionRequest collectionRequest = new CollectionRequest(); AddressSearchCriteria searchCriteria = new AddressSearchCriteria(); searchCriteria.MemberId = _memId; searchCriteria.OrganisationId = _orgId; _addressSearchReturnValue = serviceClient.GetClientAddresses(_logonId, collectionRequest, searchCriteria); if (_addressSearchReturnValue.Success) { GetAddressTypes(); DisplayAddressDetails(); } else { throw new Exception(_addressSearchReturnValue.Message); } } catch (Exception ex) { throw ex; } finally { if (serviceClient != null) { if (serviceClient.State != System.ServiceModel.CommunicationState.Faulted) serviceClient.Close(); } } }
/// <summary> /// Gets the address. /// </summary> /// <param name="memId">The mem id.</param> /// <param name="orgId">The org id.</param> /// <returns></returns> private string GetAddress(Guid memId, Guid orgId) { string addressLine1 = string.Empty; ClientServiceClient clientService = null; try { CollectionRequest collectionRequest = new CollectionRequest(); AddressSearchCriteria criteria = new AddressSearchCriteria(); criteria.MemberId = memId; criteria.OrganisationId = orgId; clientService = new ClientServiceClient(); AddressSearchReturnValue returnValue = clientService.GetClientAddresses(_logonSettings.LogonId, collectionRequest, criteria); if (returnValue.Success) { if (returnValue.Addresses.Rows.Length > 0) { addressLine1 = returnValue.Addresses.Rows[0].Line1; } } else { throw new Exception(returnValue.Message); } } catch (Exception ex) { throw ex; } finally { if (clientService != null) { if (clientService.State != System.ServiceModel.CommunicationState.Faulted) clientService.Close(); } } return addressLine1; }
/// <summary> /// Gets the client details. /// </summary> private void GetClientDetails(string matterReference) { ClientServiceClient clientService = null; try { CollectionRequest collectionRequest = new CollectionRequest(); collectionRequest.ForceRefresh = true; ClientSearchCriteria criteria = new ClientSearchCriteria(); criteria.ClientReference = matterReference.Substring(0, 6); clientService = new ClientServiceClient(); ClientSearchReturnValue returnValue = clientService.ClientSearch(_logonSettings.LogonId, collectionRequest, criteria); if (returnValue.Success) { if (returnValue.Clients != null) { Session[SessionName.MemberId] = returnValue.Clients.Rows[0].MemberId; Session[SessionName.OrganisationId] = returnValue.Clients.Rows[0].OrganisationId; Session[SessionName.ClientRef] = returnValue.Clients.Rows[0].ClientReference; Session[SessionName.ClientName] = returnValue.Clients.Rows[0].Name; } } else { throw new Exception(returnValue.Message); } } catch (Exception ex) { throw ex; } finally { if (clientService != null) { if (clientService.State != System.ServiceModel.CommunicationState.Faulted) clientService.Close(); } } }
protected void _imgBtnSearch_Click(object sender, ImageClickEventArgs e) { if (_txtSearch.Text.Trim() == string.Empty) { _txtSearch.Text = AllClients; } ClientServiceClient clientService = null; try { CollectionRequest collectionRequest = new CollectionRequest(); collectionRequest.ForceRefresh = true; ClientSearchCriteria criteria = new ClientSearchCriteria(); if (_txtSearch.Text.Trim() == string.Empty || _txtSearch.Text.Trim() == AllClients) { criteria.Name = string.Empty; } else { criteria.Name = _txtSearch.Text.Trim(); } if (_ddlFeeEarner.SelectedIndex > 0) { criteria.Partner = new Guid(_ddlFeeEarner.SelectedValue); } clientService = new ClientServiceClient(); ClientSearchReturnValue returnValue = clientService.ClientSearch(_logonId, collectionRequest, criteria); _ddlClients.Items.Clear(); _ddlClientMatters.Items.Clear(); if (returnValue.Success) { if (returnValue.Clients.Rows.Length > 0) { foreach (ClientSearchItem client in returnValue.Clients.Rows) { ListItem item = new ListItem(); item.Text = client.ClientReference.Trim() + " - " + client.Name; item.Value = client.MemberId.ToString() + "$" + client.OrganisationId.ToString(); _ddlClients.Items.Add(item); } } else { SuccessEventArgs success = new SuccessEventArgs(); success.Message = "Search is complete. There are no results to display."; OnSearchSuccessful(success); } if (_ddlClients.Items.Count > 0) { _clientRowCount = _ddlClients.Items.Count; Guid memberId = new Guid(GetValueOnIndexFromArray(_ddlClients.SelectedValue, 0)); Guid organisationId = new Guid(GetValueOnIndexFromArray(_ddlClients.SelectedValue, 1)); GetClientMatters(memberId, organisationId); SelectLastMatter(); } } else { ErrorEventArgs error = new ErrorEventArgs(); error.Message = returnValue.Message.Replace("WebClientSearch requires some parameters", "Please select a Fee Earner or use the client search."); OnError(error); } } catch (Exception ex) { ErrorEventArgs error = new ErrorEventArgs(); error.Message = ex.Message; OnError(error); } finally { if (clientService != null) { if (clientService.State != System.ServiceModel.CommunicationState.Faulted) clientService.Close(); } } }
protected void _imgBtnSearch_Click(object sender, ImageClickEventArgs e) { if (_txtSearch.Text.Trim() == string.Empty) { _txtSearch.Text = AllClients; } ClientServiceClient clientService = null; try { CollectionRequest collectionRequest = new CollectionRequest(); collectionRequest.ForceRefresh = true; ClientSearchCriteria criteria = new ClientSearchCriteria(); if (_txtSearch.Text.Trim() == string.Empty || _txtSearch.Text.Trim() == AllClients) { criteria.Name = string.Empty; } else { criteria.Name = _txtSearch.Text.Trim(); } if (_ddlFeeEarner.SelectedIndex > 0) { criteria.Partner = new Guid(_ddlFeeEarner.SelectedValue); } clientService = new ClientServiceClient(); ClientSearchReturnValue returnValue = clientService.ClientSearch(_logonId, collectionRequest, criteria); _ddlClients.Items.Clear(); _ddlClientMatters.Items.Clear(); if (returnValue.Success) { if (returnValue.Clients.Rows.Length > 0) { foreach (ClientSearchItem client in returnValue.Clients.Rows) { ListItem item = new ListItem(); item.Text = client.ClientReference.Trim() + " - " + client.Name; item.Value = client.MemberId.ToString() + "$" + client.OrganisationId.ToString(); _ddlClients.Items.Add(item); } } else { SuccessEventArgs success = new SuccessEventArgs(); success.Message = "Search is complete. There are no results to display."; OnSearchSuccessful(success); } if (_ddlClients.Items.Count > 0) { _clientRowCount = _ddlClients.Items.Count; Guid memberId = new Guid(GetValueOnIndexFromArray(_ddlClients.SelectedValue, 0)); Guid organisationId = new Guid(GetValueOnIndexFromArray(_ddlClients.SelectedValue, 1)); GetClientMatters(memberId, organisationId); SelectLastMatter(); } } else { ErrorEventArgs error = new ErrorEventArgs(); error.Message = returnValue.Message.Replace("WebClientSearch requires some parameters", "Please select a Fee Earner or use the client search."); OnError(error); } } catch (Exception ex) { ErrorEventArgs error = new ErrorEventArgs(); error.Message = ex.Message; OnError(error); } finally { if (clientService != null) { if (clientService.State != System.ServiceModel.CommunicationState.Faulted) { clientService.Close(); } } } }
/// <summary> /// Saves the client details(user types 1 and 2). /// </summary> private void SaveClient() { //Perform HO UCN field length validation as it is not checked in the service layer if (_txtHOUCN.Text.Length > 0 && _txtHOUCN.Text.Length < 8) { _lblMessage.CssClass = "errorMessage"; _lblMessage.Text = "All characters have not been entered for the HO UCN"; return; } ClientServiceClient clientService = null; try { SaveAddresses(); clientService = new ClientServiceClient(); IRIS.Law.WebServiceInterfaces.Client.Client client = GetClientDetails(); Person person = GetPersonDetails(); Organisation organisation = GetOrganisationDetails(); ReturnValue returnValue = clientService.UpdateClient(_logonSettings.LogonId, client, person, organisation); if (returnValue.Success) { _lblMessage.CssClass = "successMessage"; _lblMessage.Text = "Edit successful"; //Generate client name label as the details may have changed if (_memberId != DataConstants.DummyGuid) { _lblClientName.Text = CommonFunctions.MakeFullName(_ddlTitle.SelectedItem.Text.Trim(), _txtForenames.Text.Trim(), _txtSurname.Text.Trim()); } else { _lblClientName.Text = _txtOrganisationName.Text.Trim(); } _imgClientArchieved.Visible = _chkArchiveClient.Checked; } else { _lblMessage.CssClass = "errorMessage"; _lblMessage.Text = 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 (clientService != null) { if (clientService.State != System.ServiceModel.CommunicationState.Faulted) clientService.Close(); } } }
/// <summary> /// Gets the ratings. /// </summary> private void GetRatings() { ClientServiceClient clientService = null; try { clientService = new ClientServiceClient(); CollectionRequest collectionRequest = new CollectionRequest(); RatingSearchCriteria searchCriteria = new RatingSearchCriteria(); searchCriteria.IncludeArchived = false; RatingSearchReturnValue returnValue = clientService.RatingSearch(_logonSettings.LogonId, collectionRequest, searchCriteria); if (returnValue.Success) { _ddlRating.DataSource = returnValue.Ratings.Rows; _ddlRating.DataTextField = "Description"; _ddlRating.DataValueField = "Id"; _ddlRating.DataBind(); } else { throw new Exception(returnValue.Message); } } catch (Exception ex) { throw ex; } finally { if (clientService != null) { if (clientService.State != System.ServiceModel.CommunicationState.Faulted) clientService.Close(); } } }
/// <summary> /// Gets the joint client candidates. /// </summary> private void GetJointClientCandidates(Guid clientId, bool isMember) { //Clear previous items _chklstClientAssociates.Items.Clear(); ClientServiceClient clientService = null; try { CollectionRequest collectionRequest = new CollectionRequest(); JointClientCandidateSearchCriteria criteria = new JointClientCandidateSearchCriteria(); criteria.ClientId = clientId; criteria.IsMember = isMember; clientService = new ClientServiceClient(); JointClientCandidateSearchReturnValue returnValue = clientService.JointClientCandidateSearch(_logonSettings.LogonId, collectionRequest, criteria); if (returnValue.Success) { foreach (JointClientCandidateSearchItem jointClientCandidate in returnValue.JointClientCandidates.Rows) { ListItem item = new ListItem(); item.Text = jointClientCandidate.Name; item.Value = jointClientCandidate.Tag; _chklstClientAssociates.Items.Add(item); } } else { throw new Exception(returnValue.Message); } } catch (Exception ex) { throw ex; } finally { if (clientService != null) { if (clientService.State != System.ServiceModel.CommunicationState.Faulted) clientService.Close(); } } }
/// <summary> /// Sets up the client. /// </summary> private void SetupClient() { //Get the client type _ddlMatterType.Enabled = true; _txtDescription.Enabled = true; _ddlBranch.Enabled = true; _ddlDepartment.Enabled = true; _ddlWorkType.Enabled = true; _ddlFeeEarner.Enabled = true; _ccUFNDate.Enabled = true; _txtHOUCN.Enabled = true; _txtUCN.Enabled = true; ClientServiceClient clientService = null; try { Guid memberId = (Guid)Session[SessionName.MemberId]; Guid organisationId = (Guid)Session[SessionName.OrganisationId]; Guid clientId; bool isMember; if (memberId != DataConstants.DummyGuid) { clientId = memberId; isMember = true; } else { clientId = organisationId; isMember = false; } clientService = new ClientServiceClient(); ClientReturnValue returnValue = clientService.GetClientDefaults(_logonSettings.LogonId, clientId); if (returnValue.Success) { if (returnValue.Client != null) { ViewState[ClientType] = returnValue.Client.TypeId; //Set the default branch for the selected client _ddlBranch.SelectedIndex = -1; if (returnValue.Client.Branch != string.Empty) { foreach (ListItem branch in _ddlBranch.Items) { if (branch.Value != string.Empty && GetBranchValueOnIndex(branch.Value, 0) == returnValue.Client.Branch.Trim()) { branch.Selected = true; break; } } } else { _ddlBranch.SelectedValue = string.Empty; } SetupClientType(returnValue.Client.TypeId); //Display joint candidates if (_chklstClientAssociates.Visible) { GetJointClientCandidates(clientId, isMember); } //Get the matter types based on the client type GetMatterTypes(); SetupUserDefaults(); SetWorkTypeDefaults(); } else { throw new Exception("Unable to load client defaults"); } } else { _ddlMatterType.Enabled = false; _txtDescription.Enabled = false; _ddlBranch.Enabled = false; _ddlDepartment.Enabled = false; _ddlWorkType.Enabled = false; _ddlFeeEarner.Enabled = false; _ccUFNDate.Enabled = false; _txtHOUCN.Enabled = false; _txtUCN.Enabled = false; _txtDescription.Text = string.Empty; _ddlBranch.SelectedValue = string.Empty; _ddlDepartment.Items.Clear(); _ddlWorkType.Items.Clear(); throw new Exception(returnValue.Message.Replace("Client Archived", "Matter can not be added to an archived client")); } } catch (Exception ex) { throw ex; } finally { if (clientService != null) { if (clientService.State != System.ServiceModel.CommunicationState.Faulted) clientService.Close(); } } }