Exemple #1
0
        private void productList_CellContentClick(object sender, DataGridViewCellEventArgs e)
        {
            if (productList.Columns[e.ColumnIndex].Name == "ProductImage" && e.RowIndex != -1)
            {
                ViewImageForm form = new ViewImageForm(filteredProducts.ElementAt(e.RowIndex).ProductImage);

                form.Show();
            }

            if (productList.Columns[e.ColumnIndex].Name == "choose" && e.RowIndex != -1)
            {
                _callback(products.ElementAt(e.RowIndex));
                Close();
            }
        }
Exemple #2
0
        private void productOfComboList_CellContentClick(object sender, DataGridViewCellEventArgs e)
        {
            if (productOfComboList.Columns[e.ColumnIndex].Name == "ProductImage" && e.RowIndex != -1)
            {
                ViewImageForm form = new ViewImageForm(products.ElementAt(e.RowIndex).ProductImage);

                form.Show();
            }
            if (productOfComboList.Columns[e.ColumnIndex].Name == "Delete" && e.RowIndex != -1)
            {
                if (Notification.Confirm("Are you sure?"))
                {
                    List <Product> tmpProducts      = products.ToList();
                    int            deletedProductID = tmpProducts.ElementAt(e.RowIndex).Id;

                    tmpProducts.RemoveAt(e.RowIndex);
                    products = tmpProducts;

                    renderCombo();
                }
            }
        }