Esempio n. 1
0
        private void BtnAddCategory_Click(object sender, EventArgs e)
        {
            CategoryBAL CB = new CategoryBAL();
            CategoryDAL CD = new CategoryDAL();

            if (TxtCategoryName.Text == "")
            {
                MessageBox.Show("Category Field Cannot be blank");
            }
            else
            {
                CB.CategoryName = TxtCategoryName.Text.Trim();
                int Result = CD.InsertCategory(CB);
                if (Result > 0)
                {
                    MessageBox.Show("Category Added Successfully");
                    LoadDGVCategory();
                }
                else
                {
                    MessageBox.Show("Something Went Wrong");
                    LoadDGVCategory();
                }
            }
        }
Esempio n. 2
0
        private void BtnUpdate_Click(object sender, EventArgs e)
        {
            CategoryBAL CB = new CategoryBAL();
            CategoryDAL CD = new CategoryDAL();

            if (TxtCategoryName.Text != "")
            {
                CB.CatID        = Cat_ID;
                CB.CategoryName = TxtCategoryName.Text.Trim();
                int Result = CD.UpdateCategory(CB);
                if (Result > 0)
                {
                    MessageBox.Show("Category Updated with Category ID Number " + Cat_ID + " Successfully");
                    LoadDGVCategory();
                }
                else
                {
                    MessageBox.Show("Something Went Wrong");
                    LoadDGVCategory();
                }
            }
        }
Esempio n. 3
0
        public void LoadDGVCategory()
        {
            CategoryDAL CD = new CategoryDAL();

            DGVCategory.DataSource = CD.LoadDGVCategory();
        }