📄 updateuserinfo.aspx.cs
字号:
using System;
using System.Collections;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Web;
using System.Web.SessionState;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.HtmlControls;
using System.Configuration;
using HouseSystem.Components;
using HouseSystem.Modal;
namespace HouseSystem.UserCenter
{
/// <summary>
/// UpdateUserInfo 的摘要说明。
/// </summary>
public class UpdateUserInfo : System.Web.UI.Page
{
protected System.Web.UI.WebControls.Label lblUserName;
protected System.Web.UI.WebControls.RadioButtonList radSex;
protected System.Web.UI.WebControls.Label lblMsg;
protected System.Web.UI.HtmlControls.HtmlInputText txtQuestion;
protected System.Web.UI.HtmlControls.HtmlInputText txtAnswer;
protected System.Web.UI.HtmlControls.HtmlInputText txtName;
protected System.Web.UI.HtmlControls.HtmlInputText txtTel1;
protected System.Web.UI.HtmlControls.HtmlInputText txtTel2;
protected System.Web.UI.HtmlControls.HtmlInputText txtEmail;
protected System.Web.UI.HtmlControls.HtmlInputButton btnSubmit;
protected string strType;
protected string WebName;
private void Page_Load(object sender, System.EventArgs e)
{
// 在此处放置用户代码以初始化页面
this.WebName = ConfigurationSettings.AppSettings["My_WebName"];
if (!this.Page.IsPostBack)
{
this.lblUserName.Text = Tools.GetUserCookie("UserName");
string text1 = Tools.GetUserCookie("UserId");
DataRow row1 = Users.GetUserInfoByID(text1);
this.txtQuestion.Value = row1["Question"].ToString();
this.txtAnswer.Value = row1["Answer"].ToString();
this.txtName.Value = row1["Name"].ToString();
this.txtTel1.Value = row1["Tel1"].ToString();
this.txtTel2.Value = row1["Tel2"].ToString();
this.txtEmail.Value = row1["Email"].ToString();
this.radSex.SelectedValue = row1["Sex"].ToString();
}
}
#region Web 窗体设计器生成的代码
override protected void OnInit(EventArgs e)
{
//
// CODEGEN: 该调用是 ASP.NET Web 窗体设计器所必需的。
//
InitializeComponent();
base.OnInit(e);
}
/// <summary>
/// 设计器支持所需的方法 - 不要使用代码编辑器修改
/// 此方法的内容。
/// </summary>
private void InitializeComponent()
{
this.btnSubmit.ServerClick += new System.EventHandler(this.btnSubmit_ServerClick);
this.Load += new System.EventHandler(this.Page_Load);
}
#endregion
private void btnSubmit_ServerClick(object sender, System.EventArgs e)
{
UserInfo info1 = new UserInfo();
info1.UserId = int.Parse(Tools.GetUserCookie("UserId"));
info1.Question = Tools.CheckStrInput(this.txtQuestion.Value);
info1.Answer = Tools.CheckStrInput(this.txtAnswer.Value);
info1.Name = Tools.CheckStrInput(this.txtName.Value);
info1.Sex = byte.Parse(this.radSex.SelectedValue);
info1.Tel1 = Tools.CheckStrInput(this.txtTel1.Value);
info1.Tel2 = Tools.CheckStrInput(this.txtTel2.Value);
info1.Email = Tools.CheckStrInput(this.txtEmail.Value);
int num1 = Users.Update(info1);
if (num1 > 0)
{
base.Response.Redirect("Index.aspx", false);
}
else
{
this.lblMsg.Text = "修改失败,请重试!";
}
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -