Example #1
0
        private Category Create(IDataReader reader)
        {
            Category c = new Category()
            {
                CategoryId = DataAccessUtility.Retrieve<int>(reader, CONST_CATEGORY_ID),
                CategoryName = DataAccessUtility.Retrieve<string>(reader, CONST_CATEGORY_NAME),
                Description = DataAccessUtility.Retrieve<string>(reader, CONST_DESCRIPTION),
                IsEnable = DataAccessUtility.Retrieve<string>(reader, CONST_IS_ENABLE),
                CreatedBy = DataAccessUtility.Retrieve<int>(reader, CONST_CREATED_BY),
                CreatedDate = DataAccessUtility.Retrieve<DateTime>(reader, CONST_CREATED_DATE),
                ModifiedBy = DataAccessUtility.Retrieve<int>(reader, CONST_MODIFIED_BY),
                ModifiedDate = DataAccessUtility.Retrieve<DateTime>(reader, CONST_MODIFIED_DATE)
            };

            return c;
        }
        private void LoadCategory()
        {
            BSCategory bs = new BSCategory();
            List<Category> datalist = new List<Category>();

            Category cat = new Category();
            cat.CategoryId = 0;
            cat.CategoryName = "Select category";
            datalist.Add(cat);

            foreach (Category c in bs.GetCategoryList(0))
            {
                datalist.Add(c);
            }

            cmbCategory.DisplayMember = "CategoryName";
            cmbCategory.ValueMember = "CategoryId";
            cmbCategory.DataSource = datalist;

            cmbCategory.SelectedIndex = 0;
        }