public string GenerateSingleDN(string templatePath, USPrimeOrderDto order)
        {
            var asposeWb = new Workbook(templatePath);
            var asposeWs = asposeWb.Worksheets[0];

            asposeWs.Cells[2, 11].PutValue(order.hblNumber);
            asposeWs.Cells[10, 3].PutValue(order.customerName);
            asposeWs.Cells[11, 3].PutValue(order.address_1);
            asposeWs.Cells[12, 3].PutValue(order.address_2);
            asposeWs.Cells[10, 11].PutValue(order.dnDate.ToString("yyyy-MM-dd"));
            asposeWs.Cells[13, 11].PutValue(order.by);

            asposeWs.Cells[15, 2].PutValue("HB/L# " + order.hblNumber.Substring(6));
            asposeWs.Cells[16, 2].PutValue("MB/L# " + order.mblNumber);

            asposeWs.Cells[18, 3].PutValue("Trucking Fee");
            asposeWs.Cells[18, 9].PutValue(1);
            asposeWs.Cells[18, 10].PutValue(order.truckingFee);

            asposeWs.Cells[19, 3].PutValue("Handling Fee");
            asposeWs.Cells[19, 9].PutValue(1);
            asposeWs.Cells[19, 10].PutValue(order.handlingFee);

            if (order.profitShare != 0)
            {
                asposeWs.Cells[20, 3].PutValue("Profit Share");
                asposeWs.Cells[20, 9].PutValue(1);
                asposeWs.Cells[20, 10].PutValue(order.profitShare);
            }

            asposeWs.Cells[38, 2].PutValue(order.OriginNote);

            var fullPath = @"D:\usprime\DN\DN-" + order.customerName + "-" + order.dnDate.ToString("yyyyMMdd") + ".pdf";

            asposeWb.Save(fullPath, SaveFormat.Xlsx);

            var wb = new Workbook(fullPath);

            fullPath = @"D:\usprime\DN\DN-" + order.customerName + "-" + order.dnDate.ToString("yyyyMMdd") + ".pdf";

            wb.Save(fullPath, SaveFormat.Pdf);

            return(fullPath);
        }
        public IHttpActionResult DownloadPdf([FromUri] string operation, [FromBody] USPrimeOrderDto order)
        {
            var customerInDb = _context.UpperVendors.SingleOrDefault(x => x.CustomerCode == order.customerCode);

            order.customerName = customerInDb.Name;
            order.address_1    = customerInDb.FirstAddressLine;
            order.address_2    = customerInDb.SecondAddressLine;

            var templatePath = @"D:\Template\PRIME-DN-TEMPLATE.xlsx";
            var g            = new FBAInvoiceHelper(templatePath);
            var path         = g.GenerateSingleDN(order);

            if (operation == "EMAIL")
            {
                var destMail = customerInDb.EmailAddress;
                //var mailService = new MailServiceManager();
                //mailService.SendMail(destMail, null, order.cc, path, "USPRIME-DN");

                var mailService = new MailServiceManager("*****@*****.**", "#lxX.Py#h,9s");
                mailService.SendMailFromUSPRIME(destMail, null, order.cc, path, $"USPRIME-DN-{order.hblNumber.Substring(6)}");
            }

            return(Ok(path));
        }