123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104 |
- using System;
- using System.Collections.Generic;
- using System.Data;
- using System.Data.SqlClient;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- using System.Windows;
- using System.Windows.Controls;
- using System.Windows.Data;
- using System.Windows.Documents;
- using System.Windows.Input;
- using System.Windows.Media;
- using System.Windows.Media.Imaging;
- using System.Windows.Shapes;
- namespace KursachMukha692gr
- {
- /// <summary>
- /// Логика взаимодействия для SpisokUchenikov.xaml
- /// </summary>
- public partial class SpisokUchenikov : Window
- {
- public SpisokUchenikov()
- {
- InitializeComponent();
- SqlConnection connection = new SqlConnection("server=WIN-2CL665KE0ED; Trusted_Connection=YES;DataBase=KURSACH1;");
- connection.Open();
- string cmd = "select id,familiya as 'Фамилия', imya as 'Имя', otchestvo as 'Отчество' , dataUchenik as 'Дата рождения',fk_disciplina_id as 'id дисциплины', fk_gruppa_id as 'Номер группы',fk_pol_id as 'id пола', telephonenumUchenik as 'Номер телефона' from infouchenik";
- SqlCommand createcommand = new SqlCommand(cmd, connection);
- createcommand.ExecuteNonQuery();
- SqlDataAdapter sql = new SqlDataAdapter(createcommand);
- DataTable dt = new DataTable("ucheniki");
- sql.Fill(dt);
- uchenikigrid.ItemsSource = dt.DefaultView;
- connection.Close();
- }
- private void Button_Click_add(object sender, RoutedEventArgs e)
- {
- AddUchenik uchenik = new AddUchenik();
- uchenik.Show();
- Close();
- }
- private void Button_Click_delete(object sender, RoutedEventArgs e)
- {
- DeleteSpisokUchenikov spisokUchenikov = new DeleteSpisokUchenikov();
- spisokUchenikov.Show();
- Close();
- }
- private void Button_Click_Back(object sender, RoutedEventArgs e)
- {
- KabinetAdmina kabinet = new KabinetAdmina();
- kabinet.Show();
- Close();
- }
- private void Button_Click_update(object sender, RoutedEventArgs e)
- {
- ViborUchenikUpdate uchenikUpdate = new ViborUchenikUpdate();
- uchenikUpdate.Show();
- Close();
- }
- private void Button_Click_Search(object sender, RoutedEventArgs e)
- {
- if (search.Text.Length > 0)
- {
- SqlConnection connection = new SqlConnection("server=WIN-2CL665KE0ED; Trusted_Connection=YES;DataBase=KURSACH1;");
- connection.Open();
- string cmd = "select id,familiya as 'Фамилия', imya as 'Имя', otchestvo as 'Отчество' , dataUchenik as 'Дата рождения',fk_disciplina_id as 'id дисциплины', fk_gruppa_id as 'Номер группы',fk_pol_id as 'id пола', telephonenumUchenik as 'Номер телефона' from infouchenik" +
- " where id like '%" + search.Text + "%' or familiya like '%" + search.Text + "%' or otchestvo like '%" + search.Text + "%' or dataUchenik like '%" + search.Text + "%' or fk_disciplina_id like '%" + search.Text + "%' or fk_gruppa_id like '%" + search.Text + "%' or fk_pol_id like '%" + search.Text + "%' or telephonenumUchenik like '%" + search.Text + "%'" ;
- SqlCommand createcommand = new SqlCommand(cmd, connection);
- createcommand.ExecuteNonQuery();
- SqlDataAdapter sql = new SqlDataAdapter(createcommand);
- DataTable dt = new DataTable("sorevi");
- sql.Fill(dt);
- uchenikigrid.ItemsSource = dt.DefaultView;
- connection.Close();
- }
- else if (search.Text.Length == 0)
- {
- SqlConnection connection = new SqlConnection("server=WIN-2CL665KE0ED; Trusted_Connection=YES;DataBase=KURSACH1;");
- connection.Open();
- string cmd = "select id,familiya as 'Фамилия', imya as 'Имя', otchestvo as 'Отчество' , dataUchenik as 'Дата рождения',fk_disciplina_id as 'id дисциплины', fk_gruppa_id as 'Номер группы',fk_pol_id as 'id пола', telephonenumUchenik as 'Номер телефона' from infouchenik";
- SqlCommand createcommand = new SqlCommand(cmd, connection);
- createcommand.ExecuteNonQuery();
- SqlDataAdapter sql = new SqlDataAdapter(createcommand);
- DataTable dt = new DataTable("sorevi");
- sql.Fill(dt);
- uchenikigrid.ItemsSource = dt.DefaultView;
- connection.Close();
- }
- }
- private void search_TextChanged(object sender, TextChangedEventArgs e)
- {
- }
- }
- }
|