public static List <KPITargetCategory> GetKPITargetCategoriesByKpiId(int kpiId) { if (kpiId <= 0) { throw new ArgumentException("El ID del KPI no puede ser cero."); } List <KPITargetCategory> theList = new List <KPITargetCategory>(); KPITargetCategory theData = null; try { KPITargetCategoriesTableAdapter localAdapter = new KPITargetCategoriesTableAdapter(); KPITargetDS.KPITargetCategoriesDataTable theTable = localAdapter.GetKPITargetCategoriesByKpiId(kpiId); if (theTable != null && theTable.Rows.Count > 0) { foreach (KPITargetDS.KPITargetCategoriesRow theRow in theTable) { theData = FillRecord(theRow); theList.Add(theData); } } } catch (Exception exc) { log.Error("Ocurrió un error mientras se obtenía el KPI Category de id: " + kpiId, exc); throw exc; } return(theList); }
private static KPITargetCategory FillRecord(KPITargetDS.KPITargetCategoriesRow row) { KPITargetCategory theNewRecord = new KPITargetCategory( row.targetID, row.detalle, row.target); return(theNewRecord); }