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

OA系统

开发平台:

ASP/ASPX

  1. using System;
  2. using System.Data;
  3. using System.Data.SqlClient;
  4. using System.Configuration;
  5. using System.Collections;
  6. using System.Web;
  7. using System.Web.Security;
  8. using System.Web.UI;
  9. using System.Web.UI.WebControls;
  10. using System.Web.UI.WebControls.WebParts;
  11. using System.Web.UI.HtmlControls;
  12. public partial class web_equipment_finish_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.             GridView1.DataKeyNames = new string[] { "form_id" };
  20.         }
  21.         if (Request.QueryString["form_id"] != null)
  22.         {
  23.             this.SetData(Request.QueryString["form_id"]);
  24.             this.SetTable(Request.QueryString["form_id"]);
  25.         }
  26.     }
  27.     public void SetData(string id)
  28.     {
  29.         MultiView2.ActiveViewIndex = 0;
  30.         GridView2.Visible = true;
  31.         Label3.Text = id;
  32.     }
  33.     public void SetTable(string id)
  34.     {
  35.         SqlConnection conn = dbConnection.getConnection();
  36.         conn.Open();
  37.         SqlCommand cmd = new SqlCommand("select operator_id,is_check,is_agree,comment,check_date,step from oa_equipment_flow where form_id='" + id + "'", conn);
  38.         SqlDataReader dr = cmd.ExecuteReader();
  39.         if (dr.HasRows)
  40.         {
  41.             while (dr.Read())
  42.             {
  43.                 TableRow tr = new TableRow();
  44.                 TableCell td = new TableCell();
  45.                 td.BorderWidth = Unit.Pixel(1);
  46.                 td.Text = dr["step"].ToString();
  47.                 tr.Cells.Add(td);
  48.                 td = new TableCell();
  49.                 td.BorderWidth = Unit.Pixel(1);
  50.                 SqlConnection conn1 = dbConnection.getConnection();
  51.                 conn1.Open();
  52.                 SqlCommand sqlcom = new SqlCommand("select emp_name from oa_employee where id='" + dr["operator_id"] + "'", conn1);
  53.                 td.Text = sqlcom.ExecuteScalar().ToString();
  54.                 tr.Cells.Add(td);
  55.                 td = new TableCell();
  56.                 td.BorderWidth = Unit.Pixel(1);
  57.                 td.Text = "審批";
  58.                 tr.Cells.Add(td);
  59.                 td = new TableCell();
  60.                 td.BorderWidth = Unit.Pixel(1);
  61.                 if (dr["is_check"].ToString().Equals("N"))
  62.                 {
  63.                     td.Text = "未處理";
  64.                 }
  65.                 else
  66.                 {
  67.                     td.Text = "已處理";
  68.                 }
  69.                 tr.Cells.Add(td);
  70.                 td = new TableCell();
  71.                 td.BorderWidth = Unit.Pixel(1);
  72.                 if (dr["is_check"].ToString().Equals("Y"))
  73.                 {
  74.                     if (dr["is_agree"].ToString().Equals("Y"))
  75.                     {
  76.                         td.Text = "已同意";
  77.                     }
  78.                     else
  79.                     {
  80.                         td.Text = "不同意";
  81.                     }
  82.                 }
  83.                 else
  84.                 {
  85.                     td.Text = "<br>";
  86.                 }
  87.                 tr.Cells.Add(td);
  88.                 td = new TableCell();
  89.                 td.BorderWidth = Unit.Pixel(1);
  90.                 if (!dr["comment"].ToString().Equals(""))
  91.                 {
  92.                     td.Text = dr["comment"].ToString();
  93.                 }
  94.                 else
  95.                 {
  96.                     td.Text = "<br>";
  97.                 }
  98.                 tr.Cells.Add(td);
  99.                 td = new TableCell();
  100.                 td.BorderWidth = Unit.Pixel(1);
  101.                 if (!dr["check_date"].ToString().Equals(""))
  102.                 {
  103.                     td.Text = dr["check_date"].ToString();
  104.                 }
  105.                 else
  106.                 {
  107.                     td.Text = "<br>";
  108.                 }
  109.                 tr.Cells.Add(td);
  110.                 this.FlowTable.Rows.Add(tr);
  111.             }
  112.         }
  113.     }
  114.         protected void ShowMessageBox(string strMessage)
  115.     {
  116.         Response.Write(string.Format("<script>alert('{0}')</script>", strMessage));
  117.     }
  118.     protected void GridView1_RowDataBound(object sender, GridViewRowEventArgs e)
  119.     {
  120.         int i = 0;
  121.         //执行循环,保证每条数据都可以更新
  122.         for (i = 0; i < GridView1.Rows.Count; i++)
  123.         {
  124.             //首先判断是否是数据行
  125.             if (e.Row.RowType == DataControlRowType.DataRow)
  126.             {
  127.                 //当鼠标停留时更改背景色
  128.                 e.Row.Attributes.Add("onmouseover", "c=this.style.backgroundColor;this.style.backgroundColor='#00A9FF'");
  129.                 //当鼠标移开时还原背景色
  130.                 e.Row.Attributes.Add("onmouseout", "this.style.backgroundColor=c");
  131.             }
  132.         }
  133.         if (e.Row.RowType == DataControlRowType.DataRow)
  134.         {
  135.             e.Row.Attributes.Add("onmouseover", "this.style.cursor='pointer';");
  136.             e.Row.Attributes.Add("onclick", "location.href='finish_list.aspx?form_id=" + GridView1.DataKeys[e.Row.RowIndex].Value.ToString() + "'");
  137.         }
  138.     }
  139. }