Пример #1
0
 private void Insert_Click(object sender, EventArgs e)
 {
     using (CityIEF frm = new CityIEF(null, db))
     {
         if (frm.ShowDialog() == DialogResult.OK)
         {
             cityBindingSource.DataSource = db.City.ToList();
         }
     }
 }
Пример #2
0
 private void Edit_Click(object sender, EventArgs e)
 {
     if (cityBindingSource.Current == null)
     {
         return;
     }
     using (CityIEF frm = new CityIEF(cityBindingSource.Current as City, db))
     {
         if (frm.ShowDialog() == DialogResult.OK)
         {
             cityBindingSource.DataSource = db.City.ToList();
         }
         else
         {
             db = new my_db_for_db_2Entities();
             cityBindingSource.DataSource = db.City.ToList();
         }
     }
 }