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); }
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); }
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); }