Пример #1
0
 /// <summary>
 /// Change Status Request of otrequest ID and action
 /// </summary>
 /// <param name="otrequestID"></param>
 /// <param name="action"></param>
 /// <returns></returns>
 public OTRequest ChangeStatus(int otrequestID, string action, string userId)
 {
     try
     {
         var model  = GetById(otrequestID);
         var status = _statusRequestRepository.GetMulti(x => x.Name.Equals(action)).FirstOrDefault();
         model.StatusRequestID = status.ID;
         model.UpdatedBy       = userId;
         model.UpdatedDate     = DateTime.Now;
         _otrequestRepository.Update(model);
         Save();
         return(model);
     }
     catch (NullReferenceException ex)
     {
         return(null);
     }
 }
Пример #2
0
        //Change status request by delegate config, when set delegate in menu Config Delegation
        public void ChangeStatusRequestConfigDelegate(string assignTo, List <Request> lstRequest)
        {
            var status = _statusRequestRepository.GetMulti(x => x.Name.Contains(CommonConstants.StatusDelegation)).FirstOrDefault();

            if (lstRequest.Count() > 0)
            {
                foreach (var itemRequest in lstRequest)
                {
                    if (itemRequest.StatusRequest.Name.Equals(CommonConstants.StatusDelegation))
                    {
                        itemRequest.AssignToId = assignTo;
                        _requestRepository.Update(itemRequest);
                    }
                    else
                    {
                        itemRequest.RequestStatusId = status.ID;
                        itemRequest.AssignToId      = assignTo;
                        _requestRepository.Update(itemRequest);
                    }
                }
                SaveChange();
            }
        }
        /// <summary>
        /// chech request status
        /// </summary>
        /// <param name="delegationRequestID">ID of Request</param>
        /// <param name="action"></param>
        /// <returns>obejct request</returns>
        private ExplanationRequest CheckStatus(int DelegationRequestID, string action, string changeStatusBy)
        {
            var model         = GetIdRequest(DelegationRequestID);
            var statusRequest = _statusRequestRepository.GetMulti(x => x.Name.Equals(action)).FirstOrDefault();

            if (model.StatusRequest.Name == CommonConstants.StatusDelegation)
            {
                model.UpdatedBy       = changeStatusBy;
                model.DelegateId      = null;
                model.UpdatedDate     = DateTime.Now;
                model.StatusRequestId = statusRequest.ID;
                _explanationRequestRepository.Update(model);
                Save();
                return(model);
            }
            else
            {
                return(model);
            }
        }
Пример #4
0
        /// <summary>
        /// chech request status
        /// </summary>
        /// <param name="delegationRequestID">ID of Request</param>
        /// <param name="action"></param>
        /// <returns>obejct request</returns>
        private Request CheckStatus(Request request, string action, string changeStatusBy)
        {
            var statusRequest = _statusRequestRepository.GetMulti(x => x.Name.Equals(action)).FirstOrDefault();

            if (request.StatusRequest.Name == CommonConstants.StatusDelegation)
            {
                float dayBreak = _requestRepository.CalculateDateBreak(request.StartDate, request.EndDate, request.RequestType.Name);
                //float dayBreak = _requestRepository.CalculateDateBreak(request.StartDate, request.EndDate, requestName);
                request.RequestStatusId  = statusRequest.ID;
                request.ChangeStatusById = changeStatusBy;
                request.AssignToId       = null;
                _requestRepository.Update(request);
                Save();
                return(request);
            }
            else if (request.StatusRequest.Name == CommonConstants.StatusApproved || request.StatusRequest.Name == CommonConstants.StatusRejected)
            {
                return(request);
            }
            return(request);
        }