Пример #1
0
        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);
        }
Пример #2
0
        /// <summary>
        /// Add or delete a categoryTarget by KPI
        /// </summary>
        /// <param name="kpiId"></param>
        /// <param name="categoryId"></param>
        /// <param name="operation">1: Insert 2: Delete</param>
        public static void AddDeleteCategoryByKpi(int kpiId, string categoryId, int operation)
        {
            if (kpiId <= 0)
            {
                throw new ArgumentException("El ID del KPI no puede ser cero.");
            }

            try
            {
                KPITargetCategoriesTableAdapter localAdapter = new KPITargetCategoriesTableAdapter();
                localAdapter.AddDeleteCategoryTargetByKpi(kpiId, categoryId, operation);
            }
            catch (Exception ex)
            {
                log.Error("Error to add or delete the KPI Target Category.", ex);
                throw ex;
            }
        }