Example #1
0
        private void AddWorkerButton_Click(object sender, RoutedEventArgs e)
        {
            DataBaseClass.DataBase dataBase = new DataBaseClass.DataBase(DataBaseOption.dataBaseOption);

            if (CheckFullInfo())
            {
                bool isExistWorker = dataBase.CheckFullStaff(secondNameTextBox.Text, firstNameTextBox.Text, middleNameTextBox.Text,
                                                             staffComboBox.SelectedItem.ToString());

                if (isExistWorker)
                {
                    MessageBox.Show("Такой работник уже записан");
                }

                else
                {
                    dataBase.CreateNewWorker(secondNameTextBox.Text, firstNameTextBox.Text, middleNameTextBox.Text,
                                             staffComboBox.SelectedItem.ToString());

                    MessageBox.Show("Уcпешно создан");

                    dataBase.OutputTableStaff(staffTableDataGrid);
                }

                firstNameTextBox.Clear();
                secondNameTextBox.Clear();
                middleNameTextBox.Clear();

                staffComboBox.SelectedIndex = -1;
            }
        }