Example #1
0
 // the following code connects with the delete function in the DataAccess logic through the BusinessLogic
 private void DeleteOwner(int id)
 {
     try
     {
         using (var owners = new OwnersBusiness())
         {
             var opSuccessful = owners.DeleteOwnerById(id);
         }
     }
     catch (Exception ex)
     {
         //Log exception error
         _loggingHandler.LogEntry(ExceptionHandler.GetExceptionMessageFormatted(ex), true);
     }
 }
Example #2
0
        private void Delete(int id)
        {
            try
            {
                using (var owners = new OwnersBusiness())
                {
                    bool opSuccessful = owners.DeleteOwnerById(id);

                    var resultMessage = opSuccessful ? "Done Successfully" : "Error happened or no Owner found to delete";

                    MessageBox.Show(resultMessage, "Success", MessageBoxButtons.OK);
                }
            }
            catch (Exception ex)
            {
                //Log exception error
                _loggingHandler.LogEntry(ExceptionHandler.GetExceptionMessageFormatted(ex), true);

                MessageBox.Show("UserInterface:OwnersForm::Delete::Error occured." +
                                Environment.NewLine + ex.Message, "Error", MessageBoxButtons.OK);
            }
        }