购物商城实训报告模版.docx
- 文档编号:3683305
- 上传时间:2022-11-24
- 格式:DOCX
- 页数:31
- 大小:200.77KB
购物商城实训报告模版.docx
《购物商城实训报告模版.docx》由会员分享,可在线阅读,更多相关《购物商城实训报告模版.docx(31页珍藏版)》请在冰豆网上搜索。
购物商城实训报告模版
郑州轻工业学院
实训报告
实训名称:
网上商城系统开发
姓名:
高耀威
院(系):
软件学院
专业班级:
计算及应用技术10-01
学号:
621013520107
指导教师:
李祖贺、范乃梅
成绩:
时间:
2011年12月19日至2012年1月6日
目录
系统简介1
系统设计的思路和整体框架2
各功能或者模块实现的思路2
实训感想24
实训内容
系统简介
1)系统设计概述
网上商城系统的模块示意图
网上商城系统可以分为前台管理和后天管理系统。
包括用户管理、商品浏览、商品管理、管理员信息管理、购物车管理、订单管理、用户资金管理及销售量查询管理等八个模块。
2)功能划分
前台功能:
商品浏览、购物车管理、用户注册、查询商品、查询管理个人信息、购物记录等等。
后台功能:
系统管理、商品管理、订单管理、用户管理、系统维护、销售量查询、用户资金管理等等。
3)数据库需求分析
●数据库的设计通常是以一个已经存在的数据库管理系统为基础的,常用的数据库管理系统有SQLServer。
●整个系统功能需要以下数据项:
●商品:
商品名称、单价、数量、同类商品
●管理员:
管理名名称、管理员密码、管理员级别。
●用户:
账号、密码。
4)系统需求分析
此系统基于ASP的购物网站分前台功能各后台管理功能:
前台部分由用户使用,主要包括用户注册,购买商品,查询商品,浏览商品。
后台管理部分由管理员使用,主要包括商品管理,品牌管理,销售统计管理,商品信息修改管理。
各功能或者模块实现的思路
日字管理
privatevoidPage_Load(objectsender,System.EventArgse)
{//页面初始方法
if(!
Page.IsPostBack)
{Show();
if(Request.QueryString["adminID"]!
=null)
{AdminDB.InsertAction("查看adminId为"+Request.QueryString["adminID"]+"的日志",System.DateTime.Now,User.Identity.Name);}}}
protectedvoidShow()
{AdminDBgetAction=newAdminDB();
GridAction.DataSource=getAction.GetAction(Convert.ToString(User.Identity.Name));
GridAction.DataBind();}
protectedvoidGridAction_PageIndexChanging(objectsource,System.Web.UI.WebControls.GridViewPageEventArgse)
{//GridView控件分页事件
introwsCont=GridAction.Rows.Count;
if(rowsCont==0)
{GridAction.Visible=false;
Response.Write("");}
else
{GridAction.PageIndex=e.NewPageIndex;}
Show();}
添加管理员
protectedvoidPage_Load(objectsender,EventArgse)
{//页面初始方法
if(!
Page.IsPostBack)
{ListBind();}}
protectedvoidListBind()
{ListRole.DataSource=AdminDB.GetAdminRoleList();
ListRole.DataTextField="RoleName";
ListRole.DataValueField="RoleId";
ListRole.DataBind();}
protectedvoidAdd_Click(objectsender,System.EventArgse)
{//添加按钮点击事件
AdminDBaddadmin=newAdminDB();
intresult=addadmin.AddNewAdmin(LoginName.Text.ToString(),Password.Text.ToString(),int.Parse(ListRole.SelectedValue));
switch(result)
{case-1:
MyError.Text="用户名已存在!
";break;
case1:
//Response.Write("
')");MyError.Text="添加成功!
";break;
default:
MyError.Text="出现错误!
";break;}}
添加商品类别
protectedvoidPage_Load(objectsender,EventArgse)
{//页面初始方法
if(!
Page.IsPostBack)
{ListCatBind();}}
protectedvoidListCatBind()
{ListCat.DataSource=Product.GetCategoryList();
ListCat.DataTextField="Categoryname";
ListCat.DataValueField="CategoryId";
ListCat.DataBind();}
protectedvoidAdd_Click(objectsender,System.EventArgse)
{//添加按钮点击事件
boolflag=true;
AdminDBAd=newAdminDB();
for(inti=0;i {if(ListCat.Items[i].Text==Convert.ToString(CategoryName.Text.Trim())) {flag=false;} if(! flag) {Response.Write(" ')");} else {try {Ad.AddNewCategory(Convert.ToString(CategoryName.Text)); MyError.Text="添加成功! ";}catch {Response.Write(" ')"); MyError.Text="添加失败! ";}} AdminDB.InsertAction("添加新的商品类别"+CategoryName.Text.Trim(),System.DateTime.Now,User.Identity.Name); ListCatBind();} protectedvoidDelete_Click(objectsender,System.EventArgse) {//删除按钮点击事件 AdminDBdelCy=newAdminDB(); inta=int.Parse(ListCat.SelectedValue); intresult=delCy.CheckCategoryUsed(a); try {switch(result) {case0: delCy.DeleteCategory(a); MyError.Text="删除成功! ";break; case1: MyError.Text="此商品类别已被引用,不能删除";break; default: AdminDB.InsertAction("删除商品类别"+ListCat.SelectedItem.Text,System.DateTime.Now,User.Identity.Name);break;}} catch {MyError.Text="删除失败! "; throw;} ListCatBind();} 添加商品 protectedvoidPage_Load(objectsender,EventArgse) {//页面初始方法 if(! Page.IsPostBack) {ListCat.DataSource=Product.GetCategoryList(); ListCat.DataTextField="Categoryname"; ListCat.DataValueField="CategoryId"; ListCat.DataBind();}} protectedvoidAdd_Click(objectsender,System.EventArgse) {//添加按钮点击事件 AdminDBaddproduct=newAdminDB(); try{addproduct.AddNewProduct(ProductName.Text.ToString(),Convert.ToDecimal(Price.Text),Intro.Text.ToString(),int.Parse(ListCat.SelectedValue));} catch {MyError.Text="添加失败! ";} 管理员列表 protectedvoidPage_Load(objectsender,EventArgse) {//页面初始方法 if(! Page.IsPostBack){ GridBind(); AdminDB.InsertAction("查看管理员列表",System.DateTime.Now,User.Identity.Name);}} protectedvoidGridBind() {AdminDBad=newAdminDB(); stringadminId=Convert.ToString(User.Identity.Name); //SqlDataReaderreader=ad.GetAdminList(ad.GetAdminRole(adminId)); GridAdmin.DataSource=ad.GetAdminList(int.Parse(ad.GetAdminRole(adminId))); GridAdmin.DataBind();} protectedvoidGridAdmin_RowDeleting(objectsource,System.Web.UI.WebControls.GridViewDeleteEventArgse) {//GridView控件行删除事件 AdminDBad=newAdminDB(); for(inti=0;i {if(i==e.RowIndex) {if(Convert.ToString(GridAdmin.DataKeys[i].Value)! =Convert.ToString(User.Identity.Name)) {ad.DeleteAdmin(Convert.ToString(GridAdmin.DataKeys[i].Value)); AdminDB.InsertAction("删除管理员,adminId为"+GridAdmin.DataKeys[i].Value.ToString(),System.DateTime.Now,User.Identity.Name);} else {Response.Write(""); //ad.DeleteAdmin(Convert.ToString(GridAdmin.DataKeys[i].Value));}}} GridBind();} protectedvoidGridAdmin_PageIndexChanging(objectsender,GridViewPageEventArgse) {GridAdmin.PageIndex=e.NewPageIndex; GridBind();}} 修改密码 protectedvoidSubmit_Click(objectsender,System.EventArgse) {//提交按钮点击事件 AdminDBchangepwd=newAdminDB(); intresult=changepwd.ChangePwd(User.Identity.Name,OldPassword.Text,NewPassword.Text); if(result==0) { Message.Text="密码不对! "; } else { if(result==1) { AdminDB.InsertAction("修改密码",System.DateTime.Now,User.Identity.Name); Message.Text="修改成功! "; } else { Message.Text="修改失败! "; } 商品列表 protectedvoidPage_Load(objectsender,EventArgse) { //页面初始方法 if(! Page.IsPostBack) { GridProduct.Visible=true; GridBind(); AdminDB.InsertAction("查看商品列表",System.DateTime.Now,User.Identity.Name);}} protectedvoidGridBind() {AdminDBad=newAdminDB(); GridProduct.DataSource=ad.GetAllProduct(); GridProduct.DataBind(); } protectedvoidSubmit_Click(objectsender,System.EventArgse) { //提交按钮点击事件 AdminDBad=newAdminDB(); for(inti=0;i { intproductId=Convert.ToInt32(GridProduct.DataKeys[i].Value.ToString()); stringproductName=((TextBox)GridProduct.Rows[i].FindControl("ProductName")).Text.Trim(); decimalprice=decimal.Parse(((TextBox)GridProduct.Rows[i].FindControl("Price")).Text.Trim()); stringintro=((TextBox)GridProduct.Rows[i].FindControl("Intro")).Text; CheckBoxremove=(CheckBox)GridProduct.Rows[i].FindControl("Remove"); try {if(remove.Checked) {if(ad.CheckProductUsed(productId)==0) {ad.DeleteProduct(productId); AdminDB.InsertAction("删除商品"+productName,System.DateTime.Now,User.Identity.Name); Message.Text="编号为"+productId.ToString()+"的商品已被删除! } else {Message.Text="编号为"+productId.ToString()+"的商品已被选购,不能被删除! "; Response.Write(""); } } else {ad.AlterProduct(productId,productName,price,intro); AdminDB.InsertAction("修改商品"+productName+"的信息",System.DateTime.Now,User.Identity.Name);}} catch {Message.Text="出现错误,更新失败! ";}} GridBind();} protectedvoidGridProduct_PageIndexChanging(objectsource,System.Web.UI.WebControls.GridViewPageEventArgse) { //GridView控件分页事件 GridProduct.PageIndex=e.NewPageIndex; GridBind(); } 销售情况 protectedvoidPage_Load(objectsender,EventArgse) { //初始化页面 if(! Page.IsPostBack) { GridSails.Visible=true; YearBind(); MonthBind(); DayBind(); GridBind(Year.SelectedValue,Month.SelectedValue,Day.SelectedValue); AdminDB.InsertAction("查看当日销售记录",System.DateTime.Now,User.Identity.Name);}} protectedvoidGridBind(stringyear,stringmonth,stringday) { AdminDBad=newAdminDB(); GridSails.DataSource=ad.GetSails(year,month,day); GridSails.DataBind();} protectedvoidYearBind() {Year.Items.Clear(); intStartYear=DateTime.Now.Year-10; intcurrentYear=DateTime.Now.Year; for(inti=StartYear;i<=currentYear;i++) {Year.Items.Add(newListItem(i.ToString()));} Year.SelectedValue=currentYear.ToString();} protectedvoidMonthBind() { Month.Items.Clear(); for(inti=1;i<=12;i++) {Month.Items.Add(i.ToString());}} protectedvoidDayBind() {Day.Items.Clear(); stringyear=Year.SelectedValue; stringmonth=Month.SelectedValue; intdays=DateTime.DaysInMonth(int.Parse(year),int.Parse(month)); for(inti=1;i<=days;i++) {Day.Items.Add(i.ToString());}} protectedvoidQueryMonth_Click(objectsender,System.EventArgse) {//查询所选日期的月销售记录 GridBind(Year.SelectedValue,Month.SelectedValue,"0"); AdminDB.InsertAction("查看"+Year.SelectedValue+"年"+Month.SelectedValue+"月" +"的销售记录",System.DateTime.Now,User.Identity.Name); }protectedvoidQueryDay_Click(objectsender,System.EventArgse) {//查询所选日期的日销售记录 GridBind(Year.SelectedValue,Month.SelectedValue,Day.SelectedValue); AdminDB.InsertAction("查看"+Year.SelectedValue+"年"+Month.SelectedValue+"月" +Day.SelectedValue+"日的销售记录",System.DateTime.Now,User.Identity.Name);} protectedvoidYear_SelectedIndexChanged(objectsender,EventArgse) {DayBind(); } protectedvoidMonth_SelectedIndexChanged(objectsender,EventArgse) {DayBind();} 用户列表 protectedvoidPage_Load(objectsender,EventArgse) {//页面初始方法 if(! Page.IsPostBack) GridBind(); AdminDB.InsertAction("查看用户列表",S
- 配套讲稿:
如PPT文件的首页显示word图标,表示该PPT已包含配套word讲稿。双击word图标可打开word文档。
- 特殊限制:
部分文档作品中含有的国旗、国徽等图片,仅作为作品整体效果示例展示,禁止商用。设计者仅对作品中独创性部分享有著作权。
- 关 键 词:
- 购物 商城 报告 模版