blank.aspx.cs
资源名称:web.rar [点击查看]
上传用户:xrffrp
上传日期:2022-03-25
资源大小:22155k
文件大小:7k
源码类别:
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_personnel_curricula_vitae_blank : System.Web.UI.Page
- {
- protected void Page_Load(object sender, EventArgs e)
- {
- if (!IsPostBack)
- {
- LoginDAO.CheckLogin(Session, Response, "../../", 2);
- EmployeeList.DataKeyNames = new string[] { "id" };
- EmployeeDimissionList.DataKeyNames = new string[] { "id" };
- if (Session["p_department_id"] != null)
- {
- SqlConnection conn = dbConnection.getConnection();
- conn.Open();
- SqlCommand cmd = new SqlCommand("select name from OA_DEPARTMENT where id=" + Session["p_department_id"].ToString(), conn);
- try
- {
- string department = cmd.ExecuteScalar().ToString();
- LblTitle2.Text = department + "離職員工列表";
- LblTitle1.Text = department + "在職員工列表";
- LblTitle1.Visible = false;
- LblTitle2.Visible = false;
- if (Request.QueryString["type"].Equals("1"))
- {
- LblTitle2.Visible = true;
- EmployeeDimissionList.Visible = true;
- }
- }
- catch { }
- conn.Close();
- }
- }
- }
- protected void EmployeeList_RowCreated(object sender, GridViewRowEventArgs e)
- {
- if (e.Row.RowType == DataControlRowType.DataRow)
- {
- if (Request.QueryString["type"] == null)
- {
- DateMgr mgr = new DateMgr();
- string time = mgr.getDateTime();
- LinkButton btn = (LinkButton)e.Row.FindControl("LbWhere");
- SqlConnection conn = dbConnection.getConnection();
- conn.Open();
- SqlCommand cmd = new SqlCommand("select f.vacation_begin, f.vacation_end, f.business_begin, f.business_end," +
- " t.name type from OA_TW_APPROVEL_FORM f inner join OA_TW_OFF_TYPE t on f.off_type=t.id where emp_id=" +
- EmployeeList.DataKeys[e.Row.RowIndex].Value.ToString() + " and total_result='同意'", conn);
- SqlDataReader dr = cmd.ExecuteReader();
- int flag = 0;
- while (dr.Read())
- {
- if (dr["type"].ToString().Equals("出差"))
- {
- if (dr["business_begin"].ToString().CompareTo(time) == -1 && dr["business_end"].ToString().CompareTo(time) == 1)
- {
- flag = 1;
- btn.Text = "出差";
- btn.PostBackUrl = "employee_where.aspx?e_id=" + EmployeeList.DataKeys[e.Row.RowIndex].Value.ToString();
- }
- }
- else
- {
- if (dr["vacation_begin"].ToString().CompareTo(time) == -1 && dr["vacation_begin"].ToString().CompareTo(time) == 1)
- {
- flag = 1;
- btn.Text = dr["type"].ToString();
- btn.PostBackUrl = "employee_where.aspx?e_id=" + EmployeeList.DataKeys[e.Row.RowIndex].Value.ToString();
- }
- }
- }
- dr.Close();
- if (flag == 0)
- {
- cmd = new SqlCommand("select begin_time, end_time from OA_CH_BUSINESS_FORM where total_result='同意' and emp_id=" +
- EmployeeList.DataKeys[e.Row.RowIndex].Value.ToString(), conn);
- dr = cmd.ExecuteReader();
- while (dr.Read())
- {
- if (dr["begin_time"].ToString().CompareTo(time) == -1 && dr["end_time"].ToString().CompareTo(time) == 1)
- {
- flag = 1;
- btn.Text = "出差";
- btn.PostBackUrl = "employee_where.aspx?e_id=" + EmployeeList.DataKeys[e.Row.RowIndex].Value.ToString();
- }
- }
- dr.Close();
- }
- if (flag == 0)
- {
- cmd = new SqlCommand("select f.begin_time, f.end_time, t.name type from OA_CH_OFF_FORM f " +
- "inner join OA_CH_OFF_TYPE t on f.off_type=t.id where total_result='同意' and emp_id=" +
- EmployeeList.DataKeys[e.Row.RowIndex].Value.ToString(), conn);
- dr = cmd.ExecuteReader();
- while (dr.Read())
- {
- if (dr["begin_time"].ToString().CompareTo(time) == -1 && dr["end_time"].ToString().CompareTo(time) == 1)
- {
- flag = 1;
- btn.Text = dr["type"].ToString();
- }
- }
- dr.Close();
- }
- if (flag == 0)
- {
- btn.Text = "上班";
- }
- conn.Close();
- }
- }
- }
- protected void EmployeeList_RowDataBound(object sender, GridViewRowEventArgs e)
- {
- //行高亮
- if (e.Row.RowType == DataControlRowType.DataRow)
- {
- try
- {
- LblTitle1.Visible = true;
- e.Row.Attributes.Add("onmouseover", "c=this.style.backgroundColor; this.style.backgroundColor='#c8dafa';this.style.cursor='pointer';");
- e.Row.Attributes.Add("onmouseout", "this.style.backgroundColor=c;");
- e.Row.Attributes.Add("onclick", "window.parent.location.href='employee_show.aspx?e_id=" + EmployeeList.DataKeys[e.Row.RowIndex].Value.ToString() + "'");
- }
- catch { }
- }
- }
- protected void EmployeeDimissionList_RowDataBound(object sender, GridViewRowEventArgs e)
- {
- //行高亮
- if (e.Row.RowType == DataControlRowType.DataRow)
- {
- try
- {
- LblTitle2.Visible = true;
- e.Row.Attributes.Add("onmouseover", "c=this.style.backgroundColor; this.style.backgroundColor='#c8dafa';this.style.cursor='pointer';");
- e.Row.Attributes.Add("onmouseout", "this.style.backgroundColor=c;");
- e.Row.Attributes.Add("onclick", "window.parent.location.href='employee_show.aspx?e_id=" + EmployeeDimissionList.DataKeys[e.Row.RowIndex].Value.ToString() + "'");
- }
- catch { }
- }
- }
- }