网上服装销售系统
receiver adress postcode email deliverytype paytype totalprice clothesfee deliveryfee orderdate varchar(50) nvarchar(50) varchar(50) varchar(50) int Int float float float datetime * * * * * * * * * * 外键 外键 (3)功能实现方法及代码设计
图4.4成订单模块效果图
结算主要是消费者选择商品后,对商品进行在线结算的一种方法,它可以使用网上银行卡,既方便又安全。实现结算功能。代码如下
if (txtReciverName.Text == \ || txtReceiverAddress.Text == \ || txtReceiverPhone.Text == \ || txtReceiverPostCode.Text == \ || txtReceiverEmails.Text == \) {
Response.Write(\请输入完整的信息 !')\); return; } else {
float P_Flt_TotalSF=TotalShipFee();
18
网上服装销售系统
if (P_Flt_TotalSF <= 0 || P_Flt_TotalSF == 100) {
return; }
float P_Flt_TotalGP=TotalGoodsPrice();
int P_Int_OrderID = ucObj.AddOrderInfo(P_Flt_TotalGP, P_Flt_TotalSF,
ddlDeliveryType.SelectedItem.Value.Trim(), ddlPayType.SelectedItem.Value.Trim(),
Convert.ToInt32(Session[\].ToString()), txtReciverName.Text.Trim(), txtReceiverPhone.Text.Trim(), txtReceiverPostCode.Text.Trim(), txtReceiverAddress.Text.Trim(), txtReceiverEmails.Text.Trim());
DataSet ds = ucObj.ReturnSCDs(Convert.ToInt32(Session[\].ToString()), \);
for(int i = 0; i < ds.Tables[\].Rows.Count; i++) {
ucObj.AddBuyInfo(Convert.ToInt32(ds.Tables[\].Rows[i][2].ToString()), Convert.ToInt32(ds.Tables[\].Rows[i][3].ToString()), P_Int_OrderID, float.Parse (ds.Tables[\].Rows[i][5].ToString()), Convert.ToInt32(ds.Tables[\].Rows[i][1].ToString()));
}
ucObj.DeleteTCInfo(Convert.ToInt32(Session[\].ToString()));
Response.Write(\购物成功 !');location='index.aspx'\); return;
}
4.3 后台管理端
4.3.1 服装管理模块
(1)功能:服装管理模块是网站非常重要的一个模块,管理员可以添加服装、添加服装类别、管理服装、管理服装类别。
(2)组成构造: 这个模块由4部分组成: (3)数据表的设计如表所示:
表4.5服装信息表(clothesinfo)
列名 clothesid 类型 int 允许空 * * 19
主键或外键 主键 clothesname varchar(50) clothesmark varchar(50)
网上服装销售系统
introduce buyprice sellprice mprice amount stock typeid provider imagepath visit isdiscount predate nvarchar(50) float float float int int int varchar(50) varchar(50) int bit datetime * * * * * * * * * * * * 外键 (4)界面设计与重点代码实现
20
网上服装销售系统
图4.5添加商品模块效果图
该模块主要实现管理员对服装的添加、服装信息的修改,重点代码为:
protected void btnSave_Click(object sender, EventArgs e) {
if (txtName.Text == \ || txtBrand.Text == \ || txtbuyprice.Text == \ || txtsellprice.Text == \ || txtmprice.Text == \) {
Response.Write(\请输入必要的信息!')\); } else {
bool IsDisCount;
if (cbxDiscount.Checked == true) {
IsDisCount = true; } else {
IsDisCount = false; }
int P_Int_returnValue =
mcObj.AddGInfo(Convert.ToInt32(ddlCategory.SelectedItem.Value.ToString()),
txtName.Text.Trim(), txtShortDesc.Text.Trim(), txtBrand.Text.Trim(), txtProvider.Text.Trim(), ddlUrl.SelectedItem.Value.Trim(), Convert.ToInt32(txtstock.Text.Trim()), float.Parse(txtbuyprice.Text.Trim()), float.Parse(txtmprice.Text.Trim()), float.Parse(txtsellprice.Text.Trim()),IsDisCount); if (P_Int_returnValue == -100) {
Response.Write(\该商品已存在!');\); } else {
Response.Write(\添加成功!');\); } }
}
21
网上服装销售系统
图4.6商品管理模块效果图
该模块管理员可以实现对服装的删除、修改以及商品的搜索。重点代码如下:
///
/// 绑定所有商品的信息 /// public void gvBind() {
DataSet ds = mcObj.GetClothesInfoDs(\);
gvGoodsInfo.DataSource = ds.Tables[\].DefaultView; gvGoodsInfo.DataBind(); }
///
/// 在搜索中绑定商品信息 ///
public void gvSearchBind() {
DataSet ds = mcObj.SearchGoodsInfoDs(\, txtKey.Text.Trim()); gvGoodsInfo.DataSource = ds.Tables[\].DefaultView; gvGoodsInfo.DataBind(); }
该模块管理员何以实现对服装类别的添加以及图片的添加。重点代码如下:
protected void btnSave_Click(object sender, EventArgs e) {
if (txtName.Text == \) {
Response.Write(\请输入商品类别!');location='javascript:history.go(-1)';\); }
22