StartInstanceAutoSubmit.aspx.cs
上传用户:li2971742
上传日期:2021-11-18
资源大小:39096k
文件大小:4k
源码类别:

OA系统

开发平台:

C#

  1. using System;
  2. using System.Collections;
  3. using System.Configuration;
  4. using System.Data;
  5. using System.Web;
  6. using System.Web.Security;
  7. using System.Web.UI;
  8. using System.Web.UI.HtmlControls;
  9. using System.Web.UI.WebControls;
  10. using System.Web.UI.WebControls.WebParts;
  11. namespace OThinker.H3.Portal
  12. {
  13.     /// <summary>
  14.     /// 创建流程,然后自动完成发起人要填写的表单
  15.     /// </summary>
  16.     public partial class StartInstanceAutoSubmit : PortalPage
  17.     {
  18.         protected string WorkflowPackage
  19.         {
  20.             get
  21.             {
  22.                 return HttpUtility.UrlDecode(this.Request.QueryString[Param_WorkflowPackage]);
  23.             }
  24.         }
  25.         protected string WorkflowName
  26.         {
  27.             get
  28.             {
  29.                 return HttpUtility.UrlDecode(this.Request.QueryString[Param_WorkflowName]);
  30.             }
  31.         }
  32.         private int _WorkflowVersion = WorkflowTemplate.WorkflowTemplate.NullWorkflowVersion;
  33.         protected int WorkflowVersion
  34.         {
  35.             get
  36.             {
  37.                 if (this._WorkflowVersion == WorkflowTemplate.WorkflowTemplate.NullWorkflowVersion)
  38.                 {
  39.                     string strVersion = this.Request.QueryString[Param_WorkflowVersion];
  40.                     if (strVersion == null || strVersion == "")
  41.                     {
  42.                         this._WorkflowVersion = OThinker.H3.Server.Engine.WorkflowManager.GetWorkflowDefaultVersion(this.WorkflowPackage, this.WorkflowName);
  43.                     }
  44.                     else
  45.                     {
  46.                         this._WorkflowVersion = int.Parse(strVersion);
  47.                     }
  48.                 }
  49.                 return this._WorkflowVersion;
  50.             }
  51.         }
  52.         protected string InstanceName
  53.         {
  54.             get
  55.             {
  56.                 return this.Request.QueryString[Param_InstanceName];
  57.             }
  58.         }
  59.         protected OThinker.H3.Instance.PriorityType Priority
  60.         {
  61.             get
  62.             {
  63.                 string strPriority = this.Request.QueryString[Param_Priority];
  64.                 if (strPriority == null || strPriority == "")
  65.                 {
  66.                     return OThinker.H3.Instance.PriorityType.Normal;
  67.                 }
  68.                 else
  69.                 {
  70.                     return OThinker.H3.Instance.PriorityTypeConvertor.ToPriorityType(strPriority);
  71.                 }
  72.             }
  73.         }
  74.         protected void Page_Load(object sender, EventArgs e)
  75.         {
  76.             string itemId = base.OriginateInstance(this.WorkflowPackage, this.WorkflowName, this.WorkflowVersion, this.Priority, this.InstanceName, null, null);
  77.             // 获得该任务
  78.             OThinker.H3.WorkItem.WorkItem item = OThinker.H3.Server.Engine.WorkItemManager.GetWorkItem(itemId);
  79.             string[] groups = this.UserValidator.Groups;
  80.             string group = ((groups == null || groups.Length == 0) ? null : groups[0]);
  81.             // 任务已经收到,标记任务为完成
  82.             OThinker.H3.Server.Engine.WorkItemManager.FinishWorkItem(item.WorkItemID, this.UserValidator.UserID, group, OThinker.Data.BoolMatchValue.Unspecified, null);
  83.             // 需要通知实例事件管理器结束事件
  84.             Messages.AsyncEndMessage endMessage
  85.                     = new OThinker.H3.Messages.AsyncEndMessage(
  86.                     Messages.MessageEmergencyType.Normal,
  87.                     item.InstanceId,
  88.                     item.ActivityName,
  89.                     item.ReplyID,
  90.                     true,
  91.                     null, 
  92.                     OThinker.Data.BoolMatchValue.Unspecified, 
  93.                     null,
  94.                     null);
  95.             OThinker.H3.Server.Engine.InstanceManager.SendMessage(endMessage);
  96.         }
  97.     }
  98. }