private void ButtonUnBlock_Click(object sender, RoutedEventArgs e)
        {
            int selectedIndex = dataGridClients.SelectedIndex;

            if (selectedIndex < 0)
            {
                MessageBox.Show("Не выбран клиент");
                return;
            }

            var ap = new DBManager().getClientList();

            Models.ModelClient modelClient = null;
            foreach (var it in ap)
            {
                if (it.ID_Authorization == listClientDetail[selectedIndex].ID_Authorization)
                {
                    modelClient = it;
                    break;
                }
            }

            modelClient.ID_status_client = 2;
            new DBManager().updateClient(modelClient);

            MessageBox.Show("Операция выполнена");
            updateData();
        }
        private async void Button_Click_Registration(object sender, RoutedEventArgs e)
        {
            if (isManager)
            {
                Close();
                return;
            }

            if (!checkBoxAgree.IsChecked.Value)
            {
                MessageBox.Show("Необходимо согласиться с условиями");
                return;
            }

            if (comboBoxID_Category.SelectedIndex < 0)
            {
                MessageBox.Show("Не выбрана категория");
                return;
            }

            if (isManager && comboBoxID_status_client.SelectedIndex < 0)
            {
                MessageBox.Show("Не выбран статус клиента");
                return;
            }

            bool znach2 = await Symb(txtBoxSurname.Text);

            if (txtBoxSurname.Text == String.Empty || znach2)
            {
                MessageBox.Show("Есть ошибка в указании Фамилии");
                return;
            }

            bool znach1 = await Symb(txtBoxName.Text);

            if (txtBoxName.Text == String.Empty || znach1)
            {
                MessageBox.Show("Есть ошибка в указании Имени");
                return;
            }

            bool znach3 = await Symb(txtBoxMiddle_Name.Text);

            if (txtBoxMiddle_Name.Text == String.Empty || znach3)
            {
                MessageBox.Show("Есть ошибка в указании Отчества");
                return;
            }

            if (!IsValidEmail(txtBoxEmail_address.Text))
            {
                MessageBox.Show("Не верно указан Email");
                return;
            }


            if (txtBoxPassport_number_and_series.Text == String.Empty)
            {
                MessageBox.Show("Не указаны номер и серия паспорта");
                return;
            }



            if (txtBoxLogin.Text == String.Empty)
            {
                MessageBox.Show("Не указан логин");
                return;
            }


            if (txtBoxPassword.Text != txtBoxPassword2.Text)
            {
                MessageBox.Show("Введенные пароли не совпадают");
                return;
            }

            int ID_Category = categories[comboBoxID_Category.SelectedIndex].Id_category;



            if (idAuth(txtBoxLogin.Text) >= 0)
            {
                MessageBox.Show("Такой логин уже есть в базе");
                return;
            }



            Models.ModelAuthorization newAuthorization = new Models.ModelAuthorization(-1, txtBoxLogin.Text, txtBoxPassword.Text, 1);
            new DBManager().insertAuthorization(newAuthorization);

            int id_Auth = idAuth(txtBoxLogin.Text);

            Models.ModelClient client = new Models.ModelClient(
                id_Auth,
                txtBoxSurname.Text,
                txtBoxName.Text,
                txtBoxMiddle_Name.Text,
                txtBoxEmail_address.Text,
                2,
                txtBoxPassport_number_and_series.Text,
                ID_Category
                );


            new DBManager().insertClient(client);

            MessageBox.Show("Регистрация прошла успешно");
            Close();
        }