public void check_thead_tbody_tfoot_access() { var expected = "<table><thead class=\"header\"></thead><tfoot class=\"footer\"></tfoot><tbody class=\"body\"></tbody></table>"; var table = new TableTag(); table.THead.AddClass("header"); table.TBody.AddClass("body"); table.TFoot.AddClass("footer").Render(true); System.Diagnostics.Trace.TraceInformation(table.ToString()); table.ToString().ShouldEqual(expected); }
protected override void teardown() { var messages = _nodes.LoggedEvents().ToArray(); var table = new TableTag(); table.AddHeaderRow(_ => { _.Header("Node"); _.Header("Subject"); _.Header("Type"); _.Header("Message"); }); messages.Each(message => { table.AddBodyRow(_ => { _.Cell(message.NodeId); _.Cell(message.Subject.ToString()); _.Cell(message.GetType().Name); _.Cell(message.ToString()); }); }); Context.Reporting.Log("Monitored Node Group", table.ToString()); _nodes.Dispose(); }
public string ToHtml() { var table = new TableTag(); table.AddClass("table"); table.AddClass("table-striped"); table.AddHeaderRow(row => { row.Header("Details"); row.Header("Duration (ms)"); row.Header("Method"); row.Header("Endpoint"); row.Header("Status"); row.Header("Content Type"); }); _logs.Each(log => { var url = _system.Application.RootUrl.TrimEnd('/') + "/_fubu/#/fubumvc/request-details/" + log.Id; table.AddBodyRow(row => { row.Cell().Add("a").Text("Details").Attr("href", url).Attr("target", "_blank"); row.Cell(log.ExecutionTime.ToString()).Attr("align", "right"); row.Cell(log.HttpMethod); row.Cell(log.Endpoint); row.Cell(log.StatusCode.ToString()); row.Cell(log.ContentType); }); }); return(table.ToString()); }
public void should_add_headings_in_a_header_row_to_the_thead() { var expected = getExpectedHtml("<tr><th>Heading 1</th><th>Heading 2</th></tr>", null, null); var tag = new TableTag(); var headerRow = tag.AddHeaderRow(); headerRow.Header().Text("Heading 1"); headerRow.Header("Heading 2"); tag.ToString().ShouldEqual(expected); }
public void should_add_cells_to_rows_in_the_tbody() { var expected = getExpectedHtml(null, "<tr><td>cell 1</td><td>cell 2</td></tr><tr><td>cell 3</td><td>cell 4</td></tr>", null); var tag = new TableTag(); var bodyRow1 = tag.AddBodyRow(); bodyRow1.Cell().Text("cell 1"); bodyRow1.Cell("cell 2"); var bodyRow2 = tag.AddBodyRow(); bodyRow2.Cell("cell 3"); bodyRow2.Cell("cell 4"); tag.ToString().ShouldEqual(expected); }
public static string WrapInNestedCenteringTable(string htmlString) { // ReSharper disable StringLiteralTypo var emailCenterTable = new TableTag(); emailCenterTable.Attr("width", "100%"); emailCenterTable.Attr("border", "0"); emailCenterTable.Attr("cellspacing", "0"); emailCenterTable.Attr("cellpadding", "0"); var emailCenterRow = emailCenterTable.AddBodyRow(); var emailCenterLeftCell = emailCenterRow.Cell(); emailCenterLeftCell.Attr("max-width", "1%"); emailCenterLeftCell.Attr("align", "center"); emailCenterLeftCell.Attr("valign", "top"); emailCenterLeftCell.Text(" ").Encoded(false); var emailCenterContentCell = emailCenterRow.Cell(); emailCenterContentCell.Attr("width", "100%"); emailCenterContentCell.Attr("align", "center"); emailCenterContentCell.Attr("valign", "top"); var emailCenterRightCell = emailCenterRow.Cell(); emailCenterRightCell.Attr("max-width", "1%"); emailCenterRightCell.Attr("align", "center"); emailCenterRightCell.Attr("valign", "top"); emailCenterRightCell.Text(" ").Encoded(false); // ReSharper restore StringLiteralTypo var outerTable = new TableTag(); emailCenterContentCell.Children.Add(outerTable); outerTable.Style("width", "100%"); outerTable.Style("max-width", "900px"); outerTable.TBody.Text(htmlString).Encoded(false); return(emailCenterTable.ToString()); }
public string ToHtml() { var table = new TableTag(); table.AddClass("table"); table.AddClass("table-striped"); table.AddHeaderRow(row => { row.Header("Details"); row.Header("Duration (ms)"); row.Header("Method"); row.Header("Endpoint"); row.Header("Status"); row.Header("Content Type"); }); _logs.Each(log => { var url = _runtime.BaseAddress.TrimEnd('/') + "/_fubu/#/fubumvc/request-details/" + log.Id; table.AddBodyRow(row => { row.Cell().Add("a").Text("Details").Attr("href", url).Attr("target", "_blank"); row.Cell(log.ExecutionTime.ToString()).Attr("align", "right"); var summary = new HttpRequestSummary(log); row.Cell(summary.method); row.Cell(log.Title()); row.Cell(summary.status.ToString()); row.Cell(summary.contentType); }); }); return(table.ToString()); }
// This is the hook that lets you generate raw HTML // that will show up as a tab within the results for a spec string Report.ToHtml() { var table = new TableTag(); table.AddClass("table").AddClass("table-striped"); table.AddHeaderRow(row => { row.Header("Category"); row.Header("Level"); row.Header("Message"); }); foreach (var record in Records) { table.AddBodyRow(row => { row.Cell(record.Category); row.Cell(record.Level); row.Cell(record.Message); }); // Write out the full stack trace if there's an exception if (record.ExceptionText.IsNotEmpty()) { table.AddBodyRow(row => { row.Cell().Attr("colspan", "3").AddClass("bg-warning").Add("pre").AddClass("bg-warning").Text(record.ExceptionText); }); } } return(table.ToString()); }
public string ToHtml() { return(_table.ToString()); }
public CommonResponse NeedsReorderEmail() { var response = new CommonResponse(); try { var ctx = context as MROContext; var needsReorderList = ctx.InventoryInputs .GroupBy(e => new { e.CatMaterial //, e.CatUnitOfMeasure }).Select(e => new { e.Key, e.Key.CatMaterial.Value, e.Key.CatMaterial.MaterialDescription, BalanceSum = e.Sum(b => b.Balance), id = e.Key.CatMaterial.CatMaterialKey }) .Where(e => e.BalanceSum < e.Key.CatMaterial.Min) .ToList(); var htmlReport = new TableTag(); htmlReport.Style("border", "solid 1px gray"); var headerRow = htmlReport.AddHeaderRow(); headerRow.Header().Text("Material"); headerRow.Header().Text("Description"); //headerRow.Header().Text("Unit of Measure"); headerRow.Header().Text("Balance"); headerRow.Header("Minimum"); foreach (var item in needsReorderList) { var row = htmlReport.AddBodyRow(); row.Cell(item.Value); row.Cell(item.MaterialDescription); //row.Cell(item.Key.CatUnitOfMeasure.Value); row.Cell(item.BalanceSum.ToString()); row.Cell(item.Key.CatMaterial.Min.ToString()); } EmailService emailService = new EmailService("", 25) { //EmailAddress = "", //Password = "", //From = "", //Subject = "Needs Reorder", EmailAddress = "", Password = "", From = "", Subject = "Needs Reorder", Body = needsReorderList.Count > 0 ? htmlReport.ToString() : "Inventario sin requerimientos minimos. " }; emailService.To.Add(""); emailService.To.Add(""); try { if (needsReorderList.Count > 0) { emailService.SendMail(); } } catch (Exception ex) { throw new KnownError("Error. Could not send email.\n" + ex.ToString()); } return(response.Success()); } catch (KnownError ke) { return(response.Error(ke)); } catch (Exception ex) { return(response.Error(ex.Message)); } }