protected void Page_Load(object sender, EventArgs e) { if (!this.IsPostBack) { if (this.Request.QueryString["WorkItemId"] != null) { string workItemId = this.Request.QueryString["WorkItemId"]; IWorkflowSession wflsession = RuntimeContextExamples.GetRuntimeContext().getWorkflowSession(); IWorkItem wi = wflsession.findWorkItemById(workItemId); String sn = (String)wi.TaskInstance.AliveProcessInstance.getProcessInstanceVariable("sn"); LoanInfoDAO lid = new LoanInfoDAO(); LoanInfo ti = lid.findBySn(sn); if (ti != null) { HWorkItemId.Value = workItemId; applicantName.Text = ti.ApplicantName; applicantId.Text = ti.ApplicantId; address.Text = ti.Address; salary.Text = ti.Salary.ToString(); loanValue.Text = ti.LoanValue.ToString(); returnDate.Text = ti.ReturnDate; loanteller.Text = ti.Loanteller; appInfoInputDate.Text = ti.AppInfoInputDate.ToString("yyyy-MM-dd"); riskEvaluator.Text = this.User.Identity.Name; riskInfoInputDate.Text = DateTime.Now.ToString("yyyy-MM-dd hh:mm:ss"); } } } }
public void Save_Click(object sender, AjaxEventArgs e) { string workItemId = HWorkItemId.Value.ToString(); IWorkflowSession wflsession = RuntimeContextExamples.GetRuntimeContext().getWorkflowSession(); IWorkItem wi = wflsession.findWorkItemById(workItemId); String sn = (String)wi.TaskInstance.AliveProcessInstance.getProcessInstanceVariable("sn"); LoanInfoDAO lid = new LoanInfoDAO(); LoanInfo loanInfo = lid.findBySn(sn); loanInfo.RejectInfoInputTime = DateTime.Parse(rejectInfoInputTime.Text);//lendMoneyInfo loanInfo.RejectInfo = comments.Text; //4、完成工单 try { if (wi != null) { if (wi.ActorId == this.User.Identity.Name) { wi.complete(comments.Text); } } } catch { throw; } }
public void Save_Click(object sender, AjaxEventArgs e) { string workItemId = HWorkItemId.Value.ToString(); IWorkflowSession wflsession = RuntimeContextExamples.GetRuntimeContext().getWorkflowSession(); IWorkItem wi = wflsession.findWorkItemById(workItemId); String sn = (String)wi.TaskInstance.AliveProcessInstance.getProcessInstanceVariable("sn"); LoanInfoDAO lid = new LoanInfoDAO(); LoanInfo loanInfo = lid.findBySn(sn); loanInfo.SalaryIsReal = Boolean.Parse(salaryIsReal.SelectedItem.Value); loanInfo.CreditStatus = Boolean.Parse(creditStatus.SelectedItem.Value); loanInfo.RiskEvaluator = riskEvaluator.Text; loanInfo.RiskInfoInputDate = DateTime.Parse(riskInfoInputDate.Text); //1、首先通过"收入状况是否属实"和"信用状况是否合格"这两项指标来设置RiskFlag流程变量 if (loanInfo.SalaryIsReal && loanInfo.CreditStatus) { loanInfo.RiskFlag = false;//false表示风险评估通过 } else { loanInfo.RiskFlag = true;//表示有风险 } //2、将RiskFlag设置到流程变量 try { wi.TaskInstance.AliveProcessInstance.setProcessInstanceVariable("RiskFlag", loanInfo.RiskFlag); } catch { throw; } //3、保存业务数据 lid.attachDirty(loanInfo); try { if (wi != null) { if (wi.ActorId == this.User.Identity.Name) { wi.complete(comments.Text); } } } catch { throw; } }
public void Save_Click(object sender, AjaxEventArgs e) { LoanInfoDAO loanInfoDAO = new LoanInfoDAO(); LoanInfo loanInfo=new LoanInfo() { ApplicantName=applicantName.Text, ApplicantId=applicantId.Text, Address=address.Text, Salary=int.Parse(salary.Text), LoanValue=int.Parse(loanValue.Text), ReturnDate = returnDate.SelectedDate.ToString("yyyy-MM-dd"), Loanteller=loanteller.Text, AppInfoInputDate=DateTime.Parse(appInfoInputDate.Text) }; // 一、执行业务业务操作,保存业务数据 loanInfoDAO.attachDirty(loanInfo); // 二、开始执行流程操作 IWorkflowSession workflowSession = RuntimeContextExamples.GetRuntimeContext().getWorkflowSession(); try { // 1、创建流程实例 IProcessInstance procInst = workflowSession.createProcessInstance("LoanProcess", this.User.Identity.Name); // 2、设置流程变量/业务属性字段 procInst.setProcessInstanceVariable("sn", loanInfo.Sn);// 设置流水号 procInst.setProcessInstanceVariable("applicantName", loanInfo.ApplicantName);//贷款人姓名 procInst.setProcessInstanceVariable("loanValue", loanInfo.LoanValue);// 贷款数额 // 3、启动流程实例,run()方法启动实例并创建第一个环节实例、分派任务 procInst.run(); } catch { throw; } }