modifycustomerinfo.aspx.cs
来自「手机网店源码」· CS 代码 · 共 98 行
CS
98 行
using System;
using System.Collections;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.HtmlControls;
using System.Web.Security;
namespace MobileOnlineShop
{
/// <summary>
/// ModifyCustomerDetail 的摘要说明。
/// </summary>
public class ModifyCustomerInfo : System.Web.UI.Page
{
protected System.Web.UI.WebControls.CompareValidator CompareValidator1;
protected System.Web.UI.HtmlControls.HtmlInputButton Submit1;
protected System.Web.UI.HtmlControls.HtmlInputButton Reset2;
protected System.Web.UI.WebControls.TextBox txtPwd;
protected System.Web.UI.WebControls.TextBox txtAPwd;
protected System.Web.UI.WebControls.TextBox txtName;
protected System.Web.UI.WebControls.TextBox txtPhoneNumber;
protected System.Web.UI.WebControls.TextBox txtAddress;
int id = 0;
private void Page_Load(object sender, System.EventArgs e)
{
HttpContext context = HttpContext.Current;
try
{
id = Convert.ToInt32(context.User.Identity.Name);
}
catch
{
id = 0;
}
}
#region Web 窗体设计器生成的代码
override protected void OnInit(EventArgs e)
{
//
// CODEGEN: 该调用是 ASP.NET Web 窗体设计器所必需的。
//
InitializeComponent();
base.OnInit(e);
}
/// <summary>
/// 设计器支持所需的方法 - 不要使用代码编辑器修改
/// 此方法的内容。
/// </summary>
private void InitializeComponent()
{
this.Submit1.ServerClick += new System.EventHandler(this.Submit1_ServerClick);
this.Reset2.ServerClick += new System.EventHandler(this.Reset2_ServerClick);
this.Load += new System.EventHandler(this.Page_Load);
}
#endregion
private void Submit1_ServerClick(object sender, System.EventArgs e)
{
if(Page.IsValid)
{
Entities.Customers newCustomer = new MobileOnlineShop.Entities.Customers();
newCustomer.PassWord = this.txtPwd.Text;
newCustomer.Name = this.txtName.Text;
newCustomer.Address = this.txtAddress.Text;
newCustomer.PhoneNumber = this.txtPhoneNumber.Text;
int re = DAL.CustomerDB.UpdateCustomers(id,newCustomer);
string sUrl=Request.Params["reurl"].ToString();
if(re ==1)
{
if(this.txtName.Text!= "")
Response.Cookies["UserName"].Value = this.txtName.Text;
Response.Redirect(sUrl);
}
}
}
private void Reset2_ServerClick(object sender, System.EventArgs e)
{
if(!Page.IsValid)
{
this.txtPwd = null;
this.txtAPwd = null;
this.txtName = null;
this.txtPhoneNumber = null;
this.txtAddress = null;
}
}
}
}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?