Ejemplo n.º 1
0
        public ActionResult ViewAwardRDV(Guid id)
        {
            return(ActionResultHelper.TryCatchWithLogger(() =>
            {
                AwardBatch awardBatch = _preservationService.GetAwardBatch(id);
                if (awardBatch.IdRDVDocument.HasValue)
                {
                    using (DocumentsClient client = new DocumentsClient())
                    {
                        DocumentContent content = client.GetDocumentContentById(awardBatch.IdRDVDocument.Value);
                        if (content != null)
                        {
                            return View(new WindowFileContentViewModel()
                            {
                                Content = System.Text.Encoding.UTF8.GetString(content.Blob)
                            });
                        }
                    }
                    _loggerService.Warn(string.Format("ViewAwardRDV -> nessun documento trovato con Id {0}.", awardBatch.IdRDVDocument));
                }

                WindowFileContentViewModel model = new WindowFileContentViewModel()
                {
                    Content = string.Empty
                };
                return View(model);
            }, _loggerService));
        }
Ejemplo n.º 2
0
        public ActionResult ViewAwardPDV(Guid id)
        {
            return(ActionResultHelper.TryCatchWithLogger(() =>
            {
                AwardBatch awardBatch = _preservationService.GetAwardBatch(id);
                if (awardBatch.IdPDVDocument.HasValue)
                {
                    using (DocumentsClient client = new DocumentsClient())
                    {
                        DocumentContent content = client.GetDocumentContentById(awardBatch.IdPDVDocument.Value);
                        if (content != null)
                        {
                            return View(new WindowFileContentViewModel()
                            {
                                Content = System.Text.Encoding.UTF8.GetString(content.Blob)
                            });
                        }
                        _loggerService.Warn(string.Format("ViewAwardPDV -> nessun documento trovato con Id {0}. Si procede con una nuova generazione del pacchetto di versamento.", awardBatch.IdPDVDocument));
                    }
                }

                string pdv = _preservationService.CreateAwardBatchPDVXml(awardBatch);
                SavePDVXml(pdv, awardBatch);
                WindowFileContentViewModel model = new WindowFileContentViewModel()
                {
                    Content = pdv
                };
                return View(model);
            }, _loggerService));
        }