Exemple #1
0
 private void btnUpdate_Click(object sender, EventArgs e)
 {
     if (txtUpdate.Text != null)
     {
         ProductDB.UpdateProduct(txtUpdate.Text, oldprodname);
         txtUpdate.Text = "";
     }
     product = ProductDB.GetAllProducts();
     dataGridView1.DataSource = product;
     this.Refresh();
 }
Exemple #2
0
 private void btnCreate_Click(object sender, EventArgs e)
 {
     if (txtCreate.Text != null)
     {
         ProductDB.AddProduct(txtCreate.Text);
         txtCreate.Text = "";
     }
     product = ProductDB.GetAllProducts();
     dataGridView1.DataSource = product;
     this.Refresh();
 }
Exemple #3
0
 private void btnDeactivate_Click(object sender, EventArgs e)
 {
     if (txtUpdate.Text != null)
     {
         string deactivate = ("inactive" + txtUpdate.Text);
         ProductDB.UpdateProduct(deactivate, oldprodname);
         txtUpdate.Text = "";
     }
     product = ProductDB.GetAllProducts();
     dataGridView1.DataSource = product;
     this.Refresh();
 }
Exemple #4
0
 private void frmProduct_Load(object sender, EventArgs e)
 {
     try
     {
         product = ProductDB.GetAllProducts();
         dataGridView1.DataSource = product;
     }
     catch (Exception ex)
     {
         MessageBox.Show("Error while loading customers data: " + ex.Message,
                         ex.GetType().ToString());
     }
 }
Exemple #5
0
        private void btnCreate_Click(object sender, EventArgs e)
        {
            FrmAddModifyProducts addproducts = new FrmAddModifyProducts
            {
                addproducts = true
            };
            DialogResult result = addproducts.ShowDialog();

            if (result == DialogResult.OK)
            {
                product = addproducts.products;
                dataGridView1.DataSource = ProductDB.GetAllProducts();
            }
        }
Exemple #6
0
        private void btnUpdate_Click(object sender, EventArgs e)
        {
            var    cells  = dataGridView1.CurrentRow.Cells;
            string rowId  = cells[0].Value.ToString();
            string rowId1 = cells[1].Value.ToString();

            var selectedProductID = ProductDB.GetAllProducts(rowId);
            FrmAddModifyProducts modifyCustomerForm = new FrmAddModifyProducts
            {
                addproducts   = false,
                modifyProduct = selectedProductID
            };
            DialogResult result = modifyCustomerForm.ShowDialog();

            if (result == DialogResult.OK)
            {
                product = modifyCustomerForm.products;
                //refresh the grid view
                dataGridView1.DataSource = ProductDB.GetAllProducts();
            }
        }
Exemple #7
0
 private void frmProduct_Load(object sender, EventArgs e)
 {
     dataGridView1.DataSource       = ProductDB.GetAllProducts();
     dataGridView1.Rows[0].Selected = true;
 }