//TODO возможно информацию нужно будет брать еще и с материалов public void GetRequisitionInfo(GetRequisitionInfoArgument argument, GetRequisitionInfoResult result) { var image = _niisContext.Requests .Where(x => x.Barcode == argument.DocumentID) .Select(x => x.Image) .FirstOrDefault(); if (image != null) { if (_validationHelper.SenderIsPep(argument.SystemInfo.Sender)) { var shepFile = _attachFileHelper.ShepFileUpload(image, ImageName); result.Image = new File { ShepFile = shepFile }; } else { result.Image = new File { Content = image, Name = ImageName }; } } result.ApplicantList = GetApplicants(argument.DocumentID).ToArray(); result.DocumentID = argument.DocumentID; }
public void GetMessageFile(GetMessageFileArgument argument, GetMessageFileResult result) { var dicReceiveTypeElectronicFeedId = _dictionaryHelper.GetDictionaryIdByCode(nameof(DicReceiveType), DicReceiveTypeCodes.ElectronicFeed); var childClass = _dictionaryHelper.GetChildClass(new[] { dicReceiveTypeElectronicFeedId }); var docInfo = _niisWebContext.DocumentDocumentRelations .Include(x => x.Child) .Include(x => x.Parent) .Include(x => x.Child.Type) .Include(x => x.Child.Workflows) .Include(x => x.Child.MainAttachment) .Where(x => x.Parent.Barcode == argument.MainDocumentID && (childClass.Contains(x.Child.Type.ClassificationId ?? 0) || x.Child.Type.ClassificationId == dicReceiveTypeElectronicFeedId) && x.Child.Workflows.Count(w => w.IsComplete == true) > 0) .OrderBy(x => x.Child.CurrentWorkflows.Select(d => d.DateCreate).Max()) .Select(x => new { Id = x.Child.Barcode, x.Child.TypeId, x.Child.OutgoingNumber, x.Child.DateCreate, DocTypeName = x.Child.Type.NameRu, x.Child.MainAttachment.PageCount, x.Child.MainAttachment.OriginalName, x.Child.MainAttachment.BucketName }) .FirstOrDefault(); if (docInfo == null) { return; } result.DocDate = docInfo.DateCreate.Date; result.DocNumber = docInfo.OutgoingNumber; result.MainDocumentID = argument.MainDocumentID; result.PageCount = docInfo.PageCount ?? 0; result.CorrespondenceType = new RefKey { UID = docInfo.TypeId, Note = docInfo.DocTypeName }; result.DocumentID = docInfo.Id; var file = _attachFileHelper.GetFile(docInfo.BucketName, docInfo.OriginalName); if (_validationHelper.SenderIsPep(argument.SystemInfo.Sender)) { var shepFile = _attachFileHelper.ShepFileUpload(file, docInfo.OriginalName); result.File = new File { ShepFile = shepFile }; } else { result.File = new File { Name = docInfo.OriginalName, Content = file }; } }