考勤查看.aspx.cs
资源名称:web.rar [点击查看]
上传用户:xrffrp
上传日期:2022-03-25
资源大小:22155k
文件大小:10k
源码类别:
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;
- public partial class web_Default2 : System.Web.UI.Page
- {
- protected void Page_Load(object sender, EventArgs e)
- {
- }
- protected void Calendar1_SelectionChanged(object sender, EventArgs e)
- {
- Calendar1.Visible = false;
- string year = Calendar1.SelectedDate.Year.ToString();
- string month = Calendar1.SelectedDate.Month.ToString();
- if (month.Length == 1)
- {
- month = "0" + month;
- }
- string day = Calendar1.SelectedDate.Day.ToString();
- if (day.Length == 1)
- {
- day = "0" + day;
- }
- TextBox1.Text = year + "-" + month + "-" + day ;
- TextBox1.Focus();
- }
- protected void Calendar2_SelectionChanged(object sender, EventArgs e)
- {
- Calendar2.Visible = false;
- string year = Calendar2.SelectedDate.Year.ToString();
- string month = Calendar2.SelectedDate.Month.ToString();
- if (month.Length == 1)
- {
- month = "0" + month;
- }
- string day = Calendar2.SelectedDate.Day.ToString();
- if (day.Length == 1)
- {
- day = "0" + day;
- }
- TextBox2.Text = year + "-" + month + "-" + day ;
- TextBox2.Focus();
- }
- protected void ImageButton1_Click(object sender, ImageClickEventArgs e)
- {
- if (Calendar1.Visible == true)
- {
- Calendar1.Visible = false;
- Calendar1.Focus();
- }
- else
- {
- Calendar1.Visible = true;
- Calendar1.Focus();
- }
- }
- protected void ImageButton2_Click(object sender, ImageClickEventArgs e)
- {
- if (Calendar2.Visible == true)
- {
- Calendar2.Visible = false;
- Calendar2.Focus();
- }
- else
- {
- Calendar2.Visible = true;
- Calendar2.Focus();
- }
- }
- protected void Button1_Click(object sender, EventArgs e)
- {
- Table1.Visible = true;
- SqlConnection conn2 = dbConnection.getConnection();
- conn2.Open();
- SqlCommand sqlcomm2 = new SqlCommand("select * from oa_pos_type where department='"+ DropDownList2.Text +"'" , conn2);
- SqlDataReader comm2 = sqlcomm2.ExecuteReader();
- while (comm2.Read())
- {
- TableRow tr1 = new TableRow();
- TableCell tddd1 = new TableCell();
- tddd1.BorderWidth = Unit.Pixel(1);
- Label label1 = new Label();
- label1.BorderStyle = BorderStyle.None;
- label1.Text = comm2["type"].ToString();
- tddd1.Controls.Add(label1);
- tr1.Cells.Add(tddd1);
- TableCell tddd2 = new TableCell();
- tddd2.BorderWidth = Unit.Pixel(1);
- label1 = new Label();
- label1.BorderStyle = BorderStyle.None;
- label1.Text = comm2["bengin_time"].ToString();
- tddd2.Controls.Add(label1);
- tr1.Cells.Add(tddd2);
- TableCell tddd3 = new TableCell();
- tddd3.BorderWidth = Unit.Pixel(1);
- label1 = new Label();
- label1.BorderStyle = BorderStyle.None;
- label1.Text = comm2["end_time"].ToString();
- tddd3.Controls.Add(label1);
- tr1.Cells.Add(tddd3);
- Table1.Rows.Add(tr1);
- }
- comm2.Close();
- conn2.Close();
- TableRow tr2 = new TableRow();
- TableCell td1 = new TableCell();
- td1.BorderWidth = Unit.Pixel(1);
- Label label = new Label();
- label.BorderStyle = BorderStyle.None;
- label.Text = "姓名";
- td1.Controls.Add(label);
- tr2.Cells.Add(td1);
- TableCell td2 = new TableCell();
- td2.BorderWidth = Unit.Pixel(1);
- label = new Label();
- label.BorderStyle = BorderStyle.None;
- label.Text = "日期";
- td2.Controls.Add(label);
- tr2.Cells.Add(td2);
- TableCell td3 = new TableCell();
- td3.BorderWidth = Unit.Pixel(1);
- label = new Label();
- label.BorderStyle = BorderStyle.None;
- label.Text = "班别";
- td3.Controls.Add(label);
- tr2.Cells.Add(td3);
- TableCell td4 = new TableCell();
- td4.BorderWidth = Unit.Pixel(1);
- label = new Label();
- label.BorderStyle = BorderStyle.None;
- label.Text = "上班";
- td4.Controls.Add(label);
- tr2.Cells.Add(td4);
- TableCell td5 = new TableCell();
- td5.BorderWidth = Unit.Pixel(1);
- label=new Label ();
- label.BorderStyle = BorderStyle.None;
- label.Text = "下班";
- td5.Controls.Add(label);
- tr2.Cells.Add(td5);
- Table1.Rows.Add(tr2);
- SqlConnection conn = dbConnection.getConnection();
- conn.Open();
- SqlCommand sqlcom = new SqlCommand("select distinct name from OA_KAOQIN_PBB where department_name = '" +DropDownList2.Text + "'", conn);
- SqlDataReader dr = sqlcom.ExecuteReader();
- while (dr.Read())
- {
- TableRow tr3 = new TableRow();
- TableCell tdd1 = new TableCell();
- tdd1.BorderWidth = Unit.Pixel(1);
- Label lb1 = new Label();
- lb1.BorderStyle = BorderStyle.None;
- lb1.Text = Convert.ToString(dr["name"]);
- tdd1.Controls.Add(lb1);
- tr3.Controls.Add(tdd1);
- Table1.Rows.Add(tr3);
- SqlConnection conn3 = dbConnection.getConnection();
- conn3.Open();
- SqlCommand sqlcom3 = new SqlCommand("select * from OA_KAOQIN_PBB where (name = '" + Convert.ToString(dr["name"]) + "') and (data between '" + Convert.ToString(TextBox1.Text).Substring(0, 10) + "'and '" + Convert.ToString(TextBox2.Text).Substring(0, 10) + "')", conn3);
- SqlDataReader comm3 = sqlcom3.ExecuteReader();
- while (comm3.Read())
- {
- TableRow tr4 = new TableRow();
- TableCell tdd2 = new TableCell();
- tdd2.BorderWidth = Unit.Pixel(1);
- Label lb2 = new Label();
- lb2.BorderStyle = BorderStyle.None;
- lb2.Text = "";
- tdd2.Controls.Add(lb2);
- tr4.Controls.Add(tdd2);
- TableCell tdd3 = new TableCell();
- tdd3.BorderWidth = Unit.Pixel(1);
- Label lb3 = new Label();
- lb3.BorderStyle = BorderStyle.None;
- lb3.Text = Convert.ToString(comm3["data"]).Substring(0, 10);
- tdd3.Controls.Add(lb3);
- tr4.Controls.Add(tdd3);
- TableCell tdd4 = new TableCell();
- tdd4.BorderWidth = Unit.Pixel(1);
- Label lb4 = new Label();
- lb4.BorderStyle = BorderStyle.None;
- lb4.Text = Convert.ToString(comm3["banbie"]);
- tdd4.Controls.Add(lb4);
- tr4.Controls.Add(tdd4);
- SqlConnection conn1 = dbConnection.getConnection();
- conn1.Open();
- SqlCommand sqlcom1 = new SqlCommand("select f.zao as zao,f.wan as wan from OA_KAOQIN_JL as f,OA_EMPLOYEE as g where f.card_id=g.work_card_no1 and f.data='" + Convert.ToString(comm3["data"]).Substring(0, 10) + "' and g.emp_name='" + Convert.ToString(dr["name"]) + "'", conn1);
- SqlDataReader comm = sqlcom1.ExecuteReader();
- while (comm.Read())
- {
- string zao = Convert.ToString(comm["zao"]);
- string wan = Convert.ToString(comm["wan"]);
- TableCell tdd5 = new TableCell();
- tdd5.BorderWidth = Unit.Pixel(1);
- Label lb5 = new Label();
- lb5.BorderStyle = BorderStyle.None;
- if (zao.Equals(""))
- {
- lb5.Text = "";
- }
- else
- {
- lb5.Text = zao.Substring(0, 2) + ":" + zao.Substring(2, 2) + ":" + zao.Substring(4, 2);
- }
- tdd5.Controls.Add(lb5);
- tr4.Controls.Add(tdd5);
- TableCell tdd6 = new TableCell();
- tdd6.BorderWidth = Unit.Pixel(1);
- Label lb6 = new Label();
- lb6.BorderStyle = BorderStyle.None;
- if (wan.Equals(""))
- {
- lb6.Text = "";
- }
- else
- {
- lb6.Text = wan.Substring(0, 2) + ":" + wan.Substring(2, 2) + ":" + wan.Substring(4, 2);
- }
- tdd6.Controls.Add(lb6);
- tr4.Controls.Add(tdd6);
- Table1.Rows.Add(tr4);
- }
- comm.Close();
- conn1.Close();
- }
- comm3.Close();
- conn3.Close();
- }
- dr.Close();
- conn.Close();
- this.form1.Controls.Add(Table1);
- }
- }