private void ButtonEmployerRegistration_Click(object sender, RoutedEventArgs e) { var name = employerName.Text; var surname = employerSurname.Text; var username = employerNickname.Text; var password = employerPassword.Password; var company = employerCompany.Text; var birthDate = employerBirthDate.SelectedDate; if (Recruter.Validate(name, surname, company, birthDate, username)) { if (repo.IsLoginFree(username)) { textIncorrect.Text = $"Логин {username} занят!"; } else { repo.CreateNewRecruter(name, surname, birthDate, company, username, password); repo.SaveConfig(); var recruterWindow = new HRWindow(repo); recruterWindow.Show(); this.Close(); } } else { textIncorrect.Text = "Введены неправильные данные"; } }
private void ButtonLogin_Click(object sender, RoutedEventArgs e) { var login = userLogin.Text; var password = userPass.Password; if (repo.AuthorizeUser(login, password)) { var userWindow = new FirstUserWindow(repo); userWindow.Show(); this.Close(); } else if (repo.AuthorizeHR(login, password)) { var recruterWindow = new HRWindow(repo); recruterWindow.Show(); this.Close(); } else { textIncorrectData.Text = "Incorrect username or password!"; } }