コード例 #1
0
        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();
                }
            }
        }