基本信息
源码名称:asp.net购物商城源码(含数据库)
源码大小:3.73M
文件格式:.rar
开发语言:ASP
更新时间:2021-08-31
友情提示:(无需注册或充值,赞助后即可获取资源下载链接)
嘿,亲!知识可是无价之宝呢,但咱这精心整理的资料也耗费了不少心血呀。小小地破费一下,绝对物超所值哦!如有下载和支付问题,请联系我们QQ(微信同号):813200300
本次赞助数额为: 2 元×
微信扫码支付:2 元
×
请留下您的邮箱,我们将在2小时内将文件发到您的邮箱
源码介绍
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using System.Data.SqlClient;
public partial class MemberManage_Shopping : System.Web.UI.Page
{
SqlOperate sqloperate = new SqlOperate();
SqlConnection sqlconn = new SqlConnection(ConfigurationManager.AppSettings["ConnectionString"]);
protected void Page_Load(object sender, EventArgs e)
{
if (Session["MName"] == null)
{
Response.Write("<script>alert('您还没有登录,请登录后再使用该功能!');location='javascript:history.go(-1)';</script>");
}
if (!IsPostBack)
{
string sqlstr = "select OrderID,GoodsName,GoodsTypeName,GoodsPrice from tb_OrderInfo where OrderMember='" Convert.ToString(Session["MName"]) "' and IsCheckout='否'";
gvOrderInfo.DataKeyNames = new string[] { "OrderID" };
sqloperate.gvDataBind(gvOrderInfo, sqlstr);
string sqlstrtprice = "select sum(GoodsPrice) as tprice from tb_OrderInfo"
" where OrderMember='" Convert.ToString(Session["MName"]) "' and IsCheckout='否'";
sqlconn.Open();
SqlDataAdapter myda = new SqlDataAdapter(sqlstrtprice, sqlconn);
DataSet myds = new DataSet();
myda.Fill(myds, "tb_OrderInfo");
DataRowView mydrv = myds.Tables["tb_OrderInfo"].DefaultView[0];
labMoney.Text = Convert.ToString(mydrv.Row["tprice"]);
}
}
protected void lbtnCheck_Click(object sender, EventArgs e)
{
if (labMoney.Text == "")
{
Response.Write("<script>alert('您的购物车中没有任何物品');</script>");
}
else
{
string sqlstr = "select MemberName,MemberMoney from tb_Member where MemberName='" Session["MName"].ToString() "'";
sqlconn.Open();
SqlDataAdapter myda = new SqlDataAdapter(sqlstr, sqlconn);
DataSet myds = new DataSet();
myda.Fill(myds, "tb_Member");
DataRowView mydrv = myds.Tables["tb_Member"].DefaultView[0];
string MPrice = Convert.ToString(mydrv.Row["MemberMoney"]);
if (Convert.ToInt32(MPrice) < Convert.ToInt32(labMoney.Text.Trim()))
{
Response.Write("<script>alert('您的余额不足,请重新充值后再购买!');</script>");
}
else
{
string sqlstrshop1 = "update tb_Member set MemberMoney='"
(Convert.ToInt32(MPrice) - Convert.ToInt32(labMoney.Text)) "' where MemberName='" Session["MName"].ToString() "'";
sqloperate.DataCom(sqlstrshop1);
string sqlstrshop2 = "update tb_OrderInfo set IsCheckout='是' where OrderMember='" Session["MName"].ToString() "'";
sqloperate.DataCom(sqlstrshop2);
Response.Redirect("SuccShop.aspx");
}
}
}
protected void lbtnClear_Click(object sender, EventArgs e)
{
string sqlstr = "delete from tb_OrderInfo where OrderMember='"
Session["MName"].ToString() "' and IsCheckout='否'";
sqloperate.DataCom(sqlstr);
Response.Redirect("Shopping.aspx");
}
protected void gvOrderInfo_PageIndexChanging(object sender, GridViewPageEventArgs e)
{
gvOrderInfo.PageIndex = e.NewPageIndex;
gvOrderInfo.DataBind();
}
protected void gvOrderInfo_RowDataBound(object sender, GridViewRowEventArgs e)
{
if (e.Row.RowType == DataControlRowType.DataRow)
{
((LinkButton)(e.Row.Cells[3].Controls[0])).Attributes.Add("onclick", "return confirm('确定要删除吗?')");
}
}
protected void gvOrderInfo_RowDeleting(object sender, GridViewDeleteEventArgs e)
{
string sqlstr = "delete from tb_OrderInfo where OrderID='" gvOrderInfo.DataKeys[e.RowIndex].Value "'";
sqloperate.DataCom(sqlstr);
Response.Redirect("Shopping.aspx");
}
}
后台模块主要包括后台管理员对会员、商品、仓库、订单和管理员的管理等功能。
会员在登录进入该网上购物商城后,不仅可以查看其各种服务条款,还可以选择查看各种商品的详细信息并购买。管理员登录后,可以查看商品销售情况,及管理会员、商品、仓库和其自身的信息。管理员还可以根据实际情况添加其他管理员以维护该网上购物商城的购物环境和安全。
using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using System.Data.SqlClient;
public partial class MemberManage_Shopping : System.Web.UI.Page
{
SqlOperate sqloperate = new SqlOperate();
SqlConnection sqlconn = new SqlConnection(ConfigurationManager.AppSettings["ConnectionString"]);
protected void Page_Load(object sender, EventArgs e)
{
if (Session["MName"] == null)
{
Response.Write("<script>alert('您还没有登录,请登录后再使用该功能!');location='javascript:history.go(-1)';</script>");
}
if (!IsPostBack)
{
string sqlstr = "select OrderID,GoodsName,GoodsTypeName,GoodsPrice from tb_OrderInfo where OrderMember='" Convert.ToString(Session["MName"]) "' and IsCheckout='否'";
gvOrderInfo.DataKeyNames = new string[] { "OrderID" };
sqloperate.gvDataBind(gvOrderInfo, sqlstr);
string sqlstrtprice = "select sum(GoodsPrice) as tprice from tb_OrderInfo"
" where OrderMember='" Convert.ToString(Session["MName"]) "' and IsCheckout='否'";
sqlconn.Open();
SqlDataAdapter myda = new SqlDataAdapter(sqlstrtprice, sqlconn);
DataSet myds = new DataSet();
myda.Fill(myds, "tb_OrderInfo");
DataRowView mydrv = myds.Tables["tb_OrderInfo"].DefaultView[0];
labMoney.Text = Convert.ToString(mydrv.Row["tprice"]);
}
}
protected void lbtnCheck_Click(object sender, EventArgs e)
{
if (labMoney.Text == "")
{
Response.Write("<script>alert('您的购物车中没有任何物品');</script>");
}
else
{
string sqlstr = "select MemberName,MemberMoney from tb_Member where MemberName='" Session["MName"].ToString() "'";
sqlconn.Open();
SqlDataAdapter myda = new SqlDataAdapter(sqlstr, sqlconn);
DataSet myds = new DataSet();
myda.Fill(myds, "tb_Member");
DataRowView mydrv = myds.Tables["tb_Member"].DefaultView[0];
string MPrice = Convert.ToString(mydrv.Row["MemberMoney"]);
if (Convert.ToInt32(MPrice) < Convert.ToInt32(labMoney.Text.Trim()))
{
Response.Write("<script>alert('您的余额不足,请重新充值后再购买!');</script>");
}
else
{
string sqlstrshop1 = "update tb_Member set MemberMoney='"
(Convert.ToInt32(MPrice) - Convert.ToInt32(labMoney.Text)) "' where MemberName='" Session["MName"].ToString() "'";
sqloperate.DataCom(sqlstrshop1);
string sqlstrshop2 = "update tb_OrderInfo set IsCheckout='是' where OrderMember='" Session["MName"].ToString() "'";
sqloperate.DataCom(sqlstrshop2);
Response.Redirect("SuccShop.aspx");
}
}
}
protected void lbtnClear_Click(object sender, EventArgs e)
{
string sqlstr = "delete from tb_OrderInfo where OrderMember='"
Session["MName"].ToString() "' and IsCheckout='否'";
sqloperate.DataCom(sqlstr);
Response.Redirect("Shopping.aspx");
}
protected void gvOrderInfo_PageIndexChanging(object sender, GridViewPageEventArgs e)
{
gvOrderInfo.PageIndex = e.NewPageIndex;
gvOrderInfo.DataBind();
}
protected void gvOrderInfo_RowDataBound(object sender, GridViewRowEventArgs e)
{
if (e.Row.RowType == DataControlRowType.DataRow)
{
((LinkButton)(e.Row.Cells[3].Controls[0])).Attributes.Add("onclick", "return confirm('确定要删除吗?')");
}
}
protected void gvOrderInfo_RowDeleting(object sender, GridViewDeleteEventArgs e)
{
string sqlstr = "delete from tb_OrderInfo where OrderID='" gvOrderInfo.DataKeys[e.RowIndex].Value "'";
sqloperate.DataCom(sqlstr);
Response.Redirect("Shopping.aspx");
}
}