//送往下一步 protected void btnSendNext_Click(object sender, EventArgs e) { try { DateTime now = DateTime.Now; string CurrentActivityText = string.Empty; string currentOpinionRemark = string.Empty; string processGUID = this.txtProcessGUID.Value.ToString(); decimal days = Helper.ConverToDecimal(this.txtDays.Value); string instanceId = this.hiddenInstanceId.Value; string DepManagerRemark = this.txtDepmanagerRemark.Value; string DirectorRemark = this.txtDirectorRemark.Value; string DeputyGeneralRemark = this.txtDeputyGeneralRemark.Value; string GeneralManagerRemark = this.txtGeneralManagerRemark.Value; int activityInstanceID = Helper.ConverToInt32(hiddenActivityInstanceID.Value); string strNextActivityPerformers = hiddenNextActivityPerformers.Value.ToString().Trim(); IDictionary <string, PerformerList> nextActivityPerformers = NextActivityPerformers(strNextActivityPerformers); if (nextActivityPerformers == null) { base.RegisterStartupScript("", "<script>alert('请选择办理步骤或办理人员--Please select next step and user');</script>"); return; } switch (hiddenPerformField.Value.ToString()) { case "DepManager": //部门经理 currentOpinionRemark = this.txtDepmanagerRemark.Value; break; case "Director": //主管总监 currentOpinionRemark = this.txtDirectorRemark.Value; break; case "Deputy": //副总经理 currentOpinionRemark = this.txtDeputyGeneralRemark.Value; break; case "General": //总经理 currentOpinionRemark = this.txtGeneralManagerRemark.Value; break; } if (!string.IsNullOrEmpty(instanceId)) { //调用流程 IWorkflowService service = new WorkflowService(); WfAppRunner initiator = new WfAppRunner(); initiator.AppName = "请假流程--AskforLeaveProcess"; initiator.AppInstanceID = instanceId; initiator.ProcessGUID = processGUID; initiator.UserID = LoginUserID.ToString(); initiator.UserName = LoginUserName; initiator.Conditions = GetCondition(string.Format("days-{0}", days)); initiator.NextActivityPerformers = nextActivityPerformers; WfExecutedResult runAppResult = service.RunProcessApp(initiator); if (runAppResult.Status != WfExecutedStatus.Success) { base.RegisterStartupScript("", "<script>alert('" + runAppResult.Message + "');</script>"); return; } ActivityInstanceEntity activityInstanceEntity = service.GetActivityInstance(activityInstanceID); if (activityInstanceEntity != null) { CurrentActivityText = activityInstanceEntity.ActivityName; } try { //保存业务数据 //BizAppFlowEntity AppFlowEntity = new Entity.BizAppFlowEntity(); //AppFlowEntity.AppName = "请假流程"; //AppFlowEntity.AppInstanceID = instanceId.ToString(); //AppFlowEntity.ActivityName = CurrentActivityText; //AppFlowEntity.Remark = string.Format("{0}(ID:{1}) {2}", LoginUserName, LoginUserID, currentOpinionRemark); //AppFlowEntity.ChangedTime = now; //AppFlowEntity.ChangedUserID = LoginUserID.ToString(); //AppFlowEntity.ChangedUserName = LoginUserName; HrsLeaveOpinionEntity hrsleaveOpinionEntity = new HrsLeaveOpinionEntity(); hrsleaveOpinionEntity.AppInstanceID = instanceId.ToString(); hrsleaveOpinionEntity.ActivityID = activityInstanceEntity.ActivityGUID.ToString(); hrsleaveOpinionEntity.ActivityName = CurrentActivityText; hrsleaveOpinionEntity.Remark = string.Format("{0}(ID:{1}) {2}", LoginUserName, LoginUserID, currentOpinionRemark); hrsleaveOpinionEntity.ChangedTime = now; hrsleaveOpinionEntity.ChangedUserID = LoginUserID.ToString(); hrsleaveOpinionEntity.ChangedUserName = LoginUserName; WorkFlows.AddHrsLeaveOpinion(hrsleaveOpinionEntity); } catch (Exception ex) { } try { HrsLeaveEntity hrsLeaveEntity = new Entity.HrsLeaveEntity(); hrsLeaveEntity.ID = Helper.ConverToInt32(instanceId); hrsLeaveEntity.DepManagerRemark = DepManagerRemark; hrsLeaveEntity.DirectorRemark = DirectorRemark; hrsLeaveEntity.DeputyGeneralRemark = DeputyGeneralRemark; hrsLeaveEntity.GeneralManagerRemark = GeneralManagerRemark; hrsLeaveEntity.CurrentActivityText = CurrentActivityText; WorkFlows.UpdateHrsLeave(hrsLeaveEntity); } catch (Exception ex) { } base.RegisterStartupScript("", "<script>alert('办理成功--Successed');window.location.href='FlowList.aspx';</script>"); } } catch (Exception ex) { base.ClientScript.RegisterStartupScript(this.GetType(), "", "<script>alert('流程发起出现异常--EXCEPTION:" + ex.ToString() + "');</script>"); } }
//送往下一步 protected void btnSendNext_Click(object sender, EventArgs e) { try { string processGUID = this.txtProcessGUID.Value.ToString(); string stepGuid = this.hiddenStepGuid.Value.ToString(); int stepUserID = Helper.ConverToInt32(this.hiddenStepUser.Value.ToString().Trim()); decimal days = Helper.ConverToDecimal(this.txtDays.Value); string instanceId = this.hiddenInstanceId.Value; string DepManagerRemark = this.txtDepmanagerRemark.Value; string DirectorRemark = this.txtDirectorRemark.Value; string DeputyGeneralRemark = this.txtDeputyGeneralRemark.Value; string GeneralManagerRemark = this.txtGeneralManagerRemark.Value; int activityInstanceID = Helper.ConverToInt32(hiddenActivityInstanceID.Value); string CurrentActivityText = string.Empty;; int nextUserID = 0; string nextUserName = string.Empty; SysUserEntity userEntity = WorkFlows.GetSysUserModel(stepUserID); if (userEntity != null && userEntity.ID > 0) { nextUserID = userEntity.ID; nextUserName = userEntity.UserName; } DateTime now = DateTime.Now; if (!string.IsNullOrEmpty(instanceId)) { //调用流程 IWorkflowService service = new WorkflowService(); WfAppRunner initiator = new WfAppRunner(); initiator.AppName = "请假流程"; initiator.AppInstanceID = instanceId; initiator.ProcessGUID = processGUID; initiator.UserID = LoginUserID.ToString(); initiator.UserName = LoginUserName; initiator.Conditions = GetCondition(string.Format("days-{0}", days)); //送往下一步 PerformerList pList = new PerformerList(); pList.Add(new Performer(nextUserID.ToString(), nextUserName)); initiator.NextActivityPerformers = new Dictionary <String, PerformerList>(); initiator.NextActivityPerformers.Add(stepGuid, pList); WfExecutedResult runAppResult = service.RunProcessApp(initiator); if (runAppResult.Status != WfExecutedStatus.Success) { base.RegisterStartupScript("", "<script>alert('" + runAppResult.Message + "');</script>"); return; } ProcessEntity processEntity = service.GetProcessById(processGUID); if (processEntity != null) { ActivityInstanceEntity activityInstanceEntity = service.GetActivityInstance(activityInstanceID); if (activityInstanceEntity != null) { CurrentActivityText = activityInstanceEntity.ActivityName; } } try { //保存业务数据 BizAppFlowEntity AppFlowEntity = new Entity.BizAppFlowEntity(); AppFlowEntity.AppName = "请假流程"; AppFlowEntity.AppInstanceID = instanceId.ToString(); AppFlowEntity.ActivityName = CurrentActivityText; AppFlowEntity.Remark = string.Format("申请人:{0}-{1}", LoginUserID, LoginUserName) + CurrentActivityText; AppFlowEntity.ChangedTime = now; AppFlowEntity.ChangedUserID = LoginUserID; AppFlowEntity.ChangedUserName = LoginUserName; WorkFlows.AddBizAppFlow(AppFlowEntity); } catch (Exception ex) { } try { HrsLeaveEntity hrsLeaveEntity = new Entity.HrsLeaveEntity(); hrsLeaveEntity.ID = Helper.ConverToInt32(instanceId); hrsLeaveEntity.DepManagerRemark = DepManagerRemark; hrsLeaveEntity.DirectorRemark = DirectorRemark; hrsLeaveEntity.DeputyGeneralRemark = DeputyGeneralRemark; hrsLeaveEntity.GeneralManagerRemark = GeneralManagerRemark; hrsLeaveEntity.CurrentActivityText = CurrentActivityText; WorkFlows.UpdateHrsLeave(hrsLeaveEntity); } catch (Exception ex) { } base.RegisterStartupScript("", "<script>alert('办理成功');window.location.href='FlowList.aspx';</script>"); } } catch (Exception ex) { base.ClientScript.RegisterStartupScript(this.GetType(), "", "<script>alert('流程发起出现异常 EXCEPTION:" + ex.ToString() + "');</script>"); } }