using System; using System.Collections.Generic; using System.Linq; using System.Web; using System.Web.UI; using System.Web.UI.WebControls; using System.Data; using System.Globalization; using System.Threading; public partial class MemberMsg : System.Web.UI.Page { public static string cid; public string cinowo_id; public string nickname; protected void Page_Load(object sender, EventArgs e) { litMen.Text = Resources.Cinowo.Nan; litWomen.Text = Resources.Cinowo.Nv; //BtnSubmit.Text = Resources.Cinowo.Registration; RequiredFieldValidator1.ErrorMessage = Resources.Cinowo.QingtianxieUserName; //RequiredFieldValidator2.ErrorMessage = Resources.Cinowo.QingTianXieMima; //RequiredFieldValidator3.ErrorMessage = Resources.Cinowo.ZaiCiShuruPwd; //CompareValidator1.ErrorMessage = Resources.Cinowo.MimaBuYiZhi; RequiredFieldValidator4.ErrorMessage = Resources.Cinowo.EmailNotNull; RegularExpressionValidator1.ErrorMessage = Resources.Cinowo.EmailError; if (!IsPostBack) { if (Session["member"] != null) //登录用户信息 { DataTable dt = (DataTable)Session["member"]; Txtname.Text = dt.Rows[0]["nickname"].ToString(); cinowo_id = dt.Rows[0]["cinowo_id"].ToString(); nickname = dt.Rows[0]["nickname"].ToString(); cid = dt.Rows[0]["Cid"].ToString(); } else { Methods1.Methods1.MsgBox("请登录!", "default.aspx"); } //先查询出该登录会员的信息绑定在页面 string str = "select * from membertab where cid='" + cid + "'"; DataTable dts = DBH.DBHelper.GetDataSet(str); if (dts.Rows.Count > 0) { this.txtmail.Text = dts.Rows[0]["cinowo_id"].ToString(); this.Txtname.Text = dts.Rows[0]["nickname"].ToString(); this.txtphone.Text = dts.Rows[0]["telephone"].ToString(); this.txtpostcode.Text = dts.Rows[0]["postcode"].ToString(); this.txtBirthday.Text = dts.Rows[0]["birthday"].ToString(); if (dts.Rows[0]["sex"].ToString() == "1") { this.tBtnMen.Checked = true; } else { this.tBtnWomen.Checked = true; } this.txtqs.Text = dts.Rows[0]["QS"].ToString(); this.txtXM.Text = dts.Rows[0]["names"].ToString(); this.txtans.Text = dts.Rows[0]["ans"].ToString(); this.txtadress.Text = dts.Rows[0]["address"].ToString(); } } } protected void ImageButton1_Click(object sender, EventArgs e) { string sql = "update membertab set cinowo_id='" + txtmail.Text + "' , sex='" + (tBtnMen.Checked == true ? 1 : 0) + "' , nickname='" + Txtname.Text + "', address='" + txtadress.Text + "', names='" + txtXM.Text + "', birthday='" + txtBirthday.Text + "' , postcode='" + txtpostcode.Text + "', telephone='" + txtphone.Text + "', QS='" + txtqs.Text + "',ans='" + txtans.Text + "' where cid='" + cid + "'"; int i = DBH.DBHelper.ExecuteNonQuery(sql); if (i > 0) { //Session.Clear(); Methods1.Methods1.MsgBox("修改成功,修改后的资料将在下次登录时显示!", "MemberMsg.aspx"); } else { Methods1.Methods1.MsgBox("信息修改失败!", "MemberMsg.aspx"); } } protected override void InitializeCulture() { if (Session["lang"] != null) { string lang = Session["lang"].ToString(); if (!String.IsNullOrEmpty(lang)) { //UICulture - 决定了采用哪一种本地化资源,也就是使用哪种语言 //Culture - 决定各种数据类型是如何组织,如数字与日期 Thread.CurrentThread.CurrentUICulture = new CultureInfo(lang); Thread.CurrentThread.CurrentCulture = CultureInfo.CreateSpecificCulture(lang); base.InitializeCulture(); } } } protected void LinkButton2_Click(object sender, EventArgs e) { Session["Lang"] = "en-us"; Response.Redirect(Request.Url.ToString()); } protected void LinkButton1_Click(object sender, EventArgs e) { Session["Lang"] = "zh-cn"; Response.Redirect(Request.Url.ToString()); } }