Пример #1
0
 public int Insert(VacationsDetails VacationDetail)
 {
     try
     {
         using (var db = new HCMEntities())
         {
             db.VacationsDetails.Add(VacationDetail);
             db.SaveChanges();
             return(VacationDetail.VacationDetailID);
         }
     }
     catch
     {
         throw;
     }
 }
Пример #2
0
 public int Delete(int VacationDetailID, int UserIdentity)
 {
     try
     {
         using (var db = new HCMEntities())
         {
             VacationsDetails VacationDetailObj = db.VacationsDetails.FirstOrDefault(x => x.VacationDetailID.Equals(VacationDetailID));
             db.VacationsDetails.Remove(VacationDetailObj);
             return(db.SaveChanges(UserIdentity));
         }
     }
     catch
     {
         throw;
     }
 }
Пример #3
0
        public int UpdateCreationDates(VacationsDetails VacationDetail)
        {
            try
            {
                using (var db = new HCMEntities())
                {
                    VacationsDetails VacationDetailObj = db.VacationsDetails.FirstOrDefault(x => x.VacationID.Equals(VacationDetail.VacationID));
                    VacationDetailObj.FromDate        = VacationDetail.FromDate;
                    VacationDetailObj.ToDate          = VacationDetail.ToDate;
                    VacationDetailObj.Notes           = VacationDetail.Notes;
                    VacationDetailObj.LastUpdatedBy   = VacationDetail.LastUpdatedBy;
                    VacationDetailObj.LastUpdatedDate = VacationDetail.LastUpdatedDate;

                    return(db.SaveChanges());
                }
            }
            catch
            {
                throw;
            }
        }
Пример #4
0
        public int Update(VacationsDetails VacationDetail)
        {
            try
            {
                using (var db = new HCMEntities())
                {
                    VacationsDetails VacationDetailObj = db.VacationsDetails.FirstOrDefault(x => x.VacationDetailID.Equals(VacationDetail.VacationDetailID));
                    VacationDetailObj.IsApproved      = VacationDetail.IsApproved;
                    VacationDetailObj.ApprovedBy      = VacationDetail.ApprovedBy;
                    VacationDetailObj.ApprovedDate    = VacationDetail.ApprovedDate;
                    VacationDetailObj.LastUpdatedBy   = VacationDetail.LastUpdatedBy;
                    VacationDetailObj.LastUpdatedDate = VacationDetail.LastUpdatedDate;

                    return(db.SaveChanges());
                }
            }
            catch
            {
                throw;
            }
        }