using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;

public partial class member_memberedit : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            if (Session["membername"] != null)
            {
                Lab_username.Text = Session["membername"].ToString();
            }
            Fm.Bussiness.public_select ps = new Fm.Bussiness.public_select();
            DataView dv = ps.Getps("Fm_user", "u_nc", "u_id=" + int.Parse(Session["memberid"].ToString()) + "");
            nicheng.Text = dv[0]["u_nc"].ToString();
        }
    }
    protected void ImageButton1_Click(object sender, ImageClickEventArgs e)
    {
        Fm.Bussiness.public_select ps = new Fm.Bussiness.public_select();

        string pass = "";
        int uid = int.Parse(Session["memberid"].ToString()); ;
        //判断是否输入了密码
        if (password.Text.Trim() != "")
        {
            pass = FormsAuthentication.HashPasswordForStoringInConfigFile(password.Text.Trim(), "MD5");
        }
        else
        {
            Response.Write("asdf");
            //查询出原来的密码
            DataView dv = ps.Getps("Fm_user","u_pass","u_id="+uid+"");
            pass = dv[0]["u_pass"].ToString();
           // Response.Write(uid);
        }
        if(ps.Queryps("update Fm_user set u_pass='"+pass+"',u_nc='"+nicheng.Text+"' where u_id="+uid+""))
        {
            Response.Redirect("Erro.aspx?eid=个人信息修改成功,如果改动了密码,以后请用新密码登陆!&url=right.aspx");
        }
    }
}
