Example #1
0
    //员工离职状态
    protected void JobStatus_Click(object sender, EventArgs e)
    {
        string username  = off_username.Text.Trim();                    //用户名
        string jobStatus = Request.Form["jobstatus"].ToString().Trim(); //工作状态

        //查找是否有此用户
        string[] pwd    = new string[1];
        string[] list01 = { "password" };
        sqlTable st     = new sqlTable();

        st.select_onjob(username, pwd, "Login", list01);



        if (pwd[0] == "NULL" || pwd[0] == "null")
        {
            Response.Write("<script>alert('员工姓名输入有误,请重新输入')</script>");
        }
        else
        {
            //更新状态
            string[] list         = { "on_job" };
            string[] source       = { jobStatus };
            string[] selectList   = { "name" };
            string[] selectSource = { username };
            int      res          = st.table_update("Login", list, source, selectList, selectSource);

            if (res == 1)
            {
                Response.Write("<script>alert('修改成功')</script>");
                Page_Load(sender, e);
            }
            else
            {
                Response.Write("<script>alert('语法错误')</script>");
            }
        }
    }