/// <summary> /// Ariel Sigo /// Created 2016/11/25 /// /// Confirms update of Trainer /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void btnConfirm_Click(object sender, RoutedEventArgs e) { Trainer treener = _userManager.createTrainer(txtTrainerID.Text, txtFirstName.Text, txtLastName.Text, txtPhoneNumber.Text, (bool)chkStatus.IsChecked, cboPoleLevel.Text, cboAcroLevel.Text, cboSilksLevel.Text, cboLyraLevel.Text); _userManager.UpdateTrainer(_trainer, treener); listOTrainers = _trainerManager.GetFullTrainerList(); MessageBox.Show("Update Completed!"); this.DialogResult = true; }
/// <summary> /// Ariel Sigo /// Created 2016/11/25 /// /// Validates user input and creates a successful login /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void btnLogin_Click(object sender, RoutedEventArgs e) { var email = txtEmail.Text; var password = txtPassword.Password; var usrMgr = new UserManager(); if (_member == null && _trainer == null) { try { if (MemberManager.VerifyMember(email, password)) { _member = MemberManager.getMember(email); trainerList = _trainerManager.GetFullTrainerList(); } else if (TrainerManager.VerifyTrainer(email, password)) { _trainer = TrainerManager.getTrainer(email); try { _memberList = _memberManager.GetFullMemberList(); trainerList = _trainerManager.GetFullTrainerList(); } catch (Exception ex) { MessageBox.Show("There was a problem retireiving your Member and Trainer Lists \n " + ex.Message); } trainerInterface(); memberInterface(); } if (_member != null) // login for member { MessageBox.Show("Welcome Back " + _member.FirstName + " " + _member.LastName + "! \n"); dgSchedule.ItemsSource = classList; dgTrainers.ItemsSource = trainerList; txtEmail.Clear(); txtPassword.Clear(); txtPassword.IsEnabled = false; txtEmail.IsEnabled = false; btnLogin.Content = "Log Out"; populateTables(); showTabs(); } else if (_trainer != null) // login for trainer { MessageBox.Show("Welcome Back " + _trainer.TrainerFirstName + " " + _trainer.TrainerLastName + "! \n"); dgSchedule.ItemsSource = classList; txtEmail.Clear(); txtPassword.Clear(); txtPassword.IsEnabled = false; txtEmail.IsEnabled = false; btnLogin.Content = "Log Out"; populateTables(); showTabs(); } else { MessageBox.Show("Incorrect Login. Please Try Again!"); txtPassword.Clear(); } } catch (Exception ex) { MessageBox.Show(ex.Message, "Incorrect Login. Please Try Again!"); } } else { _trainer = null; _member = null; txtEmail.IsEnabled = true; txtPassword.IsEnabled = true; btnLogin.Content = "Login"; txtEmail.Focus(); dgSchedule.Visibility = Visibility.Hidden; dgMembers.Visibility = Visibility.Hidden; dgTrainers.Visibility = Visibility.Hidden; hideAllTabs(); } }