示例#1
0
 public int Update(Vacations Vacation)
 {
     try
     {
         using (var db = new HCMEntities())
         {
             Vacations VacationObj = db.Vacations.FirstOrDefault(x => x.VacationID.Equals(Vacation.VacationID));
             VacationObj.VacationStartDate        = Vacation.VacationStartDate;
             VacationObj.VacationEndDate          = Vacation.VacationEndDate;
             VacationObj.OldBalanceConsumed       = Vacation.OldBalanceConsumed;
             VacationObj.IsCanceled               = Vacation.IsCanceled;
             VacationObj.LastUpdatedBy            = Vacation.LastUpdatedBy;
             VacationObj.LastUpdatedDate          = Vacation.LastUpdatedDate;
             VacationObj.StudiesVacationStartDate = Vacation.StudiesVacationStartDate;
             VacationObj.SickVacationTypeID       = Vacation.SickVacationTypeID;
             VacationObj.IsSickLeaveAmountPaid    = Vacation.IsSickLeaveAmountPaid;
             VacationObj.NormalVacationTypeID     = Vacation.NormalVacationTypeID;
             return(db.SaveChanges());
         }
     }
     catch
     {
         throw;
     }
 }
示例#2
0
 public int Insert(Vacations Vacation)
 {
     try
     {
         using (var db = new HCMEntities())
         {
             db.Vacations.Add(Vacation);
             db.SaveChanges();
             return(Vacation.VacationID);
         }
     }
     catch
     {
         throw;
     }
 }
示例#3
0
 public int Delete(int VacationID, int UserIdentity)
 {
     try
     {
         using (var db = new HCMEntities())
         {
             Vacations VacationObj = db.Vacations.FirstOrDefault(x => x.VacationID.Equals(VacationID));
             db.Vacations.Remove(VacationObj);
             return(db.SaveChanges(UserIdentity));
         }
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
示例#4
0
 public int UpdateVacationDates(Vacations Vacation)
 {
     try
     {
         using (var db = new HCMEntities())
         {
             Vacations VacationObj = db.Vacations.FirstOrDefault(x => x.VacationID.Equals(Vacation.VacationID));
             VacationObj.VacationStartDate = Vacation.VacationStartDate;
             VacationObj.VacationEndDate   = Vacation.VacationEndDate;
             VacationObj.LastUpdatedBy     = Vacation.LastUpdatedBy;
             VacationObj.LastUpdatedDate   = Vacation.LastUpdatedDate;
             return(db.SaveChanges());
         }
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }