public static void RunReviewApply(Guid id, ReviewUseCarApplyForm Form) { SqlWorkflowInstanceStore instanceStore = new SqlWorkflowInstanceStore(@"server=.\SQLEXPRESS;database=aspnetdb;uid=sa;pwd=123456"); WorkflowApplication application2 = new WorkflowApplication(new UseCarApply()); application2.InstanceStore = instanceStore; application2.Completed = (workflowApplicationCompletedEventArgs) => { Console.WriteLine("\nWorkflowApplication has Completed in the {0} state.", workflowApplicationCompletedEventArgs.CompletionState); instanceUnloaded.Set(); }; application2.PersistableIdle = (e) => { instanceUnloaded.Set(); return(PersistableIdleAction.Unload); }; application2.Unloaded = (workflowApplicationEventArgs) => { Console.WriteLine("WorkflowApplication has Unloaded\n"); instanceUnloaded.Set(); }; application2.Load(id); application2.ResumeBookmark("WaitForExamine", Form); instanceUnloaded.WaitOne(); Console.ReadLine(); }
protected void btnSubmit_Click(object sender, EventArgs e) { ReviewUseCarApplyForm form = new ReviewUseCarApplyForm(); if (rbtOK.Checked) { form.Agree = 1; } else { form.Agree = 3; } form.UseCarApplyFormID = int.Parse(this.LblID.Text.ToString()); form.ReviewUserName = this.txtYName.Text.ToString(); if (int.Parse(Session["IDsdfsdf"].ToString()) == 6) { UseCarWorkFlowProcess.RunRenewInstance(Guid.Parse(this.lblQC.Text.ToString()), form); } else { UseCarWorkFlowProcess.RunReviewApply(Guid.Parse(this.lblQC.Text.ToString()), form); } lbMsg.Text = "提交成功!"; this.btnSubmit.Visible = false; gvDataBind(); Session["IDsdfsdf"] = null; }
// 如果活动返回值,则从 CodeActivity<TResult> // 派生并从 Execute 方法返回该值。 protected override void Execute(CodeActivityContext context) { // 获取 Text 输入参数的运行时值 if (2 == ReviewUseCarApplyForm.Get(context).Agree) { StringBuilder MailBody = new StringBuilder(); MailBody.Append("你好,这里是云山OA用车部门发布的信息,由"); MailBody.Append(Apply.Get(context).ApplyUserName.ToString() + "发布续车申请,由于各种原因不能通过,请仔细检查原因,重新申请,如果有问题乐意联系我们!!"); MailModel mailModel = new MailModel(); mailModel.MailBody = MailBody.ToString(); // mailModel.MailBody mailModel.DisplayName = "云山用车部门"; mailModel.MailSubject = "续车申请不能通过!!"; YunShanOA.Common2.SendEmail2.SendEmailToUseCarUsers(new YunShanOA.BusinessLogic.UseCar.UsecarAndUserManager().GetCarAndUserlistByFormID(Apply.Get(context).UseCarApplyFormID), mailModel); } else { StringBuilder MailBody = new StringBuilder(); MailBody.Append("你好,这里是云山OA用车部门发布的信息,由"); MailBody.Append(Apply.Get(context).ApplyUserName.ToString() + "发布续车申请已经通过,开始时间是:"); MailBody.Append(Apply.Get(context).BeginTime.ToString() + ",结束时间是:"); MailBody.Append(Apply.Get(context).EndTime + ",如果有问题,请联系我们!!!"); MailModel mailModel = new MailModel(); mailModel.MailBody = MailBody.ToString(); // mailModel.MailBody mailModel.DisplayName = "云山用车部门"; mailModel.MailSubject = "续车申请通过!!"; YunShanOA.Common2.SendEmail2.SendEmailToUseCarUsers(new YunShanOA.BusinessLogic.UseCar.UsecarAndUserManager().GetCarAndUserlistByFormID(Apply.Get(context).UseCarApplyFormID), mailModel); } }
protected override void Execute(CodeActivityContext context) { YunShanOA.BusinessLogic.UseCar.UsecarApplyformManager ApplyformManager = new BusinessLogic.UseCar.UsecarApplyformManager(); usecarapplyform myform = UpdateApplyInfo.Get(context); myform.ApplyStatus = ReviewUseCarApplyForm.Get(context).Agree; ApplyformManager.Sava(myform); new YunShanOA.BusinessLogic.UseCar.ReviewUseCarApplyFormManager().Save((YunShanOA.Model.UseCarModel.ReviewUseCarApplyForm)ReviewUseCarApplyForm.Get(context)); OUTApplyForm.Set(context, myform); }
protected override void Execute(CodeActivityContext context) { YunShanOA.BusinessLogic.UseCar.UsecarApplyformManager ApplyformManager = new BusinessLogic.UseCar.UsecarApplyformManager(); usecarapplyform myform = UpdateApplyInfo.Get(context); if (ReviewUseCarApplyForm.Get(context).Agree == 1) { myform.BeginTime = BeginTime.Get(context); } myform.ApplyStatus = 4; ApplyformManager.Sava(myform); OUTApplyForm.Set(context, myform); }