QueryInstanceByProperty.aspx.cs
资源名称:H3_OA.rar [点击查看]
上传用户:li2971742
上传日期:2021-11-18
资源大小:39096k
文件大小:5k
源码类别:
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 QueryInstanceByProperty : PortalPage
- {
- protected System.Web.UI.WebControls.Panel QueryPanel;
- protected void Page_Load(object sender, System.EventArgs e)
- {
- this.OriginatorSelector.SelectUserUrl = PageName_SelectUser;
- this.OriginatorSelector.SelectUserImageUrl = PageName_SelectUserImage;
- // 获得所有流程
- if(!IsPostBack)
- {
- // 验证是否具有管理员权限
- if (!this.UserValidator.ValidateViewReport())
- {
- this.NotifyMessage(LackOfAuth);
- }
- // 设置默认的搜索时间
- System.DateTime today = System.DateTime.Now;
- System.DateTime tomorrow = today.Add(new System.TimeSpan(1, 0, 0, 0, 0));
- this.txtFromTime.Text = today.ToShortDateString();
- this.txtToTime.Text = tomorrow.ToShortDateString();
- foreach(string instanceState in OThinker.H3.Instance.InstanceStateConvertor.GetAllState())
- {
- this.lstState.Items.Add(instanceState);
- }
- // 当前引擎内的所有流程类型
- string[] catalogs = OThinker.H3.Server.Engine.WorkflowManager.GetWorkflowPackages();
- // 添加一个空项
- this.lstWorkflowPackage.Items.Add("");
- if(catalogs != null)
- {
- foreach(string processCatalog in catalogs)
- {
- this.lstWorkflowPackage.Items.Add(processCatalog);
- }
- }
- this.lstWorkflowPackage_SelectedIndexChanged(this, null);
- }
- }
- #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.btnQuery.Click += new System.Web.UI.ImageClickEventHandler(this.btnQuery_Click);
- }
- #endregion
- protected void lstWorkflowPackage_SelectedIndexChanged(object sender, System.EventArgs e)
- {
- this.lstWorkflowName.Items.Clear();
- string catalog = this.lstWorkflowPackage.SelectedValue;
- this.lstWorkflowName.Items.Add("");
- string[] names = OThinker.H3.Server.Engine.WorkflowManager.GetWorkflowNames(catalog, OThinker.H3.WorkflowTemplate.WorkflowState.Unspecified);
- if(names != null)
- {
- foreach(string name in names)
- {
- this.lstWorkflowName.Items.Add(name);
- }
- }
- }
- private void btnQuery_Click(object sender, System.Web.UI.ImageClickEventArgs e)
- {
- this.Query();
- }
- private void Query()
- {
- string[] originators = null;
- string selectedUser = this.OriginatorSelector.SelectedUser;
- if (selectedUser == null || selectedUser == "")
- {
- originators = null;
- }
- else
- {
- originators = OThinker.H3.Server.Engine.Organization.GetMembers(new string[] { selectedUser });
- }
- OThinker.H3.Instance.InstanceState state = OThinker.H3.Instance.InstanceStateConvertor.ToState(this.lstState.SelectedValue);
- string catalog;
- if(this.lstWorkflowPackage.SelectedValue == null || this.lstWorkflowPackage.SelectedValue == "")
- {
- catalog = null;
- }
- else
- {
- catalog = this.lstWorkflowPackage.SelectedValue.Trim();
- }
- string name;
- if(this.lstWorkflowName.SelectedValue == null || this.lstWorkflowName.SelectedValue == "")
- {
- name = null;
- }
- else
- {
- name = this.lstWorkflowName.SelectedValue.Trim();
- }
- System.DateTime from;
- try
- {
- from = System.DateTime.Parse(this.txtFromTime.Text);
- }
- catch
- {
- from = System.DateTime.MinValue;
- }
- System.DateTime to;
- try
- {
- to = System.DateTime.Parse(this.txtToTime.Text);
- }
- catch
- {
- to = System.DateTime.MaxValue;
- }
- if(
- originators == null &&
- state == OThinker.H3.Instance.InstanceState.Unspecified &&
- catalog == null &&
- name == null &&
- from == System.DateTime.MinValue &&
- to == System.DateTime.MaxValue)
- {
- // 所有的查询条件都没有赋值,不进行查询
- }
- else
- {
- // 查找满足条件的实例
- System.Data.DataTable table = Portal.Query.QueryInstance(
- null,
- originators,
- null,
- OThinker.H3.Instance.InstanceContext.UnspecifiedID,
- state,
- catalog,
- name,
- OThinker.H3.WorkflowTemplate.WorkflowTemplate.NullWorkflowVersion,
- from,
- to,
- null,
- OThinker.H3.Instance.PriorityType.Unspecified,
- OThinker.Data.BoolMatchValue.Unspecified,
- OThinker.Data.BoolMatchValue.Unspecified);
- this.InstanceGridView.BindDataGrid(table);
- }
- }
- protected void lnkQuery_Click(object sender, System.EventArgs e)
- {
- this.Query();
- }
- }
- }