/// <summary> /// </summary> public static bool CancelOneItem(OutApplicationItem item, Account account, string remark, IOutApplication dalOutApplication, OutDiyProcessUtility outDiyProcessUtility, OutApplication outApplication) { item = dalOutApplication.GetOutApplicationItemByItemID(item.ItemID); bool valide = RequestStatus.CanCancelStatus(item.Status); if (valide) { using (TransactionScope ts = new TransactionScope(TransactionScopeOption.Required)) { RequestStatus status = RequestStatus.Cancelled; if (outApplication.OutType.ID == OutType.InCity.ID || outApplication.OutType.ID == OutType.Train.ID) { status = RequestStatus.ApproveCancelPass; ConfirmMessage confirmmessage = new ConfirmMessage(); confirmmessage.FinishPhoneMessageOperation( new PhoneMessageType(PhoneMessageEnumType.OutApplication, item.ItemID)); valide = false; } dalOutApplication.UpdateOutApplicationItemStatusByItemID(item.ItemID, status); OutApplicationFlow OutApplicationFlow = new OutApplicationFlow(0, account, DateTime.Now, remark, RequestStatus.Cancelled, 1); dalOutApplication.InsertOutApplicationFlow(item.ItemID, OutApplicationFlow); ts.Complete(); } } return(valide); }
/// <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 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> /// test /// </summary> public AddOutApplication(OutApplication outapplication, List <Account> ccList, IOutApplication mockDal) : this(outapplication, ccList) { _OutApplicationDal = mockDal; }
/// <summary> /// /// </summary> public static bool ApproveOneItem(OutApplicationItem item, bool isAgree, Account account, OutApplication outApplication, string remark, IOutApplication dalOutApplication, OutDiyProcessUtility outDiyProcess, bool isAdjust, bool isChangeAdjust, decimal adjustHour, out Account nextOperator) { if (!isAdjust) { adjustHour = 0; } nextOperator = null; item = dalOutApplication.GetOutApplicationItemByItemID(item.ItemID); item.AdjustHour = adjustHour; bool ans = RequestStatus.CanApproveStatus(item.Status) && account.Id == outDiyProcess.GetNextOperator(outApplication.DiyProcess, item, outApplication.Account.Id).Id; if (ans) { if (!isAgree) { using (TransactionScope ts = new TransactionScope(TransactionScopeOption.Required)) { RequestStatus requestStatus = RequestUtility.GetStatus(item.Status, isAgree, 1); dalOutApplication.UpdateOutApplicationItemStatusByItemID(item.ItemID, requestStatus); dalOutApplication.InsertOutApplicationFlow(item.ItemID, new OutApplicationFlow(0, account, DateTime.Now, remark, requestStatus, -1)); nextOperator = null; item.Status = requestStatus; if (outApplication.OutType.ID == OutType.OutCity.ID) { if (isChangeAdjust) { dalOutApplication.UpdateOutApplicationItemAdjustByItemID(item.ItemID, isAdjust, adjustHour); item.Adjust = isAdjust; } new UpdateAdjustRestByOut(item, outApplication.Account.Id).Excute(); } ts.Complete(); } } else { //现在做到第几步,就是上一步加1 int step = outDiyProcess.GetNextStep(item.OutApplicationFlow, outApplication.DiyProcess); RequestStatus requestStatus = RequestUtility.GetStatus(item.Status, isAgree, step); OutApplicationFlow OutApplicationFlow = new OutApplicationFlow(0, account, DateTime.Now, remark, requestStatus, step); using (TransactionScope ts = new TransactionScope(TransactionScopeOption.Required)) { dalOutApplication.InsertOutApplicationFlow(item.ItemID, OutApplicationFlow); dalOutApplication.UpdateOutApplicationItemStatusByItemID(item.ItemID, requestStatus); item.Status = requestStatus; if (outApplication.OutType.ID == OutType.OutCity.ID) { if (isChangeAdjust) { dalOutApplication.UpdateOutApplicationItemAdjustByItemID(item.ItemID, isAdjust, adjustHour); item.Adjust = isAdjust; } new UpdateAdjustRestByOut(item, outApplication.Account.Id).Excute(); } ts.Complete(); } nextOperator = outDiyProcess.GetNextOperator(outApplication.DiyProcess, step, outApplication.Account.Id); } } return(ans); }