Exemplo n.º 1
0
        private void FacultyUpdate()
        {
            FacultyBox.ItemsSource   = unitOfWork.Faculties.GetAll().ToList();
            FacultyBox.SelectedIndex = 0;
            FacultyBox.RaiseEvent(new RoutedEventArgs(ComboBox.SelectedEvent));

            ChairUpdate();
        }
Exemplo n.º 2
0
 private void ClearFormFields()
 {
     FirstNameBox.Clear();
     SecondNameBox.Clear();
     FacultyBox.Clear();
     DegreeGraduationDate.SelectedDate = DateTime.Today;
     DegreeDomain.Clear();
     DegreeForm.Visibility       = Visibility.Collapsed;
     MakeMasterButton.Visibility = Visibility.Collapsed;
 }
Exemplo n.º 3
0
        private void UpdateTeacherClick(object sender, RoutedEventArgs e)
        {
            string ConnectionString = @"Data Source=DESKTOP-15P21ID;Initial Catalog=kursovoi;Integrated Security=True";
            string sqlExpression    = $"SELECT id,name From facylties where name='{faculty}'";

            using (SqlConnection connection = new SqlConnection(ConnectionString))
            {
                connection.Open();
                SqlCommand    command = new SqlCommand(sqlExpression, connection);
                SqlDataReader reader  = command.ExecuteReader();
                SqlCommand    cm1     = connection.CreateCommand();
                try
                {
                    while (reader.Read())
                    {
                        object s = reader.GetValue(0);
                        fakk_id = Convert.ToInt32(s);
                    }
                    reader.Close();
                    if (fakk_id == 0)
                    {
                        MessageBox.Show("Такого факультета не существует");
                    }
                    else
                    {
                        cm1.CommandText = "update users set first_name='" + SurnameBox.Text + "',middle_name='" + NameBox.Text + "',login='******',email='" + PostBox.Text + "',faculty_id='" + fakk_id + "' where id='" + id_admin_panel + "'";
                        cm1.ExecuteNonQuery();
                        MessageBox.Show("Данные успешно обновлены!");
                    }
                }

                catch (Exception ex)
                {
                    MessageBox.Show(ex.Message);
                }
                finally
                {
                    SurnameBox.Clear();
                    NameBox.Clear();
                    LoginBox.Clear();
                    PostBox.Clear();
                    FacultyBox.Clear();
                    connection.Close();
                    reader.Close();
                }
            }
        }