private void bntLogin_Click(object sender, RoutedEventArgs e) { //Check if the user logi controlling con = new controlling(); int ID = 0; bool openForm = false; if (rbnNewUser.IsChecked.Value) { //Create User ID = (con.Create_User(txtUsername.Text, txtPassword.Password)).UserID; openForm = true; } else { var user = con.Check_Credential(txtUsername.Text, txtPassword.Password); if (user != null) { ID = user.UserID; openForm = true; } else { MessageBox.Show("Username or Password not correct", "Login", MessageBoxButton.OK, MessageBoxImage.Warning); } } if (openForm) { //Show the diary selector con.Show_Diary(ID); this.Close(); } }
private void bntChange_Click(object sender, RoutedEventArgs e) { //closes the programm controlling con = new controlling(); con.Show_Diary(DiaryID); this.Close(); }