2024年3月14日发(作者:)
图书在线销售系统系统实现
一、 页面实现
1.登录与注册会员页面
protected void ImageButton1_Click(object sender, ImageClickEventArgs e)
{
string OleDbchk = "select count(*) from user_info where userName='" + this.a_
+ "' and userPwd='" + this.a_ + "'";
OleDbConnection conn = r();
();
OleDbCommand cmd = new OleDbCommand(OleDbchk, conn);
int i = 32(eScalar());
if (i > 0)
{
Session["user"] = this.a_;
ct("");
}
else
{
= "用户名或密码输入有误,请重新输入!";
}
}
2.图书订购页面
:
protected void bookcar()
protected void bookcar()
{
string id = tring["id"];
if (Session["car"] == null)
{
(id, 1);
Session["car"] = ht;
}
else
{
ht = (Hashtable)Session["car"];
if (nsKey(id)==true)
{
("");
}
else
{
(id, + 1);
Session["car"] = ht;
}
}
}
//检查商品是否已经在购物车中
protected void sum()
{
float carprice = 0;
int carnum = 0;
int allnum = 0;
for (int i = 0; i < ; i++)
{
float price =
(float)le(((Label)([i].Cells[1].FindControl("ol"))).Text);
int num =
32(((TextBox)([i].Cells[2].FindControl("ct"))).Text);
((Label)([i].Cells[3].FindControl("lball"))).Text =
ng(price * num);
float lbprice = (float)le(price * num);
carprice = carprice + lbprice;
carnum = i + 1;
allnum = allnum + num;
}
= ng(carnum);
= ng(allnum);
= ng(carprice);
}//对购物车里的所有商品的价格求总和
protected void dlCar_RowDeleting(object sender, GridViewDeleteEventArgs e)
{
string id = ng(ys[ex].Value);
ht = (Hashtable)Session["car"];
if (nsKey(id) == true)
{
(id);
Session["car"] = ht;
}
r();
1


发布评论