Exemplo n.º 1
0
        private void dgvProducts_CellClick(object sender, DataGridViewCellEventArgs e)
        {
            //Ensure that the click was not on the title cells
            if (e.RowIndex > -1)
            {
                string id = (sender as DataGridView).Rows[e.RowIndex].Cells["Id"].Value.ToString();

                Product clickedItem = products.Find(p => p.Id == id);
                if (clickedItem != null)
                {
                    frmProductDetails frm = new frmProductDetails(ref location, ref clickedItem);
                    Utils.ShowForm(this, frm, dgvProducts, () =>
                    {
                        if (location == null)
                        {
                            products = Product.Select();
                        }
                        else
                        {
                            products = ComplexQueryHelper.GetProductsForLocation(location);
                        }
                        dgvProducts.DataSource = products;
                    });
                }
            }
        }
Exemplo n.º 2
0
        private void btnAddProduct_Click(object sender, EventArgs e)
        {
            frmProductDetails frm = new frmProductDetails(new Product("", "", "", 0, DateTime.Now, ""), true);

            Utils.ShowForm(this, frm, dgvProducts, () =>
            {
                searchProducts("%" + txtSearchterm.Text + "%");
            });
        }