SearchWorkList.aspx.cs
上传用户:simon2hong
上传日期:2021-11-18
资源大小:16746k
文件大小:5k
源码类别:

OA系统

开发平台:

C#

  1. using System;
  2. using System.Data;
  3. using System.Configuration;
  4. using System.Collections.Generic;
  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. public partial class Work_SearchWorkList : System.Web.UI.Page
  12. {
  13.     /// <summary>
  14.     /// 模板 
  15.     /// </summary>
  16.     Model.FlowRun MR = new Model.FlowRun();
  17.     /// <summary>
  18.     /// 业务
  19.     /// </summary>
  20.     BLL.FlowRun BR = new BLL.FlowRun();
  21.     /// <summary>
  22.     /// 查询条件
  23.     /// </summary>
  24.     public string TiaoJian
  25.     {
  26.         get
  27.         {
  28.             if (ViewState["Work_SearchWorkListTiaoJian"] == null)
  29.             {
  30.                 return "";
  31.             }
  32.             else
  33.             {
  34.                 return ViewState["Work_SearchWorkListTiaoJian"].ToString();
  35.             }
  36.         }
  37.         set { ViewState["Work_SearchWorkListTiaoJian"] = value; }
  38.     }
  39.     protected void Page_Load(object sender, EventArgs e)
  40.     {
  41.         LoginLogic.MatchLoad("../", "Work_SearchWorkList");
  42.         if (!IsPostBack)
  43.         {
  44.             KeyValue_YHMC.Text = SessionInclude.SessionId;
  45.             DropLoadSet();
  46.             TiaoJian = "";
  47.             MyDataBind(1);
  48.         }
  49.     }
  50.     protected void GridView1_RowDataBound(object sender, GridViewRowEventArgs e)
  51.     {
  52.         for (int i = 0; i < GridView1.Rows.Count; i++)
  53.         {
  54.             //首先判断是否是数据行
  55.             if (e.Row.RowType == DataControlRowType.DataRow)
  56.             {
  57.                 //当鼠标停留时更改背景色
  58.                 e.Row.Attributes.Add("onmouseover", "c=this.style.backgroundColor;this.style.backgroundColor='#F0F0F0'");
  59.                 //当鼠标移开时还原背景色
  60.                 e.Row.Attributes.Add("onmouseout", "this.style.backgroundColor=c");
  61.             }
  62.         }
  63.     }
  64.     protected void AspNetPager1_PageChanging(object src, Wuqi.Webdiyer.PageChangingEventArgs e)
  65.     {
  66.         MyDataBind(e.NewPageIndex);
  67.     }
  68.     /// <summary>
  69.     /// 获取信息
  70.     /// </summary>
  71.     /// <param name="pidx">页号</param>
  72.     public void MyDataBind(int pidx)
  73.     {
  74.        
  75.         AspNetPager1.RecordCount = BR.GetCount(TiaoJian);
  76.         List<Model.FlowRun> LRData = BR.GetPageList(20, pidx, "ID", false, TiaoJian);
  77.         if (LRData.Count == 0)
  78.         {
  79.             Model.FlowRun MR = new Model.FlowRun();
  80.             LRData.Add(MR);
  81.         }
  82.         GridView1.DataSource = LRData;
  83.         GridView1.DataBind();
  84.     }
  85.     /// <summary>
  86.     /// 操作
  87.     /// </summary>
  88.     /// <returns></returns>
  89.     public string CaoZuo()
  90.     {
  91.         string Id = Eval("Id").ToString();
  92.   
  93.         string Rtstr = @" 
  94.                             <!--固定流程有流程编辑器选项 -->
  95.            <img align=""absMiddle"" border=""0"" src=""../images/query.gif"" /><a href=""WorkView.aspx?id=" + Id + @"""><span style=""color: #0000ff;
  96.                                             text-decoration: underline"">查看办理情况</span>
  97.                           ";
  98.         return Rtstr;
  99.     }
  100.     /// <summary>
  101.     /// 流程
  102.     /// </summary>
  103.     /// <returns></returns>
  104.     public string LiuCheng()
  105.     {
  106.         string Rtstr = "请假";
  107.         string Id = Eval("LCID").ToString();
  108.         Rtstr = EnumGet.GetFlowBaseName(int.Parse(Id));
  109.         Rtstr = "<a href='WorkFlowView.aspx?lcid=" + Id + "' target='_blank'>" + Rtstr + "</a>";
  110.         return Rtstr;
  111.     }
  112.     public void DropLoadSet()
  113.     {
  114.         //流程
  115.         KeyValue_LCFL.DataTextField = "LCMC";
  116.         KeyValue_LCFL.DataValueField = "ID";
  117.         KeyValue_LCFL.DataSource = EnumGet.FlowBaseGetEnum();
  118.         KeyValue_LCFL.DataBind();
  119.         KeyValue_LCFL.SelectedIndex = KeyValue_LCFL.Items.Count - 1;
  120.     }
  121.     protected void Button1_Click(object sender, EventArgs e)
  122.     {
  123.         string SqlStr = "LCID=" + KeyValue_LCFL.SelectedValue;
  124.         SqlStr+= " and YXZT='" + KeyValue_YXZT.Text+ "'";
  125.         SqlStr+= " and FQR='" + KeyValue_YHMC.Text + "'";
  126.         if ((DateTimeTextBox1.Text != "") && (DateTimeTextBox2.Text != ""))
  127.         {
  128.             SqlStr+= " and FQSJ>='" + DateTimeTextBox1.Text + "' and FQSJ<='" + DateTimeTextBox2.Text + "'";
  129.         }
  130.         TiaoJian = SqlStr;
  131.         if (RunID_TextBox.Text != "")
  132.         {
  133.             int RunID_Value = 0;
  134.             if (int.TryParse(RunID_TextBox.Text, out RunID_Value))
  135.             {
  136.                 TiaoJian = "ID=" + RunID_Value.ToString();
  137.             }
  138.             else
  139.             {
  140.                 MessageBox.Show("运行ID必须为数字!");
  141.             
  142.             }
  143.         }
  144.         MyDataBind(1);
  145.     }
  146. }