📄 myinfo.aspx.cs
字号:
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;
using Model;
using BLL;
using BLL.interfaces;
using System.Collections.Generic;
public partial class myinfo : System.Web.UI.Page
{
IUsers userMessage = Factory.greatUsers();
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
if (Session["userId"] == null)
Response.Redirect("login.aspx");
int i = int.Parse(Session["userId"].ToString().Trim());
ViewState["userId"] =i ;
show();
}
}
private void show()
{
List<Users> list = new List<Users>();
list = userMessage.selOnly((int)ViewState["userId"]);
if (list != null)
{
dlvmyinfo.DataSource = list;
dlvmyinfo.DataBind();
}
else
{
Response.Redirect("error.aspx");
}
}
protected void Button1_Click(object sender, EventArgs e)
{
TextBox txtaddress= dlvmyinfo.FindControl("txtaddress") as TextBox;
TextBox txtphone = dlvmyinfo.FindControl("txtphone") as TextBox;
string address = txtaddress.Text;
string phone = txtphone.Text;
Users user=new Users();
user.Address=address;
user.Phone=phone;
user.Id=(int)ViewState["userId"];
if (userMessage.updateMy(user))
{
Response.Write("<script>alert('服务器已经接受您的请求!')</script>");
}
else
{
Response.Redirect("error.aspx");
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -