private void SetContext(DataBaseType DbType, Connections Conn) { switch (DbType) { case DataBaseType.DB2: _DB2DBContext = new DB2DBContext(Conn); QueryProcessor = _DB2DBContext; break; case DataBaseType.MSSql: _MSSQLDBContext = new MSSQLDBContext(Conn); QueryProcessor = _MSSQLDBContext; break; case DataBaseType.MySQL: _MySqlDBContext = new MySqlDBContext(Conn); QueryProcessor = _MySqlDBContext; break; case DataBaseType.PostgreSQL: _PostgreSQLLDBContext = new PostgreSQLLDBContext(Conn); QueryProcessor = _PostgreSQLLDBContext; break; } }
private void BtAddGender_Click(object sender, RoutedEventArgs e) { ApDBContext sqlContext = new MSSQLDBContext(); ApDBContext pgContext = new PostGreSQLDBContext(); if (sqlContext.Genders.Count() == 0 && pgContext.Genders.Count() == 0) { List <Gender> genders = new List <Gender>() { new Gender { Name = "Мужской" }, new Gender { Name = "Женский" } }; sqlContext.Genders.AddRange(genders); sqlContext.SaveChanges(); pgContext.Genders.AddRange(genders); pgContext.SaveChanges(); } else { MessageBox.Show("Уже добавлены в бд"); } }
private void BtSql_Click(object sender, RoutedEventArgs e) { ApDBContext sqlContext = new MSSQLDBContext(); sqlContext.Users.Add(NewUserGenerator()); sqlContext.SaveChanges(); dgSql.ItemsSource = sqlContext.Users.ToList(); }
private void BtSqlClear_Click(object sender, RoutedEventArgs e) { ApDBContext sqlContext = new MSSQLDBContext(); sqlContext.Users.RemoveRange(sqlContext.Users); sqlContext.SaveChanges(); dgSql.ItemsSource = sqlContext.Users.ToList(); }
private void BtSqlClCompread_Click(object sender, RoutedEventArgs e) { ApDBContext sqlContext = new MSSQLDBContext(); sqlContext.Users.Distinct(); sqlContext.SaveChanges(); dgSql.ItemsSource = sqlContext.Users.ToList(); }
private void MainWindow_Loaded(object sender, RoutedEventArgs e) { ApDBContext sqlContext = new MSSQLDBContext(); ApDBContext pgContext = new PostGreSQLDBContext(); dgSql.ItemsSource = sqlContext.Users.ToList(); dgPostgreSql.ItemsSource = pgContext.Users.ToList(); }
private void FreshUp_Click(object sender, RoutedEventArgs e) { Window1 window = new Window1(); if (window.ShowDialog() == true) { ApDBContext sqlContext = new MSSQLDBContext(); dgSql.ItemsSource = sqlContext.Users.ToList(); } }
public ProductService(MSSQLDBContext dbContext) { _dbContext = dbContext; }
private void Btcompare_Click(object sender, RoutedEventArgs e) { ApDBContext sqlContext = new MSSQLDBContext(); ApDBContext pgContext = new PostGreSQLDBContext(); }