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

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. using System.Drawing;
  13. public partial class web_approvel_employee_where_1_d : System.Web.UI.Page
  14. {
  15.     protected void Page_Load(object sender, EventArgs e)
  16.     {
  17.         if (!IsPostBack)
  18.         {
  19.             LoginDAO.CheckLogin(Session, Response, "../", 2);
  20.             GridView1.DataKeyNames = new string[] { "id" };
  21.            
  22.         }
  23.     }
  24.     protected void Setcolor(object sender, GridViewRowEventArgs e) 
  25.     {
  26.         
  27.         if (e.Row.RowType == DataControlRowType.DataRow)
  28.         {
  29.             ArrayList time = new ArrayList();
  30.             ArrayList status = new ArrayList();
  31.             SqlConnection conn = dbConnection.getConnection();
  32.             conn.Open();
  33.             SqlCommand cmd = new SqlCommand("select card_status,card_t,card_date from oa_card_time as a left join oa_employee as b on a.emp_card_no=b.work_card_no1 where   " +
  34.             "a.id=" + GridView1.DataKeys[e.Row.RowIndex].Value.ToString(), conn);
  35.             SqlDataReader dr = cmd.ExecuteReader();
  36.             while (dr.Read())
  37.             {
  38.                
  39.                 Label label1 = (Label)e.Row.FindControl("Label1");
  40.                 if (dr["card_status"].ToString().Equals("2"))
  41.                 {
  42.                     label1.Text = dr["card_t"].ToString();
  43.                     label1.ForeColor = Color.Red;
  44.                 }
  45.                 else
  46.                 {
  47.                     label1.Text = dr["card_t"].ToString();
  48.                     label1.ForeColor = Color.Black;
  49.                 }
  50.             }
  51.          /*   for (int i = 0; i < time.Count; i++)
  52.             {
  53.                 Label label1 = (Label)e.Row.FindControl("Label1");
  54.                 if (status[i].ToString().Equals("2"))
  55.                 {
  56.                     label1.Text = time[i].ToString();
  57.                     label1.ForeColor = Color.Red;
  58.                 }
  59.                 else
  60.                 {
  61.                     label1.Text = time[i].ToString();
  62.                     label1.ForeColor = Color.Black;
  63.                 }
  64.             }
  65. */
  66.                 dr.Close();
  67.             conn.Close();
  68.         }
  69.         
  70.           
  71.     }
  72. }