Ejemplo n.º 1
0
 public int Insert(EmployeesVacationsOpeningBalances EmployeeVacationOpeningBalance)
 {
     try
     {
         using (var db = new HCMEntities())
         {
             db.EmployeesVacationsOpeningBalances.Add(EmployeeVacationOpeningBalance);
             db.SaveChanges();
             return(EmployeeVacationOpeningBalance.EmployeeVacationOpeningBalanceID);
         }
     }
     //catch (DbEntityValidationException e)
     //{
     //    foreach (var eve in e.EntityValidationErrors)
     //    {
     //        Console.WriteLine("Entity of type \"{0}\" in state \"{1}\" has the following validation errors:", eve.Entry.Entity.GetType().Name, eve.Entry.State);
     //        foreach (var ve in eve.ValidationErrors)
     //            Console.WriteLine("- Property: \"{0}\", Error: \"{1}\"", ve.PropertyName, ve.ErrorMessage);
     //    }
     //    throw;
     //}
     catch
     {
         throw;
     }
 }
Ejemplo n.º 2
0
 public int Update(EmployeesVacationsOpeningBalances EmployeeVacationOpeningBalance)
 {
     try
     {
         using (var db = new HCMEntities())
         {
             EmployeesVacationsOpeningBalances EmployeesVacationsOpeningBalancesObj = db.EmployeesVacationsOpeningBalances.SingleOrDefault(x => x.EmployeeVacationOpeningBalanceID.Equals(EmployeeVacationOpeningBalance.EmployeeVacationOpeningBalanceID));
             EmployeesVacationsOpeningBalancesObj.OpeningBalance = EmployeeVacationOpeningBalance.OpeningBalance;
             return(db.SaveChanges());
         }
     }
     catch
     {
         throw;
     }
 }