コード例 #1
0
ファイル: pwd.aspx.cs プロジェクト: yysong822/citydata
    protected void btnModPwd_Click(object sender, EventArgs e)
    {
        string id = Session["UserID"].ToString();

        Model.User user = new Model.User();
        user.UserID   = id;
        user.Password = tbOldPwd.Text;

        Model.User[] mur = dbll.getUsers(user);
        if (mur.Length > 0)
        {
            Model.User mu = new Model.User();
            mu.UserID   = id;
            mu.Password = tbNewPwd.Text;

            if (sbll.updatePwd(mu))
            {
                Response.Write("<script>alert('密码修改成功!');</script>");
            }
            else
            {
                Response.Write("<script>alert('密码修改失败!');</script>");
            }
        }
        else
        {
            Response.Write("<script>alert('旧密码不正确!');</script>");
        }

        tbOldPwd.Text = "";
        tbNewPwd.Text = "";
        tbCfmPwd.Text = "";
    }
コード例 #2
0
ファイル: user.aspx.cs プロジェクト: yysong822/citydata
    protected void gvUsers_RowCommand(object sender, GridViewCommandEventArgs e)
    {
        if (e.CommandName == "Reset")   // 重置该用户密码
        {
            string userID = e.CommandArgument.ToString();

            GridViewRow gvr      = ((GridViewRow)(((LinkButton)(e.CommandSource)).Parent.Parent));
            string      userName = (((Label)gvUsers.Rows[gvr.RowIndex].Cells[2].FindControl("lbUserName_Item")).Text);

            Model.User mu = new Model.User();
            mu.UserID   = userID;
            mu.Password = "******";     // 默认密码

            if (sbll.updatePwd(mu))
            {
                Response.Write(String.Format("<script language=\"javascript\" type=\"text/javascript\">alert('用户:{0} 重置成功!');</script>", userName));
            }
            else
            {
                Response.Write(String.Format("<script language=\"javascript\" type=\"text/javascript\">alert('用户:{0} 重置失败!');</script>", userName));
            }
        }
    }