public void Register_Button_Click(object sender, RoutedEventArgs e) { if (Login.Text.Length == 0 || RegisterPassword.Text.Length == 0 || ConfirmPassword.Text.Length == 0) { MessageBox.Show("Заповніть всі поля"); return; } else if (RegisterPassword.Text != ConfirmPassword.Text) { MessageBox.Show("Паролі не співпадають"); return; } else { DB_ServerConnection cnn = DB_ServerConnection.getInstance(); string[] res = cnn.Connect("select Student_Password from Student where Student_Login = '******'").Split('/'); if (res[0].Length != 0) { MessageBox.Show("Користувач з таким логіном вже існує"); } else { cnn.Connect("insert into Student (Student_Login, Student_Password) values('" + Login.Text + "', '" + RegisterPassword.Text + "')"); ProfileSearchWindow p = new ProfileSearchWindow(Login.Text); p.Show(); this.Close(); } } }
private void Login_Button_Click(object sender, RoutedEventArgs e) { DB_ServerConnection cnn = DB_ServerConnection.getInstance(); string[] res = cnn.Connect("select Student_Password from Student where Student_Login = '******'").Split('/'); if (res[0].Length == 0) { MessageBox.Show("Користувача з таким логіном не існує"); } else if (res[0] != Password.Password) { MessageBox.Show("Невірний пароль"); } else if (res[0] == Password.Password) { ProfileSearchWindow p = new ProfileSearchWindow(Login.Text); this.Close(); p.Show(); } }