コード例 #1
0
        /// <summary>
        /// Get the value from TabCategory
        /// </summary>
        /// <param name="CategoryRows">Name of the rows</param>
        /// <returns>Return the value from the rows selected</returns>
        public static TabCategoryModel Parse(DataSet1.TabCategoryRow CategoryRows)
        {
            if (CategoryRows == null)
            {
                return(null);
            }
            else
            {
                TabCategoryModel Tabcategory = new TabCategoryModel();
                Tabcategory.Cid          = CategoryRows.CID;
                Tabcategory.CategoryName = CategoryRows.CategoryName;

                return(Tabcategory);
            }
        }
コード例 #2
0
        /// <summary>
        /// Get all the category
        /// </summary>
        /// <returns>List of all the categories</returns>
        public List <TabCategoryModel> CategoryList()
        {
            List <TabCategoryModel> _books = new List <TabCategoryModel>();

            _categorytable = _bookDao.GetCategory();

            // Create a new object and add a new rows to _books
            TabCategoryModel booksCat = new TabCategoryModel();

            booksCat.Cid          = 0;
            booksCat.CategoryName = "All Categories";
            _books.Add(booksCat);

            foreach (DataSet1.TabCategoryRow booksRow in _categorytable.Rows)
            {
                TabCategoryModel tempRow = TabCategoryModel.Parse(booksRow);
                _books.Add(tempRow);
            }

            return(_books);
        }