employee_select_single.aspx.cs
资源名称:web.rar [点击查看]
上传用户:xrffrp
上传日期:2022-03-25
资源大小:22155k
文件大小:4k
源码类别:
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.Net.Mail;
- using System.Net;
- using System.Net.Sockets;
- public partial class web_personnel_curricula_vitae_employee_select_single : System.Web.UI.Page
- {
- protected void Page_Load(object sender, EventArgs e)
- {
- if (!IsPostBack)
- {
- LoginDAO.CheckLogin(Session, Response, "../../", 2);
- if (Session["user"] != null)
- {
- User user = (User)Session["user"];
- Session["department_id"] = user.Department.Id.ToString();
- ArrayList department_id = new ArrayList();
- SqlConnection conn = dbConnection.getConnection();
- conn.Open();
- SqlCommand cmd = new SqlCommand("select id from oa_department where id=" + Session["department_id"] +
- " or last_id=" + Session["department_id"], conn);
- SqlDataReader dr1 = cmd.ExecuteReader();
- while (dr1.Read())
- {
- department_id.Add(dr1["id"].ToString());
- }
- dr1.Close();
- if (Request.QueryString["department_id"] != null)
- {
- cmd = new SqlCommand("select e.id, e.emp_no, e.emp_name, p.name position from " +
- "OA_EMPLOYEE e inner join OA_EMPLOYEE_POSITION p on e.position=p.id where " +
- "department_id=" + Request.QueryString["department_id"] + " and dimission_date=''", conn);
- SqlDataReader dr = cmd.ExecuteReader();
- while (dr.Read())
- {
- ListItem item = new ListItem();
- item.Value = dr["id"].ToString();
- item.Text = dr["emp_no"].ToString() + " " + dr["emp_name"].ToString() + dr["position"].ToString();
- LbEmp.Items.Add(item);
- }
- dr.Close();
- conn.Close();
- }
- if (Request.QueryString["department_id"] == null)
- {
- for (int i = 0; i < department_id.Count; i++)
- {
- cmd = new SqlCommand("select e.id, e.emp_no, e.emp_name, p.name position from " +
- "OA_EMPLOYEE e inner join OA_EMPLOYEE_POSITION p on e.position=p.id where " +
- "department_id=" + department_id[i] + " and dimission_date=''", conn);
- SqlDataReader dr = cmd.ExecuteReader();
- while (dr.Read())
- {
- ListItem item = new ListItem();
- item.Value = dr["id"].ToString();
- item.Text = dr["emp_no"].ToString() + " " + dr["emp_name"].ToString() + dr["position"].ToString();
- LbEmp.Items.Add(item);
- }
- dr.Close();
- }
- conn.Close();
- }
- }
- }
- }
- protected void BtnOk_Click(object sender, EventArgs e)
- {
- try
- {
- Response.Write("<script language='javascript'>window.parent.opener.setValue('" + LbEmp.SelectedValue + "','" + LbEmp.SelectedItem.Text + "');window.parent.close();</script>");
- }
- catch
- {
- Response.Write("<script language='javascript'>alert('請至少選擇一個代理人');</script>");
- }
- }
- }