private void btnViewInvoice_Click(object sender, EventArgs e) { if (resultsFound == true && grdView.SelectedRows.Count > 0) { FrmEditInvoice editInvoiceFrm = new FrmEditInvoice(); editInvoiceFrm.OpenForm(customer, GetCurrentInvoice()); if (editInvoiceFrm.invoiceChanged) { RetrieveData(); FormatData(); } } }
private void btnViewInvoice_Click(object sender, EventArgs e) { if (resultsFound == true && grdView.SelectedRows.Count > 0) { // Creates new Customer & Invoice objects based on current selection, then passes them into FrmEditInvoice cust = new Customer(); invoice = new Invoice(); cust.CustomerID = customerID; cust.FirstName = grdView.SelectedRows[0].Cells[4].Value.ToString(); cust.LastName = grdView.SelectedRows[0].Cells[5].Value.ToString(); invoice.InvoiceID = invoiceID; invoice.InvoiceDate = Convert.ToDateTime(grdView.SelectedRows[0].Cells[2].Value); invoice.Amount = Convert.ToDecimal(grdView.SelectedRows[0].Cells[3].Value.ToString()); invoice.IsPaid = false; FrmEditInvoice editInvoiceFrm = new FrmEditInvoice(); editInvoiceFrm.OpenForm(cust, invoice); if (editInvoiceFrm.invoiceChanged) { RetrieveData(); } } }