public void LoadTable()// Вывод данных в таблицу { dt = db.RunSelect("SELECT Id as 'ID', Name as 'Название', PochtaIndex as 'Почтовый индекс' FROM City"); dataGridGorod.ItemsSource = dt.DefaultView; //dataGridGorod.Columns[0].Visibility = Visibility.Hidden; //dataGridSportC.Columns[0].Visibility = Visibility.Hidden; }
private void butEdit_Click(object sender, RoutedEventArgs e) { if (UsersDataGrid.SelectedItems.Count > 0) { groupBox.Header = "Редактировать"; DataRowView row = (DataRowView)UsersDataGrid.SelectedItems[0]; DataTable datat = db.RunSelect("SELECT [Id] as 'Id', [FIO] as 'ФИО', [Login] as 'Логин', [Password] as 'Пароль', [Admin] as 'Администратор' FROM [dbo].[User] Where [Id]= '" + row["Id"] + "'"); string[] words = datat.Rows[0][1].ToString().Split(new char[] { ' ' }); textBox_F.Text = words[0]; textBox_I.Text = words[1]; textBox_O.Text = words[2]; textBox_Login.Text = datat.Rows[0][2].ToString(); textBox_Password.Text = datat.Rows[0][3].ToString(); CheckBoxAdmin.IsChecked = (datat.Rows[0][4].ToString() == "1") ? true : false; VisibleTrue(); } else { MessageBox.Show("Выберите пользователя в таблице"); } }
public void LoadTable()// Вывод данных в таблицу { dt = db.RunSelect("SELECT Id as 'ID', WeightFrom as 'От', WeightTo as 'До' FROM WeightClass"); dataGrid.ItemsSource = dt.DefaultView; //dataGridGorod.Columns[0].Visibility = Visibility.Hidden; //dataGridSportC.Columns[0].Visibility = Visibility.Hidden; }
private void InitDataСompetitors() { string query = @"SELECT People.Id, People.FIO, People.DateOfBirth, People.Age, People.Gender, People.Weight,SportClub.Name as SportClub, City.Name AS City, People.Street FROM People INNER JOIN SportClub ON People.Id_SportClub = SportClub.Id INNER JOIN City ON People.Id_City = City.Id"; dgCompetitors.ItemsSource = sql.RunSelect(query).DefaultView; }
private void butLogin_Click(object sender, RoutedEventArgs e) { if (tbLogin.Text != "" && tbPassword.Password.ToString() != "") { dt = db.RunSelect("Select FIO, Admin from [User] where Login='******' and Password='******'"); if (dt.Rows.Count > 0) { if (dt.Rows[0][1].ToString() == "True") { FormAdmin fa = new FormAdmin(); fa.Title = dt.Rows[0][0].ToString(); fa.Show(); this.Hide(); } else { FormJury fj = new FormJury(); fj.Title = dt.Rows[0][0].ToString(); fj.Show(); this.Hide(); } } else { MessageBox.Show("Неверно введен логин или пароль!"); } } else { MessageBox.Show("Заполните все поля!"); } }
public FormJury() { InitializeComponent(); db = new SQLData(); dt = db.RunSelect("Select Id, Name from Mat"); dataGrid.ItemsSource = dt.DefaultView; }
public void LoadTable()// Вывод данных в таблицу { dt = db.RunSelect(@"SELECT People.FIO, People_1.FIO AS FIO1, People_1.Weight AS Weight1, People_1.Age AS Age1, People.Weight, People.Age, PeopleBattleGroup.Id AS IDPeopleBattleGroup1, PBG1.Id as IDPeopleBattleGroup2, Battle.Id as BattleID FROM Battle INNER JOIN PeopleBattleGroup On Battle.Id_People1 = PeopleBattleGroup.Id INNER JOIN PeopleBattleGroup AS PBG1 On Battle.Id_People2 = PBG1.Id INNER JOIN People On PeopleBattleGroup.People_Id = People.Id INNER JOIN People AS People_1 On PBG1.People_Id = People_1.Id Where (Battle.Result is NULL OR Battle.Result='') and Battle.Id_Mat=" + idmat); NextBattle(); }
private void butLogin_Click(object sender, RoutedEventArgs e) { if (tbEmail.Text != "") { dt = db.RunSelect("Select Login, Password from [User] where Email='" + tbEmail.Text + "'"); if (dt.Rows.Count > 0) { SendMail(); } else { MessageBox.Show("Такая почта не зарегистрирована!"); } } else { MessageBox.Show("Введите почту!"); } }
public void LoadTable() { dg.ItemsSource = db.RunSelect("Select [ID] as id , Name as 'Наименование' FROM Mat").DefaultView; }
private void LoadBD() { dataGridParty.ItemsSource = db.RunSelect("Select FIO as ФИО, SportClub.Name as Спортклуб, City.Name as Город, Weight as Вес, Age as Возраст from ((People inner join SportClub On People.Id_SportClub=SportClub.Id) inner join City On People.Id_City=City.ID)").DefaultView; }
public fightGroup() { InitializeComponent(); DataTable dt = db.RunSelect(@"Select Distinct AgeClass.Id,AgeFrom,AgeTo From (AgeClass inner join BattleGroup on AgeClass.Id =BattleGroup.Id_Age) inner join PeopleBattleGroup on BattleGroup.Id = PeopleBattleGroup.Battle_Id"); for (int i = 0; i < dt.Rows.Count; i++) { comboBox.Items.Add(dt.Rows[i][1] + "-" + dt.Rows[i][2]); } dt = db.RunSelect(@"Select Distinct WeightClass.Id,WeightFrom,WeightTo From (WeightClass inner join BattleGroup on WeightClass.Id = BattleGroup.Id_Weight) inner join PeopleBattleGroup on BattleGroup.Id = PeopleBattleGroup.Battle_Id"); for (int i = 0; i < dt.Rows.Count; i++) { comboBox1.Items.Add(dt.Rows[i][1] + "-" + dt.Rows[i][2]); } }
public void LoadTable()// Вывод данных в таблицу { dt = db.RunSelect("SELECT Id as 'ID', Name as 'Название клуба' FROM SportClub"); dataGridSportC.ItemsSource = dt.DefaultView; //dataGridSportC.Columns[0].Visibility = Visibility.Hidden; }