/// <summary> /// Gets the documents for the matter. /// </summary> public DocumentSearchItem[] GetSearchForMatterDocuments(int startRow, int pageSize, string searchText, Int32 fileType, Boolean deepSearch, Boolean matchCase, Boolean searchSubFolders) { DocumentServiceClient documentService = new DocumentServiceClient(); DocumentSearchItem[] matterDocs = null; try { Guid logonId = ((LogonReturnValue)HttpContext.Current.Session[SessionName.LogonSettings]).LogonId; DocumentSearchCriteria criteria = new DocumentSearchCriteria(); criteria.DocumentType = fileType; criteria.IsDeepSearch = deepSearch; criteria.IsMatchCase = matchCase; criteria.IsSubFolderSearch = searchSubFolders; criteria.SearchString = searchText; if (HttpContext.Current.Session[SessionName.ProjectId] != null) { DocumentSearchReturnValue returnValue = documentService.GetMatterDocumentForDeepSearch(logonId, (Guid)HttpContext.Current.Session[SessionName.ProjectId], criteria); if (returnValue != null) { if (returnValue.Success) { if (returnValue.Document != null) { matterDocs = returnValue.Document.Rows; _matterDocumentRowCount = returnValue.Document.Rows.Length; } } else { throw new Exception(returnValue.Message); } } } else { throw new Exception("No Project Id found."); } } catch (Exception ex) { throw ex; } finally { if (documentService != null) { if (documentService.State != System.ServiceModel.CommunicationState.Faulted) { documentService.Close(); } } } return(matterDocs); }
/// <summary> /// Gets the documents for the matter. /// </summary> public DocumentSearchItem[] GetMatterDocuments(int startRow, int pageSize) { DocumentServiceClient documentService = new DocumentServiceClient(); DocumentSearchItem[] matterDocs = null; try { Guid logonId = ((LogonReturnValue)Session[SessionName.LogonSettings]).LogonId; CollectionRequest collectionRequest = new CollectionRequest(); collectionRequest.StartRow = startRow; collectionRequest.RowCount = pageSize; collectionRequest.ForceRefresh = true; if (Session[SessionName.ProjectId] != null) { DocumentSearchReturnValue returnValue = documentService.MatterDocumentSearch(logonId, (Guid)Session[SessionName.ProjectId], ""); if (returnValue != null) { if (returnValue.Success) { if (returnValue.Document != null) { matterDocs = returnValue.Document.Rows; _matterDocumentRowCount = returnValue.Document.Rows.Length; } } else { throw new Exception(returnValue.Message); } } } else { throw new Exception("No Project Id found."); } return(matterDocs); } catch (Exception ex) { throw ex; } finally { if (documentService != null) { if (documentService.State != System.ServiceModel.CommunicationState.Faulted) { documentService.Close(); } } } }
/// <summary> /// Get List of Documents for Matter /// </summary> /// <param name="oHostSecurityToken"></param> /// <param name="projectId"></param> /// <returns></returns> public DocumentSearchReturnValue MatterDocumentSearch(HostSecurityToken oHostSecurityToken, Guid projectId, string OrderBy) { DocumentSearchReturnValue ReturnValue = new DocumentSearchReturnValue(); if (Functions.ValidateIWSToken(oHostSecurityToken)) { oDocumentService = new DocumentService(); ReturnValue = oDocumentService.MatterDocumentSearch(Functions.GetLogonIdFromToken(oHostSecurityToken), projectId, OrderBy); } else { ReturnValue = new DocumentSearchReturnValue(); ReturnValue.Success = false; ReturnValue.Message = "Invalid Token"; } return(ReturnValue); }
/// <summary> /// Get documents for deep search /// </summary> /// <param name="oHostSecurityToken"></param> /// <param name="fileListToSearch"></param> /// <returns></returns> public DocumentSearchReturnValue GetMatterDocumentForDeepSearch(HostSecurityToken oHostSecurityToken, Guid projectId, DocumentSearchCriteria criteria) { DocumentSearchReturnValue ReturnValue = new DocumentSearchReturnValue(); if (Functions.ValidateIWSToken(oHostSecurityToken)) { oDocumentService = new DocumentService(); ReturnValue = oDocumentService.GetMatterDocumentForDeepSearch(Functions.GetLogonIdFromToken(oHostSecurityToken), projectId, criteria); } else { ReturnValue = new DocumentSearchReturnValue(); ReturnValue.Success = false; ReturnValue.Message = "Invalid Token"; } return(ReturnValue); }
/// <summary> /// Get List of Documents for Matter /// </summary> /// <param name="logonId"></param> /// <param name="projectId"></param> /// <returns></returns> public DocumentSearchReturnValue MatterDocumentSearch(Guid logonId, Guid projectId, string OrderBy) { DocumentSearchReturnValue returnValue = new DocumentSearchReturnValue(); try { // Get the logged on user from the current logons and add their // ApplicationSettings the list of concurrent sessions. Host.LoadLoggedOnUser(logonId); try { Functions.RestrictRekoopIntegrationUser(UserInformation.Instance.DbUid); switch (UserInformation.Instance.UserType) { case DataConstants.UserType.Staff: // Can do everything break; case DataConstants.UserType.Client: case DataConstants.UserType.ThirdParty: if (!SrvMatterCommon.WebAllowedToAccessMatter(projectId)) throw new Exception("Access denied"); break; default: throw new Exception("Access denied"); } DataList<DocumentSearchItem> docSearch = this.MatterDocumentSearchInternal(projectId); if (OrderBy == null) OrderBy = string.Empty; string sortOrder = "ASC"; if (OrderBy.Contains("DESC")) sortOrder = "DESC"; returnValue.Document = this.SortDocumentSearchResults(docSearch, OrderBy.Replace("DESC", "").Replace("ASC", "").Trim(), sortOrder); //returnValue.Document = MatterDocumentSearchInternal(projectId); } 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; }
/// <summary> /// Get documents for deep search /// </summary> /// <param name="logonId"></param> /// <param name="fileListToSearch"></param> /// <returns></returns> public DocumentSearchReturnValue GetMatterDocumentForDeepSearch(Guid logonId, Guid projectId, DocumentSearchCriteria criteria) { DocumentSearchReturnValue returnValue = new DocumentSearchReturnValue(); SrvFileSearcher srvFileSearcher = new SrvFileSearcher(); try { // Get the logged on user from the current logons and add their // ApplicationSettings the list of concurrent sessions. Host.LoadLoggedOnUser(logonId); try { Functions.RestrictRekoopIntegrationUser(UserInformation.Instance.DbUid); switch (UserInformation.Instance.UserType) { case DataConstants.UserType.Staff: // Can do everything break; case DataConstants.UserType.Client: case DataConstants.UserType.ThirdParty: //Can search for documents if (!SrvMatterCommon.WebAllowedToAccessMatter(projectId)) throw new Exception("Access denied"); break; default: throw new Exception("Access denied"); } DataList<DocumentSearchItem> docs = this.MatterDocumentSearchInternal(projectId); string[] listOfDocuments = null; string fileInfo; string searchFilePath; listOfDocuments = new string[docs.Rows.Count]; for (int i = 0; i < docs.Rows.Count; i++) { fileInfo = string.Empty; fileInfo = docs.Rows[i].FilePath; if (fileInfo != string.Empty) { fileInfo += "^" + docs.Rows[i].FileDescription + "^" + docs.Rows[i].Id + "^" + Convert.ToString(docs.Rows[i].CreatedDate.ToString("dd/MM/yyyy")) + "^" + Convert.ToString(docs.Rows[i].FeeEarnerRef); listOfDocuments[i] = fileInfo; } } srvFileSearcher.IgnoreCase = !criteria.IsMatchCase; srvFileSearcher.SearchSubFolders = criteria.IsSubFolderSearch; srvFileSearcher.SearchInFiles = criteria.IsDeepSearch; srvFileSearcher.SearchFilesOfType = (SrvFileSearcher.AvailableFileTypes)criteria.DocumentType; if (string.IsNullOrEmpty(criteria.SearchString)) { criteria.SearchString = string.Empty; } srvFileSearcher.SearchSetPaths(listOfDocuments, criteria.SearchString); List<FileInfo> filesFound = srvFileSearcher.FilesFound; DataList<DocumentSearchItem> listDocuments = new DataList<DocumentSearchItem>(); foreach (FileInfo info in filesFound) { searchFilePath = string.Empty; DocumentSearchItem item = new DocumentSearchItem(); item.FileName = info.Name; string fileDescription = SrvDocumentCommon.GetDocumentDescription(info.Name); item.FileDescription = fileDescription; item.FilePath = info.FullName; foreach (string element in listOfDocuments) { searchFilePath = string.Empty; if (element.Contains("^")) { searchFilePath = element.Split('^')[0]; if (info.FullName == searchFilePath) { item.Id = Convert.ToInt32(element.Split('^')[2]); item.CreatedDate = Convert.ToDateTime(Convert.ToString(element.Split('^')[3])); item.FeeEarnerRef = Convert.ToString(Convert.ToString(element.Split('^')[4])); } } } listDocuments.Rows.Add(item); } returnValue.Document = listDocuments; returnValue.Message = srvFileSearcher.ErrorMessage; } 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 = srvFileSearcher.ErrorMessage + "<br />" + ex.Message; } return returnValue; }
/// <summary> /// Gets the documents for the matter. /// </summary> public DocumentSearchItem[] GetMatterDocuments(int startRow, int pageSize) { DocumentServiceClient documentService = new DocumentServiceClient(); DocumentSearchItem[] matterDocs = null; try { Guid logonId = ((LogonReturnValue)Session[SessionName.LogonSettings]).LogonId; CollectionRequest collectionRequest = new CollectionRequest(); collectionRequest.StartRow = startRow; collectionRequest.RowCount = pageSize; collectionRequest.ForceRefresh = true; if (Session[SessionName.ProjectId] != null) { DocumentSearchReturnValue returnValue = documentService.MatterDocumentSearch(logonId, (Guid)Session[SessionName.ProjectId], ""); if (returnValue != null) { if (returnValue.Success) { if (returnValue.Document != null) { List <DocumentSearchItem> _Dsi = new List <DocumentSearchItem>(); List <string> AppFiles = ApprovedFiles(); foreach (DocumentSearchItem _Dr in returnValue.Document.Rows) { if (AppFiles.Contains(_Dr.FileName.Trim())) { _Dsi.Add(_Dr); } } matterDocs = _Dsi.ToArray(); //_LblRowCount.Text = _Dsi.Count.ToString(); //matterDocs = returnValue.Document.Rows; //_matterDocumentRowCount = returnValue.Document.Rows.Length; } } else { throw new Exception(returnValue.Message); } } } else { throw new Exception("No Project Id found."); } return(matterDocs); } catch (Exception ex) { throw ex; } finally { if (documentService != null) { documentService.Close(); } } }