Beispiel #1
0
        public FileResult DownloadIOU(string id)
        {
            string fileName = string.Format("IOU_{0}_{1}.pdf", CurrentMerchantID, ContractID);
            var iou = contractApi.GetIOUDetails(CurrentMerchantID, ContractID);

            string templateFile = string.Empty;

            if (iou.BusinesTypeId == 11001) 	//Persona Fisica
            {
                if (iou.StateId == 30) //Santo Domingo
                {
                    if (iou.OwnerList.Count > 1)
                    {
                        templateFile = "IOUPersonaFisicaSantoDomingo2Owner";
                    }
                    else
                    {
                        templateFile = "IOUPersonaFisicaSantoDomingo1Owner";
                    }

                }
                else
                {
                    if (iou.OwnerList.Count > 1)
                    {
                        templateFile = "IOUPersonaFisica2Owner";
                    }
                    else
                    {
                        templateFile = "IOUPersonaFisica1Owner";
                    }
                }

            }
            else
            {
                if (iou.StateId == 30) //Santo Domingo
                {
                    if (iou.OwnerList.Count > 1)
                    {
                        templateFile = "IOUSantoDomingo2Owner";
                    }
                    else
                    {
                        templateFile = "IOUSantoDomingo1Owner";
                    }

                }
                else
                {
                    if (iou.OwnerList.Count > 1)
                    {
                        templateFile = "IOUOther2Owner";
                    }
                    else
                    {
                        templateFile = "IOUOther1Owner";
                    }
                }
            }

            string destPdf = Path.Combine(Server.MapPath("~/Docs/Contract"), fileName);

            PdfHelper pdfHelper = new PdfHelper();

            pdfHelper.CreatePDF(iou, Server.MapPath(ConfigurationManager.AppSettings[templateFile]), destPdf);

            return File(destPdf, "application/pdf", "IOU.pdf");
        }
Beispiel #2
0
        public ActionResult GenerateBLA(ContractModel model, string button)
        {
            string blafileName = string.Format("Cont_{0}_{1}.pdf", CurrentMerchantID, ContractID);

            if (button == "BLA")
            {
                var bla = contractApi.GetBLADetails(CurrentMerchantID, ContractID);

                bla.ExpenseAmount = model.AdminExp.ToString();

                string tempFilePath = System.IO.Path.GetTempFileName();

                string destPdf = Path.Combine(Server.MapPath("~/Docs/Contract"), blafileName);
                string termsPdf = Server.MapPath(ConfigurationManager.AppSettings["ContractTermsPDF"]);

                PdfHelper pdfHelper = new PdfHelper();

                pdfHelper.CreatePDF(bla, Server.MapPath(ConfigurationManager.AppSettings["BLATemplate"]), tempFilePath);

                pdfHelper.CombineMultiplePDFs(new string[] { tempFilePath, termsPdf }, destPdf);
            }
            else if (button == "IOU")
            {

            }
            model.FileName = blafileName;
            return PartialView("_Contracts", model);
        }