Esempio n. 1
0
    protected void btnOk_Click(object sender, EventArgs e)
    {
        string id     = Request.Cookies["id"].Value.ToString();
        int    typeId = 0;

        //  typeId =Convert.ToInt32(Session["typeId"].ToString());
        typeId = Convert.ToInt32(Request.Cookies["typeId"].Value);
        string pwd    = tbANewPwd.Text;
        string oldPwd = tbOldPwd.Text;

        Fannie.Users user = new Fannie.Users();
        DataTable    dt   = user.IsPwdRight(id, oldPwd, typeId).Tables[0];

        if (dt.Rows.Count == 0)
        {
            Response.Write("<script>alert('原密码输入错误');location.href='ModifyPwd.aspx'</script>");
        }
        else
        {
            if (user.ModifyPwd(id, pwd, typeId) > 0)
            {
                Response.Write("<script>alert('修改成功');location.href='ModifyPwd.aspx'</script>");
            }
            else
            {
                Response.Write("<script>alert('修改失败');location.href='ModifyPwd.aspx'</script>");
            }
        }
    }
Esempio n. 2
0
 protected void Button2_Click(object sender, EventArgs e)
 {
     if (tbTID.Text != "")
     {
         Fannie.Users user = new Fannie.Users();
         if (user.ModifyPwd(tbTID.Text, tbTID.Text, 1) > 0)
         {
             Response.Write("<script>alert('密码重置已经重置为该教师的账号')</script>");
         }
     }
 }
Esempio n. 3
0
 protected void btnOk_Click(object sender, EventArgs e)
 {
     if (tbID.Text != "")
     {
         Fannie.Users user = new Fannie.Users();
         if (user.ModifyPwd(tbID.Text, tbID.Text, 2) > 0)
         {
             Response.Write("<script>alert('密码重置已经重置为该学生的学号')</script>");
         }
     }
 }
Esempio n. 4
0
    private void SetUserName()
    {
        Fannie.Users user = new Fannie.Users();
        string       name = user.GetUserName(id, TypeId);

        Session["user"] = name;
        Response.Cookies["user"].Value = name;
        //HttpCookie cookie = new HttpCookie("login");
        //System.Text.Encoding enc = System.Text.Encoding.GetEncoding("gb2312");
        //cookie["user"] = HttpUtility.UrlEncode(name, enc);
        tvRole.Nodes[0].Text = "桌面" + "(" + name + ")";
    }
Esempio n. 5
0
 protected void Page_Load(object sender, EventArgs e)
 {
     if (Request.Cookies["id"] != null)
     {
         id = Request.Cookies["id"].Value.ToString();
     }
     if (!IsPostBack)
     {
         GetStuName();
     }
     if (Request.QueryString["sid"] != null)
     {
         sid            = Request.QueryString["sid"].ToString();
         txt_theme.Text = "回复:‘" + Request.QueryString["title"].ToString() + "’的答疑";
         Fannie.Users user = new Fannie.Users();
         tbSendTo.Text      = user.GetUserName(sid, 2);
         ddlTeacher.Visible = false;
     }
 }
Esempio n. 6
0
    protected void btnLogin_Click(object sender, EventArgs e)
    {
        string id   = tbName.Text;
        string pwd  = tbPwd.Text;
        int    type = 0;

        Fannie.Users user = new Fannie.Users();
        if (rblType.SelectedIndex == 0)
        {
            type = 2;
        }
        else if (rblType.SelectedIndex == 2)
        {
            type = 0;
        }
        else if (rblType.SelectedIndex == 1)
        {
            type = 1;
        }
        int re = user.IsUserExist(id, type);

        if (re == 0)
        {
            Response.Write("<script>alert('该用户不存在');location.href='Login.aspx'</script>");
        }
        else if (re == 1)
        {
            DataTable dt = user.IsPwdRight(id, pwd, type).Tables[0];
            if (dt.Rows.Count == 0)
            {
                Response.Write("<script>alert('密码错误');location.href='Login.aspx'</script>");
            }
            else
            {
                Response.Cookies["id"].Value = id.ToString();
                Session["id"] = id.ToString();
                Response.Cookies["typeId"].Value = type.ToString();
                Session["typeId"] = type.ToString();
                Response.Redirect("~/Default.aspx");
            }
        }
    }