InstanceDetail.aspx.cs
资源名称:H3_OA.rar [点击查看]
上传用户:li2971742
上传日期:2021-11-18
资源大小:39096k
文件大小:11k
源码类别:
OA系统
开发平台:
C#
- //===========================================================================
- // This file was modified as part of an ASP.NET 2.0 Web project conversion.
- // The class name was changed and the class modified to inherit from the abstract base class
- // in file 'App_CodeMigratedconsoleStub_casedetail_aspx_cs.cs'.
- // During runtime, this allows other classes in your web application to bind and access
- // the code-behind page using the abstract base class.
- // The associated content page 'consolecasedetail.aspx' was also modified to refer to the new class name.
- // For more information on this code pattern, please refer to http://go.microsoft.com/fwlink/?LinkId=46995
- //===========================================================================
- using System;
- using System.Collections;
- using System.ComponentModel;
- using System.Data;
- using System.Drawing;
- using System.Web;
- using System.Web.SessionState;
- using System.Web.UI;
- using System.Web.UI.WebControls;
- using System.Web.UI.HtmlControls;
- namespace OThinker.H3.Portal
- {
- /// <summary>
- /// Summary description for CaseDetail.
- /// </summary>
- public partial class InstanceDetail : PortalPage
- {
- #region 参数
- public string InstanceId
- {
- get
- {
- return this.Request.QueryString[Param_InstanceId];
- }
- }
- public OThinker.H3.Instance.InstanceContext InstanceContext
- {
- get
- {
- string sessionName = OThinker.H3.WorkSheet.Sessions.GetInstanceContext(this.InstanceId);
- if (this.Session[sessionName] == null)
- {
- this.Session[sessionName] = OThinker.H3.Server.Engine.InstanceManager.GetInstanceContext(this.InstanceId);
- }
- return (OThinker.H3.Instance.InstanceContext)this.Session[sessionName];
- }
- set
- {
- string sessionName = OThinker.H3.WorkSheet.Sessions.GetInstanceContext(this.InstanceId);
- this.Session[sessionName] = value;
- }
- }
- #endregion
- protected void Page_Load(object sender, System.EventArgs e)
- {
- if (!this.IsPostBack)
- {
- // 如果该流程不存在则显示不存在
- if (this.InstanceContext == null)
- {
- this.NotifyMessage("该流程不存在");
- }
- this.ViewInstanceSheets();
- // 如果是管理员,那么显示某些按钮
- if (this.UserValidator.ValidateAdministrator())
- {
- foreach (OThinker.H3.Instance.ActivityContext activity in this.InstanceContext.ActivityArray)
- {
- if (activity.State == OThinker.H3.Instance.ActivityState.Running)
- {
- // 处于活动状态中的活动
- this.lstActivateActivity.Items.Add(activity.Name);
- }
- else
- {
- // 显示要激活的活动列表
- this.lstActivity.Items.Add(activity.Name);
- }
- }
- if (this.lstActivateActivity.Items.Count > 0)
- {
- this.lstActivateActivity.SelectedIndex = 0;
- }
- else
- {
- this.lnkCancelActivity.Enabled = false;
- }
- }
- else
- {
- this.AdminPanel.Visible = false;
- }
- // 如果该流程已经完成则隐藏某些按钮
- if (this.InstanceContext.State == OThinker.H3.Instance.InstanceState.Complete)
- {
- this.lstActivity.Enabled = false;
- this.lnkActivate.Enabled = false;
- this.lstActivateActivity.Enabled = false;
- this.lnkCancelActivity.Enabled = false;
- }
- string cancelUrl = PageName_CancelInstance + "?" + Param_InstanceId + "=" + this.InstanceId;
- string cancelJs = "if(confirm('确定要删除?'))location='" + cancelUrl + "'";
- this.lnkTerminate.Attributes.Add("onClick",cancelJs);
- this.btnTerminate.Attributes.Add("onClick",cancelJs);
- }
- }
- #region Web Form Designer generated code
- override protected void OnInit(EventArgs e)
- {
- //
- // CODEGEN: This call is required by the ASP.NET Web Form Designer.
- //
- InitializeComponent();
- base.OnInit(e);
- }
- /// <summary>
- /// Required method for Designer support - do not modify
- /// the contents of this method with the code editor.
- /// </summary>
- private void InitializeComponent()
- {
- this.btnViewSheet.Click += new System.Web.UI.ImageClickEventHandler(this.btnViewSheet_Click);
- this.btnChartInstanceState.Click += new System.Web.UI.ImageClickEventHandler(this.btnChartInstanceState_Click);
- this.btnUrge.Click += new System.Web.UI.ImageClickEventHandler(this.btnUrge_Click);
- this.btnViewCurrentActivity.Click += new System.Web.UI.ImageClickEventHandler(this.btnViewCurrentActivity_Click);
- this.btnViewCaseData.Click += new System.Web.UI.ImageClickEventHandler(this.btnViewCaseData_Click);
- this.btnViewHeapData.Click += new System.Web.UI.ImageClickEventHandler(this.btnViewHeapData_Click);
- this.btnQueryToken.Click += new System.Web.UI.ImageClickEventHandler(this.btnQueryToken_Click);
- }
- #endregion
- private void btnViewCaseData_Click(object sender, System.Web.UI.ImageClickEventArgs e)
- {
- this.ViewInstanceData();
- }
- protected void lnkViewCaseData_Click(object sender, System.EventArgs e)
- {
- this.ViewInstanceData();
- }
- private void ViewInstanceData()
- {
- this.DetailFrame.Attributes.Add(
- "src",
- PageName_InstanceData + "?" + Param_InstanceId + "=" + this.InstanceId);
- }
- private void btnViewHeapData_Click(object sender, System.Web.UI.ImageClickEventArgs e)
- {
- this.ViewHeapData();
- }
- protected void lnkViewHeapData_Click(object sender, System.EventArgs e)
- {
- this.ViewHeapData();
- }
- private void ViewHeapData()
- {
- this.DetailFrame.Attributes.Add(
- "src",
- PageName_HeapData + "?" + Param_InstanceId + "=" + this.InstanceId);
- }
- private void btnChartInstanceState_Click(object sender, System.Web.UI.ImageClickEventArgs e)
- {
- this.ChartInstanceState();
- }
- protected void lnkChartInstanceState_Click(object sender, System.EventArgs e)
- {
- this.ChartInstanceState();
- }
- private void ChartInstanceState()
- {
- this.DetailFrame.Attributes.Add(
- "src",
- PageName_InstanceStateChart + "?" + Param_InstanceId + "=" + this.InstanceId);
- }
- private void btnUrge_Click(object sender, System.Web.UI.ImageClickEventArgs e)
- {
- this.Urge();
- }
- protected void lnkUrge_Click(object sender, System.EventArgs e)
- {
- this.Urge();
- }
- private void Urge()
- {
- this.DetailFrame.Attributes.Add(
- "src",
- PageName_UrgeInstance + "?" + Param_InstanceId + "=" + this.InstanceId);
- }
- private void btnViewCurrentActivity_Click(object sender, System.Web.UI.ImageClickEventArgs e)
- {
- this.ViewActivity();
- }
- protected void lnkViewCurrentActivity_Click(object sender, System.EventArgs e)
- {
- this.ViewActivity();
- }
- private void ViewActivity()
- {
- this.DetailFrame.Attributes.Add(
- "src",
- PageName_EnabledActivity + "?" + Param_InstanceId + "=" + this.InstanceId);
- }
- private void btnViewSheet_Click(object sender, System.Web.UI.ImageClickEventArgs e)
- {
- this.ViewInstanceSheets();
- }
- protected void lnkViewSheet_Click(object sender, System.EventArgs e)
- {
- this.ViewInstanceSheets();
- }
- private void ViewInstanceSheets()
- {
- this.DetailFrame.Attributes.Add(
- "src",
- PageName_InstanceSheets + "?" +
- Param_InstanceId + "=" + this.InstanceId + "&" +
- Param_WorkflowPackage + "=" + System.Web.HttpUtility.UrlEncode(this.InstanceContext.WorkflowPackage) + "&" +
- Param_WorkflowName + "=" + System.Web.HttpUtility.UrlEncode(this.InstanceContext.WorkflowName) + "&" +
- Param_WorkflowVersion + "=" + System.Web.HttpUtility.UrlEncode(this.InstanceContext.WorkflowVersion.ToString()));
- }
- private void btnQueryToken_Click(object sender, System.Web.UI.ImageClickEventArgs e)
- {
- this.QueryToken();
- }
- protected void lnkQueryToken_Click(object sender, System.EventArgs e)
- {
- this.QueryToken();
- }
- private void QueryToken()
- {
- this.DetailFrame.Attributes.Add(
- "src",
- PageName_InstanceToken + "?" +
- Param_InstanceId + "=" + this.InstanceContext.InstanceId);
- }
- protected void lnkActivate_Click(object sender, EventArgs e)
- {
- string activity = this.lstActivity.SelectedValue;
- this.Response.Redirect(
- PageName_ActivateActivity + "?" +
- Param_InstanceId + "=" + this.InstanceId + "&" +
- Param_DestActivityName + "=" + HttpUtility.UrlEncode(activity));
- }
- protected void lnkCancelActivity_Click(object sender, EventArgs e)
- {
- string activity = this.lstActivateActivity.SelectedValue;
- if (this.InstanceContext.State == OThinker.H3.Instance.InstanceState.Running &&
- this.InstanceContext.Suspended == false &&
- this.InstanceContext.Exceptional == false)
- {
- // 准备触发后面Activity的消息
- OThinker.H3.Messages.CancelActivityMessage cancelMessage
- = new OThinker.H3.Messages.CancelActivityMessage(
- OThinker.H3.Messages.MessageEmergencyType.Normal,
- this.InstanceId,
- activity,
- false,
- null);
- OThinker.H3.Server.Engine.InstanceManager.SendMessage(cancelMessage);
- // 重写缓存
- this.InstanceContext = null;
- this.NotifyMessage(System.String.Format("取消活动{0}已成功", activity));
- }
- else
- {
- this.NotifyMessage(System.String.Format("取消活动{0}失败", activity));
- }
- }
- }
- }