Exemplo n.º 1
0
        private void newproduct_Click(object sender, EventArgs e)
        {
            frmProductAddModfy newform = new frmProductAddModfy();

            newform.isAdd = true;
            DialogResult result = newform.ShowDialog();

            if (result == DialogResult.OK)
            {
                RefreshProducts();
            }
        }
Exemplo n.º 2
0
        private void update_Click(object sender, EventArgs e)
        {
            int     rowNum   = productDataGridView.CurrentCell.RowIndex;                             // index of the current row
            int     prodCode = (int)productDataGridView["dataGridViewTextBoxColumn1", rowNum].Value; // Column for ProductCode
            Product currentproduct;

            using (productsDataContext dbContext = new productsDataContext())
            {
                currentproduct = (from p in dbContext.Products
                                  where p.ProductId == prodCode
                                  select p).Single();
            }
            frmProductAddModfy newform = new frmProductAddModfy();

            newform.isAdd          = false;
            newform.currentProduct = currentproduct;
            DialogResult result = newform.ShowDialog();

            if (result == DialogResult.OK)
            {
                RefreshProducts();
            }
        }