コード例 #1
0
ファイル: frmProduct.cs プロジェクト: marnu123/Recent-Work
        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;
                    });
                }
            }
        }
コード例 #2
0
        private void btnManageProducts_Click(object sender, EventArgs e)
        {
            List <Product> products = ComplexQueryHelper.GetProductsForLocation(location);
            frmProduct     frm      = new frmProduct();

            frm.FormClosed += (s, eventArgs) =>
            {
                Show();
            };
            frm.Show();
            Hide();
        }