employee_where_d.aspx.cs
资源名称:web.rar [点击查看]
上传用户:xrffrp
上传日期:2022-03-25
资源大小:22155k
文件大小:2k
源码类别:
OA系统
开发平台:
ASP/ASPX
- using System;
- using System.Data;
- using System.Configuration;
- using System.Collections;
- using System.Web;
- using System.Web.Security;
- using System.Web.UI;
- using System.Web.UI.WebControls;
- using System.Web.UI.WebControls.WebParts;
- using System.Web.UI.HtmlControls;
- using System.Data.SqlClient;
- using System.Drawing;
- public partial class web_approvel_employee_where_1_d : System.Web.UI.Page
- {
- protected void Page_Load(object sender, EventArgs e)
- {
- if (!IsPostBack)
- {
- LoginDAO.CheckLogin(Session, Response, "../", 2);
- GridView1.DataKeyNames = new string[] { "id" };
- }
- }
- protected void Setcolor(object sender, GridViewRowEventArgs e)
- {
- if (e.Row.RowType == DataControlRowType.DataRow)
- {
- ArrayList time = new ArrayList();
- ArrayList status = new ArrayList();
- SqlConnection conn = dbConnection.getConnection();
- conn.Open();
- 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 " +
- "a.id=" + GridView1.DataKeys[e.Row.RowIndex].Value.ToString(), conn);
- SqlDataReader dr = cmd.ExecuteReader();
- while (dr.Read())
- {
- Label label1 = (Label)e.Row.FindControl("Label1");
- if (dr["card_status"].ToString().Equals("2"))
- {
- label1.Text = dr["card_t"].ToString();
- label1.ForeColor = Color.Red;
- }
- else
- {
- label1.Text = dr["card_t"].ToString();
- label1.ForeColor = Color.Black;
- }
- }
- /* for (int i = 0; i < time.Count; i++)
- {
- Label label1 = (Label)e.Row.FindControl("Label1");
- if (status[i].ToString().Equals("2"))
- {
- label1.Text = time[i].ToString();
- label1.ForeColor = Color.Red;
- }
- else
- {
- label1.Text = time[i].ToString();
- label1.ForeColor = Color.Black;
- }
- }
- */
- dr.Close();
- conn.Close();
- }
- }
- }