approvel_select.aspx.cs
资源名称:web.rar [点击查看]
上传用户:xrffrp
上传日期:2022-03-25
资源大小:22155k
文件大小:6k
源码类别:
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_fair_approvel_select : System.Web.UI.Page
- {
- protected void Page_Load(object sender, EventArgs e)
- {
- if (!IsPostBack)
- {
- this.SetTable();
- }
- }
- protected void SetTable()
- {
- int user_id = 0;
- if (Session["user_id"] != null)
- {
- user_id = Convert.ToInt32(Session["user_id"]);
- }
- if (user_id != 0)
- {
- SqlConnection conn = dbConnection.getConnection();
- conn.Open();
- int flag = 0;
- SqlCommand cmd = new SqlCommand("select f.id, f.form_id, f.vacation_begin, f.vacation_end, " +
- "f.business_begin, f.business_end, t.name type, f.vacation_place from OA_TW_APPROVEL_FORM f " +
- "inner join OA_TW_OFF_TYPE t on f.off_type=t.id where emp_id=" + user_id + " order by form_id desc", conn);
- SqlDataReader dr = cmd.ExecuteReader();
- while (dr.Read())
- {
- flag = 1;
- TableRow tr = new TableRow();
- TableCell td = new TableCell();
- td.BorderWidth = Unit.Pixel(1);
- CheckBox chk = new CheckBox();
- chk.ID = dr["id"].ToString() + "-" + dr["form_id"].ToString() + "-" + "OA_TW_APPROVEL_FORM";
- td.Controls.Add(chk);
- tr.Cells.Add(td);
- td = new TableCell();
- td.BorderWidth = Unit.Pixel(1);
- td.Text = dr["form_id"].ToString();
- tr.Cells.Add(td);
- td = new TableCell();
- td.BorderWidth = Unit.Pixel(1);
- td.Text = dr["type"].ToString();
- tr.Cells.Add(td);
- if (dr["type"].ToString().Equals("出差"))
- {
- td = new TableCell();
- td.BorderWidth = Unit.Pixel(1);
- td.Text = dr["business_begin"].ToString();
- tr.Cells.Add(td);
- td = new TableCell();
- td.BorderWidth = Unit.Pixel(1);
- td.Text = dr["business_end"].ToString();
- tr.Cells.Add(td);
- }
- else
- {
- td = new TableCell();
- td.BorderWidth = Unit.Pixel(1);
- td.Text = dr["vacation_begin"].ToString();
- tr.Cells.Add(td);
- td = new TableCell();
- td.BorderWidth = Unit.Pixel(1);
- td.Text = dr["vacation_end"].ToString();
- tr.Cells.Add(td);
- }
- TblForm.Rows.Add(tr);
- }
- dr.Close();
- if (flag == 0)
- {
- cmd = new SqlCommand("select id, form_id, begin_time, end_time from OA_CH_BUSINESS_FORM " +
- "where emp_id=" + user_id + " order by form_id desc", conn);
- dr = cmd.ExecuteReader();
- while (dr.Read())
- {
- flag = 1;
- TableRow tr = new TableRow();
- TableCell td = new TableCell();
- td.BorderWidth = Unit.Pixel(1);
- CheckBox chk = new CheckBox();
- chk.ID = dr["id"].ToString() + "-" + dr["form_id"].ToString() + "-" + "OA_CH_BUSINESS_FORM";
- td.Controls.Add(chk);
- tr.Cells.Add(td);
- td = new TableCell();
- td.BorderWidth = Unit.Pixel(1);
- td.Text = dr["form_id"].ToString();
- tr.Cells.Add(td);
- td = new TableCell();
- td.BorderWidth = Unit.Pixel(1);
- td.Text = "出差";
- tr.Cells.Add(td);
- td = new TableCell();
- td.BorderWidth = Unit.Pixel(1);
- td.Text = dr["begin_time"].ToString();
- tr.Cells.Add(td);
- td = new TableCell();
- td.BorderWidth = Unit.Pixel(1);
- td.Text = dr["end_time"].ToString();
- tr.Cells.Add(td);
- TblForm.Rows.Add(tr);
- }
- dr.Close();
- cmd = new SqlCommand("select f.id, f.form_id, t.name type, f.begin_time, f.end_time from " +
- "OA_CH_OFF_FORM f inner join OA_CH_OFF_TYPE t on f.off_type=t.id where emp_id=" + user_id +
- " order by f.form_id", conn);
- dr = cmd.ExecuteReader();
- while (dr.Read())
- {
- flag = 1;
- TableRow tr = new TableRow();
- TableCell td = new TableCell();
- td.BorderWidth = Unit.Pixel(1);
- CheckBox chk = new CheckBox();
- chk.ID = dr["id"].ToString() + "-" + dr["form_id"].ToString() + "-" + "OA_CH_OFF_FORM";
- td.Controls.Add(chk);
- tr.Cells.Add(td);
- td = new TableCell();
- td.BorderWidth = Unit.Pixel(1);
- td.Text = dr["form_id"].ToString();
- tr.Cells.Add(td);
- td = new TableCell();
- td.BorderWidth = Unit.Pixel(1);
- td.Text = dr["type"].ToString();
- tr.Cells.Add(td);
- td = new TableCell();
- td.BorderWidth = Unit.Pixel(1);
- td.Text = dr["begin_time"].ToString();
- tr.Cells.Add(td);
- td = new TableCell();
- td.BorderWidth = Unit.Pixel(1);
- td.Text = dr["end_time"].ToString();
- tr.Cells.Add(td);
- TblForm.Rows.Add(tr);
- }
- dr.Close();
- }
- if (flag == 0)
- {
- TblForm.Visible = false;
- }
- conn.Close();
- }
- }
- }