MyWorkItem2.aspx.cs
上传用户:li2971742
上传日期:2021-11-18
资源大小:39096k
文件大小:6k
源码类别:

OA系统

开发平台:

C#

  1. using System;
  2. using System.Data;
  3. using System.Configuration;
  4. using System.Collections;
  5. using System.Web;
  6. using System.Web.Security;
  7. using System.Web.UI;
  8. using System.Web.UI.WebControls;
  9. using System.Web.UI.WebControls.WebParts;
  10. using System.Web.UI.HtmlControls;
  11. namespace OThinker.H3.Portal
  12. {
  13.     public partial class MyWorkItem2 : PortalPage
  14.     {
  15.         protected DataTable WorkItemTable
  16.         {
  17.             get
  18.             {
  19.                 return (DataTable)Session[OThinker.H3.WorkSheet.Sessions.GetMyWorkItemTable()];
  20.             }
  21.             set
  22.             {
  23.                 Session[OThinker.H3.WorkSheet.Sessions.GetMyWorkItemTable()] = value;
  24.             }
  25.         }
  26.         protected OThinker.H3.WorkItem.WorkItemState State
  27.         {
  28.             get
  29.             {
  30.                 string strState = this.Request.QueryString[Param_State];
  31.                 if (strState == null || strState == "")
  32.                 {
  33.                     return OThinker.H3.WorkItem.WorkItemState.Unspecified;
  34.                 }
  35.                 else
  36.                 {
  37.                     return OThinker.H3.WorkItem.WorkItemStateConvertor.ToState(strState);
  38.                 }
  39.             }
  40.         }
  41.         private OThinker.Data.BoolMatchValue Approval
  42.         {
  43.             get
  44.             {
  45.                 string strApproval = this.Request.QueryString[Param_Approval];
  46.                 if (strApproval == null || strApproval == "")
  47.                 {
  48.                     return OThinker.Data.BoolMatchValue.Unspecified;
  49.                 }
  50.                 else
  51.                 {
  52.                     try
  53.                     {
  54.                         return (OThinker.Data.BoolMatchValue)Enum.Parse(typeof(OThinker.Data.BoolMatchValue), strApproval);
  55.                     }
  56.                     catch
  57.                     {
  58.                         return OThinker.Data.BoolMatchValue.Unspecified;
  59.                     }
  60.                 }
  61.             }
  62.         }
  63.         protected void Page_Load(object sender, EventArgs e)
  64.         {
  65.             if (!this.IsPostBack)
  66.             {
  67.                 // 工作流模板的包
  68.                 string[] packages = OThinker.H3.Server.Engine.WorkflowManager.GetWorkflowPackages();
  69.                 this.lstWorkflowPackage.Items.Add(new ListItem("所有", "All"));
  70.                 if (packages != null)
  71.                 {
  72.                     foreach (string package in packages)
  73.                     {
  74.                         this.lstWorkflowPackage.Items.Add(package);
  75.                     }
  76.                 }
  77.                 this.lstWorkflowPackage_SelectedIndexChanged(this, new EventArgs());
  78.                 // 设置搜索日期
  79.                 this.StartTime.TimeValue = System.DateTime.Now.Subtract(new TimeSpan(7, 0, 0, 0));
  80.                 this.EndTime.TimeValue = System.DateTime.Now.AddDays(1);
  81.                 // 搜索默认的工作项表
  82.                 this.WorkItemTable = Query.QueryWorkItem(
  83.                     null,
  84.                     null,
  85.                     OThinker.H3.WorkflowTemplate.WorkflowTemplate.NullWorkflowVersion,
  86.                     null,
  87.                     null,
  88.                     this.UserValidator.Delegants2,
  89.                     System.DateTime.MinValue,
  90.                     System.DateTime.MaxValue,
  91.                     this.State,
  92.                     OThinker.H3.Instance.PriorityType.Unspecified, 
  93.                     null, 
  94.                     null, 
  95.                     this.Approval, 
  96.                     OThinker.Data.BoolMatchValue.Unspecified);
  97.             }
  98.             this.WorkItemGrid.BindDataGrid(this.WorkItemTable);
  99.         }
  100.         protected void lstWorkflowPackage_SelectedIndexChanged(object sender, EventArgs e)
  101.         {
  102.             this.lstWorkflowName.Items.Clear();
  103.             this.lstWorkflowName.Items.Add(new ListItem("所有", "All"));
  104.             if (this.lstWorkflowPackage.SelectedItem != null)
  105.             {
  106.                 string selectedPackage = this.lstWorkflowPackage.SelectedItem.Value;
  107.                 if (selectedPackage != null && selectedPackage != "" && selectedPackage != "All")
  108.                 {
  109.                     string[] names = OThinker.H3.Server.Engine.WorkflowManager.GetWorkflowNames(selectedPackage, OThinker.H3.WorkflowTemplate.WorkflowState.Active);
  110.                     if (names != null)
  111.                     {
  112.                         foreach (string name in names)
  113.                         {
  114.                             this.lstWorkflowName.Items.Add(name);
  115.                         }
  116.                     }
  117.                 }
  118.             }
  119.         }
  120.         protected void btnSearch_Click(object sender, EventArgs e)
  121.         {
  122.             // 工作流模板参数
  123.             string workflowPackage = null;
  124.             string workflowName = null;
  125.             if (this.lstWorkflowPackage.SelectedItem.Value == "All")
  126.             {
  127.             }
  128.             else
  129.             {
  130.                 workflowPackage = this.lstWorkflowPackage.SelectedItem.Value;
  131.                 if (this.lstWorkflowName.SelectedItem.Value == "All")
  132.                 {
  133.                 }
  134.                 else
  135.                 {
  136.                     workflowName = this.lstWorkflowName.SelectedItem.Value;
  137.                 }
  138.             }
  139.             // 时间
  140.             System.DateTime startTime = System.DateTime.MinValue;
  141.             System.DateTime endTime = System.DateTime.MaxValue;
  142.             try
  143.             {
  144.                 startTime = this.StartTime.TimeValue;
  145.             }
  146.             catch
  147.             {
  148.             }
  149.             try
  150.             {
  151.                 endTime = System.DateTime.Parse(this.EndTime.Text);
  152.             }
  153.             catch
  154.             {
  155.             }
  156.             // 查找
  157.             this.WorkItemTable = Query.QueryWorkItem(
  158.                 workflowPackage, 
  159.                 workflowName,
  160.                 WorkflowTemplate.WorkflowTemplate.NullWorkflowVersion, 
  161.                 null, 
  162.                 null, 
  163.                 this.UserValidator.Delegants2, 
  164.                 startTime, 
  165.                 endTime,
  166.                 this.State,
  167.                 OThinker.H3.Instance.PriorityType.Unspecified,
  168.                 this.txtName.Text.Trim(), 
  169.                 null,
  170.                 this.Approval,
  171.                 OThinker.Data.BoolMatchValue.Unspecified);
  172.             this.WorkItemGrid.BindDataGrid(this.WorkItemTable);
  173.         }
  174.     }
  175. }