private CompliaceByTracerHeatMap AddTracerwiseSite(CompliaceByTracerHeatMap newSite, ComplianceByTracerTransform tracerTransform) { if (newSite.SitewiseTracer.Any(item => string.Equals(item.TracerName, tracerTransform.TracerCustomName, StringComparison.CurrentCultureIgnoreCase))) { var tracerMonthInfo = newSite.SitewiseTracer.First(item => string.Equals(item.TracerName, tracerTransform.TracerCustomName, StringComparison.CurrentCultureIgnoreCase)); tracerMonthInfo.ScheduleCompliance = ""; if (tracerTransform.ExpectedObs != 0) { var shcdlCompl = ((decimal)(100 * tracerTransform.ObservationCount) / (decimal)tracerTransform.ExpectedObs); tracerMonthInfo.ScheduleCompliance = shcdlCompl > 100 ? "100.0%" : shcdlCompl.ToString("0.0") + "%"; } tracerMonthInfo.TracerCompliance = tracerTransform.Denominator == 0 ? "" : ((decimal)(100 * tracerTransform.Numerator) / (decimal)tracerTransform.Denominator).ToString("0.0") + "%"; } return(newSite); }
private CompliaceByTracerHeatMap PopulateTracerwiseInfo(List <string> tracerList) { CompliaceByTracerHeatMap tbe = new CompliaceByTracerHeatMap(); foreach (var s in tracerList) { tbe.SitewiseTracer.Add(new SiteByTracerInfo { TracerName = s, TotalCompletedObservations = "", TracerCompliance = "" }); } return(tbe); }
private CompliaceByTracerHeatMap AddTracerwiseSite(CompliaceByTracerHeatMap newSite, ComplianceByTracerTransform tracerTransform) { newSite.OverallTotalCompletedObservation += tracerTransform.ObservationCount; newSite.OverallNum += tracerTransform.Numerator; newSite.OverallDen += tracerTransform.Denominator; newSite.OverallTracerCompliance = (newSite.OverallDen == 0 && newSite.OverallNum == 0) ? "N/A" : ((decimal)(100 * newSite.OverallNum) / (decimal)newSite.OverallDen).ToString("0.0") + "%"; newSite.OverallTracerCompliance = newSite.OverallTotalCompletedObservation == 0 ? "" : newSite.OverallTracerCompliance; if (newSite.SitewiseTracer.Any(item => string.Equals(item.TracerName, tracerTransform.TracerCustomName, StringComparison.CurrentCultureIgnoreCase))) { var tracerMonthInfo = newSite.SitewiseTracer.First(item => string.Equals(item.TracerName, tracerTransform.TracerCustomName, StringComparison.CurrentCultureIgnoreCase)); tracerMonthInfo.TotalCompletedObservations = tracerTransform.ObservationCount == 0 ? "" : tracerTransform.ObservationCount.ToString(); tracerMonthInfo.TracerCompliance = tracerTransform.Denominator == 0 && tracerTransform.Numerator == 0 ? "N/A" : ((decimal)(100 * tracerTransform.Numerator) / (decimal)tracerTransform.Denominator).ToString("0.0") + "%"; tracerMonthInfo.TracerCompliance = tracerMonthInfo.TotalCompletedObservations == "" ? "" : tracerMonthInfo.TracerCompliance; } return(newSite); }