Exemplo n.º 1
0
        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("Уже добавлены в бд");
            }
        }
Exemplo n.º 2
0
        private void BtPg_Click(object sender, RoutedEventArgs e)
        {
            ApDBContext pgContext = new PostGreSQLDBContext();

            pgContext.Users.Add(NewUserGenerator());
            pgContext.SaveChanges();
            dgPostgreSql.ItemsSource = pgContext.Users.ToList();
        }
Exemplo n.º 3
0
        private void BtPgSqlClear_Click(object sender, RoutedEventArgs e)
        {
            ApDBContext pgContext = new PostGreSQLDBContext();

            pgContext.Users.RemoveRange(pgContext.Users);
            pgContext.SaveChanges();
            dgPostgreSql.ItemsSource = pgContext.Users.ToList();
        }
Exemplo n.º 4
0
        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();
        }
Exemplo n.º 5
0
 private void Btcompare_Click(object sender, RoutedEventArgs e)
 {
     ApDBContext sqlContext = new MSSQLDBContext();
     ApDBContext pgContext  = new PostGreSQLDBContext();
 }