毕业设计(论文)-中国论文教育学院 www.icsv.net
Response.Redirect(\); } }
protected void LinkButton1_Click(object sender, EventArgs e) {
Response.Redirect(\); }
protected void LinkButton2_Click(object sender, EventArgs e) {
Response.Redirect(\); } }
用户注册实现代码(Regist.aspx.cs):
public partial class Regist : System.Web.UI.Page {
protected void Page_Load(object sender, EventArgs e) { }
protected void handon_Click(object sender, EventArgs e) {
zhuce(); }
protected void zhuce() {
ConnectionStringSettings sets =
ConfigurationManager.ConnectionStrings[\]; SqlConnection conn = new SqlConnection(sets.ConnectionString);
SqlCommand cmd = new SqlCommand(\
Users(username,password,Address,Telephone,Email) values ('\ + UserName.Text +
\+Password.Text+\+Address.Text+\+Telephone.Text+\+E
31
毕业设计(论文)-中国论文教育学院 www.icsv.net
mail.Text+\, conn); conn.Open();
cmd.ExecuteNonQuery(); conn.Close();
Response.Write(\添加用户\+UserName.Text+\成功!');\); }
protected void Button1_Click(object sender, EventArgs e)
{
Response.Redirect(\);
} }
购物主界面的实现代码(shopping.aspx.cs):
public partial class shopping : System.Web.UI.Page {
protected void Page_Load(object sender, EventArgs e) {
BindData();
string username = Session[\].ToString(); Label1.Text = username; bbsshow(); }
ConnectionStringSettings sets =
ConfigurationManager.ConnectionStrings[\]; SqlConnection conn; protected void bbsshow() {
conn = new SqlConnection(sets.ConnectionString); SqlCommand cmd = new SqlCommand(\bbscontent from BBS \, conn);
conn.Open();
SqlDataReader reader = cmd.ExecuteReader();
32
毕业设计(论文)-中国论文教育学院 www.icsv.net
while (reader.Read()) {
Label2.Text += reader.GetString(0)+\; }
reader.Close(); conn.Close(); }
protected void BindData() {
conn = new SqlConnection(sets.ConnectionString); SqlDataAdapter da = new SqlDataAdapter(\Products\, conn);
DataSet ds = new DataSet(); da.Fill(ds);
productList.DataSource = ds; productList.DataBind(); }
protected void Button1_Click(object sender, EventArgs e) {
BindData2(); }
protected void BindData2() {
string spmc = prodtdesn.Text;
conn = new SqlConnection(sets.ConnectionString);
SqlDataAdapter da = new SqlDataAdapter(\* from Products where Description='\ + spmc + \, conn); DataSet ds = new DataSet(); da.Fill(ds);
productList.DataSource = ds; productList.DataBind(); }
33
毕业设计(论文)-中国论文教育学院 www.icsv.net
protected void LinkButton2_Click(object sender, EventArgs e) {
Response.Redirect(\); }
protected void productList_PageIndexChanging(object sender, GridViewPageEventArgs e) {
productList.PageIndex = e.NewPageIndex; productList.DataBind(); }
protected void LinkButton1_Click(object sender, EventArgs e) {
Response.Redirect(\); } }
收银台功能实现代码(CheckShopCart2.aspx.cs):
public partial class CheckShopCart2 : System.Web.UI.Page {
protected void Page_Load(object sender, EventArgs e) {
Userorders dingdan = (Userorders)Session[\]; Label1.Text = dingdan.UserName; Label2.Text = dingdan.UserAddress; Label3.Text = dingdan.UserCity; Label4.Text = dingdan.UserPhone; ShoppingCarts cart;
cart = (ShoppingCarts)Session[\]; GridView1.DataSource = cart.Product; GridView1.DataBind();
Label5.Text += cart.TotalPrice; }
protected void Button2_Click(object sender, EventArgs e)
34
毕业设计(论文)-中国论文教育学院 www.icsv.net
{
Response.Redirect(\); }
protected void Button1_Click(object sender, EventArgs e) {
ConnectionStringSettings sets =
ConfigurationManager.ConnectionStrings[\]; SqlConnection conn = new SqlConnection(sets.ConnectionString);
string username = Session[\].ToString(); int n = GridView1.Rows.Count; for (int i = 0; i < n; i++) {
int id
=Convert.ToInt32( GridView1.Rows[i].Cells[0].Text); int num =
Convert.ToInt32(GridView1.Rows[i].Cells[4].Text); SqlCommand cmd = new SqlCommand(\
ShopCarts(username,ProductID,ProductNum) values ('\ + username+ \ + id + \ + num+ \, conn); conn.Open();
cmd.ExecuteNonQuery(); conn.Close(); }
SqlCommand cmd1 = new SqlCommand(\
SHInformation(username,SHName,SHAddress,SHCity,SHPhone) values ('\ + username + \ + Label1.Text + \ + Label2.Text + \ + Label3.Text + \ + Label4.Text + \, conn); conn.Open();
cmd1.ExecuteNonQuery(); conn.Close();
Response.Write(\谢谢您的购买!'))
35