public static List <KPITarget> GetKPITargetCategoriesByKpiId(int kpiId) { if (kpiId <= 0) { throw new ArgumentException("El ID del KPI no puede ser cero."); } List <KPITarget> theList = new List <KPITarget>(); KPITarget theData = null; try { KPITargetTableAdapter localAdapter = new KPITargetTableAdapter(); KPITargetDS.KPITargetDataTable theTable = localAdapter.GetKPITargetCategoriesByKpiId(kpiId); if (theTable != null && theTable.Rows.Count > 0) { foreach (KPITargetDS.KPITargetRow theRow in theTable) { theData = FillRecord(theRow); theData.Detalle = theRow.IsdetalleNull() ? "" : theRow.detalle; theData.Categories = theRow.IscategoriesNull() ? "" : theRow.categories; theList.Add(theData); } } } catch (Exception exc) { log.Error("Error en GetKPITargetCategoriesByKpiId para kpiId: " + kpiId, exc); throw exc; } return(theList); }
public static KPITarget GetKPITargetByKpiId(int kpiId) { if (kpiId <= 0) { throw new ArgumentException("El ID del KPI no puede ser cero."); } KPITarget theData = null; try { KPITargetTableAdapter localAdapter = new KPITargetTableAdapter(); KPITargetDS.KPITargetDataTable theTable = localAdapter.GetKPITargetById(kpiId); if (theTable != null && theTable.Rows.Count > 0) { KPITargetDS.KPITargetRow theRow = theTable[0]; theData = FillRecord(theRow); } } catch (Exception exc) { log.Error("Ocurrió un error mientras se obtenía el KPI Target de id: " + kpiId, exc); throw exc; } return(theData); }