public void createQuote(object sender, EventArgs e) { QuoteForm newQuote = (QuoteForm)((Button)sender).FindForm(); //save QuoteItems items = new QuoteItems(); string id = new Quote().set(franchiseeUserId, newQuote.getServiceAddressId(), tax.ToString(), newQuote.getTotal()); DataGridView dt = newQuote.getQuoteItems(); for (int i = 0; i < dt.Rows.Count-1; i++) { items.set(dt.Rows[i].Cells[0].Value.ToString(), dt.Rows[i].Cells[4].Value != null ? dt.Rows[i].Cells[4].Value.ToString() : "NULL", dt.Rows[i].Cells[3].Value != null ? dt.Rows[i].Cells[3].Value.ToString() : "NULL", dt.Rows[i].Cells[5].Value.ToString(), dt.Rows[i].Cells[1].Value.ToString(), id); } newQuote.Dispose(); MessageBox.Show("The Quote ID is " + id + "!"); // _view.Show(); }
public void createQuote(object sender, EventArgs e) { QuoteForm newQuote = (QuoteForm)((Button)sender).FindForm(); //save QuoteItems items = new QuoteItems(); string id = new Quote().set(franchiseeUserId, newQuote.getServiceAddressId(), tax.ToString(), newQuote.getTotal()); DataGridView dt = newQuote.getQuoteItems(); for (int i = 0; i < dt.Rows.Count - 1; i++) { items.set(dt.Rows[i].Cells[0].Value.ToString(), dt.Rows[i].Cells[4].Value != null ? dt.Rows[i].Cells[4].Value.ToString() : "NULL", dt.Rows[i].Cells[3].Value != null ? dt.Rows[i].Cells[3].Value.ToString() : "NULL", dt.Rows[i].Cells[5].Value.ToString(), dt.Rows[i].Cells[1].Value.ToString(), id); } newQuote.Dispose(); MessageBox.Show("The Quote ID is " + id + "!"); // _view.Show(); }
public void saveQuote(object sender, EventArgs e) { QuoteForm quote = (QuoteForm)((Button)sender).FindForm(); //save QuoteItems items = new QuoteItems(); new Quote().update(quote.getId(), franchiseeUserId, quote.getServiceAddressId(), tax.ToString(), quote.getTotal()); for (int i = 0; i < rowsDeletedCounter; i++) { items.delete(rowsDeleted[i].ToString(), quote.getId()); } DataGridView dt = quote.getQuoteItems(); for (int i = 0; i < dt.Rows.Count - 1; i++) { items.setUpdate(dt.Rows[i].Cells[0].Value.ToString(), dt.Rows[i].Cells[4].Value != null && dt.Rows[i].Cells[4].Value.ToString() != "" ? dt.Rows[i].Cells[4].Value.ToString() : "NULL", dt.Rows[i].Cells[3].Value != null && dt.Rows[i].Cells[3].Value.ToString() != "" ? dt.Rows[i].Cells[3].Value.ToString() : "NULL", dt.Rows[i].Cells[5].Value.ToString(), dt.Rows[i].Cells[1].Value.ToString(), quote.getId()); } quote.Dispose(); // _view.Show(); }