Пример #1
0
 private void BtnDelte_Click(object sender, RoutedEventArgs e)
 {
     try
     {
         using (var context = new SDXCatering_Emp010Entities())
         {
             var empleado = (CtMae_Empleados)gridA.SelectedItem;
             //context.CtMae_Empleados.Remove(empleado);
             context.Entry(empleado).State = System.Data.Entity.EntityState.Deleted;
             context.SaveChanges();
             load();
         }
     }
     catch (Exception w)
     {
         MessageBox.Show("error al eliminar:" + w);
     }
 }
Пример #2
0
 private void BtnUpdate_Click(object sender, RoutedEventArgs e)
 {
     try
     {
         var empleado = (CtMae_Empleados)gridA.SelectedItem;
         //MessageBox.Show(a.EmpleadoCodigo);
         //empleado.EmpleadoNombres = "cambiado";
         using (var context = new SDXCatering_Emp010Entities())
         {
             context.Entry(empleado).State = System.Data.Entity.EntityState.Modified;
             context.SaveChanges();
             load();
         }
     }
     catch (Exception w)
     {
         MessageBox.Show("error al actualizar:" + w);
     }
 }