Example #1
0
 // the following code connects with the update function in the DataAccess logic through the BusinessLogic
 private void UpdateOwner(int id, string ownername, string petname, int petage, string contactphone, string firstname, string lastname, string username, string password, int age, string email, string role)
 {
     try
     {
         using (var owners = new OwnersBusiness())
         {
             var entity = new OwnersEntity();
             entity.OwnerID      = id;
             entity.OwnerName    = ownername;
             entity.PetName      = petname;
             entity.PetAge       = petage;
             entity.ContactPhone = contactphone;
             entity.FirstName    = firstname;
             entity.LastName     = lastname;
             entity.Username     = username;
             entity.Password     = password;
             entity.Age          = age;
             entity.Email        = email;
             entity.Role         = role;
             var opSuccessful = owners.UpdateOwner(entity);
         }
     }
     catch (Exception ex)
     {
         //Log exception error
         _loggingHandler.LogEntry(ExceptionHandler.GetExceptionMessageFormatted(ex), true);
     }
 }
Example #2
0
        private void Update(int id, string ownername, string petname, int age, string contactphone)
        {
            try
            {
                using (var owners = new OwnersBusiness())
                {
                    var entity = new OwnersEntity();
                    entity.OwnerID      = id;
                    entity.OwnerName    = ownername;
                    entity.PetName      = petname;
                    entity.PetAge       = age;
                    entity.ContactPhone = contactphone;
                    var opSuccessful = owners.UpdateOwner(entity);

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

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

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