예제 #1
0
        /// <summary>
        /// Purpose: Grabs category information based on ID
        /// Accepts: Int
        /// Returns: Nothing
        /// </summary>
        public void GetCategoryByID(int id)
        {
            try
            {
                CategoryData data = new CategoryData();
                Hashtable hsh = new Hashtable();

                hsh = data.GetCategoryByID(id);

                CategoryID = id;
                Name = hsh["name"];
                Description = hsh["description"];
                ParentCategoryID = Convert.ToInt32(hsh["parentcategoryid"]);
                Created = hsh["created"];
                Modified = hsh["modified"];
                IsActive = hsh["isactive"];
            }
            catch (Exception ex)
            {
                ErrorRoutine(ex, "Category", "GetCategoryByID");
            }
        }
예제 #2
0
        /// <summary>
        /// Purpose: Grabs all categories
        /// Accepts: Boolean
        /// Returns: List<Category>
        /// </summary>
        public List<Category> GetAllCategories(bool onlyActive)
        {
            List<Category> categories = new List<Category>();
            try
            {
                CategoryData data = new CategoryData();
                List<QSRDataObjects.Category> dataCategories = data.GetAllCategories(onlyActive);

                foreach (QSRDataObjects.Category c in dataCategories)
                {
                    Category cat = new Category();
                    cat.CategoryID = c.CategoryID;
                    cat.Name = c.Name;
                    cat.Description = c.Description;
                    cat.ParentCategoryID = Convert.ToInt32(c.ParentCategoryID);
                    cat.Created = c.Created;
                    cat.Modified = c.Modified;
                    cat.IsActive = c.IsActive;
                    categories.Add(cat);
                }
            }
            catch (Exception ex)
            {
                ErrorRoutine(ex, "Category", "GetAllCategories");
            }
            return categories;
        }