//private void tabComics_GotFocus(object sender, RoutedEventArgs e) //{ // if(_comics==null) // { // try // { // _comics = _comicManager.RetrieveAvailableComics(true); // dgComics.ItemsSource = _comics; // } // catch (Exception ex) // { // MessageBox.Show(ex.Message + ex.StackTrace, "Error:"); // } // } // else // { // RefreshComicsAvailable(); // dgComics.ItemsSource = _comicsAvailable; // //MessageBox.Show("Say something."); // } //} private void btnLoginEmp_Click(object sender, RoutedEventArgs e) { var email = txtEmail.Text; var password = txtPassword.Password; var empMgr = new EmployeeManager(); if (_employee == null) { try { _employee = empMgr.AuthenticateEmpLogin(email, password); MessageBox.Show("Logged in!"); txtEmail.Clear(); txtPassword.Clear(); txtEmail.IsEnabled = false; txtPassword.IsEnabled = false; btnAddComicWindow.IsEnabled = true; btnLoginEmp.Content = "Log out"; btnLoginEmp.IsDefault = false; btnLogin.IsEnabled = false; btnCreateAccount.IsEnabled = false; showEmpTabs(); //Load the current available comics list for inventory page RefreshComicsAvailable(); dgComicsEmpView.ItemsSource = _comicsAvailable; //Load the current customers list LoadCurrentCustomers(); _customers = _custManager.CurrentCustomers(true); dgCustomersEmpView.ItemsSource = _customers; btnLogin.IsDefault = false; } catch (Exception ex) { MessageBox.Show(ex.Message, "Error"); txtEmail.IsEnabled = true; txtEmail.Clear(); txtEmail.Focus(); txtPassword.IsEnabled = true; txtPassword.Clear(); btnLogin.Content = "Login"; btnLogin.IsDefault = true; } } else { _employee = null; txtEmail.IsEnabled = true; txtEmail.Clear(); txtEmail.Focus(); txtPassword.IsEnabled = true; txtPassword.Clear(); btnLogin.Content = "Login"; btnLogin.IsDefault = true; btnLogin.IsEnabled = true; btnLoginEmp.IsEnabled = true; btnCreateAccount.IsEnabled = true; btnLoginEmp.Content = "Employee Login"; hideAllTabs(); MessageBox.Show("Logged out."); } }