public ILResponse GetBillDocuments([FromBody] BillDetails bills) { ILResponse response = new ILResponse(); string strBaseFilePath = null; byte[] Filebytes = null; List <FileData> lstActualData = new List <FileData>(); try { CaseTransferService service = new CaseTransferService(); IEnumerable <FileData> lstFileData = service.GetBillFiles(bills.billNumber); foreach (FileData data in lstFileData) { try { strBaseFilePath = null; Filebytes = null; string[] SplitFilePath = data.FilePath.Replace('\\', '/').Split('/'); strBaseFilePath = data.PhysicalBasePath; string NodeType = StringExtensions.GetNodeType(data.NodeType); if (NodeType == "") { NodeType = "UNCATEGORIZED"; } if (File.Exists(strBaseFilePath + data.FilePath)) { Filebytes = File.ReadAllBytes(strBaseFilePath + data.FilePath); } FileData fileObject = new FileData(); fileObject.FileName = SplitFilePath[SplitFilePath.Length - 1]; fileObject.BasePathId = data.BasePathId; fileObject.FilePath = data.FilePath.Replace('\\', '/'); fileObject.NodeType = NodeType; fileObject.FileContent = Filebytes; lstActualData.Add(fileObject); } catch (Exception ex) { log.Error("Error: " + ex.Message + ex.StackTrace); } } service.UpdateBillStatus(bills.companyId, bills.billNumber, bills.LawFirmId); response.MessageCode = MessageCodes.REQUEST_SUCCESS; response.MessageText = MSG_SUCCESS; response.MessageType = EnumMessageType.OPERATION_SUCCESS; response.Add(lstActualData); response.HasException = false; } catch (Exception ex) { response.MessageCode = MessageCodes.REQUEST_ERROR; response.HasException = true; response.MessageText = ex.Message; response.MessageType = EnumMessageType.OPERATION_APPLICATION_ERROR; response.Exception = ex.ToString(); log.Error("Error: " + ex.Message + ex.StackTrace); } return(response); }
public ILResponse GetAllBillDocumentsByCaseIDWithoutContent([FromBody] BillDetails bills) { ILResponse response = new ILResponse(); DateTime startTime = DateTime.UtcNow; var context = new HttpContextWrapper(HttpContext.Current); List <FileData> lstActualData = new List <FileData>(); string NodeType = string.Empty; try { CaseTransferService service = new CaseTransferService(); IEnumerable <FileData> lstFileData = service.GetAllBillDocumentsByCaseID(bills.billNumber); foreach (FileData data in lstFileData) { try { if (data.DocumentType == "BillDocuments") { NodeType = StringExtensions.GetNodeType(data.NodeType); if (NodeType == "") { NodeType = "UNCATEGORIZED"; } } else { NodeType = data.NodeType; } string[] SplitFilePath = data.FilePath.Replace('\\', '/').Split('/'); FileData fileObject = new FileData(); fileObject.FileName = SplitFilePath[SplitFilePath.Length - 1]; fileObject.FilePath = data.FilePath.Replace('\\', '/'); fileObject.NodeType = NodeType; fileObject.BasePathId = data.BasePathId; fileObject.PhysicalBasePath = data.PhysicalBasePath; fileObject.BasePathType = data.BasePathType; fileObject.DocumentType = data.DocumentType; lstActualData.Add(fileObject); } catch (Exception ex) { log.Error("Error: " + ex.Message + ex.StackTrace); } } service.UpdateBillStatus(bills.companyId, bills.billNumber, bills.LawFirmId); response.MessageCode = MessageCodes.REQUEST_SUCCESS; response.MessageText = MSG_SUCCESS; response.MessageType = EnumMessageType.OPERATION_SUCCESS; response.Add(lstActualData); response.HasException = false; } catch (Exception ex) { response.MessageCode = MessageCodes.REQUEST_ERROR; response.HasException = true; response.MessageText = ex.Message; response.MessageType = EnumMessageType.OPERATION_APPLICATION_ERROR; response.Exception = ex.ToString(); log.Error("Error: " + ex.Message + ex.StackTrace); } return(response); }