Пример #1
0
    protected void imgBtnModifyPwd_Click1(object sender, ImageClickEventArgs e)
    {
        Usersmr user = new Usersmr();//����Usersmr����user

        user.LoadData(Session["userID"].ToString());
        // string txtOldPwdMD5 = System.Web.Security.FormsAuthentication.HashPasswordForStoringInConfigFile(txtOldPwd.Text.Trim(), "MD5").ToString();
        string txtOldPwdMD5 = user.GetMd5(txtOldPwd.Text.Trim());

        if (user.UserPwd == txtOldPwdMD5)//��֤�û�����ԭ�����Ƿ���ȷ
        {
            // string txtNewPwdMD5 = System.Web.Security.FormsAuthentication.HashPasswordForStoringInConfigFile(txtNewPwd.Text.Trim(), "MD5").ToString();
            string txtNewPwdMD5 = user.GetMd5(txtNewPwd.Text.Trim());
            user.UserPwd = txtNewPwdMD5.ToString().Trim();
            if (user.ModifyPassword(this.Session["userID"].ToString()))//�����û�����
            {
                lblMessage.Text = "�ɹ��޸�����!";
            }
            else//�޸�����ʧ��
            {
                lblMessage.Text = "�޸�����ʧ��!";
            }
        }
        else//ԭ�������
        {
            lblMessage.Text = "����ԭ�������,����������!";
        }
    }
Пример #2
0
    protected void imgBtnModifyPwd_Click1(object sender, ImageClickEventArgs e)
    {
        Usersmr user = new Usersmr();//创建Usersmr对象user

        user.LoadData(Session["userID"].ToString());
        //string txtOldPwdMd5 = System.Web.Security.FormsAuthentication.HashPasswordForStoringInConfigFile(txtOldPwd.Text.Trim(), "MD5").ToString();
        string txtOldPwdMd5 = user.GetMd5(txtOldPwd.Text.Trim());

        if (user.UserPwd == txtOldPwdMd5)//验证用户输入原密码是否正确
        {
            //string txtNewPwdMD5 = System.Web.Security.FormsAuthentication.HashPasswordForStoringInConfigFile(txtNewPwd.Text.Trim(), "MD5").ToString();
            string txtNewPwdMD5 = user.GetMd5(txtNewPwd.Text.Trim());
            user.UserPwd = txtNewPwdMD5;
            if (user.ModifyPassword(this.Session["userID"].ToString()))//更改用户密码
            {
                lblPwd.Text = "成功修改密码!";
            }
            else//修改密码失败
            {
                lblPwd.Text = "修改密码失败!";
            }
        }
        else//原密码错误
        {
            lblPwd.Text = "输入原密码错误,请重新输入!";
        }
    }
Пример #3
0
    private void InitData()
    {
        CheckUser();

        string loginName = Session["userID"].ToString();

        Usersmr user = new Usersmr();

        user.LoadData(loginName);

        string sql = "Select * from [TreeMenu] Where [Duty] in (";

        foreach (string duty in user.Duties)
        {
            sql += SQLString.GetQuotedString(duty) + ",";
        }
        sql += "'#')";

        DataBase  db = new DataBase();
        DataTable dt = db.GetDataTable(sql);

        Tree tree = new Tree();

        LabelTree.Text += tree.CreateTree(dt);
    }
Пример #4
0
    private void RedirectPage()
    {
        if (Session["userID"] == null)
        {
            Response.Redirect("Login.aspx");
        }

        Usersmr user   = new Usersmr();
        string  userid = Session["userID"].ToString();

        user.LoadData(userid);
        switch (user.RoleName)
        {
        case "管理员":
            Response.Redirect("PwdModify.aspx");
            break;

        case "教师":
            Response.Redirect("PwdModify.aspx");
            break;

        case "学生":
            Response.Redirect("StudentIndex.aspx");
            break;

        default:
            break;
        }
    }
 protected void Page_Load(object sender, EventArgs e)
 {
     if (!Page.IsPostBack)
     {
         string  loginName = Session["userID"].ToString();
         Usersmr user      = new Usersmr();
         user.LoadData(loginName);
         labUser.Text = user.UserName;
     }
 }
 protected void Page_Load(object sender, EventArgs e)
 {
     if (!Page.IsPostBack)
     {
         string  loginName = Session["userID"].ToString();
         Usersmr user      = new Usersmr();
         user.LoadData(loginName);
         labUser.Text = user.UserName;
         GridViewBind();
     }
     ImageButtonResetPassword.Attributes.Add("onClick", "javascript:return confirm('确定重置密码?');");
     ImageButtonDelete.Attributes.Add("onclick", "javascript:return confirm('确定删除?');");
 }
 protected void Page_Load(object sender, EventArgs e)
 {
     if (!Page.IsPostBack)
     {
         string  loginName = Session["userID"].ToString();
         Usersmr user      = new Usersmr();
         user.LoadData(loginName);
         labUser.Text = user.UserName;
         this.txtDepartmentId.Attributes.Add("nullable", "yes");    //是否为空
         this.txtDepartmentName.Attributes.Add("nullable", "yes");  //是否为空
         this.imgBtnSave.Attributes["onclick"] = "javascript:return verifyAll(window.Form1);";
     }
 }
Пример #8
0
 protected void Page_Load(object sender, EventArgs e)
 {
     if (!IsPostBack)
     {
         InitData();      //初始化科目列表框
         ScoreInitData(); //初始化成绩
         labUser.Text = Session["userID"].ToString();
         Usersmr user   = new Usersmr();
         string  userid = Session["userID"].ToString();
         user.LoadData(userid);
         lblName.Text = user.UserName;
     }
 }
Пример #9
0
 protected void Page_Load(object sender, EventArgs e)
 {
     if (!IsPostBack)
     {
         //应用Session对象存储用户名
         string loginName = Session["userID"].ToString();
         //实例化公共类Usersmr
         Usersmr user = new Usersmr();
         user.LoadData(loginName);
         labUser.Text = user.UserName;
         //调用自定义方法绑定数据库中试题信息
         PaperData();
     }
 }
 protected void Page_Load(object sender, EventArgs e)
 {
     if (!Page.IsPostBack)
     {
         string  loginName = Session["userID"].ToString();
         Usersmr user      = new Usersmr();
         user.LoadData(loginName);
         labUser.Text = user.UserName;
         InitDDLData();             //初始化考试科目下拉列表框
         if (Request["ID"] != null) //如果是修改题目,初始化数据
         {
             InitData();
         }
     }
 }
Пример #11
0
 protected void Page_Load(object sender, EventArgs e)
 {
     if (Convert.ToString(Session["userID"]) == null)
     {
         Response.Write("<script language=javascript>location='Login.aspx'</script>");
     }
     if (!Page.IsPostBack)
     {
         this.txtOldPwd.Focus();
         string  loginName = Session["userID"].ToString();
         Usersmr user      = new Usersmr();
         user.LoadData(loginName);
         labUser.Text = user.UserName;
     }
 }
Пример #12
0
 protected void Page_Load(object sender, EventArgs e)
 {
     if (!IsPostBack)
     {
         //应用Session记录用户ID号
         string loginName = Session["userID"].ToString();
         //实例化公共类Usersmr
         Usersmr user = new Usersmr();
         user.LoadData(loginName);
         //显示登录的用户角色
         labUser.Text = user.UserName;
         //调用自定义方法InitData()进行权限设置
         InitData();
     }
 }