/// <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="logonId">Logon id obtained when logging on to the logon service</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(Guid logonId, CollectionRequest collectionRequest, MatterSearchCriteria criteria) { MatterSearchReturnValue returnValue = new MatterSearchReturnValue(); try { // Get the logged on user from the current logons and add their // ApplicationSettings the list of concurrent sessions. Host.LoadLoggedOnUser(logonId); try { switch (UserInformation.Instance.UserType) { case DataConstants.UserType.Staff: case DataConstants.UserType.Client: case DataConstants.UserType.ThirdParty: // Matter search will filter data that they are allowed to see break; default: throw new Exception("Access denied"); } // Create a data list creator for a list of matters DataListCreator<MatterSearchItem> dataListCreator = new DataListCreator<MatterSearchItem>(); // Declare an inline event (annonymous delegate) to read the // dataset if it is required dataListCreator.ReadDataSet += delegate(object Sender, ReadDataSetEventArgs e) { // Create the dataset e.DataSet = SrvMatterCommon.WebMatterSearch(criteria.MemberId, criteria.OrganisationId, criteria.MatterId, criteria.MatterDescription, criteria.KeyDescription, criteria.DepartmentCode, criteria.BranchCode, criteria.FeeEarner, criteria.WorkTypeCode, criteria.OpenedDateFrom, criteria.OpenedDateTo, criteria.ClosedDateFrom, criteria.ClosedDateTo, criteria.MatterReference, criteria.MatterPreviousReference, criteria.UFN); if (criteria.OrderBy != string.Empty) { DataTable dt = Functions.SortDataTable(e.DataSet.Tables[0], criteria.OrderBy); e.DataSet.Tables.Remove("Table"); e.DataSet.Tables.Add(dt); } }; // Create the data list returnValue.Matters = dataListCreator.Create(logonId, // Give the query a name so it can be cached "MatterSearch", // Tell it the query criteria used so if the cache is accessed // again it knows if it is the same query criteria.ToString(), collectionRequest, // Import mappings to map the dataset row fields to the data // list entity properties new ImportMapping[] { new ImportMapping("Id", "ProjectId"), new ImportMapping("Reference", "MatterReference"), new ImportMapping("Description", "MatterDescription"), new ImportMapping("KeyDescription","MatterKeyDescription"), new ImportMapping("DepartmentCode","DepartmentCode"), new ImportMapping("DepartmentName","Department"), new ImportMapping("BranchCode","BranchCode"), new ImportMapping("BranchName","BranchName"), new ImportMapping("FeeEarnerName","FeeEarner"), new ImportMapping("WorkTypeCode","WorkTypeCode"), new ImportMapping("WorkType","WorkType"), new ImportMapping("OpenedDate","OpenedDate"), new ImportMapping("ClosedDate","ClosedDate") } ); } finally { // Remove the logged on user's ApplicationSettings from the // list of concurrent sessions Host.UnloadLoggedOnUser(); } } catch (System.Data.SqlClient.SqlException) { returnValue.Success = false; returnValue.Message = Functions.SQLErrorMessage; } catch (Exception ex) { returnValue.Success = false; returnValue.Message = ex.Message; } return returnValue; }
public void LoadClientMatterDetailsWithoutUsingSession() { _clientSearch.SetSession = false; 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 = _memberId ; criteria.OrganisationId = DataConstants.DummyGuid; } else { criteria.MemberId = DataConstants.DummyGuid; criteria.OrganisationId = _organisationId ; } matterReturnValue = matterService.MatterSearch(((LogonReturnValue)HttpContext.Current.Session[SessionName.LogonSettings]).LogonId, collectionRequest, criteria); if (matterReturnValue.Success) { if (matterReturnValue != null) { _ddlMatterReference.Items.Clear(); _clientSearch.SearchText = _clientRef; _linkClientName.Text = _clientName; _lnkMatter.Text = string.Empty; if (matterReturnValue.Matters.Rows.Length == 0) { _projectId = DataConstants.DummyGuid; _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 (_projectId != DataConstants.DummyGuid) { if (_projectId == matterReturnValue.Matters.Rows[i].Id) { _ddlMatterReference.SelectedIndex = -1; item.Selected = true; _lnkMatter.Text = matterReturnValue.Matters.Rows[i].Description; } } _ddlMatterReference.Items.Add(item); } if (_projectId == DataConstants.DummyGuid) { _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); _projectId = new Guid(GetValueOnIndexFromArray(_ddlMatterReference.Items[_ddlMatterReference.Items.Count - 1].Value, 0)); } } } } 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; } }
/// <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> /// 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; }