Beispiel #1
0
        public static List <KPICategoyCombination> GetCategoryItemsCombinatedByKpiId(int kpiId)
        {
            if (kpiId <= 0)
            {
                throw new ArgumentException("El ID del KPI no puede ser cero.");
            }

            List <KPICategoyCombination> theList = new List <KPICategoyCombination>();
            KPICategoyCombination        theData = null;

            try
            {
                KPICombinationCategoryTableAdapter localAdapter = new KPICombinationCategoryTableAdapter();
                KPICategoryCombinationDS.KPICombinationCategoryDataTable theTable = localAdapter.GetCategoryItemsCombinatedByKpiId(kpiId);
                if (theTable != null && theTable.Rows.Count > 0)
                {
                    foreach (KPICategoryCombinationDS.KPICombinationCategoryRow theRow in theTable)
                    {
                        theData       = FillRecord(theRow);
                        theData.KpiId = kpiId;
                        theList.Add(theData);
                    }
                }
            }
            catch (Exception exc)
            {
                log.Error("Error en GetCategoryItemsCombinatedByKpiId para kpiId: " + kpiId, exc);
                throw exc;
            }

            return(theList);
        }
Beispiel #2
0
        public static List <KPICategoyCombination> GetKPITargetCategoriesByKpiId(List <Category> theCategories)
        {
            if (theCategories == null || theCategories.Count <= 0)
            {
                throw new ArgumentException("No se tiene la lista de categorias.");
            }

            string categories = "";

            foreach (Category cat in theCategories)
            {
                categories = string.IsNullOrEmpty(categories) ? cat.ID : categories + "," + cat.ID;
            }

            List <KPICategoyCombination> theList = new List <KPICategoyCombination>();
            KPICategoyCombination        theData = null;

            try
            {
                KPICombinationCategoryTableAdapter localAdapter = new KPICombinationCategoryTableAdapter();
                KPICategoryCombinationDS.KPICombinationCategoryDataTable theTable = localAdapter.GetCombinationCategoryItems(categories);
                if (theTable != null && theTable.Rows.Count > 0)
                {
                    foreach (KPICategoryCombinationDS.KPICombinationCategoryRow theRow in theTable)
                    {
                        theData = FillRecord(theRow);
                        theList.Add(theData);
                    }
                }
            }
            catch (Exception exc)
            {
                log.Error("Error en GetKPITargetCategoriesByKpiId.", exc);
                throw exc;
            }

            return(theList);
        }