//server-database version of edit private void editButton_click_S(object sender, EventArgs e) { if (FileBrowserListView.SelectedItems.Count == 0) { MessageBox.Show("Error: no files selected!"); } else if (FileBrowserListView.SelectedItems.Count == 1) { //to do delete old entry //MessageBox.Show(FileBrowserListView.SelectedItems[0].SubItems[5].Text.ToString()); string[] invoiceInfo = ServerCommands.getInvoiceInfo( FileBrowserListView.SelectedItems[0].SubItems[0].Text.ToString(), FileBrowserListView.SelectedItems[0].SubItems[5].Text.ToString()); task task = ServerCommands.getTasks(FileBrowserListView.SelectedItems[0].SubItems[5].Text.ToString()); InvoiceForm newInvoice = new InvoiceForm(invoiceInfo,task.tasks,task.prices); newInvoice.ShowDialog(); update(); } else { MessageBox.Show("Error: Can only edit one invoice at a time!"); } }
void newButton_click(object sender, EventArgs e) { InvoiceForm newInvoice = new InvoiceForm(); newInvoice.ShowDialog(); update(); }
//local version of edit private void editButton_click_L(object sender, EventArgs e) { if (FileBrowserListView.SelectedItems.Count == 0) { MessageBox.Show("Error: no files selected!"); } else if (FileBrowserListView.SelectedItems.Count == 1) { try { InvoiceForm newInvoice = new InvoiceForm(FileBrowserListView.SelectedItems[0].SubItems[0].Text.ToString() + ".invoice"); newInvoice.ShowDialog(); update(); } catch { //invoiceform not init correctly MessageBox.Show("invoice error"); } } else { MessageBox.Show("Error: Can only edit one invoice at a time!"); } }