ActivateWorkflow.aspx.cs
资源名称:H3_OA.rar [点击查看]
上传用户:li2971742
上传日期:2021-11-18
资源大小:39096k
文件大小:4k
源码类别:
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 ActivateWorkflow : PortalPage
- {
- protected void Page_Load(object sender, EventArgs e)
- {
- if (!this.IsPostBack)
- {
- // 验证是否具有管理员权限
- if (!this.UserValidator.ValidateAdministrator())
- {
- this.NotifyMessage(LackOfAuth);
- }
- // 加载模板类型
- this.lstWorkflowPackage.Items.Clear();
- string[] packages = OThinker.H3.Server.Engine.WorkflowManager.GetWorkflowPackages();
- if (packages != null && packages.Length != 0)
- {
- foreach (string package in packages)
- {
- this.lstWorkflowPackage.Items.Add(package);
- }
- this.lstWorkflowPackage.SelectedIndex = 0;
- this.lstWorkflowPackage_SelectedIndexChanged(this, new EventArgs());
- }
- }
- }
- protected void lstWorkflowPackage_SelectedIndexChanged(object sender, EventArgs e)
- {
- if (this.lstWorkflowPackage.SelectedItem == null)
- {
- return;
- }
- string package = this.lstWorkflowPackage.SelectedItem.Text;
- OThinker.H3.WorkflowTemplate.WorkflowState filterState = new OThinker.H3.WorkflowTemplate.WorkflowState();
- filterState.OriginatorVisible = false;
- string[] names = OThinker.H3.Server.Engine.WorkflowManager.GetWorkflowNames(package, filterState);
- this.lstWorkflowName.Items.Clear();
- if (names != null && names.Length != 0)
- {
- foreach (string name in names)
- {
- this.lstWorkflowName.Items.Add(name);
- }
- this.lstWorkflowName.SelectedIndex = 0;
- }
- this.lstWorkflowName_SelectedIndexChanged(this, new EventArgs());
- }
- protected void lstWorkflowName_SelectedIndexChanged(object sender, EventArgs e)
- {
- string package = this.lstWorkflowPackage.SelectedItem.Text;
- if (this.lstWorkflowName.SelectedItem == null)
- {
- return;
- }
- string name = this.lstWorkflowName.SelectedItem.Text;
- // 获得选中的工作流模板的状态
- WorkflowTemplate.WorkflowState state = OThinker.H3.Server.Engine.WorkflowManager.GetWorkflowState(package, name);
- this.chkOriginatorVisible.Checked = state.OriginatorVisible;
- this.chkPerformanceReportVisible.Checked = state.PerformanceReportVisible;
- this.chkSearchWorkItemVisible.Checked = state.SearchWorkItemVisible;
- this.chkSearchInstanceVisible.Checked = state.SearchInstanceVisible;
- }
- protected void btnSubmit_Click(object sender, EventArgs e)
- {
- // 检查是否有被选中的
- if (this.lstWorkflowPackage.SelectedItem == null || this.lstWorkflowName.SelectedItem == null)
- {
- this.NotifyMessage("没有选中的工作流模板");
- }
- string package = this.lstWorkflowPackage.SelectedItem.Text;
- string name = this.lstWorkflowName.SelectedItem.Text;
- // 获得选中的工作流模板的状态
- WorkflowTemplate.WorkflowState state = new OThinker.H3.WorkflowTemplate.WorkflowState();
- state.OriginatorVisible = this.chkOriginatorVisible.Checked;
- state.PerformanceReportVisible = this.chkPerformanceReportVisible.Checked;
- state.SearchInstanceVisible = this.chkSearchInstanceVisible.Checked;
- state.SearchWorkItemVisible = this.chkSearchWorkItemVisible.Checked;
- // 设置状态
- OThinker.H3.Server.Engine.WorkflowManager.SetWorkflowState(package, name, state);
- // 通知结果
- this.NotifyMessage("设置流程模板状态成功");
- }
- }
- }