private static RowCounter RowCounter() { string[] isPropertyNames = new string[13] { "IsAbstractGroupTitle", "IsBaseElement", "IsBeginningBalance", "IsCalendarTitle", "IsEndingBalance", "IsEquityAdjustmentRow", "IsEquityPrevioslyReportedAsRow", "IsReportTitle", "IsReverseSign", "IsSegmentTitle", "IsSubReportEnd", "IsTotalLabel", "IsTuple" }; RowCounter row = new RowCounter(); foreach (string prop in isPropertyNames) { row[prop] = 0; } return(row); }
private bool CompareRows(InstanceReport baseRep, InstanceReport newRep, DateTime reportDate, out string error) { error = string.Empty; output op = new output(Output); bool retval = true; RowCounter baseCount = BuildRowCount(baseRep); RowCounter newCount = BuildRowCount(newRep); //"Row property {0} mismatched counts: <br>Expected Results: '{1}' Actual Results: '{2}'" //Compare results of each dictionary: foreach (string key in baseCount.Keys) { if (baseCount[key] != newCount[key]) { retval = false; this.htmlStarter(string.Format(mismatchRows, key, baseCount[key], newCount[key]), reportDate, out error); //RLogger.Info(string.Format(debugParameters, baseRep.ReportLongName, newRep.ReportLongName, errorID, 433)); using (BaselineRules baseL = new BaselineRules(baseRep, newRep, errorID)) { baseL.EvaluateIsAbstractGroupRule(); } } } if (baseRep.Rows.Count != newRep.Rows.Count) { retval = false; this.htmlStarter(string.Format("Row counts do not match " + expectedResults, baseRep.Rows.Count, newRep.Rows.Count), reportDate, out error); } int min = Math.Min(baseRep.Rows.Count, newRep.Rows.Count); for (int r = 0; r < min; r++) { InstanceReportRow baseRow = baseRep.Rows[r]; InstanceReportRow newRow = newRep.Rows[r]; string baseLabel = WHITE_SPACE.Replace(baseRow.Label, " "); string newLabel = WHITE_SPACE.Replace(newRow.Label, " "); if (!string.Equals(baseLabel, newLabel)) { retval = false; this.htmlStarter(string.Format("Row '" + r + "' labels do not match " + expectedResults, baseLabel, newLabel), reportDate, out error); } if (!string.Equals(baseRow.FootnoteIndexer, newRow.FootnoteIndexer)) { retval = false; htmlStarter(string.Format(mismatchCell, r.ToString(), baseLabel, "Footnotes: " + baseRow.FootnoteIndexer, "Footnotes: " + newRow.FootnoteIndexer), reportDate, out error); } } return(retval); }
public void EvaluateIsAbstractGroupRule() { RowCounter baseCounter = CompareReports.BuildRowCount(localBaseReport); RowCounter newCounter = CompareReports.BuildRowCount(localNewReport); if (localBaseReport.Rows.Count == (localNewReport.Rows.Count - 1) && baseCounter["IsAbstractGroupTitle"] == (newCounter["IsAbstractGroupTitle"] - 1) && localNewReport.Rows[0].Label.ToLower().Contains("[text block]")) { //Update baseline flag: UpdateDataBase(); } baseCounter = null; newCounter = null; }
public static RowCounter BuildRowCount(InstanceReport report) { RowCounter rows = RowCounter(); for (int i = 0; i < report.Rows.Count; i++) { if (report.Rows[i].IsAbstractGroupTitle) { rows["IsAbstractGroupTitle"]++; } if (report.Rows[i].IsBaseElement) { rows["IsBaseElement"]++; } if (report.Rows[i].IsBeginningBalance) { rows["IsBeginningBalance"]++; } if (report.Rows[i].IsCalendarTitle) { rows["IsCalendarTitle"]++; } if (report.Rows[i].IsEndingBalance) { rows["IsEndingBalance"]++; } //if (report.Rows[i].IsEPS) // rows["IsEPS"]++; if (report.Rows[i].IsEquityAdjustmentRow) { rows["IsEquityAdjustmentRow"]++; } if (report.Rows[i].IsEquityPrevioslyReportedAsRow) { rows["IsEquityPrevioslyReportedAsRow"]++; } //if (report.Rows[i].IsNumericDataType) // rows["IsNumericDataType"]++; if (report.Rows[i].IsReportTitle) { rows["IsReportTitle"]++; } if (report.Rows[i].IsReverseSign) { rows["IsReverseSign"]++; } if (report.Rows[i].IsSegmentTitle) { rows["IsSegmentTitle"]++; } if (report.Rows[i].IsSubReportEnd) { rows["IsSubReportEnd"]++; } if (report.Rows[i].IsTotalLabel) { rows["IsTotalLabel"]++; } if (report.Rows[i].IsTuple) { rows["IsTuple"]++; } } return(rows); }