Hi Experts. I Thank this forum so much for the previous assistance.
private void simpleButtonAccept_Click(object sender, EventArgs e){
try {
if (
MessageBox.Show("Do you really want to Accept this invoice transaction", "GMIS Question",
MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes) {
var TotalInvoiceSum = totalAmountTextEdit.Value + textEditInvoiceAmount.Value;
totalAmountTextEdit.Text = Convert.ToString(TotalInvoiceSum);
_invoiceTransaction.InvoiceAmount = Convert.ToInt32(textEditInvoiceAmount.Text);
_invoiceTransaction.InvoiceDetails = jobCardDetailsSearchLookUpEdit.Text;
gridInvoiceTransactions.Focus();
InvoiceTransactionbindingSource.EndEdit();
_InvoiceService.Insert(_Invoice);
MessageBox.Show(
"Invoice transaction accepted. Do you want to post another invoice transaction",
"GMIS - Question", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes) {
jobCardDetailsSearchLookUpEdit.Text = string.Empty;
InvoiceTransactionsView.AddNewRow();
_invoiceTransaction = new InvoiceTransaction() {
Datecreated = DateTime.Now,
LastEditedDate = DateTime.Now,
DeletedStatus = false,
};
}
else {
} catch (UwapiValidationException ex) {
string errorMessage = "Please fix the issue below before Proceeding:";
int i = 0;
foreach (var error in ex.Errors) errorMessage += string.Format("\n{0}) {1}", ++i, error.Message);
MessageBox.Show(errorMessage, "Error", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);