/// <summary> /// /// </summary> protected override void ExcuteSelf() { int failCount = 0; int successCount = 0; List <List <Account> > account = new List <List <Account> >(); List <DiyStep> csteps = new List <DiyStep>(); List <DiyStep> nsteps = new List <DiyStep>(); foreach (LeaveRequestItem item in _LeaveRequest.LeaveRequestItems) { //-1 全部;0 新增;1 提交;2 审核不通过;3 审核通过;4 取消请假;5 拒绝取消假期; //6 批准取消假期;7 审核中;8 审核取消中 switch (item.Status.Id) { case 1: case 7: _RequestStatus = RequestStatus.ApprovePass; break; case 4: case 8: _RequestStatus = RequestStatus.ApproveCancelPass; break; } try { ApproveLeaveRequestItem approveLeaveRequestItem = new ApproveLeaveRequestItem(_LeaveRequestID, item.LeaveRequestItemID, _AccountID, _RequestStatus, _Reason, _DalLeaveRequest, _DalLeaveRequestFlow, _DalEmployeeDiyProcess, _DalVacation, _IAdjustRestDal, _DalPlanDutyDal, _DalLeaveRequestType); List <Account> mailaccountlist; DiyStep cstep; DiyStep nstep; approveLeaveRequestItem.ConfirmItem(out mailaccountlist, out cstep, out nstep); if (!DiyStep.Contains(nsteps, nstep)) { account.Add(mailaccountlist); csteps.Add(cstep); nsteps.Add(nstep); } successCount++; } catch { failCount++; } ResultMessage = successCount + "个请假项审核成功," + failCount + "个请假项审核失败";; } for (int i = 0; i < nsteps.Count; i++) { new LeaveRequestMailAndPhoneDelegate().ConfirmOperationMail(_LeaveRequest, account[i], _AccountID, csteps[i], nsteps[i]); } }
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); } }
/// <summary> /// /// </summary> protected override void ExcuteSelf() { int failCount = 0; int successCount = 0; List <List <Account> > account = new List <List <Account> >(); List <DiyStep> csteps = new List <DiyStep>(); List <DiyStep> nsteps = new List <DiyStep>(); foreach (LeaveRequestItem item in _LeaveRequest.LeaveRequestItems) { try { ChangeRequestStatus(item); ApproveLeaveRequestItem approveLeaveRequestItem = new ApproveLeaveRequestItem(_LeaveRequestID, item.LeaveRequestItemID, _AccountID, _RequestStatus, _Reason, _DalLeaveRequest, _DalLeaveRequestFlow, _DalEmployeeDiyProcess, _DalVacation, _IAdjustRestDal, _DalPlanDutyDal, _DalLeaveRequestType); List <Account> mailaccountlist; DiyStep cstep; DiyStep nstep; approveLeaveRequestItem.ConfirmItem(out mailaccountlist, out cstep, out nstep); if (!DiyStep.Contains(nsteps, nstep)) { account.Add(mailaccountlist); csteps.Add(cstep); nsteps.Add(nstep); } successCount++; } catch { failCount++; } ResultMessage = successCount + "个请假项审核成功," + failCount + "个请假项审核失败";; } for (int i = 0; i < nsteps.Count; i++) { new LeaveRequestMailAndPhoneDelegate().ConfirmOperationMail(_LeaveRequest, account[i], _AccountID, csteps[i], nsteps[i]); } }