Example #1
0
        public static List <KPIMeasurement> GetKpiMeasurementsByKpiId(int kpiId, string categoryId, string categoryItemId, string unit)
        {
            if (kpiId <= 0)
            {
                throw new ArgumentException("KpiId cannot be equals or less than zero");
            }

            KpiMeasurementDSTableAdapters.KpiMeasurementTableAdapter adapter = new KpiMeasurementDSTableAdapters.KpiMeasurementTableAdapter();
            KpiMeasurementDS.KpiMeasurementDataTable table = adapter.GetKpiMeasurements(kpiId, categoryId, categoryItemId);

            List <KPIMeasurement> list = new List <KPIMeasurement>();

            foreach (var row in table)
            {
                list.Add(new KPIMeasurement()
                {
                    KPIID       = row.kpiID,
                    Date        = row.date,
                    Measurement = row.measurement
                });
            }

            return(list);
        }