// Performance Indicator Report section public static IList <PIMetricInfo> GetPIReportValues(Guid?OrgLocationID, Guid GroupID, int FrequencyID, Guid?OrgLocationTypeID, DateTime BeginDate, DateTime EndDate) { LinqMicajahDataContext dc = new LinqMicajahDataContext(); IMultipleResults results = dc.Sp_SelectPIReportValues(LinqMicajahDataContext.InstanceId, OrgLocationID, GroupID, FrequencyID, OrgLocationTypeID, BeginDate, EndDate); IList <PIMetricInfo> MetricInfo = results.GetResult <PIMetricInfo>().ToList(); IList <PIMetricValue> MetricValues = results.GetResult <PIMetricValue>().ToList(); List <Micajah.Common.Bll.MeasureUnit> OrgUoMs = Mc_UnitsOfMeasure.GetOrganizationUoMs(); foreach (PIMetricInfo mi in MetricInfo) { mi.LocationFullName = (OrgLocationID == Guid.Empty && !String.IsNullOrEmpty(mi.LocationFullName)) ? LinqMicajahDataContext.OrganizationName : mi.LocationFullName; mi.InputUoMName = GetMeasureUnitPluralName(OrgUoMs, mi.InputUnitOfMeasureID); mi.UoMName = GetMeasureUnitPluralName(OrgUoMs, mi.UnitOfMeasureID); CompositeDailyValues cdv = new CompositeDailyValues(); foreach (PIMetricValue mv in MetricValues) { decimal Val = 0; if (mv.MetricID == mi.MetricID && mv.OrgLocationID == mi.OrgLocationID) // add one more linq select { if ((mv.ValueMetricDataTypeID == 1) && (mv.UnitOfMeasureID == mv.MetricUnitOfMeasureID)) { // !!! for now we ignore values when its output uom != metric output uom if (decimal.TryParse(mv.ConvertedValue, out Val)) { cdv.AddCompositeDailyValue((DateTime)mv.InputDate, Val, (int)mv.FrequencyID, (DateTime)mv.Date, (int)mi.FrequencyID); } } } } decimal?res = cdv.GetCompositeValue(BeginDate, EndDate, false); mi.SumValue = res == null ? "0" : res.ToString(); } return(MetricInfo); }