StartInstance.aspx.cs
资源名称:H3_OA.rar [点击查看]
上传用户:li2971742
上传日期:2021-11-18
资源大小:39096k
文件大小:5k
源码类别:
OA系统
开发平台:
C#
- using System;
- using System.Data;
- using System.Configuration;
- using System.Collections;
- using System.Web;
- using System.Web.Security;
- using System.Web.UI;
- using System.Web.UI.WebControls;
- using System.Web.UI.WebControls.WebParts;
- using System.Web.UI.HtmlControls;
- namespace OThinker.H3.Portal
- {
- public partial class StartInstance : PortalPage
- {
- protected string WorkflowPackage
- {
- get
- {
- return HttpUtility.UrlDecode(this.Request.QueryString[Param_WorkflowPackage]);
- }
- }
- protected string WorkflowName
- {
- get
- {
- return HttpUtility.UrlDecode(this.Request.QueryString[Param_WorkflowName]);
- }
- }
- private int _WorkflowVersion = WorkflowTemplate.WorkflowTemplate.NullWorkflowVersion;
- protected int WorkflowVersion
- {
- get
- {
- if (this._WorkflowVersion == WorkflowTemplate.WorkflowTemplate.NullWorkflowVersion)
- {
- string strVersion = this.Request.QueryString[Param_WorkflowVersion];
- if (strVersion == null || strVersion == "")
- {
- this._WorkflowVersion = OThinker.H3.Server.Engine.WorkflowManager.GetWorkflowDefaultVersion(this.WorkflowPackage, this.WorkflowName);
- }
- else
- {
- this._WorkflowVersion = int.Parse(strVersion);
- }
- }
- return this._WorkflowVersion;
- }
- }
- protected string InstanceName
- {
- get
- {
- return this.Request.QueryString[Param_InstanceName];
- }
- }
- protected OThinker.H3.Instance.PriorityType Priority
- {
- get
- {
- string strPriority = this.Request.QueryString[Param_Priority];
- if (strPriority == null || strPriority == "")
- {
- return OThinker.H3.Instance.PriorityType.Normal;
- }
- else
- {
- return OThinker.H3.Instance.PriorityTypeConvertor.ToPriorityType(strPriority);
- }
- }
- }
- protected void Page_Load(object sender, EventArgs e)
- {
- // 获得工作流模板
- OThinker.H3.WorkflowTemplate.WorkflowTemplate workflow = OThinker.H3.Server.Engine.WorkflowManager.GetWorkflow(this.WorkflowPackage, this.WorkflowName, this.WorkflowVersion);
- // 开始节点
- OThinker.H3.WorkflowTemplate.ActivityTemplate startActivity = null;
- // 开始的表单
- OThinker.H3.WorkflowTemplate.Sheet startSheet = null;
- if (workflow.StartWithSheet &&
- (startActivity = workflow.GetActivity(workflow.StartActivity))!= null &&
- (startActivity.SheetName != null && startActivity.SheetName != "") &&
- (startSheet = workflow.GetSheet(startActivity.SheetName)) != null)
- {
- string url = PortalPage.GetSheetBaseUrl(startSheet.SheetType, startSheet.SheetAddress);
- if (url.LastIndexOf("?") == -1)
- {
- // url的形式应该是http://.../page1.aspx
- url += "?";
- }
- else if (url.LastIndexOf("&") == -1)
- {
- // url的形式应该是http://.../page1.aspx?
- }
- else
- {
- // url的形式应该是http://.../page1.aspx?param1=value1
- url += "&";
- }
- this.Response.Redirect(
- url +
- OThinker.H3.WorkSheet.SheetEnviroment.Param_Mode + "=" + OThinker.H3.WorkSheet.SheetMode.Originate + "&" +
- PortalPage.Param_WorkflowPackage + "=" + System.Web.HttpUtility.UrlEncode(workflow.WorkflowPackageName) + "&" +
- PortalPage.Param_WorkflowName + "=" + System.Web.HttpUtility.UrlEncode(workflow.WorkflowName) + "&" +
- PortalPage.Param_WorkflowVersion + "=" + workflow.WorkflowVersion);
- }
- else
- {
- string itemId = base.OriginateInstance(this.WorkflowPackage, this.WorkflowName, this.WorkflowVersion, this.Priority, null, null, null);
- OThinker.H3.WorkItem.WorkItem item = OThinker.H3.Server.Engine.WorkItemManager.GetWorkItem(itemId);
- this.Response.Redirect(PortalPage.GetWorkSheetUrl(item));
- }
- }
- }
- }