private void btnLogin_Click(object sender, RoutedEventArgs e) { Login_Table userDetails = new Login_Table(); //new instance of login table from SQL database string currentuser = tbxUser.Text.Trim(); //removing spaces with trim get user detials string curentpassword = tbxPassword.Password; //use password box to hide character entry userDetails = mtdGetUserDetails(currentuser, curentpassword); //check if details exist in DB if (userDetails.Admin_Status == 2) //ADMIN details entered { Admin_Dashboard Admin = new Admin_Dashboard(); //open admin dash Admin.login = userDetails; //pass userdetails to dashboard page this.Hide(); //hide login page Admin.ShowDialog(); //show admin dashboard } else if (userDetails.Admin_Status == 1) //Student account { Student_Dash Student_View = new Student_Dash(); //new student dashboard instance Student_View.login = userDetails; //pass login details to dashboard this.Hide(); //hide login page Student_View.ShowDialog(); //show student dash } else { lblLoginInformation.Content = "Invalid Login Details!"; tbxUser.Background = Brushes.Red; tbxPassword.Background = Brushes.Red; tbxPassword.Password = ""; tbxUser.Text = ""; tbxUser.Focus(); } }
private void btnLogin_Click(object sender, RoutedEventArgs e) { Admin_Dashboard Admin = new Admin_Dashboard(); //Admin.Show(); this.Hide(); var Admin_dc = new Admin_Dashboard(); Admin_dc.Closed += (s, args) => this.Close(); Admin_dc.Show(); }