/// <summary> /// After validating creates the credit note and switches to viewing it /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void Btn_Complete_Click(object sender, RoutedEventArgs e) { if (checkCustomerForm() && checkDetailsForm() && hasItemsSelected()) { var creditNote = createCreditNoteObject(); creditNote.createdDate += DateTime.Now.TimeOfDay; CreditNoteViewModel.insertCreditNote(creditNote); MessageBox.Show("Credit Note with ID " + creditNote.idCreditNote + " was created."); creditNoteMain.viewCreditNote(creditNote.idCreditNote); Btn_clearAll_Click(null, null); } }
/// <summary> /// After validating updates the credit note and switches to viewing it /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void Btn_Complete_Click(object sender, RoutedEventArgs e) { if (Has_Items_Selected()) { if (int.TryParse(textBox_invoiceNumber.Text, out var creditNoteID)) { CreditNoteViewModel.updateCreditNote(createCreditNoteObject(), oldCreditNote); creditNoteMain.viewCreditNote(creditNoteID); Btn_clearAll_Click(null, null); } } }
/// <summary> /// Switches to view Credit Note page and loads the specific credit note /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void ViewCreditNote_Click(object sender, RoutedEventArgs e) { mainPage.viewCreditNote(((CreditNote)creditNoteDataGrid.SelectedItem).idCreditNote); }