Ejemplo n.º 1
0
        public static void CreateReport(string template, Report report, int type)
        {
            archiveManager = new ArchiveManager(dataManager);
            var service = new WordService(template, false);

            service = type == 2 ? InsertIntoSupplierReport(report, service) : InsertIntoClientReport(report, service);
            var fileListId = DataBaseClient.GetFileListAuctionByLot(report.Code);

            if (fileListId != null)
            {
                DocumentRequisite docReq = new DocumentRequisite()
                {
                    date     = fileListId.date,
                    fileName = template.Substring(template.LastIndexOf("\\") + 1),
                    market   = AltaBO.specifics.MarketPlaceEnum.ETS,
                    number   = fileListId.number,
                    section  = AltaBO.specifics.DocumentSectionEnum.Auction,
                    type     = type == 2 ? AltaBO.specifics.DocumentTypeEnum.SupplierReport : AltaBO.specifics.DocumentTypeEnum.CustomerReport
                };

                archiveManager.SaveFile(docReq, (int)fileListId.fileslistid);
                docReq.fileName = docReq.fileName.Replace(".docx", ".pdf");
                archiveManager.SaveFile(docReq, (int)fileListId.fileslistid);
            }

            service.SaveAsPDF(template);
            service.CloseDocument(true);
            service.CloseWord(true);
        }