public Boolean UpdateDocumentsDataForUser(Int64 fileId, String fileName, String userName, String metaTags, String companyInfo , String categoryType, String comment, Byte[] overwriteStream) { try { ICPresentationEntities entity = new ICPresentationEntities(); if (overwriteStream == null) { entity.UpdateDocumentsData(fileId, userName, metaTags, companyInfo, categoryType, comment); } else { FileMaster fileMaster = entity.FileMasters.Where(record => record.FileID == fileId).FirstOrDefault(); if (fileMaster != null) { String uploadUrl = UploadDocument(fileName, overwriteStream, fileMaster.Location); Int32? result = entity.SetUploadFileInfo(userName, fileName, uploadUrl, companyInfo, null, null , categoryType, metaTags, comment).FirstOrDefault(); if (result == 0) { entity.DeleteFileMaster(fileMaster.FileID); } } } return(true); } catch (Exception ex) { ExceptionTrace.LogException(ex); string networkFaultMessage = ServiceFaultResourceManager.GetString("NetworkFault").ToString(); throw new FaultException <ServiceFault>(new ServiceFault(networkFaultMessage), new FaultReason(ex.Message)); } }
public List <DocumentCategoricalData> RetrieveDocumentsDataForUser(String userName) { try { List <DocumentCategoricalData> result = new List <DocumentCategoricalData>(); ICPresentationEntities entity = new ICPresentationEntities(); List <FileMaster> data = entity.FileMasters.Where(record => record.CreatedBy == userName).ToList(); if (data == null) { return(result); } foreach (FileMaster fileMasterRecord in data) { DocumentCatalogData documentCatalogData = new DocumentCatalogData() { FileId = fileMasterRecord.FileID, FileMetaTags = fileMasterRecord.MetaTags, FileName = fileMasterRecord.Name, FilePath = fileMasterRecord.Location, FileUploadedBy = fileMasterRecord.CreatedBy, FileUploadedOn = Convert.ToDateTime(fileMasterRecord.CreatedOn) }; List <CommentInfo> commentInfo = fileMasterRecord.CommentInfoes.ToList(); List <CommentDetails> commentDetails = new List <CommentDetails>(); foreach (CommentInfo info in commentInfo) { commentDetails.Add(new CommentDetails() { Comment = info.Comment, CommentBy = info.CommentBy, CommentOn = Convert.ToDateTime(info.CommentOn) }); } result.Add(new DocumentCategoricalData() { CommentDetails = commentDetails, DocumentCatalogData = documentCatalogData, DocumentCategoryType = (DocumentCategoryType)EnumUtils.ToEnum(fileMasterRecord.Type, typeof(DocumentCategoryType)), DocumentCompanyName = fileMasterRecord.IssuerName, DocumentSecurityName = fileMasterRecord.SecurityName, DocumentSecurityTicker = fileMasterRecord.SecurityTicker }); } return(result); } catch (Exception ex) { ExceptionTrace.LogException(ex); string networkFaultMessage = ServiceFaultResourceManager.GetString("NetworkFault").ToString(); throw new FaultException <ServiceFault>(new ServiceFault(networkFaultMessage), new FaultReason(ex.Message)); } }
public List <string> GetDocumentsMetaTags(Boolean OnlyTags) { try { ICPresentationEntities entity = new ICPresentationEntities(); List <string> metaTagsInfo = new List <string>(); List <String> metaTags = entity.FileMasters.Select(a => a.MetaTags).Distinct().ToList(); for (int i = 0; i < metaTags.Count; i++) { if (metaTags[i] != null) { if (metaTags[i].Contains(";")) { List <String> subTags = metaTags[i].Split(';').ToList(); metaTagsInfo.AddRange(subTags); } else { metaTagsInfo.Add(metaTags[i]); } } } if (!OnlyTags) { metaTagsInfo.AddRange(entity.FileMasters.Select(a => a.IssuerName).Distinct().ToList()); metaTagsInfo.AddRange(entity.FileMasters.Select(a => a.SecurityName).Distinct().ToList()); metaTagsInfo.AddRange(entity.FileMasters.Select(a => a.SecurityTicker).Distinct().ToList()); } for (int i = 0; i < metaTagsInfo.Count; i++) { if (metaTagsInfo[i] != null) { metaTagsInfo[i] = metaTagsInfo[i].ToUpper(); } } metaTagsInfo = metaTagsInfo.Where(record => record != null && record != String.Empty).ToList(); metaTagsInfo = metaTagsInfo.Distinct().ToList(); return(metaTagsInfo); } catch (Exception ex) { ExceptionTrace.LogException(ex); string networkFaultMessage = ServiceFaultResourceManager.GetString("NetworkFault").ToString(); throw new FaultException <ServiceFault>(new ServiceFault(networkFaultMessage), new FaultReason(ex.Message)); } }
public Boolean SetDocumentComment(String userName, Int64 fileId, String comment) { try { ICPresentationEntities entity = new ICPresentationEntities(); Int32?result = entity.SetFileCommentInfo(userName, fileId, comment).FirstOrDefault(); return(result == 0); } catch (Exception ex) { ExceptionTrace.LogException(ex); string networkFaultMessage = ServiceFaultResourceManager.GetString("NetworkFault").ToString(); throw new FaultException <ServiceFault>(new ServiceFault(networkFaultMessage), new FaultReason(ex.Message)); } }
public bool DeleteFileMasterRecord(Int64 fileId) { try { ICPresentationEntities entity = new ICPresentationEntities(); entity.DeleteFileMaster(fileId); return(true); } catch (Exception ex) { ExceptionTrace.LogException(ex); string networkFaultMessage = ServiceFaultResourceManager.GetString("NetworkFault").ToString(); throw new FaultException <ServiceFault>(new ServiceFault(networkFaultMessage), new FaultReason(ex.Message)); } }
public Boolean SetUploadFileInfo(String userName, String Name, String Location, String CompanyName, String SecurityName , String SecurityTicker, String Type, String MetaTags, String Comments) { try { ICPresentationEntities entity = new ICPresentationEntities(); Int32?result = entity.SetUploadFileInfo(userName, Name, Location, CompanyName, SecurityName , SecurityTicker, Type, MetaTags, Comments).FirstOrDefault(); return(result == 0); } catch (Exception ex) { ExceptionTrace.LogException(ex); string networkFaultMessage = ServiceFaultResourceManager.GetString("NetworkFault").ToString(); throw new FaultException <ServiceFault>(new ServiceFault(networkFaultMessage), new FaultReason(ex.Message)); } }
public List <DocumentCategoricalData> RetrieveDocumentsData(String searchString) { try { List <DocumentCategoricalData> result = new List <DocumentCategoricalData>(); ICPresentationEntities entity = new ICPresentationEntities(); List <DocumentsData> documentsDataInfo = entity.GetDocumentsData(searchString).ToList(); if (documentsDataInfo == null) { return(result); } List <DocumentsData> distinctDocumentsData = documentsDataInfo .GroupBy(record => record.FileID, (key, group) => group.First()).ToList(); foreach (DocumentsData distinctInfo in distinctDocumentsData) { List <DocumentsData> distinctDocumentsDataInfo = documentsDataInfo .Where(record => record.FileID == distinctInfo.FileID).ToList(); List <CommentDetails> commentsDetails = new List <CommentDetails>(); foreach (DocumentsData documentData in distinctDocumentsDataInfo) { commentsDetails.Add(new CommentDetails() { Comment = documentData.Comment, CommentBy = documentData.CommentBy, CommentOn = Convert.ToDateTime(documentData.CommentOn) }); } result.Add(new DocumentCategoricalData() { DocumentCategoryType = (DocumentCategoryType)EnumUtils.ToEnum(distinctInfo.Type, typeof(DocumentCategoryType)), DocumentCompanyName = distinctInfo.IssuerName, DocumentSecurityName = distinctInfo.SecurityName, DocumentSecurityTicker = distinctInfo.SecurityTicker, DocumentCatalogData = new DocumentCatalogData() { FileId = distinctInfo.FileID, FileMetaTags = distinctInfo.MetaTags, FileName = distinctInfo.Name, FilePath = distinctInfo.Location, FileUploadedBy = distinctInfo.CreatedBy, FileUploadedOn = Convert.ToDateTime(distinctInfo.CreatedOn) }, CommentDetails = commentsDetails }); } return(result); } catch (Exception ex) { ExceptionTrace.LogException(ex); string networkFaultMessage = ServiceFaultResourceManager.GetString("NetworkFault").ToString(); throw new FaultException <ServiceFault>(new ServiceFault(networkFaultMessage), new FaultReason(ex.Message)); } }