public void Run() { try { var report = new SampleReport() { Created = DateTime.Now, Data = new System.Collections.Generic.List <SampleDatum>(), //Data = RunQuery<SampleDatum>(), }; // Pass into Razor engine string template = "Created on <strong>@Model.Created</strong> with <strong>@Model.Data.Count</strong> records."; var html = Engine.Razor.RunCompile(template, "template-01", typeof(SampleReport), report); // Send Mail var mailMessage = new MailMessage(); mailMessage.To.Add("*****@*****.**"); mailMessage.Subject = "Sample SQL Report"; mailMessage.From = new MailAddress("root@localhost"); mailMessage.Body = html; mailMessage.IsBodyHtml = true; MailClient.Send(mailMessage); } catch (Exception exception) { throw new IntegrationJobRunFailureException("SampleSqlReportJob failed.", exception); } }
public void Run() { try { var report = new SampleReport() { Created = DateTime.Now, Data = new System.Collections.Generic.List<SampleDatum>(), //Data = RunQuery<SampleDatum>(), }; // Pass into Razor engine string template = "Created on <strong>@Model.Created</strong> with <strong>@Model.Data.Count</strong> records."; var html = Engine.Razor.RunCompile(template, "template-01", typeof(SampleReport), report); // Send Mail var mailMessage = new MailMessage(); mailMessage.To.Add("*****@*****.**"); mailMessage.Subject = "Sample SQL Report"; mailMessage.From = new MailAddress("root@localhost"); mailMessage.Body = html; mailMessage.IsBodyHtml = true; MailClient.Send(mailMessage); } catch (Exception exception) { throw new IntegrationJobRunFailureException("SampleSqlReportJob failed.", exception); } }
public ActionResult Export() { var model = Product.GetProducts(); IBasePrintable gridViewPrintable = GridViewExtension.CreatePrintableObject(ViewsHelper.CreateGridViewSettings(), model); IBasePrintable pivotGridPrintable = PivotGridExtension.CreatePrintableObject(ViewsHelper.CreatePivotGridSettings(), model); XtraReport report = new SampleReport(gridViewPrintable, pivotGridPrintable); MemoryStream stream = new MemoryStream(); report.ExportToPdf(stream); return(File(stream.ToArray(), "application/pdf")); }
public ActionResult ConcreteSampleReports() { var samples = db.ConcreteSample1.OrderByDescending(r => r.ReportDate).ToList(); List <SampleReport> result = new List <SampleReport>(); SampleReport s; if (samples.Count() > 0) { foreach (var sample in samples) { s = new SampleReport { SampleNumber = sample.SampleNumber, ReportedDate = sample.ReportDate, FactoryName = sample.FactoryName, MonitorName = db.Users.Where(u => u.Id == sample.SampledBy).FirstOrDefault().FullName, CustomerName = sample.ClientName }; result.Add(s); } } return(View(result)); }
public ReportViewSampleData() { ActiveReport = new SampleReport(); }