Example #1
0
 private void ExecuteInsert(object obj)
 {
     if (obj is Employee em)
     {
         using (SuperManagerEntities context = new SuperManagerEntities())
         {
             context.dtEmployee.Add(em);
             context.SaveChanges();
             DisplayInfo.Add(em);
             MessageBox.Show("插入成功", "系统提示");
         }
     }
 }
Example #2
0
 public void ExecuteDelete(object obj)
 {
     if (obj is Employee em)
     {
         using (SuperManagerEntities context = new SuperManagerEntities())
         {
             Employee employee = context.dtEmployee.Find(em.ID);
             context.dtEmployee.Remove(employee);
             context.SaveChanges();
             DisplayInfo.Remove(em);
             System.Windows.MessageBox.Show("删除成功", "系统提示");
         }
     }
 }
Example #3
0
 private void ExecuteUpdate(object obj)
 {
     if (obj is Employee em)
     {
         using (SuperManagerEntities context = new SuperManagerEntities())
         {
             Employee employee = context.dtEmployee.Find(em.ID);
             //更新数据信息
             employee.Name      = em.Name;
             employee.Phone     = em.Phone;
             employee.Remark    = em.Remark;
             employee.Address   = em.Address;
             employee.Alternate = em.Alternate;
             employee.Education = em.Education;
             employee.Email     = em.Email;
             context.SaveChanges();
             MessageBox.Show("更新成功", "系统提示");
         }
     }
 }