public ActionResult DownloadPDF(int id) { //pdf creation var pdf = new ActionAsPdf("ViewNote", new { id = id }); return(pdf); }
public ActionResult InprimirCuponDescuento(string producto_id, string codigo_venta) { var usuarioSesion = Session["USUARIO_SESION"] as UsuarioSesionBO; var q = new ActionAsPdf("GenerarCuponPDF", new { id = producto_id, nombre = usuarioSesion.nombre, codigo_venta = codigo_venta }); return(q); }
public ActionResult PrescribePatient(Prescription prescription, int AppointmentId) { ViewBag.PrescribePatient = "active"; string name; name = DateTime.Now.ToString("dd-MM-yyyy") + "_" + prescription.PatientId + "_" + Guid.NewGuid() + ".pdf"; using (var ctx = new HospitalContext()) { Appointment apt = ctx.Appointment.Find(AppointmentId); apt.Chat = baseControl.Encrypt(prescription.Chat); if (prescription.WardId > 0) { apt.WardId = prescription.WardId; } ctx.SaveChanges(); var kl = from a in ctx.Appointment join p in ctx.Patient on a.PatientId equals p.Id join d in ctx.Doctor on a.DoctorId equals d.Id where a.Id == AppointmentId select new { DoctorName = d.Name, DoctorDesignation = d.Designation, DoctorDegree = d.Degree, PatientName = p.Name, PatientPhone = p.PhoneNo, PatientAge = p.Age }; foreach (var v in kl) { prescription.DoctorDesignation = baseControl.Decrypt(v.DoctorDesignation); prescription.DoctorName = baseControl.Decrypt(v.DoctorName); prescription.DoctorDegree = baseControl.Decrypt(v.DoctorDegree); prescription.PatientName = baseControl.Decrypt(v.PatientName); prescription.PatientAge = v.PatientAge; prescription.PatientPhone = baseControl.Decrypt(v.PatientPhone); } Appointment ap = ctx.Appointment.Single(c => c.Id == AppointmentId); ap.Prescription = "PatientPrescriptions/" + name; ap.Approval = 3; ctx.SaveChanges(); } var printpdf = new ActionAsPdf("MakePdf", prescription) { FileName = name }; string path = Server.MapPath("~/PatientPrescriptions"); string pth = Path.Combine(path, name); var byteArray = printpdf.BuildPdf(ControllerContext); var fileStream = new FileStream(pth, FileMode.Create, FileAccess.Write); fileStream.Write(byteArray, 0, byteArray.Length); fileStream.Close(); return(printpdf); }
public ActionResult PrintAllApproved() { int InstituteID = int.Parse(Session["InstitutionID"].ToString()); var ApprovedStudents = new ActionAsPdf("AvailingStudents", new { reportid = InstituteID }); return(ApprovedStudents); }
public ActionResult ImprimirPDF() { var actionResult = new ActionAsPdf("PDF") { FileName = FileName + Extencion }; var misDatos = System.IO.Path.Combine(AppDomain.CurrentDomain.BaseDirectory, RutaPDF + ArchivoReporte); var byteArray = actionResult.BuildPdf(ControllerContext); try { using (var fileStream = new FileStream(misDatos, FileMode.OpenOrCreate, FileAccess.ReadWrite)) { fileStream.Write(byteArray, 0, byteArray.Length); fileStream.Close(); } } catch (Exception) { ArchivoReporte = NombreReporte + DateTime.Now.Year + DateTime.Now.Month + DateTime.Now.Day + DateTime.Now.Hour + DateTime.Now.Minute + DateTime.Now.Second + Extencion; misDatos = System.IO.Path.Combine(AppDomain.CurrentDomain.BaseDirectory, RutaPDF + ArchivoReporte); using (var fileStream = new FileStream(misDatos, FileMode.OpenOrCreate, FileAccess.ReadWrite)) { fileStream.Write(byteArray, 0, byteArray.Length); fileStream.Close(); } } return(actionResult); }
public ActionResult DownloadViewPDF() { var p = new ActionAsPdf("Index"); return(p); //Code to get content }
public ActionResult fiPdfAdmit() { var receiptId = Session["receiptId"].ToString(); var report = new ActionAsPdf("fiAdmitCard", new { receiptId = receiptId }); return(report); }
public ActionResult PrintAll() { int InstituteID = int.Parse(Session["InstitutionID"].ToString()); var q = new ActionAsPdf("ScholarshipDetailsYearWise", new { reportid = InstituteID }); return(q); }
public ActionResult ExportFilePDF(int?Id) { TempData["OrderId"] = Id; ActionAsPdf result = new ActionAsPdf("ExportOrder", new { Id = Id }); return(result); }
public ActionResult ConvertirPDF(int id) { var clienteId = id; var imprimir = new ActionAsPdf("Details", new { id = clienteId }); return(imprimir); }
public ActionResult PDF_Saldos(string id, string id2) { try { string customSwitches = string.Format("--header-center \"COMO USAR O ROTATIVA\" " + "--header-spacing \"8\" " + "--header-font-name \"Open Sans\" " + "--footer-font-size \"8\" " + "--footer-font-name \"Open Sans\" " + "--header-font-size \"10\" " + "--footer-right \"Pag: [page] de [toPage]\""); var report = new ActionAsPdf("RptSaldos", new { id, id2 }) { //FileName = "Invoice.pdf", PageOrientation = Rotativa.Options.Orientation.Landscape, CustomSwitches = "--margin-bottom 15 --margin-left 10 --margin-right 10 --margin-top 17 --footer-right \"Fecha: [date]\" " + "--footer-center \"Pagina: [page] de [toPage]\" --footer-line --footer-font-size \"12\" --footer-spacing 5 --footer-font-name \"calibri light\"" //"--page-offset 0 --footer-center [page] --footer-font-size 12 --viewport-size 1000x1000" //PageMargins = new Rotativa.Options.Margins(30, 10, 15, 10) //pageMargins = new Rotativa.Options.Margins() }; return(report); } catch (Exception ex) { throw ex; //return RedirectToAction("Index"); } }
public ActionResult ViewSafetyAuditPDF() { var date = DateTime.Now.ToString("MM-dd-yyyy"); var report = new ActionAsPdf("SafetyAuditPDF"); //{ FileName = "SafetyAudit - " + date + ".pdf" }; return(report); }
public ActionResult downloadPdf() { var userId = Session["userId"].ToString(); var report = new ActionAsPdf("studentShip", new { userId = userId }); return(report); }
// FI PDF ADMIT Card ------------------------------------------------------------ public ActionResult pdfAdmit() { var userId = Session["userId"].ToString(); var report = new ActionAsPdf("adminCard", new { userId = userId }); return(report); }
public ActionResult PDF_INDEX() { try { CatClienteModels Cliente = new CatClienteModels(); CatCliente_Datos ClienteD = new CatCliente_Datos(); Cliente.Conexion = Conexion; Cliente = ClienteD.ObtenerClientes(Cliente); //new ViewAsPdf("Index") { PageOrientation = Rotativa.Options.Orientation.Landscape, CustomSwitches = "--viewport-size 1000x1000" }; var report = new ActionAsPdf("Index") { //FileName = "Invoice.pdf", PageOrientation = Rotativa.Options.Orientation.Landscape, CustomSwitches = "--page-offset 0 --footer-center [page] --footer-font-size 12 --viewport-size 1000x1000" }; return(report); //var pdfResult = new ActionAsPdf("Index", new { name = "Giorgio" }) { FileName = "Test.pdf" }; //var binary = pdfResult.BuildPdf(this.ControllerContext); //return File(binary, "application/pdf"); } catch (Exception) { CatClienteModels Cliente = new CatClienteModels(); Cliente.ListaClientes = new List <CatClienteModels>(); TempData["typemessage"] = "2"; TempData["message"] = "No se puede cargar la vista"; return(View(Cliente)); } }
private void CreatePDF(int orderId, OrderStatus status) { var order = svc.GetOrder(orderId); if (order == null) { throw new Exception("order not found"); } if (order.ISP == null) { throw new Exception("ISP is null"); } string fileName = DateTime.Now.ToString("yyyy-MM-dd-HH-mm-") + order.ISP.Name + "-" + status + ".pdf"; string targetFolder = System.Web.HttpContext.Current.Server.MapPath("~/Assets/OrderPDF/"); string targetPath = Path.Combine(targetFolder, fileName); var asset = new Asset { AssetPath = targetPath, Name = fileName, CreatedDate = DateTime.Now }; svc.SaveOrderPDFAsset(order, asset); var actionResult = new ActionAsPdf("Details", new { id = order.OrderId }); var byteArray = actionResult.BuildPdf(ControllerContext); var fileStream = new FileStream(targetPath, FileMode.Create, FileAccess.Write); fileStream.Write(byteArray, 0, byteArray.Length); fileStream.Close(); }
public ActionResult pdf_admit() { string userRoll = Session["admission_roll"].ToString(); var report = new ActionAsPdf("admitCard", new { userRoll = userRoll }); return(report); }
public ActionResult pdfStuCer() { var userId = Session["userId"].ToString(); var report = new ActionAsPdf("stuCer", new { userId = userId }); return(report); }
public ActionResult PrintAllRequest() { int requestyear = int.Parse(TempData["year"].ToString()); int InstituteID = int.Parse(Session["InstitutionID"].ToString()); var q = new ActionAsPdf("ScholarshipRequests", new { reportid = InstituteID, requestyear = requestyear }); return(q); }
public ActionResult PrintRapprt3() { // LangueController.CreateCulture(getLangue()); CreateCulture(getLangue()); var list = new ActionAsPdf("ListObjetVenduSouPeu"); return(list); }
public ActionResult PrintObjetvendu() { // LangueController.CreateCulture(getLangue()); CreateCulture(getLangue()); var list = new ActionAsPdf("getEnchereVendeur", new { etat = 1 }); return(list); }
/// <summary> /// Print the cv Operation /// </summary> /// <returns></returns> public ActionResult PrintCV() { string emailAddress = (string)Session["email"]; ServiceProvider sp = new ServiceProvider(); var cv = new ActionAsPdf("Findex", new { email = emailAddress }); return(cv); }
public ActionResult PrintSyntheseVenteAnnuel() { // LangueController.CreateCulture(getLangue()); CreateCulture(getLangue()); var list = new ActionAsPdf("SyntheseVenteAnnuel"); return(list); }
public ActionResult PrintEvaluaionMembre() { // LangueController.CreateCulture(getLangue()); CreateCulture(getLangue()); var list = new ActionAsPdf("ListeEvaluationsMembres"); return(list); }
public ActionResult BinaryTest() { var pdfResult = new ActionAsPdf("Index", new { name = "Giorgio" }) { FileName = "Test.pdf" }; var binary = pdfResult.BuildPdf(this.ControllerContext); return File(binary, "application/pdf"); }
public ActionResult PrintObjetIntressemembre() { // LangueController.CreateCulture(getLangue()); CreateCulture(getLangue()); var list = new ActionAsPdf("ObjetIntressemembre"); return(list); }
public async Task <ActionResult> SendInvoice(int id) { Order order = await db.Orders.FindAsync(id); if (order != null) { Dictionary <string, string> cookieCollection = new Dictionary <string, string>(); foreach (var key in Request.Cookies.AllKeys) { cookieCollection.Add(key, Request.Cookies.Get(key).Value); } ActionAsPdf pdf = new ActionAsPdf("Invoice", new { id }) { FileName = $"Order#{order.Id}-{DateTime.Now.ToFileTime()}.pdf", RotativaOptions = new DriverOptions { Cookies = cookieCollection, } }; var message = new MimeMessage(); message.From.Add(new MailboxAddress("Kishor", "*****@*****.**")); message.To.Add(new MailboxAddress($"{order.Customer.FirstName} {order.Customer.LastName}", $"{order.Customer.Email}")); message.Subject = $"Order#{order.Id} Invoice"; var builder = new BodyBuilder(); // Set the plain-text version of the message text builder.TextBody = $"Hey {order.Customer.FirstName} {order.Customer.LastName}, Here is your invoice for Order#{order.Id}"; // We may also want to attach a calendar event for Monica's party... builder.Attachments.Add(pdf.FileName, pdf.BuildPdf(ControllerContext)); // Now we just need to set the message body and we're done message.Body = builder.ToMessageBody(); using (var client = new SmtpClient()) { client.Connect("smtp.gmail.com", 587); // Note: since we don't have an OAuth2 token, disable // the XOAUTH2 authentication mechanism. client.AuthenticationMechanisms.Remove("XOAUTH2"); // Note: only needed if the SMTP server requires authentication client.Authenticate("*****@*****.**", "kxbcyuqhwtbhzjml"); client.Send(message); client.Disconnect(true); return(Json("Email Sent", JsonRequestBehavior.AllowGet)); } } return(HttpNotFound()); }
public ActionResult GeneratePDF(Models.Certificado modelo) { var model = new Models.Certificado() { RunC = Session["rutConsu"].ToString(), UserC = Session["userName"].ToString() }; using (var db = new MisOfertas.Datos.MisOfertasEntities()) { var consu = db.CONSUMIDOR.Where(x => x.PERSONA_RUN == model.RunC).FirstOrDefault(); if (consu.PUNTOS >= 0 && consu.PUNTOS <= 100) { MisOfertas.Negocio.Models.CertificadoEmitido certificadoEmitido = new MisOfertas.Negocio.Models.CertificadoEmitido() { Run = model.RunC, Descuento = 5, Idcert = 1, Ptsusados = consu.PUNTOS, Username = model.UserC }; certificadoEmitido.Agregar(); } else if (consu.PUNTOS >= 101 && consu.PUNTOS <= 500) { MisOfertas.Negocio.Models.CertificadoEmitido certificadoEmitido = new MisOfertas.Negocio.Models.CertificadoEmitido() { Run = model.RunC, Descuento = 10, Idcert = 2, Ptsusados = consu.PUNTOS, Username = model.UserC }; certificadoEmitido.Agregar(); } else if (consu.PUNTOS >= 501 && consu.PUNTOS <= 1000) { MisOfertas.Negocio.Models.CertificadoEmitido certificadoEmitido = new MisOfertas.Negocio.Models.CertificadoEmitido() { Run = model.RunC, Descuento = 15, Idcert = 3, Ptsusados = consu.PUNTOS, Username = model.UserC }; certificadoEmitido.Agregar(); } } var q = new ActionAsPdf("Certificado", model); return(q); }
public IActionResult GeneratePayslipPdf(int id) { var payslip = new ActionAsPdf("Payslip", new { id = id }) { FileName = "payslip.pdf" }; return(payslip); }
public ActionResult PrintAl() { var q = new ActionAsPdf("Index2", new { name = "Admin" }) { FileName = "ListaTowarów.pdf" }; return(q); }
public ActionResult GetPurchaseReport(DateTime startDate, DateTime endDate) { var report = new ActionAsPdf("PurchaseReportPdf", new { startDate, endDate }) { FileName = "PurchaseReportPdf.pdf" }; return(report); }