my_list.aspx.cs
上传用户:xrffrp
上传日期:2022-03-25
资源大小:22155k
文件大小:4k
源码类别:

OA系统

开发平台:

ASP/ASPX

  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. using System.Data.SqlClient;
  12. public partial class web_computer_my_list : System.Web.UI.Page
  13. {
  14.     protected void Page_Load(object sender, EventArgs e)
  15.     {
  16.         if (!IsPostBack)
  17.         {
  18.             LoginDAO.CheckLogin(Session, Response, "../", 2);
  19.             FairList.DataKeyNames = new string[] { "id" };
  20.             if (Request.QueryString["f_id"] != null)
  21.             {
  22.                 this.SetForm(Request.QueryString["f_id"]);
  23.                 Panform.Visible = true;
  24.                 PnlFlow.Visible = true;
  25.                 FlowList.DataKeyNames = new string[] { "id" };
  26.             }
  27.         }
  28.     }
  29.     protected void FairList_RowDataBound(object sender, GridViewRowEventArgs e)
  30.     {
  31.         if (e.Row.RowType == DataControlRowType.DataRow)
  32.         {
  33.             e.Row.Attributes.Add("onmouseover", "this.style.cursor='pointer';");
  34.             e.Row.Attributes.Add("onclick", "location.href='my_list.aspx?f_id=" + FairList.DataKeys[e.Row.RowIndex].Value.ToString() + "'");
  35.         }
  36.     }
  37.    
  38.        protected void SetForm(string id)
  39.     {
  40.         SqlConnection conn = dbConnection.getConnection();
  41.         conn.Open();
  42.        SqlCommand  cmd = new SqlCommand("select * from oa_computer_form where id=" + id+" order by date1 desc", conn);
  43.         SqlDataReader dr = cmd.ExecuteReader();
  44.         if (dr.Read())
  45.         {
  46.             form_no.Text = dr["form_id"].ToString();
  47.             emp_no.Text = dr["emp_no"].ToString();
  48.             emp_name.Text = dr["emp_name"].ToString();
  49.             emp_dept.Text = dr["emp_dept"].ToString();
  50.             emp_position.Text = dr["emp_position"].ToString();
  51.             date1.Text = dr["date1"].ToString();
  52.             f_item.Text = dr["item1"].ToString();
  53.             Enddate.Text = dr["enddate"].ToString();
  54.             content.Text = dr["content"].ToString();
  55.         }
  56.         dr.Close();
  57.         
  58.         conn.Close();
  59.     }
  60.     
  61.     protected void FlowList_RowCreated(object sender, GridViewRowEventArgs e)
  62.     {
  63.         if (e.Row.RowType == DataControlRowType.DataRow)
  64.         {   
  65.             SqlConnection conn = dbConnection.getConnection();
  66.             conn.Open();
  67.             SqlCommand cmd = new SqlCommand("select apply_type, is_check, is_agree, comment from " +
  68.                 "OA_computer_FORM_FLOW where id=" + FlowList.DataKeys[e.Row.RowIndex].Value.ToString(), conn);
  69.             SqlDataReader dr = cmd.ExecuteReader();
  70.             if (dr.Read())
  71.             {
  72.                 Label label = (Label)e.Row.FindControl("LblApplyType");
  73.                 if (dr["apply_type"].ToString().Equals("1"))
  74.                 {
  75.                     label.Text = "會簽";
  76.                 }
  77.                 else
  78.                 {
  79.                     label.Text = "審批";
  80.                 }
  81.                 label = (Label)e.Row.FindControl("LblIsCheck");
  82.                 if (dr["is_check"].ToString().Equals("N"))
  83.                 {
  84.                     label.Text = "未處理";
  85.                 }
  86.                 else
  87.                 {
  88.                     label.Text = "已處理";
  89.                     label = (Label)e.Row.FindControl("LblIsAgree");
  90.                     if (dr["is_agree"].ToString().Equals("Y"))
  91.                     {
  92.                         label.Text = "已同意";
  93.                     }
  94.                     else
  95.                     {
  96.                         label.Text = "不同意";
  97.                     }
  98.                 }
  99.                 label = (Label)e.Row.FindControl("LblComment");
  100.                 label.Text = dr["comment"].ToString();
  101.             }
  102.             dr.Close();
  103.             conn.Close();
  104.         }
  105.     }
  106.     
  107. }