Exemplo n.º 1
0
 private void UpdateSitter(int id, string name, int age, decimal fee, string bio, DateTime?hiringDate, decimal grossSalary, string email, string username, string firstname, string lastname, string password, string role)
 {
     try
     {
         using (var sitters = new SittersBusiness())
         {
             var entity = new SittersEntity();
             entity.SitterID    = id;
             entity.Name        = name;
             entity.Age         = age;
             entity.Fee         = fee;
             entity.Bio         = bio;
             entity.HiringDate  = hiringDate;
             entity.GrossSalary = grossSalary;
             entity.Username    = username;
             entity.FirstName   = firstname;
             entity.LastName    = lastname;
             entity.Email       = email;
             entity.Password    = password;
             entity.Role        = role;
             var opSuccessful = sitters.UpdateSitter(entity);
         }
     }
     catch (Exception ex)
     {
         //Log exception error
         _loggingHandler.LogEntry(ExceptionHandler.GetExceptionMessageFormatted(ex), true);
     }
 }
Exemplo n.º 2
0
        private void Update(int id, string name, int age, decimal fee, string bio, DateTime?hiringDate, decimal grossSalary)
        {
            try
            {
                using (var sitters = new SittersBusiness())
                {
                    var entity = new SittersEntity();
                    entity.SitterID    = id;
                    entity.Name        = name;
                    entity.Age         = age;
                    entity.Fee         = fee;
                    entity.Bio         = bio;
                    entity.HiringDate  = hiringDate;
                    entity.GrossSalary = grossSalary;
                    var opSuccessful = sitters.UpdateSitter(entity);

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

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

                MessageBox.Show("UserInterface:SittersForm::Update::Error occured." +
                                Environment.NewLine + ex.Message, "Error", MessageBoxButtons.OK);
            }
        }
Exemplo n.º 3
0
 private void DeleteSitter(int id)
 {
     try
     {
         using (var sitters = new SittersBusiness())
         {
             var opSuccessful = sitters.DeleteSitterById(id);
         }
     }
     catch (Exception ex)
     {
         //Log exception error
         _loggingHandler.LogEntry(ExceptionHandler.GetExceptionMessageFormatted(ex), true);
     }
 }
Exemplo n.º 4
0
 private SittersEntity SelectSitterById(int id)
 {
     try
     {
         using (var sitters = new SittersBusiness())
         {
             return(sitters.SelectSitterById(id));
         }
     }
     catch (Exception ex)
     {
         //Log exception error
         _loggingHandler.LogEntry(ExceptionHandler.GetExceptionMessageFormatted(ex), true);
     }
     return(null);
 }
Exemplo n.º 5
0
        private List <SittersEntity> SelectAll()
        {
            try
            {
                using (var sitters = new SittersBusiness())
                {
                    return(sitters.SelectAllSitters());
                }
            }
            catch (Exception ex)
            {
                //Log exception error
                _loggingHandler.LogEntry(ExceptionHandler.GetExceptionMessageFormatted(ex), true);

                MessageBox.Show("UserInterface:SittersForm::SelectAll::Error occured." +
                                Environment.NewLine + ex.Message, "Error", MessageBoxButtons.OK);
            }
            return(null);
        }
Exemplo n.º 6
0
        private void Delete(int id)
        {
            try
            {
                using (var sitters = new SittersBusiness())
                {
                    bool opSuccessful = sitters.DeleteSitterById(id);

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

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

                MessageBox.Show("UserInterface:SittersForm::Delete::Error occured." +
                                Environment.NewLine + ex.Message, "Error", MessageBoxButtons.OK);
            }
        }
Exemplo n.º 7
0
 private void InsertSitter(string name, int age, decimal fee, string bio, DateTime?hiringDate, decimal grossSalary)
 {
     try
     {
         using (var sitters = new SittersBusiness())
         {
             var entity = new SittersEntity();
             entity.Name        = name;
             entity.Age         = age;
             entity.Fee         = fee;
             entity.Bio         = bio;
             entity.HiringDate  = hiringDate;
             entity.GrossSalary = grossSalary;
             var opSuccessful = sitters.InsertSitter(entity);
         }
     }
     catch (Exception ex)
     {
         //Log exception error
         _loggingHandler.LogEntry(ExceptionHandler.GetExceptionMessageFormatted(ex), true);
     }
 }