private void BtnModify_Click(object sender, EventArgs e)
        {
            var    cells  = dataGridView1.CurrentRow.Cells;
            string rowId  = cells[1].Value.ToString();
            string rowId1 = cells[2].Value.ToString();

            var selectedProductSupplierId         = Product_supplierDB.GetSuppliers(rowId, rowId1);
            FrmAddModifyDelete modifyCustomerForm = new FrmAddModifyDelete
            {
                addproductsupplier    = false,
                modifyproductsupplier = selectedProductSupplierId
            };
            DialogResult result = modifyCustomerForm.ShowDialog();

            if (result == DialogResult.OK)
            {
                productsupplier = modifyCustomerForm.productsupplier;
                //this.DisplayProductSupplier();
                //refresh the grid view
                dataGridView1.DataSource = Product_supplierDB.GetSuppliers();
            }
            //else if (result == DialogResult.Retry)
            //{
            //    this.GetProductSupplierId(productsupplier.ProductSupplierId);
            //    if (productsupplier != null)
            //        this.DisplayProductSupplier();
            //    else
            //        this.ClearControls();
            //}
        }
Exemple #2
0
        private void BtnModify_Click(object sender, EventArgs e)
        {
            FrmAddModifyDelete modifyCustomerForm = new FrmAddModifyDelete
            {
                addproductsupplier = false,
                productsupplier    = productsupplier
            };
            DialogResult result = modifyCustomerForm.ShowDialog();

            if (result == DialogResult.OK)
            {
                productsupplier = modifyCustomerForm.productsupplier;
                this.DisplayProductSupplier();
                //refresh the grid view
                dataGridView1.DataSource = Product_supplierDB.GetSuppliers();
            }
            else if (result == DialogResult.Retry)
            {
                this.GetProductSupplierId(productsupplier.ProductSupplierId);
                if (productsupplier != null)
                {
                    this.DisplayProductSupplier();
                }
                else
                {
                    this.ClearControls();
                }
            }
        }
        private void BtnAdd_Click(object sender, EventArgs e)
        {
            FrmAddModifyDelete addproductsupplierform = new FrmAddModifyDelete
            {
                addproductsupplier = true
            };
            DialogResult result = addproductsupplierform.ShowDialog();

            if (result == DialogResult.OK)
            {
                productsupplier          = addproductsupplierform.productsupplier;
                dataGridView1.DataSource = Product_supplierDB.GetSuppliers();
            }
        }