private CompliaceByTracerDetails AddSitewiseQuestion(CompliaceByTracerDetails newQuestion, ComplianceBySiteTransform siteTransform) { if (newQuestion.QuestionwiseSite.Any(item => string.Equals(item.SiteName, siteTransform.SiteName, StringComparison.CurrentCultureIgnoreCase))) { var siteInfo = newQuestion.QuestionwiseSite.First(item => string.Equals(item.SiteName, siteTransform.SiteName, StringComparison.CurrentCultureIgnoreCase)); siteInfo.Numerator = siteTransform.Numerator.ToString(); siteInfo.Denominator = siteTransform.Denominator.ToString(); siteInfo.CompliancePercent = siteTransform.Denominator == 0 ? "" : siteTransform.CompliancePercent + "%"; } return(newQuestion); }
private CompliaceByTracerDetails AddSitewiseQuestion(CompliaceByTracerDetails newQuestion, ComplianceBySiteTransform siteTransform) { newQuestion.OverallNum += siteTransform.Numerator; newQuestion.OverallDen += siteTransform.Denominator; newQuestion.OverallTracerCompliance = (newQuestion.OverallDen == 0 && newQuestion.OverallNum == 0) ? "N/A" : ((decimal)(100 * newQuestion.OverallNum) / (decimal)newQuestion.OverallDen).ToString("0.0") + "%"; if (newQuestion.QuestionwiseSite.Any(item => string.Equals(item.SiteName, siteTransform.SiteName, StringComparison.CurrentCultureIgnoreCase))) { var siteInfo = newQuestion.QuestionwiseSite.FirstOrDefault(item => string.Equals(item.SiteName, siteTransform.SiteName, StringComparison.CurrentCultureIgnoreCase)); siteInfo.Numerator = siteTransform.Numerator.ToString(); siteInfo.Denominator = siteTransform.Denominator.ToString(); siteInfo.CompliancePercent = siteTransform.Denominator == 0 ? "N/A" : siteTransform.CompliancePercent + "%"; } return(newQuestion); }
private CompliaceByTracerDetails PopulateSitewiseInfo(List <string> siteList) { CompliaceByTracerDetails tbe = new CompliaceByTracerDetails(); foreach (var s in siteList) { tbe.QuestionwiseSite.Add(new QuestionBySiteInfo { SiteName = s, Numerator = "", Denominator = "", CompliancePercent = "" }); } return(tbe); }