public void SetProductCategory(int ID)
        {
            ProductCategoryBL productCategoryBL = new ProductCategoryBL();

            table        = productCategoryBL.GetProductCategoryByID(ID);
            txtName.Text = table.Rows[0]["Name"].ToString();
        }
Example #2
0
        private void LoadProduct()
        {
            ProductCategoryBL productBL = new ProductCategoryBL();

            cmbProductCategory.DataSource    = productBL.GetProductCategory();
            cmbProductCategory.DisplayMember = "Name";
            cmbProductCategory.ValueMember   = "ID";
        }
Example #3
0
        public void SetProducts(int ID)
        {
            ProductBL productBL = new ProductBL();

            table         = productBL.GetProductsById(ID);
            txtName.Text  = table.Rows[0]["Name"].ToString();
            txtType.Text  = table.Rows[0]["Type"].ToString();
            txtColor.Text = table.Rows[0]["Color"].ToString();
            ProductCategoryBL productCategoryBL = new ProductCategoryBL();

            cmbProductCategory.SelectedValue = (int)table.Rows[0]["ProductCategoryID"];
        }
        private void button2_Click(object sender, EventArgs e)
        {
            ProductCategoryBL contactBL = new ProductCategoryBL();

            if (dgvProductCategory.SelectedRows.Count > 0 && dgvProductCategory.SelectedRows[0].Cells["ID"].Value != null)
            {
                var id = (int)dgvProductCategory.SelectedRows[0].Cells["ID"].Value;
                contactBL.DeleteProductCategory(id);
                ProductCategoryBL productCategoryBL = new ProductCategoryBL();
                dgvProductCategory.DataSource = productCategoryBL.GetProductCategory();
            }
        }
        private void Save_Click(object sender, EventArgs e)
        {
            ProductCategoryBL contactBL = new ProductCategoryBL();

            if (table == null)
            {
                contactBL.AddProductCategory(txtName.Text);
            }
            else
            {
                contactBL.UpdateProductCategory((int)table.Rows[0]["ID"], txtName.Text);
            }
            this.Close();
            LoadProductCategory();
        }
        private void LoadProductCategory()
        {
            ProductCategoryBL ProductCategory = new ProductCategoryBL();

            dgvProductCategory.DataSource = ProductCategory.GetProductCategory();
        }