Exemplo n.º 1
0
 public int Delete(int EmployeeAllowanceID, int UserIdentity)
 {
     try
     {
         using (var db = new HCMEntities())
         {
             EmployeesAllowances EmployeeAllowanceObj = db.EmployeesAllowances.SingleOrDefault(x => x.EmployeeAllowanceID.Equals(EmployeeAllowanceID));
             db.EmployeesAllowances.Remove(EmployeeAllowanceObj);
             return(db.SaveChanges(UserIdentity));
         }
     }
     catch
     {
         throw;
     }
 }
Exemplo n.º 2
0
 public int Update(EmployeesAllowances EmployeeAllowance)
 {
     try
     {
         using (var db = new HCMEntities())
         {
             EmployeesAllowances EmployeeAllowanceObj = db.EmployeesAllowances.SingleOrDefault(x => x.EmployeeAllowanceID.Equals(EmployeeAllowance.EmployeeAllowanceID));
             EmployeeAllowanceObj.EmployeeCareerHistoryID = EmployeeAllowance.EmployeeCareerHistoryID;
             EmployeeAllowanceObj.AllowanceID             = EmployeeAllowance.AllowanceID;
             EmployeeAllowanceObj.AllowanceStartDate      = EmployeeAllowance.AllowanceStartDate;
             EmployeeAllowanceObj.IsActive        = EmployeeAllowance.IsActive;
             EmployeeAllowanceObj.LastUpdatedDate = EmployeeAllowance.LastUpdatedDate;
             EmployeeAllowanceObj.LastUpdatedBy   = EmployeeAllowance.LastUpdatedBy;
             return(db.SaveChanges());
         }
     }
     catch
     {
         throw;
     }
 }
Exemplo n.º 3
0
 public int Insert(EmployeesAllowances EmployeeAllowance)
 {
     try
     {
         using (var db = new HCMEntities())
         {
             db.EmployeesAllowances.Add(EmployeeAllowance);
             db.SaveChanges();
             return(EmployeeAllowance.EmployeeAllowanceID);
         }
     }
     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;
     }
 }