/// <summary> /// Gets the matters for the selected client. /// </summary> private void GetClientMatters(Guid memberId, Guid organisationId) { _ddlClientMatters.Items.Clear(); if (_ddlClients.Items.Count > 0) { MatterServiceClient matterService = null; try { matterService = new MatterServiceClient(); MatterSearchReturnValue matterReturnValue = new MatterSearchReturnValue(); CollectionRequest collectionRequest = new CollectionRequest(); collectionRequest.ForceRefresh = true; MatterSearchCriteria criteria = new MatterSearchCriteria(); criteria.MemberId = memberId; criteria.OrganisationId = organisationId; matterReturnValue = matterService.MatterSearch(_logonId, collectionRequest, criteria); if (matterReturnValue.Success) { if (matterReturnValue.Matters.Rows.Length > 0) { foreach (MatterSearchItem matter in matterReturnValue.Matters.Rows) { ListItem item = new ListItem(); item.Text = matter.Reference.Substring(6) + " - " + matter.Description; item.Value = matter.Id.ToString(); _ddlClientMatters.Items.Add(item); } } else { SuccessEventArgs success = new SuccessEventArgs(); success.Message = "No Matters found for this client."; OnSearchSuccessful(success); } } else { throw new Exception(matterReturnValue.Message); } } catch (Exception ex) { throw ex; } finally { if (matterService != null) { if (matterService.State != System.ServiceModel.CommunicationState.Faulted) { matterService.Close(); } } } } }
/// <summary> /// Displays the client matters. /// </summary> public MatterSearchItem[] GetClientMatters(int startRow, int pageSize, string memberId, string organisationId, bool forceRefresh) { MatterServiceClient matterService = null; MatterSearchItem[] clientMatters = null; try { Guid logonId = ((LogonReturnValue)HttpContext.Current.Session[SessionName.LogonSettings]).LogonId; Guid orgId = new Guid(organisationId); Guid memId = new Guid(memberId); matterService = new MatterServiceClient(); CollectionRequest collectionRequest = new CollectionRequest(); collectionRequest.StartRow = startRow; collectionRequest.RowCount = pageSize; collectionRequest.ForceRefresh = forceRefresh; MatterSearchCriteria searchCriteria = new MatterSearchCriteria(); if (memId != DataConstants.DummyGuid) { searchCriteria.MemberId = memId; } else { searchCriteria.OrganisationId = orgId; } MatterSearchReturnValue returnValue = matterService.MatterSearch(logonId, collectionRequest, searchCriteria); if (returnValue.Success) { _clientMatterRowCount = returnValue.Matters.TotalRowCount; clientMatters = returnValue.Matters.Rows; } return(clientMatters); } catch (Exception ex) { throw ex; } finally { if (matterService != null) { if (matterService.State != System.ServiceModel.CommunicationState.Faulted) { matterService.Close(); } } } }
/// <summary> /// Get a list of matters /// </summary> /// <param name="oHostSecurityToken">HostSecurityToken obtained when security provider of IWS is called</param> /// <param name="collectionRequest">Information about the collection being requested</param> /// <param name="criteria">Search criteria as enterred on the web page</param> /// <returns></returns> public MatterSearchReturnValue MatterSearch(HostSecurityToken oHostSecurityToken, CollectionRequest collectionRequest, MatterSearchCriteria criteria) { MatterSearchReturnValue returnValue = null; if (Functions.ValidateIWSToken(oHostSecurityToken)) { oMatterService = new MatterService(); returnValue = oMatterService.MatterSearch(Functions.GetLogonIdFromToken(oHostSecurityToken), collectionRequest, criteria); } else { returnValue = new MatterSearchReturnValue(); returnValue.Success = false; returnValue.Message = "Invalid Token"; } return(returnValue); }
/// <summary> /// Searches the matter. /// </summary> public MatterSearchItem[] SearchMatter(int startRow, int pageSize, string sortBy, string clientReference, string description, string keyDescription, string department, string branch, string feeEarner, string workTypeCode, string openedFrom, string openedTo, string closedFrom, string closedTo, string reference, string prevReference, string UFN, bool forceRefresh) { MatterServiceClient matterService = null; MatterSearchItem[] matters = null; try { if (HttpContext.Current.Session[SessionName.LogonSettings] != null) { if (description == null || description.Trim() == string.Empty) { if (keyDescription == null || keyDescription == string.Empty) { if (clientReference == null || clientReference.Trim() == string.Empty) { if (UFN == null || UFN.Trim() == "______/___") { if (prevReference == null || prevReference.Trim() == string.Empty) { if (branch == null || branch.Trim() == string.Empty) { if (department == null || department.Trim() == string.Empty) { if (feeEarner == null || feeEarner.Trim() == string.Empty) { if (workTypeCode == null || workTypeCode.Trim() == string.Empty) { if (openedFrom == null || openedFrom.Trim() == string.Empty) { if (openedTo == null || openedTo.Trim() == string.Empty) { if (closedFrom == null || closedFrom.Trim() == string.Empty) { if (closedTo == null || closedTo.Trim() == string.Empty) { if (reference == null || reference.Trim() == string.Empty) { throw new Exception("Please enter search criteria"); } } } } } } } } } } } } } } Guid _logonId = ((LogonReturnValue)HttpContext.Current.Session[SessionName.LogonSettings]).LogonId; CollectionRequest collectionRequest = new CollectionRequest(); collectionRequest.ForceRefresh = forceRefresh; collectionRequest.StartRow = startRow; collectionRequest.RowCount = pageSize; MatterSearchCriteria criteria = new MatterSearchCriteria(); criteria.MatterId = DataConstants.DummyGuid; criteria.OrderBy = sortBy; if (null == clientReference || clientReference == ClientSearch.NoClientSelected) { criteria.OrganisationId = DataConstants.DummyGuid; criteria.MemberId = DataConstants.DummyGuid; } else { if (HttpContext.Current.Session[SessionName.MemberId] != null) { criteria.MemberId = new Guid(Convert.ToString(HttpContext.Current.Session[SessionName.MemberId])); } else { criteria.MemberId = DataConstants.DummyGuid; } if (HttpContext.Current.Session[SessionName.OrganisationId] != null) { criteria.OrganisationId = new Guid(Convert.ToString(HttpContext.Current.Session[SessionName.OrganisationId])); } else { criteria.OrganisationId = DataConstants.DummyGuid; } } criteria.MatterDescription = description != null?description.Replace("'", "''") : description; if (!string.IsNullOrEmpty(criteria.MatterDescription)) { criteria.MatterDescription = string.Format("%{0}%", criteria.MatterDescription); } criteria.KeyDescription = keyDescription != null?keyDescription.Replace("'", "''") : keyDescription; if (department != null && department != String.Empty) { criteria.DepartmentCode = GetDepartmentValueOnIndex(department, 1); } if (branch != null && branch != String.Empty) { criteria.BranchCode = GetBranchValueOnIndex(branch, 0); } if (feeEarner != null && feeEarner != String.Empty) { criteria.FeeEarner = new Guid(GetFeeEarnerValueOnIndex(feeEarner, 1)); } else { criteria.FeeEarner = DataConstants.DummyGuid; } criteria.WorkTypeCode = workTypeCode; if (openedFrom != null && openedFrom.Length > 0) { criteria.OpenedDateFrom = Convert.ToDateTime(openedFrom.Trim()); } else { criteria.OpenedDateFrom = null; } if (openedTo != null && openedTo.Length > 0) { criteria.OpenedDateTo = Convert.ToDateTime(openedTo.Trim()); } else { criteria.OpenedDateTo = null; } if (closedFrom != null && closedFrom.Length > 0) { criteria.ClosedDateFrom = Convert.ToDateTime(closedFrom.Trim()); } else { criteria.ClosedDateFrom = null; } if (closedTo != null && closedTo.Length > 0) { criteria.ClosedDateTo = Convert.ToDateTime(closedTo.Trim()); } else { criteria.ClosedDateTo = null; } if (reference != null) { criteria.MatterReference = reference != null?reference.Replace("'", "''").Replace("-", "") : reference; } criteria.MatterPreviousReference = prevReference != null?prevReference.Replace("'", "''") : prevReference; //Check if the ufn field is empty. //Replace the prompt char for the masked control to check if its blank if (UFN != null && UFN.Replace("_", "") == "/") { criteria.UFN = string.Empty; } else { criteria.UFN = UFN; } matterService = new MatterServiceClient(); MatterSearchReturnValue returnValue = matterService.MatterSearch(_logonId, collectionRequest, criteria); if (returnValue.Success) { _matterRowCount = returnValue.Matters.TotalRowCount; matters = returnValue.Matters.Rows; } else { if (returnValue.Message == "SqlDateTime overflow. Must be between 1/1/1753 12:00:00 AM and 12/31/9999 11:59:59 PM.") { throw new Exception("Date is invalid"); } else { throw new Exception(returnValue.Message); } } } return(matters); } catch (Exception ex) { throw ex; } finally { if (matterService != null) { if (matterService.State != System.ServiceModel.CommunicationState.Faulted) { matterService.Close(); } } } }
public void LoadClientMatterDetails() { try { MatterServiceClient matterService = new MatterServiceClient(); try { MatterSearchReturnValue matterReturnValue = new MatterSearchReturnValue(); CollectionRequest collectionRequest = new CollectionRequest(); collectionRequest.ForceRefresh = true; MatterSearchCriteria criteria = new MatterSearchCriteria(); if (_isClientMember) { criteria.MemberId = new Guid(HttpContext.Current.Session[SessionName.MemberId].ToString());; criteria.OrganisationId = DataConstants.DummyGuid; } else { criteria.MemberId = DataConstants.DummyGuid; criteria.OrganisationId = new Guid(HttpContext.Current.Session[SessionName.OrganisationId].ToString());; } matterReturnValue = matterService.MatterSearch(((LogonReturnValue)HttpContext.Current.Session[SessionName.LogonSettings]).LogonId, collectionRequest, criteria); if (matterReturnValue.Success) { if (matterReturnValue != null) { _ddlMatterReference.Items.Clear(); _clientSearch.SearchText = Convert.ToString(HttpContext.Current.Session[SessionName.ClientRef]); _linkClientName.Text = Convert.ToString(HttpContext.Current.Session[SessionName.ClientName]); _lnkMatter.Text = string.Empty; if (matterReturnValue.Matters.Rows.Length == 0) { HttpContext.Current.Session[SessionName.ProjectId] = null; _message = "No Matter(s) found for this client."; if (MatterChanged != null) { OnMatterChanged(System.EventArgs.Empty); } return; } for (int i = 0; i < matterReturnValue.Matters.Rows.Length; i++) { ListItem item = new ListItem(); item.Text = matterReturnValue.Matters.Rows[i].Reference.Substring(6) + " - " + matterReturnValue.Matters.Rows[i].Description; item.Value = matterReturnValue.Matters.Rows[i].Id.ToString() + "$" + matterReturnValue.Matters.Rows[i].Description; // This will be used if this method is called from some content page, which will set the default matter if (HttpContext.Current.Session[SessionName.ProjectId] != null) { if (new Guid(HttpContext.Current.Session[SessionName.ProjectId].ToString()) == matterReturnValue.Matters.Rows[i].Id) { item.Selected = true; _lnkMatter.Text = matterReturnValue.Matters.Rows[i].Description; } } _ddlMatterReference.Items.Add(item); } if (HttpContext.Current.Session[SessionName.ProjectId] == null) { _ddlMatterReference.SelectedIndex = -1; if (_ddlMatterReference.Items.Count > 0) { _ddlMatterReference.SelectedIndex = _ddlMatterReference.Items.Count - 1; _lnkMatter.Text = GetValueOnIndexFromArray(_ddlMatterReference.Items[_ddlMatterReference.Items.Count - 1].Value, 1); HttpContext.Current.Session[SessionName.ProjectId] = GetValueOnIndexFromArray(_ddlMatterReference.Items[_ddlMatterReference.Items.Count - 1].Value, 0); } } if (HttpContext.Current.Session[SessionName.ProjectId] != null) { IRIS.Law.WebApp.App_Code.AppFunctions.SetClientMatterDetailsInSession((Guid)HttpContext.Current.Session[SessionName.MemberId], (Guid)HttpContext.Current.Session[SessionName.OrganisationId], Convert.ToString(HttpContext.Current.Session[SessionName.ClientName]), (new Guid(HttpContext.Current.Session[SessionName.ProjectId].ToString())), _lnkMatter.Text); ((ILBHomePage)Page.Master).DisplayClientMatterDetailsInContext(); } } } else { _message = matterReturnValue.Message; return; } } catch (Exception ex) { _message = ex.Message; } finally { if (matterService.State != System.ServiceModel.CommunicationState.Faulted) { matterService.Close(); } } } catch (Exception ex) { throw ex; } }