⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 checklvreq.aspx.cs

📁 人事管理系统
💻 CS
字号:
using System;
using System.Collections;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Web;
using System.Web.SessionState;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.HtmlControls;
using System.Data.SqlClient;

namespace BlueHill.CheckLeave
{
	/// <summary>
	/// CheckLvReq 的摘要说明。
	/// </summary>
	public partial class CheckLvReq : System.Web.UI.Page
	{ 

     
  
		protected void Page_Load(object sender, System.EventArgs e)
		{


            if (!IsPostBack)
            {


                pnlDetail.Visible = false;
                //pnlDenyReason.Visible = false;







                if (Session["EmployeeID"].ToString() == null)
                {
                    lblMessage.Text = "登录信息丢失,请重新登录!";
                    lblMessage.Visible = true;
                    return;
                }
                string ygzc = "";
                string strsql = "select * from 员工表  where 员工编号='" + Session["EmployeeID"].ToString() + "'";
                SqlDataReader rd;
                SqlConnection conn = db.mysqll();
                conn.Open();
                SqlCommand cmd = new SqlCommand(strsql, conn);
                rd = cmd.ExecuteReader();
            
                if (rd.Read())
                {
              

                    ygzc = rd["员工职位名称"].ToString();
                   
                }
                Label1.Text = ygzc; 

                rd.Close();
              
               
                

                
              //  string strsql = "select 员工职位名称 from 员工表 where 员工编号='" + Session["EmployeeID"].ToString() + "' ";
              ////string ygzc = "";
              //  SqlDataReader rd;
              //  SqlConnection conn = db.mysqll();
              //  conn.Open();
              //  SqlCommand cmd = new SqlCommand(strsql, conn);
              //  //ygzc = (string)cmd.ExecuteScalar();

              //  rd = cmd.ExecuteReader();




              //  rd.Read();

              //  if (rd.Read())
              //  {

              //      Label1 .Text  = rd["员工职位名称"].ToString();

              //  }
              //  rd.Close();




                if (Label1.Text !="经理")
                {
                    lblMessage.Text = "对不起,该网页属经理专用,请退出!";
                    lblMessage.Visible = true;
                    return;
                }
                conn.Close();

             
                //RefreshPage();

            }
		}

		
		
		/// <summary>
		/// 设计器支持所需的方法 - 不要使用代码编辑器修改
		/// 此方法的内容。
		/// </summary>
		private void InitializeComponent()
		{    
		}
	
        protected void Header1_Load(object sender, EventArgs e)
        {

        }
        protected void btnOK_Click(object sender, EventArgs e)
        {
            string ly = "";
            ly = txtDenyReason.Text.ToString();
            if (ly == "")
            {
                Response.Write("<script>alert('否决理由不能为空!')</script>");
                return;
            }

            string pzhqj = "update 员工请假表 set 拒绝申请的理由='" + ly + "'   where  请假申请编号='" +int.Parse(lblLeaveID.Text)+"'";
            SqlConnection conn = db.mysqll();
            conn.Open();
            SqlCommand cmd = new SqlCommand(pzhqj, conn);
            cmd.ExecuteNonQuery();
            conn.Close();



        }
        protected void btnCancel_Click(object sender, EventArgs e)
        {
            pnlDenyReason.Visible = false;
        }
        void RefreshPage()
        {

            int iApproverID;

            //检查员工的登录信息是否丢失,是则显示出错信息。
            if (Session["EmployeeID"] == null)
            {
                lblMessage.Text = "登录信息丢失,请重新登录!";
                lblMessage.Visible = true;
                return;
            }

            //'获取保存在 Session 中的审核者的员工编号信息。
            iApproverID = int.Parse((string)Session["EmployeeID"]);

            DataSet dsResult = new DataSet();

            //重设界面控件的显示方式。
            pnlDetail.Visible = false;
            pnlDenyReason.Visible = false;
            grdResult.Visible = false;
            lblMessage.Visible = false;

            //在数据库中查找登录者要审核的所有请假记录。
            string strsql = "select * from 员工请假表  where 审核者编号='" + Session["EmployeeID"] + "'";
            SqlConnection conn = db.mysqll();
            conn.Open();
            SqlDataAdapter myda = new SqlDataAdapter(strsql, conn);
            //DataSet myds = new DataSet();
            //sqlcon.Open();
            //myda.Fill(myds, "请假申请编号");
            //GridView1.DataSource = myds;
            myda.Fill(dsResult,"请假申请编号");
																																
            
            if (dsResult.Tables[0].Rows.Count > 0)
            {
                //找到了要审批的记录,则以 DataGrid 的形式显示结果。
                grdResult.DataSource = dsResult.Tables[0];
                grdResult.DataBind();
                grdResult.Visible = true;
            }
            else
            {
                //没有找到任何记录,则显示提示信息。
                lblMessage.Text = "没有要审批的记录!";
                lblMessage.Visible = true;
                return;
            }
        }
        protected void txtDenyReason_TextChanged(object sender, EventArgs e)
        {

        }
        protected void grdResult_SelectedIndexChanged(object sender, EventArgs e)
        {

        }
        protected void grdResult_ItemCommand(object source, DataGridCommandEventArgs e)
        {

           


            if (e.CommandName == "Approve")
                
            {
                  lblLeaveID.Text = e.Item.Cells[0].Text;

                  string pzh = "update 员工请假表 set 申请状态='已批准'   where  请假申请编号='" + int.Parse(lblLeaveID.Text) + "' ";
                SqlConnection conn = db.mysqll();
                conn.Open();
                SqlCommand cmd = new SqlCommand(pzh,conn);
                cmd.ExecuteNonQuery();
                conn.Close();


            }
            if (e.CommandName == "Deny")
            {

               
                lblLeaveID.Text = e.Item.Cells[0].Text;
                txtDenyReason.Text = "";
                pnlDenyReason.Visible = true;
                pnlDetail.Visible = false;


            }
            if (e.CommandName == "Detail")
            {
                lblReason.Text = e.Item.Cells[5].Text;
                pnlDetail.Visible = true;
                pnlDenyReason.Visible = false;

            
            }
        }
}
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -