示例#1
0
        /// <summary>
        ///
        /// </summary>
        protected override void ExcuteSelf()
        {
            try
            {
                using (TransactionScope ts = new TransactionScope(TransactionScopeOption.Required))
                {
                    foreach (LeaveRequestItem item in _LeaveRequest.LeaveRequestItems)
                    {
                        item.Status = _RequestStatus;
                        UpdateVacationDaysAvailable(item);
                        UpdateAdjustHour(item);
                    }


                    _DalLeaveRequest.UpdateLeaveRequestItemStatusByLeaveRequestItemID(_LeaveRequestItemID,
                                                                                      _RequestStatus, 0);
                    _DalLeaveRequestFlow.InsertLeaveRequestFlow(PrepareLeaveRequestFlow(_LeaveRequestItemID));

                    ts.Complete();
                }
            }
            catch
            {
                BllUtility.ThrowException(BllExceptionConst._DbError);
            }
        }
示例#2
0
        protected override void ExcuteSelf()
        {
            try
            {
                int                    cancelCount     = 0;
                DiyStep                currentStep     = _LeaveRequest.DiyProcess.FindCancelStep();
                DiyStep                nextStep        = _LeaveRequest.DiyProcess.FindCancelNextStep();
                List <DiyStep>         diysteplist     = new List <DiyStep>();
                List <List <Account> > mailAccountlist = new List <List <Account> >();

                //如果请假信息状态不是取消或提交状态,不能取消
                foreach (LeaveRequestItem item in _LeaveRequest.LeaveRequestItems)
                {
                    using (TransactionScope ts = new TransactionScope(TransactionScopeOption.Required))
                    {
                        if (RequestStatus.CanCancelStatus(item.Status))
                        {
                            _DalLeaveRequest.UpdateLeaveRequestItemStatusByLeaveRequestItemID(item.LeaveRequestItemID,
                                                                                              _RequestStatus,
                                                                                              nextStep.DiyStepID);
                            _DalLeaveRequestFlow.InsertLeaveRequestFlow(
                                PrepareLeaveRequestFlow(item.LeaveRequestItemID));
                            ts.Complete();
                            cancelCount++;
                        }
                    }
                    new LeaveRequestMailAndPhoneDelegate().CancelOperation(_LeaveRequest.PKID, item,
                                                                           currentStep.MailAccount, nextStep);
                    if (!DiyStep.Contains(diysteplist, nextStep))
                    {
                        diysteplist.Add(nextStep);
                        mailAccountlist.Add(currentStep.MailAccount);
                    }
                }
                for (int i = 0; i < diysteplist.Count; i++)
                {
                    new LeaveRequestMailAndPhoneDelegate().CancelMail(_LeaveRequest.PKID, mailAccountlist[i], diysteplist[i]);
                }
                if (cancelCount == _LeaveRequest.LeaveRequestItems.Count)
                {
                    ResultMessage = string.Empty;
                }
                else if (cancelCount == 0)
                {
                    ResultMessage = HrmisUtility._LeaveRequest_CanNot_BeCancled;
                }
                else if (cancelCount > 0)
                {
                    ResultMessage = HrmisUtility._LeaveRequest_Partial_CanNot_BeCancled;
                }
            }
            catch
            {
                HrmisUtility.ThrowException(HrmisUtility._DbError);
            }
        }
示例#3
0
 /// <summary>
 ///
 /// </summary>
 protected override void ExcuteSelf()
 {
     try
     {
         DiyStep currentStep = _LeaveRequest.DiyProcess.FindCancelStep();
         DiyStep nextStep    = _LeaveRequest.DiyProcess.FindCancelNextStep();
         using (TransactionScope ts = new TransactionScope(TransactionScopeOption.Required))
         {
             _DalLeaveRequest.UpdateLeaveRequestItemStatusByLeaveRequestItemID(_LeaveRequestItemID,
                                                                               _RequestStatus, nextStep.DiyStepID);
             _DalLeaveRequestFlow.InsertLeaveRequestFlow(PrepareLeaveRequestFlow(_LeaveRequestItemID));
             ts.Complete();
         }
         new LeaveRequestMailAndPhoneDelegate().CancelOperation(_LeaveRequest.PKID, _LeaveRequestItem,
                                                                currentStep.MailAccount, nextStep);
         new LeaveRequestMailAndPhoneDelegate().CancelMail(_LeaveRequest.PKID, currentStep.MailAccount, nextStep);
     }
     catch
     {
         BllUtility.ThrowException(BllExceptionConst._DbError);
     }
 }
        /// <summary>
        ///
        /// </summary>
        public void ConfirmItem(out List <Account> mailaccountlist, out DiyStep cstep, out DiyStep nstep)
        {
            Validation();
            mailaccountlist = new List <Account>();
            cstep           = null;
            nstep           = null;
            try
            {
                DiyStep currentStep = _LeaveRequest.DiyProcess.FindStep(_LeaveRequestItem.CurrentStep.DiyStepID);
                DiyStep nextStep    = _LeaveRequest.DiyProcess.FindNextStep(_LeaveRequestItem.CurrentStep.DiyStepID);
                if (nextStep == null)
                {
                    nextStep = new DiyStep(0, "结束", OperatorType.Others, 0);
                }

                ChangeRequestStatus(nextStep);

                if (_RequestStatus.Id == RequestStatus.ApproveFail.Id ||
                    _RequestStatus.Id == RequestStatus.ApproveCancelFail.Id)
                {
                    nextStep = new DiyStep(0, "结束", OperatorType.Others, 0);
                }

                _LeaveRequestItem.Status = _RequestStatus;
                using (TransactionScope ts = new TransactionScope(TransactionScopeOption.Required))
                {
                    if (_LeaveRequest.LeaveRequestType.LeaveRequestTypeID == (int)LeaveRequestTypeEnum.AdjustRest)
                    {
                        new UpdateAdjustRestByLeaveRequest(_LeaveRequestItem, _LeaveRequest.Account.Id, _LeaveRequestID)
                        .Excute();
                    }
                    if (_LeaveRequest.LeaveRequestType.LeaveRequestTypeID == (int)LeaveRequestTypeEnum.AnnualLeave)
                    {
                        new UpdateVacationByLeaveRequest(_LeaveRequest, _LeaveRequestItem).Excute();
                    }

                    _DalLeaveRequest.UpdateLeaveRequestItemStatusByLeaveRequestItemID(_LeaveRequestItemID,
                                                                                      _RequestStatus, nextStep.DiyStepID);
                    _DalLeaveRequestFlow.InsertLeaveRequestFlow(PrepareLeaveRequestFlow(_LeaveRequestItemID));

                    ts.Complete();
                }

                DiyProcess hrDiyProcess =
                    _DalEmployeeDiyProcess.GetDiyProcessByProcessTypeAndAccountID(ProcessType.HRPrincipal,
                                                                                  _LeaveRequest.Account.Id);

                List <Account> accountList = new List <Account>();
                if (hrDiyProcess != null && hrDiyProcess.DiySteps != null && hrDiyProcess.DiySteps.Count > 0)
                {
                    accountList = hrDiyProcess.DiySteps[0].MailAccount;
                }


                new LeaveRequestMailAndPhoneDelegate().ConfirmOperation(_LeaveRequest, _LeaveRequestItem,
                                                                        accountList, _OperatorID, currentStep,
                                                                        nextStep);
                mailaccountlist = accountList;
                cstep           = currentStep;
                nstep           = nextStep;
            }
            catch
            {
                BllUtility.ThrowException(BllExceptionConst._DbError);
            }
        }