Beispiel #1
0
 public int Update(EmployeesEvaluationsDetails EmployeeEvaluationDetail)
 {
     try
     {
         using (var db = new HCMEntities())
         {
             EmployeesEvaluationsDetails EmployeesEvaluationsDetailsObj = db.EmployeesEvaluationsDetails.SingleOrDefault(x => x.EmployeeEvaluationDetailID.Equals(EmployeeEvaluationDetail.EmployeeEvaluationDetailID));
             EmployeesEvaluationsDetailsObj.DirectManagerEvaluation  = EmployeeEvaluationDetail.DirectManagerEvaluation;
             EmployeesEvaluationsDetailsObj.TimeAttendanceEvaluation = EmployeeEvaluationDetail.TimeAttendanceEvaluation;
             EmployeesEvaluationsDetailsObj.ViolationsEvaluation     = EmployeeEvaluationDetail.ViolationsEvaluation;
             EmployeesEvaluationsDetailsObj.LastUpdatedBy            = EmployeeEvaluationDetail.LastUpdatedBy;
             EmployeesEvaluationsDetailsObj.LastUpdatedDate          = EmployeeEvaluationDetail.LastUpdatedDate;
             return(db.SaveChanges());
         }
     }
     catch
     {
         throw;
     }
 }
Beispiel #2
0
 public int Insert(EmployeesEvaluationsDetails EmployeeEvaluationDetail)
 {
     try
     {
         using (var db = new HCMEntities())
         {
             db.EmployeesEvaluationsDetails.Add(EmployeeEvaluationDetail);
             db.SaveChanges();
             return(EmployeeEvaluationDetail.EmployeeEvaluationDetailID);
         }
     }
     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;
     }
 }