CancelInstance.aspx.cs
资源名称:H3_OA.rar [点击查看]
上传用户:li2971742
上传日期:2021-11-18
资源大小:39096k
文件大小:6k
源码类别:
OA系统
开发平台:
C#
- 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>
- public partial class CancelInstance : PortalPage
- {
- public string InstanceId
- {
- get
- {
- return this.Request.QueryString[Param_InstanceId];
- }
- }
- public string ReturnUrl
- {
- get
- {
- string url = this.Request.QueryString[Param_Q];
- return HttpUtility.UrlDecode(url);
- }
- }
- protected void Page_Load(object sender, System.EventArgs e)
- {
- if (!this.IsPostBack)
- {
- if (!this.UserValidator.ValidateAdministrator())
- {
- this.NotifyMessage(LackOfAuth);
- }
- if (this.ReturnUrl == null || this.ReturnUrl == "")
- {
- this.lnkReturn.Visible = false;
- }
- this.lnkReturn.NavigateUrl = this.ReturnUrl;
- // 流程标题
- this.lblInstanceName.Text = OThinker.H3.Server.Engine.InstanceManager.GetInstanceName(this.InstanceId);
- string package = OThinker.H3.Server.Engine.InstanceManager.GetInstanceWorkflowPackage(this.InstanceId);
- string name = OThinker.H3.Server.Engine.InstanceManager.GetInstanceWorkflowName(this.InstanceId);
- int version = OThinker.H3.Server.Engine.InstanceManager.GetInstanceWorkflowVersion(this.InstanceId);
- string workflowName = OThinker.H3.WorkflowTemplate.WorkflowTemplate.GetWorkflowFullName(package, name, version);
- this.lblWorkflowName.Text = workflowName;
- string originator = OThinker.H3.Server.Engine.InstanceManager.GetInstanceOriginator(this.InstanceId);
- this.lblOriginator.Text = OThinker.H3.Server.Engine.Organization.GetFullName(originator);
- // 邮件通知
- string[] participants = OThinker.H3.Server.Engine.WorkItemManager.QueryParticipant(this.InstanceId, null, OThinker.H3.Instance.Token.UnspecifiedID, OThinker.H3.WorkItem.WorkItemType.Unspecified, OThinker.H3.WorkItem.WorkItemState.Unspecified);
- if (participants != null)
- {
- foreach (string participant in participants)
- {
- string participantName = OThinker.H3.Server.Engine.Organization.GetFullName(participant);
- this.lblReceiver.Text += (participantName + "; ");
- }
- }
- // 邮件标题
- this.txtEmailTitle.Text = "流程" + this.InstanceId + "已经被取消";
- this.txtEmailContext.Text = "流程" + this.InstanceId + "已经被用户" + this.UserValidator.UserFullName + "取消。";
- }
- }
- #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()
- {
- }
- #endregion
- protected void lnkOk_Click(object sender, EventArgs e)
- {
- // 发送邮件通知
- string title = this.txtEmailTitle.Text;
- string context = this.txtEmailContext.Text;
- string[] participants = OThinker.H3.Server.Engine.WorkItemManager.QueryParticipant(this.InstanceId, null, OThinker.H3.Instance.Token.UnspecifiedID, OThinker.H3.WorkItem.WorkItemType.Unspecified, OThinker.H3.WorkItem.WorkItemState.Unspecified);
- if (participants != null)
- {
- foreach (string participant in participants)
- {
- OThinker.H3.Notification.Notification email = new OThinker.H3.Notification.Notification(
- OThinker.H3.Notification.NotifyType.Email,
- null,
- participant,
- null,
- OThinker.H3.Server.Engine.InstanceManager.GetInstanceWorkflowPackage(this.InstanceId),
- OThinker.H3.Server.Engine.InstanceManager.GetInstanceWorkflowName(this.InstanceId),
- OThinker.H3.Server.Engine.InstanceManager.GetInstanceWorkflowVersion(this.InstanceId),
- this.InstanceId,
- title,
- context,
- null);
- OThinker.H3.Server.Engine.Notifier.Notify(email);
- }
- }
- // 终止该流程
- OThinker.H3.Server.Engine.InstanceManager.RemoveInstance(this.InstanceId);
- // 设置session为空
- string sessionName = OThinker.H3.WorkSheet.Sessions.GetInstanceContext(this.InstanceId);
- this.Session[sessionName] = null;
- // 显示已经终止
- this.NotifyMessage("流程已经终止");
- }
- }
- }