private void LoginTextBox_Validating(object sender, System.ComponentModel.CancelEventArgs e) { if (string.IsNullOrEmpty(LoginTextBox.Text)) { ErrorIcon.SetError(LoginTextBox, "This field cant be empty!"); } else if (!authorization.IsLoginExist(LoginTextBox.Text)) { ErrorIcon.SetError(LoginTextBox, "Login is not exists"); } else { ErrorIcon.Clear(); } }
private void AcceptButton_Click(object sender, EventArgs e) { bool check = true; if (String.IsNullOrEmpty(AtributeTextBox.Text)) { MessageBox.Show("Enter some data!"); } else { if (Atribute == "Name") { _reader.Name = AtributeTextBox.Text; } if (Atribute == "Surname") { _reader.Surname = AtributeTextBox.Text; } if (Atribute == "Login") { if (authorization.IsLoginExist(AtributeTextBox.Text)) { check = false; MessageBox.Show("Login already exists"); } else { authorization.SetNewLogin(_reader, AtributeTextBox.Text); } } if (check) { readerBL.Update(_reader); MessageBox.Show($"{Atribute} changed." + Environment.NewLine + "Сhanges will be displayed after the next authorization."); Close(); } } }