MyInstance2.aspx.cs
资源名称:H3_OA.rar [点击查看]
上传用户:li2971742
上传日期:2021-11-18
资源大小:39096k
文件大小:9k
源码类别:
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 MyInstance2 : PortalPage
- {
- protected DataTable InstanceTable
- {
- get
- {
- return (DataTable)Session[OThinker.H3.WorkSheet.Sessions.GetMyWorkItemTable()];
- }
- set
- {
- Session[OThinker.H3.WorkSheet.Sessions.GetMyWorkItemTable()] = value;
- }
- }
- private OThinker.H3.Instance.InstanceState State
- {
- get
- {
- string state = System.Web.HttpUtility.UrlDecode(this.Request.QueryString[Param_State]);
- if (state == null || state == "")
- {
- return OThinker.H3.Instance.InstanceState.Unfinished;
- }
- else
- {
- return OThinker.H3.Instance.InstanceStateConvertor.ToState(state);
- }
- }
- }
- protected void Page_Load(object sender, EventArgs e)
- {
- if (!this.IsPostBack)
- {
- // 工作流模板的包
- string[] packages = OThinker.H3.Server.Engine.WorkflowManager.GetWorkflowPackages();
- this.lstWorkflowPackage.Items.Add(new ListItem("所有", "All"));
- if (packages != null)
- {
- foreach (string package in packages)
- {
- this.lstWorkflowPackage.Items.Add(package);
- }
- }
- this.lstWorkflowPackage_SelectedIndexChanged(this, new EventArgs());
- // 设置搜索日期
- this.StartTime.TimeValue = System.DateTime.Now.Subtract(new TimeSpan(7, 0, 0, 0));
- this.EndTime.TimeValue = System.DateTime.Now.Add(new TimeSpan(1, 0, 0, 0));
- // 状态
- if (this.State == OThinker.H3.Instance.InstanceState.Unfinished)
- {
- this.lstState.SelectedIndex = 1;
- }
- else
- {
- this.lstState.SelectedIndex = 2;
- }
- // 搜索默认的工作项表
- // 查找我发起且未完成的流程表
- this.InstanceTable = Query.QueryInstance(
- null,
- new string[] { this.UserValidator.UserID },
- null,
- Instance.InstanceContext.UnspecifiedID,
- this.State,
- null,
- null,
- WorkflowTemplate.WorkflowTemplate.NullWorkflowVersion,
- System.DateTime.MinValue,
- System.DateTime.MaxValue,
- null,
- OThinker.H3.Instance.PriorityType.Unspecified,
- OThinker.Data.BoolMatchValue.Unspecified,
- OThinker.Data.BoolMatchValue.Unspecified);
- }
- this.InstanceGridView.BindDataGrid(this.InstanceTable);
- }
- protected void lstWorkflowPackage_SelectedIndexChanged(object sender, EventArgs e)
- {
- this.lstWorkflowName.Items.Clear();
- this.lstWorkflowName.Items.Add(new ListItem("所有", "All"));
- if (this.lstWorkflowPackage.SelectedItem != null)
- {
- string selectedPackage = this.lstWorkflowPackage.SelectedItem.Value;
- if (selectedPackage != null && selectedPackage != "" && selectedPackage != "All")
- {
- string[] names = OThinker.H3.Server.Engine.WorkflowManager.GetWorkflowNames(selectedPackage, OThinker.H3.WorkflowTemplate.WorkflowState.Active);
- if (names != null)
- {
- foreach (string name in names)
- {
- this.lstWorkflowName.Items.Add(name);
- }
- }
- }
- }
- }
- protected void btnSearch_Click(object sender, EventArgs e)
- {
- // 工作流模板参数
- string workflowPackage = null;
- string workflowName = null;
- if (this.lstWorkflowPackage.SelectedItem.Value == "All")
- {
- }
- else
- {
- workflowPackage = this.lstWorkflowPackage.SelectedItem.Value;
- if (this.lstWorkflowName.SelectedItem.Value == "All")
- {
- }
- else
- {
- workflowName = this.lstWorkflowName.SelectedItem.Value;
- }
- }
- // 时间
- System.DateTime startTime = System.DateTime.MinValue;
- System.DateTime endTime = System.DateTime.MaxValue;
- try
- {
- startTime = this.StartTime.TimeValue;
- }
- catch
- {
- }
- try
- {
- endTime = System.DateTime.Parse(this.EndTime.Text);
- }
- catch
- {
- }
- // 状态
- Instance.InstanceState state = OThinker.H3.Instance.InstanceState.Unspecified;
- if (this.lstState.SelectedValue == "All")
- {
- }
- else if (this.lstState.SelectedValue == "Unfinished")
- {
- state = OThinker.H3.Instance.InstanceState.Unfinished;
- }
- else
- {
- state = OThinker.H3.Instance.InstanceState.Complete;
- }
- // 关键字
- string keyword = this.txtKeyword.Text == null ? null : this.txtKeyword.Text.Trim();
- if(keyword == null || keyword == "")
- {
- keyword = null;
- }
- if(this.lstScope.SelectedValue == "Originate" && keyword == null)
- {
- // 查找
- this.InstanceTable = Query.QueryInstance(
- null,
- new string[]{this.UserValidator.UserID},
- null,
- Instance.InstanceContext.UnspecifiedID,
- state,
- workflowPackage,
- workflowName,
- WorkflowTemplate.WorkflowTemplate.NullWorkflowVersion,
- startTime,
- endTime,
- null,
- OThinker.H3.Instance.PriorityType.Unspecified,
- OThinker.Data.BoolMatchValue.Unspecified,
- OThinker.Data.BoolMatchValue.Unspecified);
- }
- else if(this.lstScope.SelectedValue == "Handle" && keyword == null)
- {
- this.InstanceTable = Query.QueryHandledInstance(
- workflowPackage,
- workflowName,
- WorkflowTemplate.WorkflowTemplate.NullWorkflowVersion,
- state,
- startTime,
- endTime,
- this.UserValidator.UserID);
- }
- else if(this.lstScope.SelectedValue == "Originate" && keyword != null)
- {
- this.InstanceTable = Query.QueryInstance(
- null,
- new string[]{this.UserValidator.UserID},
- null,
- Instance.InstanceContext.UnspecifiedID,
- state,
- workflowPackage,
- workflowName,
- WorkflowTemplate.WorkflowTemplate.NullWorkflowVersion,
- startTime,
- endTime,
- keyword,
- OThinker.H3.Instance.PriorityType.Unspecified,
- OThinker.Data.BoolMatchValue.Unspecified,
- OThinker.Data.BoolMatchValue.Unspecified);
- }
- else if(this.lstScope.SelectedValue == "Handle" && keyword != null)
- {
- // 查找满足经办条件的
- string[] instances = OThinker.H3.Server.Engine.WorkItemManager.QueryHandledInstances(
- null,
- this.UserValidator.UserID,
- OThinker.H3.WorkItem.WorkItemState.Unspecified);
- // 查找表
- this.InstanceTable = Query.QueryInstance(
- instances,
- null,
- null,
- Instance.InstanceContext.UnspecifiedID,
- state,
- workflowPackage,
- workflowName,
- WorkflowTemplate.WorkflowTemplate.NullWorkflowVersion,
- startTime,
- endTime,
- keyword,
- OThinker.H3.Instance.PriorityType.Unspecified,
- OThinker.Data.BoolMatchValue.Unspecified,
- OThinker.Data.BoolMatchValue.Unspecified);
- }
- else{
- throw new NotImplementedException();
- }
- this.InstanceGridView.BindDataGrid(this.InstanceTable);
- }
- }
- }