private void btnAddItem_Click(object sender, EventArgs e) { var frm = new frmSales_Add(); frm.ShowDialog(); if (frm.IsSelected == false) { return; } invoiceData.InvoiceDetails.Add(frm.invoiceDetail); SetGridViewSource(); UpdateInvoiceTotal(); }
private void btnEditItem_Click(object sender, EventArgs e) { if (gvSalesData.SelectedRows.Count == 0) { "Please Select Details You Want To Edit.".ShowError(); return; } InvoiceDetail _selectedItem = (InvoiceDetail)gvSalesData.SelectedRows[0].DataBoundItem; var data = invoiceData.InvoiceDetails.Where(i => i == _selectedItem).SingleOrDefault(); var frm = new frmSales_Add(data); frm.ShowDialog(); if (frm.IsSelected) { SetGridViewSource(); UpdateInvoiceTotal(); } }