private void EditInvoice_Load(object sender, EventArgs e) { try { textInvoice.Text = ""; textValue.Text = ""; textCustomer.Text = ""; textStreet.Text = ""; textCity.Text = ""; textZip.Text = ""; textState.Text = ""; listAddresses.Items.Clear(); listAddresses.Enabled = false; toolStripStatusLabel1.Text = ""; mysql_invoices = new MySQL_Invoices(GlobalVar.sqlhost, GlobalVar.sqlport, GlobalVar.sqldatabase, GlobalVar.sqlusername, ""); newinvoice = mysql_invoices.GetInvoice(inputinvoice.number); if (newinvoice != null) { textInvoice.Text = newinvoice.number.ToString(); textValue.Text = DataFormat.FormatMoneyToString(newinvoice.value); if(newinvoice.addr1!="") { textStreet.Text = newinvoice.addr1; } else { textStreet.Text = newinvoice.addr2; } textCustomer.Text = newinvoice.customername; textCity.Text = newinvoice.city; textZip.Text = newinvoice.zip; textState.Text = newinvoice.state; } else { Cancel_Click(null, null); } } catch { Cancel_Click(null, null); } }
private void EditInvoice_Load(object sender, EventArgs e) { try { textInvoice.Text = ""; textValue.Text = ""; textCustomer.Text = ""; textStreet.Text = ""; textCity.Text = ""; textZip.Text = ""; textState.Text = ""; listAddresses.Items.Clear(); button1.Enabled = false; toolStripStatusLabel1.Text = ""; mysql_invoices = new MySQL_Invoices(GlobalVar.sqlhost, GlobalVar.sqlport, GlobalVar.sqldatabase, GlobalVar.sqlusername, ""); mysql_lineitems = new MySQL_LineItems(GlobalVar.sqlhost, GlobalVar.sqlport, GlobalVar.sqldatabase, GlobalVar.sqlusername, ""); newinvoice = mysql_invoices.GetInvoice(inputinvoice.number); if (newinvoice != null) { lineitems = mysql_lineitems.GetLineItems(newinvoice); textInvoice.Text = newinvoice.number.ToString(); textValue.Text = DataFormat.FormatMoneyToString(newinvoice.value); if (newinvoice.addr1 != "") { textStreet.Text = newinvoice.addr1; } else { textStreet.Text = newinvoice.addr2; } textCustomer.Text = newinvoice.customername; textCity.Text = newinvoice.city; textZip.Text = newinvoice.zip; textState.Text = newinvoice.state; for (int i = 0; i < lineitems.Count; i++) { string toinsert = lineitems[i].description + " - " + DataFormat.FormatMoneyToString(lineitems[i].value); listAddresses.Items.Add(toinsert); } DatePicker.Value = newinvoice.due; button1.Enabled = true; } else { Cancel_Click(null, null); } } catch { Cancel_Click(null, null); } }