예제 #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();
 }
예제 #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();
 }
예제 #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();
 }
예제 #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());
     }
 }
예제 #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();
            }
        }
예제 #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();
            }
        }
예제 #7
0
 private void frmProduct_Load(object sender, EventArgs e)
 {
     dataGridView1.DataSource       = ProductDB.GetAllProducts();
     dataGridView1.Rows[0].Selected = true;
 }