//Bootstrap helper function string CreateTableRow(BaseRecord record, ResultPrimarySecondary primarySecondary) { WeakHTMLTag tr = new WeakHTMLTag("tr"); //If the conclusion is MAJOR or FATAL, add a class to the TR so the entire row is colored if ((record.Conclusion == ConclusionEnum.Major) || (record.Conclusion == ConclusionEnum.Fatal)) { tr.CSSClass = ConclusionToCSSModifier(record.Conclusion); } //Add parameter for script details modal tr.Attributes["data-toggle"] = "modal"; tr.Attributes["data-target"] = "#modalDetails"; tr.Attributes["data-modal-title"] = WeakHTMLTag.HTMLEncode(record.ScriptFilename); tr.Attributes["data-modal-content"] = ConvertProcessMessagesToHTML(record.ProcessMessages); //Create <td> for Status string tdStatus = CreateHTMLElement_TdGlyphSpan(record.Conclusion); //Create <td> for Name and Script file string tdName = CreateHTMLElement_TdTextSmallText(record.Name, record.ScriptFilename); string tdValue = CreateHTMLElement_TdTextSmallText(primarySecondary.Primary, primarySecondary.Secondary); tr.HTML = tdStatus + tdName + tdValue; return(tr.ToString() + "\r\n"); }
//This needs to be called by the implementation to start the replacement process protected void StartGenerating(Report report) { ReplaceHeaderValuesInternal(report); ReplaceAssetStatisticsInternal(report); ReplaceTestStatisticsInternal(report); ReplaceResultTextInternal(); ReplaceAssetConclusionTextInternal(); ReplaceTestConclusionTextInternal(); ReplaceTestRecommendedActionTextInternal(); //Begin details replacement for assets StringBuilder sbAssets = new StringBuilder(); StartAssetDetails(sbAssets); foreach (AssetRecord asset in report.Assets) { BaseRecord baseRec = asset as BaseRecord; ResultPrimarySecondary rps = new ResultPrimarySecondary(baseRec); ProcessAsset(sbAssets, asset, baseRec, rps); } EndAssetDetails(sbAssets); ReplaceAssetList("AssetRows".ToUpper(), sbAssets.ToString()); //Begin details replacment for tests StringBuilder sbTests = new StringBuilder(); StartTestDetails(sbTests); foreach (TestRecord test in report.Tests) { BaseRecord baseRec = test as BaseRecord; ResultPrimarySecondary rps = new ResultPrimarySecondary(baseRec); ProcessTest(sbTests, test, baseRec, rps); } EndTestDetails(sbAssets); ReplaceTestList("TestRows".ToUpper(), sbTests.ToString()); }
string CreateRecordDetails(string tagName, BaseRecord record, ResultPrimarySecondary resultPrimSecond) { //Yes, this somewhat cheating.... WeakHTMLTag tag = new WeakHTMLTag(tagName); WeakHTMLTag name = new WeakHTMLTag("Name"); name.Text = record.Name; WeakHTMLTag filename = new WeakHTMLTag("Filename"); filename.Text = record.ScriptFilename; WeakHTMLTag conclusion = new WeakHTMLTag("Conclusion"); conclusion.Text = ((int)record.Conclusion).ToString(); WeakHTMLTag conclusionString = new WeakHTMLTag("ConclusionString"); conclusionString.Text = record.Conclusion.ToString(); //Create sub tag "result" WeakHTMLTag primary = new WeakHTMLTag("Primary"); primary.Text = resultPrimSecond.Primary; WeakHTMLTag secondary = new WeakHTMLTag("Secondary"); secondary.Text = resultPrimSecond.Secondary; WeakHTMLTag result = new WeakHTMLTag("Result"); result.HTML = primary.ToString() + secondary.ToString(); //Construct the final XML tag.HTML = name.ToString() + filename.ToString() + conclusion.ToString() + conclusionString.ToString() + result.ToString(); return(tag.ToString()); }
private ItemDetail ConvertToItemDetail(BaseRecord baseRec) { ItemDetail detail = new ItemDetail(); detail.Name = baseRec.Name; detail.Filename = baseRec.ScriptFilename; detail.Conclusion = baseRec.Conclusion; detail.ConclusionString = baseRec.Conclusion.ToString(); ResultPrimarySecondary rps = new ResultPrimarySecondary(baseRec); ItemResult result = new ItemResult(); result.Primary = rps.Primary; result.Seconday = rps.Secondary; detail.Result = result; return(detail); }
//Called by this class for each test that exists. Imlementation must add the content to the given stringbuilder. protected abstract void ProcessTest(StringBuilder sbTests, TestRecord test, BaseRecord baseRec, ResultPrimarySecondary resultPrimSecond);
//Called by this class for each asset that exists. Imlementation must add the content to the given stringbuilder. protected abstract void ProcessAsset(StringBuilder sbAssets, AssetRecord asset, BaseRecord baseRec, ResultPrimarySecondary resultPrimSecond);
protected override void ProcessTest(StringBuilder sbTests, TestRecord test, BaseRecord baseRec, ResultPrimarySecondary resultPrimSecond) { sbTests.AppendLine(CreateTableRow(baseRec, resultPrimSecond)); }
protected override void ProcessAsset(StringBuilder sbAssets, AssetRecord asset, BaseRecord baseRec, ResultPrimarySecondary resultPrimSecond) { sbAssets.AppendLine(CreateTableRow(baseRec, resultPrimSecond)); }
//Bootstrap helper function string CreateTableRow(BaseRecord record, ResultPrimarySecondary primarySecondary) { WeakHTMLTag tr = new WeakHTMLTag("tr"); //If the conclusion is MAJOR or FATAL, add a class to the TR so the entire row is colored if ((record.Conclusion == ConclusionEnum.Major) || (record.Conclusion == ConclusionEnum.Fatal)) { tr.CSSClass = ConclusionToCSSModifier(record.Conclusion); } //Add parameter for script details modal tr.Attributes["data-toggle"] = "modal"; tr.Attributes["data-target"] = "#modalDetails"; tr.Attributes["data-modal-title"] = WeakHTMLTag.HTMLEncode(record.ScriptFilename); tr.Attributes["data-modal-content"] = ConvertProcessMessagesToHTML(record.ProcessMessages); //Create <td> for Status string tdStatus = CreateHTMLElement_TdGlyphSpan(record.Conclusion); //Create <td> for Name and Script file string tdName = CreateHTMLElement_TdTextSmallText(record.Name, record.ScriptFilename); string tdValue = CreateHTMLElement_TdTextSmallText(primarySecondary.Primary, primarySecondary.Secondary); tr.HTML = tdStatus + tdName + tdValue; return tr.ToString() + "\r\n"; }
protected override void ProcessTest(StringBuilder sbTests, TestRecord test, BaseRecord baseRec, ResultPrimarySecondary resultPrimSecond) { sbTests.AppendLine(CreateTableRow(baseRec, resultPrimSecond)); }
protected override void ProcessAsset(StringBuilder sbAssets, AssetRecord asset, BaseRecord baseRec, ResultPrimarySecondary resultPrimSecond) { sbAssets.AppendLine(CreateTableRow(baseRec, resultPrimSecond)); }
//This needs to be called by the implementation to start the replacement process protected void StartGenerating(Report report) { ReplaceHeaderValuesInternal(report); ReplaceAssetStatisticsInternal(report); ReplaceTestStatisticsInternal(report); ReplaceResultTextInternal(); ReplaceAssetConclusionTextInternal(); ReplaceTestConclusionTextInternal(); ReplaceTestRecommendedActionTextInternal(); //Begin details replacement for assets StringBuilder sbAssets = new StringBuilder(); StartAssetDetails(sbAssets); foreach (AssetRecord asset in report.Assets) { BaseRecord baseRec = asset as BaseRecord; ResultPrimarySecondary rps = new ResultPrimarySecondary(baseRec); ProcessAsset(sbAssets, asset, baseRec, rps); } EndAssetDetails(sbAssets); ReplaceAssetList("AssetRows".ToUpper(), sbAssets.ToString()); //Begin details replacment for tests StringBuilder sbTests = new StringBuilder(); StartTestDetails(sbTests); foreach (TestRecord test in report.Tests) { BaseRecord baseRec = test as BaseRecord; ResultPrimarySecondary rps = new ResultPrimarySecondary(baseRec); ProcessTest(sbTests, test, baseRec, rps); } EndTestDetails(sbAssets); ReplaceTestList("TestRows".ToUpper(), sbTests.ToString()); }
//Called by this class for each test that exists. Imlementation must add the content to the given stringbuilder. protected abstract void ProcessTest(StringBuilder sbTests, TestRecord test, BaseRecord baseRec, ResultPrimarySecondary resultPrimSecond);
//Called by this class for each asset that exists. Imlementation must add the content to the given stringbuilder. protected abstract void ProcessAsset(StringBuilder sbAssets, AssetRecord asset, BaseRecord baseRec, ResultPrimarySecondary resultPrimSecond);