예제 #1
0
 public static void AddEmployee(Employee e)
 {
     using (Entities2 db = new Entities2())
     {
         db.Employee.Add(e);
         db.SaveChanges();
     }
 }
예제 #2
0
 public static void DeleteEmployee(int IdEmployee)
 {
     using (Entities2 db = new Entities2())
     {
         Employee e = db.Employee.Find(IdEmployee);
         try
         {
             db.Employee.Remove(e);
             db.SaveChanges();
         }
         catch (Exception)
         {
             e.StatusEmployee = false;
             db.SaveChanges();
         }
     }
 }
예제 #3
0
 public static void UpdatEmployee(int id, Employee e)
 {
     using (Entities2 db = new Entities2())
     {
         Employee em = db.Employee.Find(id);
         if (em != null)
         {
             em.IdPosition        = e.IdPosition;
             em.LastNameEmployee  = e.LastNameEmployee;
             em.FirstNameEmployee = e.FirstNameEmployee;
             em.IdPosition        = e.IdPosition;
             em.StatusEmployee    = e.StatusEmployee;
             db.SaveChanges();
         }
     }
 }