/// <summary> /// 测试专用 /// </summary> public ApplicationSearch( ILeaveRequestDal iLeaveRequestDal, IOutApplication iOutApplication, IOverWork iOverWork) { _DalLeaveRequest = iLeaveRequestDal; _DalOutApplication = iOutApplication; _DalOverWork = iOverWork; }
/// <summary> /// 测试LeaveRequest调用 /// </summary> public ValidateRequestItemRepeat(IOverWork overwork, ILeaveRequestDal leaveRequestdal, IOutApplication outApplication, LeaveRequest leaveRequest, bool isAdd) { _IsAdd = isAdd; _Request = new Request(leaveRequest); _DalOverWork = overwork; _DalOutApplication = outApplication; _DalLeaveRequest = leaveRequestdal; _IsOverWorkJoinToCheck = true; _IsLeaveJoinToCheck = true; //_IsOutJoinToCheck = true; }
/// <summary> /// </summary> public static bool CancelOneItem(OverWorkItem item, Account account, string remark, IOverWork dalOverWork, OverWorkDiyProcessUtility OverWorkDiyProcessUtility) { item = dalOverWork.GetOverWorkItemByItemID(item.ItemID); bool valide = RequestStatus.CanCancelStatus(item.Status); if (valide) { using (TransactionScope ts = new TransactionScope(TransactionScopeOption.Required)) { dalOverWork.UpdateOverWorkItemStatusByItemID(item.ItemID, RequestStatus.Cancelled); OverWorkFlow OverWorkFlow = new OverWorkFlow(0, account, DateTime.Now, remark, RequestStatus.Cancelled, 1); dalOverWork.InsertOverWorkFlow(item.ItemID, OverWorkFlow); ts.Complete(); } } return(valide); }
/// <summary> /// 新增请假单 /// </summary> public AddLeaveRequest(LeaveRequest leaveRequest, bool ifSubmit, IVacation mockIVacation, IAdjustRest mockIAdjustRest, ILeaveRequestDal mockILeaveRequestDal, ILeaveRequestFlowDal mockILeaveRequestFlowDal, IEmployeeDiyProcessDal mockIEmployeeDiyProcessDal, IOverWork mockIOverWork, IOutApplication mockIOutApplication, IPlanDutyDal mockIPlanDutyDal, ILeaveRequestType mockILeaveRequestType, IEmployee mockIEmployee) { _LeaveRequest = leaveRequest; _IfSubmit = ifSubmit; _IVacationDal = mockIVacation; _IAdjustRestDal = mockIAdjustRest; _DalLeaveRequest = mockILeaveRequestDal; _DalLeaveRequestFlow = mockILeaveRequestFlowDal; _DalEmployeeDiyProcess = mockIEmployeeDiyProcessDal; _OverWorkDal = mockIOverWork; _DalOutApplication = mockIOutApplication; _DalPlanDutyDal = mockIPlanDutyDal; _DalLeaveRequestType = mockILeaveRequestType; _DalEmployee = mockIEmployee; }
/// <summary> /// </summary> public bool ApproveOneItem(OverWorkItem item, bool isAgree, Account account, OverWork overWork, string remark, IOverWork dalOverWork, OverWorkDiyProcessUtility overWorkDiyProcessUtility, bool isAdjust, bool isChangeAdjust, decimal adjustHour, out Account nextOperator) { if (!isAdjust) { adjustHour = 0; } nextOperator = null; item = dalOverWork.GetOverWorkItemByItemID(item.ItemID); item.AdjustHour = adjustHour; bool valide = RequestStatus.CanApproveStatus(item.Status) && account.Id == overWorkDiyProcessUtility.GetNextOperator(overWork.DiyProcess, item, overWork.Account.Id).Id; if (valide) { if (!isAgree) { using (TransactionScope ts = new TransactionScope(TransactionScopeOption.Required)) { RequestStatus requestStatus = RequestUtility.GetStatus(item.Status, isAgree, 1); dalOverWork.UpdateOverWorkItemStatusByItemID(item.ItemID, requestStatus); item.Status = requestStatus; if (isChangeAdjust) { dalOverWork.UpdateOverWorkItemAdjustByItemID(item.ItemID, isAdjust, adjustHour); item.Adjust = isAdjust; } dalOverWork.InsertOverWorkFlow(item.ItemID, new OverWorkFlow(0, account, DateTime.Now, remark, requestStatus, -1)); new UpdateAdjustRestByOverWork(item, overWork.Account.Id).Excute(); ts.Complete(); } nextOperator = null; } else { int step = overWorkDiyProcessUtility.GetNextStep(item.OverWorkFlow, overWork.DiyProcess); RequestStatus requestStatus = RequestUtility.GetStatus(item.Status, isAgree, step); OverWorkFlow OverWorkFlow = new OverWorkFlow(0, account, DateTime.Now, remark, requestStatus, step); using (TransactionScope ts = new TransactionScope(TransactionScopeOption.Required)) { dalOverWork.InsertOverWorkFlow(item.ItemID, OverWorkFlow); dalOverWork.UpdateOverWorkItemStatusByItemID(item.ItemID, requestStatus); item.Status = requestStatus; if (isChangeAdjust) { dalOverWork.UpdateOverWorkItemAdjustByItemID(item.ItemID, isAdjust, adjustHour); item.Adjust = isAdjust; } new UpdateAdjustRestByOverWork(item, overWork.Account.Id).Excute(); ts.Complete(); } nextOperator = overWorkDiyProcessUtility.GetNextOperator(overWork.DiyProcess, step, overWork.Account.Id); } } return(valide); }