基于BS结构网上商城的设计与实现 - 图文(7)

2019-04-21 14:02

毕业设计(论文)-中国论文教育学院 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


基于BS结构网上商城的设计与实现 - 图文(7).doc 将本文的Word文档下载到电脑 下载失败或者文档不完整,请联系客服人员解决!

下一篇:卫生部关于印发《关于建立国家基本药物制度的实施意见》的通知(

相关阅读
本类排行
× 注册会员免费下载(下载后可以自由复制和排版)

马上注册会员

注:下载文档有可能“只有目录或者内容不全”等情况,请下载之前注意辨别,如果您已付费且无法下载或内容有问题,请联系我们协助你处理。
微信: QQ: