/// <summary> /// 找出所有曾经审核通过的item /// </summary> /// <param name="leaveRequestItems"></param> /// <returns></returns> public List <LeaveRequestItem> AdjustIfApprovePass(List <LeaveRequestItem> leaveRequestItems) { List <LeaveRequestItem> iRet = new List <LeaveRequestItem>(); foreach (LeaveRequestItem item in leaveRequestItems) { List <LeaveRequestFlow> LeaveRequestFlows = _DalLeaveRequestFlow.GetLeaveRequestFlowByLeaveRequestItemID(item.LeaveRequestItemID); bool ifApprovePass = false; foreach (LeaveRequestFlow flow in LeaveRequestFlows) { if (flow.LeaveRequestStatus.Id == RequestStatus.ApprovePass.Id) { ifApprovePass = true; break; } } if (!ifApprovePass) { iRet.Add(item); } } return(iRet); }
/// <summary> /// 用于判断是否该请假被审核同意过 /// </summary> /// <returns></returns> private bool IsAgreed(LeaveRequestItem item) { List <LeaveRequestFlow> leaveRequestFlows = _DalLeaveRequestFlow.GetLeaveRequestFlowByLeaveRequestItemID(item.LeaveRequestItemID); foreach (LeaveRequestFlow leaveRequestFlow in leaveRequestFlows) { if (leaveRequestFlow.LeaveRequestStatus.Id == RequestStatus.ApprovePass.Id) { return(true); } } return(false); }
/// <summary> /// /// </summary> public void Excute() { List <LeaveRequestItem> items = new List <LeaveRequestItem>(); items.Add(_LeaveRequestItem); if (_LeaveRequestItem.Status.Id == RequestStatus.ApprovePass.Id) { new DeleteVacationByLeaveReuqest(_LeaveRequest.Account.Id, items, _LeaveRequest.LeaveRequestType). Excute(); return; } List <LeaveRequestFlow> leaveRequestFlows = _DalLeaveRequestFlow.GetLeaveRequestFlowByLeaveRequestItemID(_LeaveRequestItem.LeaveRequestItemID); if (RequestUtility.IsItemFlowContainStatus(leaveRequestFlows, RequestStatus.ApprovePass)) { if (_LeaveRequestItem.Status.Id == RequestStatus.ApproveCancelPass.Id && !RequestUtility.IsItemFlowContainStatus(leaveRequestFlows, RequestStatus.ApproveCancelPass)) { new AddVacationByLeaveReuqest(items).Excute(); return; } } else { if (_LeaveRequestItem.Status.Id == RequestStatus.ApproveCancelFail.Id) { new DeleteVacationByLeaveReuqest(_LeaveRequest.Account.Id, items, _LeaveRequest.LeaveRequestType) .Excute(); return; } if (_LeaveRequestItem.Status.Id == RequestStatus.ApproveCancelPass.Id && RequestUtility.IsItemFlowContainStatus(leaveRequestFlows, RequestStatus.ApproveCancelFail)) { new AddVacationByLeaveReuqest(items).Excute(); return; } } }
/// <summary> /// 提交—>通过(扣)—>取消—>通过取消(返还)—>再编辑(不动) /// 提交—>通过(扣)—>取消—>拒绝取消(不动)—>再编辑(返还) /// 提交—>通过(扣)—>取消—>再编辑(返还) /// 提交—>通过(扣)—>再编辑(返还) /// 提交—>不通过(不动)—>再编辑(不动) /// 提交—>再编辑(不动) /// 提交—>取消—>通过取消(不动)—>再编辑(不动) /// 提交—>取消—>拒绝取消(扣)—>再编辑(返还) /// </summary> public void Excute() { if (_LeaveRequestItem.Status.Id == RequestStatus.ApprovePass.Id) { new DeleteAdjustRestByLeaveRequest(_LeaveRequestItem, _AccountID, _LeaveRequestID).Excute(); return; } List <LeaveRequestFlow> leaveRequestFlows = _DalLeaveRequestFlow.GetLeaveRequestFlowByLeaveRequestItemID(_LeaveRequestItem.LeaveRequestItemID); if (RequestUtility.IsItemFlowContainStatus(leaveRequestFlows, RequestStatus.ApprovePass)) { if (_LeaveRequestItem.Status.Id == RequestStatus.ApproveCancelPass.Id && !RequestUtility.IsItemFlowContainStatus(leaveRequestFlows, RequestStatus.ApproveCancelPass)) { new RestoreAdjustRestByLeaveRequest(_LeaveRequestItem, _AccountID, _LeaveRequestID).Excute(); return; } } else { if (_LeaveRequestItem.Status.Id == RequestStatus.ApproveCancelFail.Id) { new DeleteAdjustRestByLeaveRequest(_LeaveRequestItem, _AccountID, _LeaveRequestID).Excute(); return; } if (_LeaveRequestItem.Status.Id == RequestStatus.ApproveCancelPass.Id && RequestUtility.IsItemFlowContainStatus(leaveRequestFlows, RequestStatus.ApproveCancelFail)) { new RestoreAdjustRestByLeaveRequest(_LeaveRequestItem, _AccountID, _LeaveRequestID).Excute(); return; } } }