Пример #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
 /// <summary>
 /// 新增请假单
 /// </summary>
 protected override void ExcuteSelf()
 {
     if (_IfSubmit)
     {
         foreach (LeaveRequestItem item in _LeaveRequest.LeaveRequestItems)
         {
             item.Status = RequestStatus.Submit;
         }
         DiyStep currentStep = _LeaveRequest.DiyProcess.FindFirstStep();
         DiyStep nextStep    = _LeaveRequest.DiyProcess.FindSecondStep();
         _LeaveRequest.PKID = _DalLeaveRequest.InsertLeaveRequest(_LeaveRequest, nextStep.DiyStepID);
         _LeaveRequest      = _DalLeaveRequest.GetLeaveRequestByPKID(_LeaveRequest.PKID);
         foreach (LeaveRequestItem item in _LeaveRequest.LeaveRequestItems)
         {
             _DalLeaveRequestFlow.InsertLeaveRequestFlow(PrepareLeaveRequestFlow(item));
         }
         new LeaveRequestMailAndPhoneDelegate().SubmitOperation(_LeaveRequest.PKID, _LeaveRequest.MailCC ?? new List <Account>(),
                                                                currentStep.MailAccount, nextStep);
     }
     else
     {
         foreach (LeaveRequestItem item in _LeaveRequest.LeaveRequestItems)
         {
             item.Status = RequestStatus.New;
         }
         DiyStep nextStep = _LeaveRequest.DiyProcess.FindFirstStep();
         _LeaveRequest.PKID = _DalLeaveRequest.InsertLeaveRequest(_LeaveRequest, nextStep.DiyStepID);
     }
 }
Пример #3
0
        /// <summary>
        /// 修改请假单
        /// </summary>
        protected override void ExcuteSelf()
        {
            try
            {
                using (TransactionScope ts = new TransactionScope(TransactionScopeOption.Required))
                {
                    if (_OldLeaveRequest.IfAutoCancel)
                    {
                        AutoCancelLeaveRequest();
                    }
                    if (_IfSubmit)
                    {
                        foreach (LeaveRequestItem item in _LeaveRequest.LeaveRequestItems)
                        {
                            item.Status = RequestStatus.Submit;
                        }
                        DiyStep currentStep = _LeaveRequest.DiyProcess.FindFirstStep();
                        DiyStep nextStep    = _LeaveRequest.DiyProcess.FindSecondStep();
                        _DalLeaveRequest.UpdateLeaveRequest(_LeaveRequest, nextStep.DiyStepID);
                        _LeaveRequest = _DalLeaveRequest.GetLeaveRequestByPKID(_LeaveRequest.PKID);
                        foreach (LeaveRequestItem item in _LeaveRequest.LeaveRequestItems)
                        {
                            _DalLeaveRequestFlow.InsertLeaveRequestFlow(PrepareLeaveRequestFlow(item));
                        }

                        new LeaveRequestMailAndPhoneDelegate().SubmitOperation(_LeaveRequest.PKID, _LeaveRequest.MailCC ?? new List <Account>(),
                                                                               currentStep.MailAccount, nextStep);
                    }
                    else
                    {
                        foreach (LeaveRequestItem item in _LeaveRequest.LeaveRequestItems)
                        {
                            item.Status = RequestStatus.New;
                        }
                        DiyStep nextStep = _LeaveRequest.DiyProcess.FindFirstStep();
                        _DalLeaveRequest.UpdateLeaveRequest(_LeaveRequest, nextStep.DiyStepID);
                    }
                    ts.Complete();
                }
            }
            catch
            {
                HrmisUtility.ThrowException(HrmisUtility._DbError);
            }
        }
Пример #4
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);
            }
        }
Пример #5
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);
            }
        }