Exemplo n.º 1
0
 private void btnCancel_Click(object sender, EventArgs e)
 {
     try
     {
         List <int> unsavedReceiptPayment = GetUnsavedReceiptPayment();
         if (unsavedReceiptPayment.Count > 0)
         {
             DialogResult isConfirm = MessageBox.Show("There are some unsaved changes. Do you want to close the screen", "Warning", MessageBoxButtons.YesNo);
             if (isConfirm == DialogResult.Yes)
             {
                 applicationFacade.ClearUnsavedReceiptPayment(unsavedReceiptPayment);
                 this.Close();
             }
         }
         else
         {
             this.Close();
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
     }
 }