Exemple #1
0
        public List <Category> GetCategories()
        {
            List <Category> theList = new List <Category>();
            Category        theData = null;

            try
            {
                CategoryDS.CategoriesDataTable theTable = theAdapter.GetCategories();

                if (theTable != null && theTable.Rows.Count > 0)
                {
                    foreach (CategoryDS.CategoriesRow theRow in theTable)
                    {
                        theData = FillRecord(theRow);
                        theList.Add(theData);
                    }
                }
            }
            catch (Exception exc)
            {
                log.Error("Error en GetCategories", exc);
                throw new ArgumentException(Resources.Categories.MessageErrorGetCategories);
            }

            return(theList);
        }
Exemple #2
0
        public static Category GetCategoryById(string categoryId)
        {
            if (string.IsNullOrEmpty(categoryId))
            {
                throw new ArgumentException(Resources.Categories.MessageEmptyCategoryId);
            }

            Category theData = null;

            try
            {
                CategoriesTableAdapter         localAdapter = new CategoriesTableAdapter();
                CategoryDS.CategoriesDataTable theTable     = localAdapter.GetCategoryById(categoryId);
                if (theTable != null && theTable.Rows.Count > 0)
                {
                    CategoryDS.CategoriesRow theRow = theTable[0];
                    theData = FillRecord(theRow);
                }
            }
            catch (Exception exc)
            {
                log.Error("Error en GetCategoryById para categoryId: " + categoryId, exc);
                throw new ArgumentException(Resources.Categories.MessageErrorGetCategory);
            }

            return(theData);
        }
Exemple #3
0
        public static List <Category> GetCategoriesByKpiId(int kpiId)
        {
            List <Category> theList = new List <Category>();
            Category        theData = null;

            try
            {
                CategoriesTableAdapter         localAdapter = new CategoriesTableAdapter();
                CategoryDS.CategoriesDataTable theTable     = localAdapter.GetCategoriesByKpiId(kpiId);

                if (theTable != null && theTable.Rows.Count > 0)
                {
                    foreach (CategoryDS.CategoriesRow theRow in theTable)
                    {
                        theData           = FillRecord(theRow);
                        theData.ItemsList = theRow.IsitemsNull() ? "" : theRow.items;
                        theList.Add(theData);
                    }
                }
            }
            catch (Exception exc)
            {
                log.Error("Error en GetCategoriesByKpiId para kpiId: " + kpiId, exc);
                throw new ArgumentException(Resources.Categories.MessageErrorGetCategoriesByKpi);
            }

            return(theList);
        }