private void Formularz_Load(object sender, EventArgs e) { GridFiller.FillProductsGrid(ProductsGrid); GridFiller.FillPricesGrid(CenyGrid); GridFiller.FillPriceListsGrid(CennikiGrid); GridFiller.FillSummaryGrid(PodsumowanieGrid); }
//@@@@@@@@ TOWARY @@@@@@@@@\\ private void AddProductBtn_Click(object sender, EventArgs e) { using (var addform = new AddEditTowarForm(null)) { if (addform.ShowDialog() == DialogResult.Yes) { GridFiller.FillProductsGrid(ProductsGrid); } } }
private void EditProductBtn_Click(object sender, EventArgs e) { try { using (var addform = new AddEditTowarForm((Towary)ProductsGrid.CurrentRow.DataBoundItem)) { if (addform.ShowDialog() == DialogResult.Yes) { GridFiller.FillProductsGrid(ProductsGrid); } } } catch (NullReferenceException exception) { MessageBox.Show(exception.Message, "Błąd", MessageBoxButtons.OK); } }
private void DeleteProductBtn_Click(object sender, EventArgs e) { try { var towarToDel = (Towary)ProductsGrid.CurrentRow.DataBoundItem; if (MessageBox.Show($"Jesteś pewien że chcesz usunąć towar: {towarToDel.Nazwa}", "Formularz Towarowy", MessageBoxButtons.YesNo) == DialogResult.Yes) { new ProductBLL().DeleteProduct(towarToDel); GridFiller.FillProductsGrid(ProductsGrid); GridFiller.FillPricesGrid(CenyGrid); } } catch (NullReferenceException exception) { MessageBox.Show(exception.Message, "Błąd", MessageBoxButtons.OK); } }