protected void Page_Load(object sender, EventArgs e) { int AccountID = Convert.ToInt32(SecurityUtil.DECDecrypt(Request.QueryString["accountId"])); Account account = BllInstance.AccountBllInstance.GetAccountById(AccountID); int PositionAppID = Convert.ToInt32(SecurityUtil.DECDecrypt(Request.QueryString["Id"])); bool allover = false; PositionApplication pa = _Facade.GetPositionApplicationByPKID(PositionAppID); if (RequestStatus.CanApproveStatus(pa.Status)) { RequestStatus rs = RequestStatus.ApprovePass; if (pa.Status.Id == RequestStatus.Cancelled.Id) { rs = RequestStatus.ApproveCancelPass; } _Facade.ApprovePositionApplication(pa, AccountID, rs, (account != null && account.Name != null ? account.Name : "") + "邮件通过"); } else { lblMessage.Text = "该申请已经审核完毕,无法再次审核"; } }
protected void Page_Load(object sender, EventArgs e) { int AccountID = Convert.ToInt32(SecurityUtil.DECDecrypt(Request.QueryString["accountId"])); int overWorkID = Convert.ToInt32(SecurityUtil.DECDecrypt(Request.QueryString["Id"])); bool allover = false; foreach (OverWorkItem item in _OverWorkFacade.GetOverWorkByOverWorkID(overWorkID).Item) { allover |= RequestStatus.CanApproveStatus(item.Status); } if (allover) { _OverWorkFacade.ApproveWholeOverWork(overWorkID, AccountID, true, "邮件通过"); } else { lblMessage.Text = "该申请已经审核完毕,无法再次审核"; } }
/// <summary> /// /// </summary> protected override void Validation() { //判断信息是否为空 if (_PositionApplication == _PositionApplicationDal.GetPositionApplicationByPKID(_PositionApplication.PKID)) { HrmisUtility.ThrowException(HrmisUtility._PositionApplication_Not_Exit); } else { //如果请假信息状态不是提交或取消请假状态,不能审批 if (!RequestStatus.CanApproveStatus(_PositionApplication.Status)) { HrmisUtility.ThrowException(HrmisUtility._PositionApplication_CanNot_BeApproved); } _PositionApplication.CurrentStep.OperatorID = new GetPositionApplication().ChangeOperatorToEmployee(_PositionApplication, _PositionApplication.CurrentStep); if (_PositionApplication.CurrentStep.OperatorID != _OperatorID) { HrmisUtility.ThrowException(HrmisUtility._No_Auth_To_Approve); } } }
/// <summary> /// /// </summary> protected override void Validation() { _LeaveRequest = _DalLeaveRequest.GetLeaveRequestByPKID(_LeaveRequestID); //判断请假信息是否为空 if (_LeaveRequest == null) { HrmisUtility.ThrowException(HrmisUtility._LeaveRequest_Not_Exist); } //判断该账号是否有请假流程 _LeaveRequest.DiyProcess = _DalEmployeeDiyProcess.GetDiyProcessByProcessTypeAndAccountID(ProcessType.LeaveRequest, _LeaveRequest.Account.Id); if (_LeaveRequest.DiyProcess == null) { HrmisUtility.ThrowException(HrmisUtility._No_LeaveRequest_DiyProcess); } //如果请假信息状态不是提交或取消请假状态,不能审批 foreach (LeaveRequestItem item in _LeaveRequest.LeaveRequestItems) { if (item.LeaveRequestItemID == _LeaveRequestItemID) { _LeaveRequestItem = item; if (!RequestStatus.CanApproveStatus(item.Status)) { HrmisUtility.ThrowException(HrmisUtility._LeaveRequest_Partial_CanNot_BeApproved); } item.CurrentStep.OperatorID = new GetLeaveRequest().ChangeOperatorToEmployee(_LeaveRequest, item.CurrentStep); if (item.CurrentStep.OperatorID != _OperatorID) { HrmisUtility.ThrowException(HrmisUtility._No_Auth_To_Approve); } } } }
/// <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); }
/// <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); }