您目前尚未登陆,请选择【登陆】或【注册
首页->电子商务->淘淘网电子商务网站源码(毕业设计)>>Customer/MyInformation.aspx.cs>>源码在线查看
温馨提示:代码在线浏览功能只能做为源码浏览参考,如果想更进一步了解该代码请下载:淘淘网电子商务网站源码(毕业设计)
当前文件:文件类型 TaoTaoBiz/Customer/MyInformation.aspx.cs打开代码结构图
普通视图
		            
1using System; 2using System.Collections; 3using System.ComponentModel; 4using System.Data; 5using System.Drawing; 6using System.Web; 7using System.Web.SessionState; 8using System.Web.UI; 9using System.Web.UI.WebControls; 10using System.Web.UI.HtmlControls; 11using web.Code; 12 13namespace web.Customer 14{ 15 /// <summary> 16 /// MyInformation 的摘要说明。 17 /// </summary> 18 public partial class MyInformation : System.Web.UI.Page 19 { 20 21 static string Name = null; 22 23 protected void Page_Load(object sender, System.EventArgs e) 24 { 25 // 在此处放置用户代码以初始化页面 26 if( !Page.IsPostBack ) 27 { 28 if( Session["LoginName"] == null ) 29 { 30 if( Request.Params["CustomerId"] != null ) 31 { 32 int id = Convert.ToInt32( Request.Params["CustomerId"].ToString() ); 33 CustomerDAO customerDAO = new CustomerDAO(); 34 DataGrid1.DataSource = customerDAO.getMyInformation( id ); 35 DataGrid1.DataBind(); 36 } 37 else 38 { 39 Response.Redirect("../Login.aspx?Return=" + Request.Url.ToString()); 40 } 41 } 42 else 43 { 44 Name = Session["LoginName"].ToString(); 45 BindData(); 46 } 47 } 48 } 49 50 Web 窗体设计器生成的代码 72 73 private void BindData() 74 { 75 CustomerDAO customerDAO = new CustomerDAO(); 76 DataGrid1.DataSource = customerDAO.getMyInformation( Name ); 77 DataGrid1.DataBind(); 78 } 79 80 private void DataGrid1_EditCommand(object source, System.Web.UI.WebControls.DataGridCommandEventArgs e) 81 { 82 DataGrid1.EditItemIndex=(int)e.Item.ItemIndex; 83 BindData(); 84 } 85 86 public string getSex( string virtualSex ) 87 { 88 string Sex = null; 89 switch( virtualSex ) 90 { 91 case "0": 92 Sex = ""; 93 break; 94 case "1": 95 Sex = ""; 96 break; 97 } 98 return Sex; 99 } 100 101 private void DataGrid1_CancelCommand(object source, System.Web.UI.WebControls.DataGridCommandEventArgs e) 102 { 103 DataGrid1.EditItemIndex = -1; 104 BindData(); 105 } 106 107 private void DataGrid1_UpdateCommand(object source, System.Web.UI.WebControls.DataGridCommandEventArgs e) 108 { 109 string realName = ((TextBox)(e.Item.FindControl("TextBox2"))).Text; 110 string address = ((TextBox)(e.Item.FindControl("TextBox3"))).Text; 111 string sex = ((RadioButtonList)(e.Item.FindControl("RadioButtonList1"))).SelectedValue; 112 string phone = ((TextBox)(e.Item.FindControl("TextBox4"))).Text; 113 string email = ((TextBox)(e.Item.FindControl("TextBox5"))).Text; 114 string qq = ((TextBox)(e.Item.FindControl("TextBox6"))).Text; 115 CustomerVO customerVO = new CustomerVO(); 116 customerVO.RealName = realName; 117 customerVO.Address = address; 118 customerVO.Sex = sex; 119 customerVO.Phone = phone; 120 customerVO.Email = email; 121 customerVO.QQ = qq; 122 CustomerDAO customerDAO = new CustomerDAO(); 123 customerVO.CustomerId = customerDAO.getUserId( Name ); 124 if( customerDAO.updateMyInformation( customerVO ) != 0 ) 125 { 126 Response.Write("<script>alert('修改成功!')</script>"); 127 DataGrid1.EditItemIndex=-1; 128 BindData(); 129 } 130 } 131 132 } 133} 134
还没有找到您心仪的内容?请用.net源码大搜捕
代码片断 打包下载该项目完整源码:淘淘网电子商务网站源码(毕业设计)
51Aspx.com 版权所有 CopyRight © 2000-2008. 京ICP备06046876号