public AdminTabData GetTabData(int assessmentId) { Dictionary <string, int> countStatementsReviewed = new Dictionary <string, int>(); AdminTabData rvalue = new AdminTabData(); using (var db = new CSET_Context()) { try { var stmtCounts = db.usp_StatementsReviewed(assessmentId).ToList <usp_StatementsReviewed_Result>(); foreach (var row in stmtCounts) { rvalue.DetailData.Add(new FINANCIAL_HOURS_OVERRIDE(row)); countStatementsReviewed[row.Component] = row.ReviewedCount ?? 0; } var totals = db.usp_StatementsReviewedTabTotals(assessmentId).ToList <usp_StatementsReviewedTabTotals_Result>(); foreach (var row in totals) { rvalue.ReviewTotals.Add(new ReviewTotals() { Total = row.Totals, ReviewType = row.ReviewType }); rvalue.GrandTotal = row.GrandTotal ?? 0; } } catch (System.Exception exc) { BusinessLogic.Helpers.CsetLogManager.Instance.LogErrorMessage(exc.ToString()); } // add another total entry for Statements Reviewed var totalReviewed = new ReviewTotals { ReviewType = "Statements Reviewed", Total = 0 }; foreach (var d in countStatementsReviewed) { totalReviewed.Total += d.Value; } rvalue.ReviewTotals.Add(totalReviewed); rvalue.Attributes = db.usp_financial_attributes(assessmentId).ToList(); } return(rvalue); }