Esempio n. 1
0
 public bool JobChangeStatus(out string message)
 {
     message = "error";
     try
     {
         TMSDbContext DbContext = new TMSDbContext();
         DbContext.Database.CommandTimeout = Common.Constants.CommonConstants.TimeExcuteSql;
         DbContext.Database.ExecuteSqlCommand(Common.Constants.AbnormalQuery.ExcuteCheckTimeOut);
         var explanationRequest = _explanationRequestRepository.GetMulti(x => x.StatusRequestId == 1 || x.StatusRequestId == 5).ToList();
         foreach (var item in explanationRequest)
         {
             if (_commonService.GetDateExRequestInPast(item.CreatedDate.Value) < DateTime.Now.Date)
             {
                 item.StatusRequestId = 2;
                 _explanationRequestRepository.Update(item);
                 _explanationRequestService.Save();
             }
         }
         log.Info("Job Change Status Run Success :" + DateTime.Now.ToString("dd'/'MM'/'yyyy HH:mm:ss"));
         message = "Success";
         return(true);
     }
     catch (Exception ex)
     {
         message = "Error:" + ex.Message;
         return(false);
     }
 }
 /// <summary>
 /// get all delegation request
 /// </summary>
 /// <param name="userID">ID of username</param>
 /// <param name="GroupID">ID of group</param>
 /// <returns>return list delegation request with user and group<</returns>
 public IEnumerable <ExplanationRequest> GetAllDelegationExplanationRequest(string userID, string groupID)
 {
     return(_explanationRequestRepository.GetMulti((x => (x.FingerTimeSheet.FingerMachineUsers.AppUser.GroupId.ToString().Equals(groupID) && x.DelegateId != null)), new string[] {
         CommonConstants.ReceiverUser,
         CommonConstants.DelegateUser,
         CommonConstants.FingerTimeSheet,
         CommonConstants.FingerMachineUser,
         CommonConstants.TimeSheetAppUser,
         CommonConstants.TimeSheetAppUserGroup,
         CommonConstants.StatusRequest
     }).OrderByDescending(x => x.UpdatedDate));
 }