版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领
文档简介
1、数据库原理及应用镌程设计掖告图书销售管理系统学校:湖北工业大学专业:计算机科学与技术班级:10计算机(2)班姓名:张露学号:10103112222012年6月课程设计任务书课题 名称图书销售管理系统设计 目的1. 加深对数据库系统、程序设计语言的理论知识的理解和应用水平。2. 通过设计实际的数据库系统应用课题,进一步熟悉数据库管理系统的操作 技术,提高动手能力,提高分析问题和解决问题的能力。3. 通过实际编程加深对基木原理的理解,提高实践能力;4. 学习开发资料的收集与整理,学会撰写课程设计报告。实验 环境1. 微型电子计算机(pc);2. windows xp 操作系统,sql server
2、2000任务 要求1. 利用课余时间去图书馆或上网查阅课题相关资料,深入理解课题含义及设 计要求,注意材料收集与整理;2. 在第16周末之前完成预设计,并请指导教师审查,通过后方可进行下一 步工作;3. 本课题主要实现图书入库信息管理、图书删除管理、图书添加管理、图书 信息查询管理、图书销售信息管理等。4. 结束后,及吋提交设计报告(含纸质稿、电子稿),耍求格式规范、内容 完整、结论止确,止文字数不少于3000字。摘要:随着信息时代的到來,it产业和internet获得了飞速发展,计算机应用已渗透到了各个 领域,网络应用越来越普遍,而且走进了千家万户,网络销售应运而牛,而图巧销售就是其 中之一
3、。传统的图书销售仅仅局限于一小块地方且人力与物力过多浪费,而网络图书销售则 面向全中国,其至全iii:界而且管理方便。网络图书销售具有面向范围广,价格优惠,种类齐 全,购买方便等特点。本图书销售管理系统的开发语言是java,开发环境是visual studio 2008,数据库采用 sql server 2005 o1需求分析1.1系统目标设计出一个能够查询图书销售管理信息查询的平台。1.2功能划分图书销售管理系统包括登录、图书入库、添加图书、删除图书、图书信息修 改、图书信息查询、销售图书等功能。2概念设计本系统规划出的实体有:管理员实体、图书入库信息实体、图书添加信息实 体、图书删除信息实
4、体、图书信息查询实体、图书销售信息实体,它们之间的关 系如下图所示。2.1图书销售管理系统概念设计。图书销售系统er图2.2各实体的e-r图2.2.1图书入库信息系统er图2.2.2图书删除系统er图2.2.3图书信息查询系统er图管理员224图书销售系统er图分析:一个管理员可以购买多木图书,一木图书只能被一个管理员购买,所以是1: n的关系;一个管理员可以删除多本图书,一本图书只能被一个管理员删除,所 以是1: n的关系;一个管理员可以查询多本图书信息,一本图书可以被多个管 理员查询,所以是m: n的关系;一个管理员可以销售多本图书,一本图书只 能被一个管理员销售,所以是1: n的关系。3
5、.数据库表结构设计表3.1图书入库信息表列名数据类型长度描述booknamenvarchar50书名,不允许为空shoppingdatedatetime8购买日期,不允许为空qantityint8图书数量,不允许为空pricemoney8图书单价,不允许为空areanvarchar50图书入悴区域,不允许为空表3.2图书删除信息表列名数据类型长度描述booknamenvarchar50书名,不允许为空areanvarchar50图书入库区域,不允许为空quantityini8图书现存数量,不允许为空requantityint8图书剩余数量,不允许为空deldatedatetime8删除fi期,
6、不允许为空表3.3管理员信息表列名数据类型长度描述adminidnvarchar50管理员登录帐号,定义为主键adminpwdnvarchar50管理员登录密码,不允许为空农3.4图书信息查询表列名数据类型长度描述booknamenvarchar50书名,不允许为空areanvarchar20图书区域,不允许为空bookpricemoney8图书单价,不允许为空bookquantityint8图书数暈,不允许为空pressnvarchar50出版社,不允许为空publishdatenvarchar50出版口期,不允许为空authornvarchar50作者,不允许为空表3.5图书销售信息表列名
7、数据类型长度描述booknamenvarchar50书名,不允许为空quantityint8现存数量,不允许为空pricemoney8图书价格,不允许为空areanvarchar20库存区域,不允许为空requantityint8剩余数量,不允许为空sellquantityint8销售数量,不允许为空selldatechar8销售口期,不允许为空4应用程序设计4.1应用程序流程图图4应用程序流程图4.2图书销售系统功能模块图用户登录图书销售管理系统' 亠亠图图图书书书入删添库除加信信信息息息亠图图图书书书信信销息息售修查信改询息5编程实现5.1运行系统,显示系统登陆界面,如图5所示。x
8、登陆退出图5.1系统登陆5.2进入图书销售系统,显示主界面,如图5.2所示。图5.2主界面5.3进入图书入库系统,如图5.3所刀j图5.3图书入库信息5.4进入图书信息修改系统,如图5.4所示。lzj兰陽曰cm回田mai网以下足喪到的e)舟的佑息的借爲节名六脉律剑作出版社:湖工出版牡出版时1司:2000-02-14 00.00 00.0u定价:30库存104更w贬回1港目 islujq称的信耳书&六鹼沖剖ft者a«出扳tt湖工岀版社出版时図2000-02-14 00:00:00 0定价:30库存10作者:-2-1图5.4图书修改信息5.5进入删除图书信息系统,如图5.5所示。
9、00:00:00.o名:六脈神剣作若:出版社:湖工出版社岀版时冋:2000-02-01定价:30库存:1o1e出>1 际返回删晾遊同图5.5图书删除系统图5.5图书删除系统5.6进入图书信息查询系统,如图所示。图5.7 图书查询系统5.7进入图书销售系统,如图所示。秸名:作者: 出版社:出版曰期:定价:销售数量:i输入豪悄售的s1书偵jbrkxssj书皆湮系妖!*作欢逊便用:请选择以下快经査询源程序:图书销售:public class book_sale extends frame implements actionlistenerj frame book_sale_window;lab
10、el lb.print = new label(n请输入要销售的图书信息“);jlabel jl_bookname = new jlabel();textfield tf_bookname = new textfield();jlabel jl_autor = new jlabel();textfield tf_autor = new textfield();jlabel jl_pres = new jlabel();textfield tf_pres = new textfield();jlabel jl_publicationdate = new jlabel();textfield tf
11、_publicationdate = new textfield();jlabel jl_pricing = new jlabel();textfield tf_pricing = new textfield();jlabel jl_book_sell_num = new jlabel();textfield tf_book_sell_num = new textfield();button btn_ok = new button("确 定”);button btnexit = new button(n返 冋”);string str_bookname = new stringo;s
12、tring str_autor = new stringo;string str_pres = new stringo;string str_publicationdate = new stringo;string str_pricing = new stringo;int buy_num,store_num;string parameter_bookname = new string。;/申请 parameter_bookname 用来保存传递过来的bookname参数book_sale()parame ter_b ookn ame = s tr_b ookn ame;/ 获取参数book_
13、sale_window = new jframe("图书销售”);book_sale_window.setbounds(650,l 60,400,350);book_sale_window.setlayout(null);b ook_s ale_wi ndo w. add(lb_pri n t);lb_print.setbounds( 140,10,150,20);jl_bookname.settext(" i $ 名:”);jl_bookname.add(tf_bookname);jl_bookname.setbounds(30,30,l 00,40);tf_bookna
14、me.setbounds(100,7,220,25);jl_autor.settext(h 作者:“);jl_autor.add(tf_autor);jl_ autor.setbounds(30,70,100,40);tf_ au tor. setb ounds( 100,7,220,25);jlpres.serrexz 壬s洋3;jlipresbdd(tfipres)八jlipresseibounds(30" 1 lpl 0p40); tfipres.seaounds( 10p722p25); jlipub=cationdae.secrex(=eesbs=); jlpub 一 ic
15、ationdae.add(tfpub=cahondae; jlpub 一 icahondao.sea()unds(3p150 j 0p40). tfipublica=ondao.setbounds(l()p722p25)八 jliprics-gsettexe亨.)一 jlipi.icing.add(tfpricing); jlipricing.sesounds(3p19p10p40)八 tfipricing.sesounds( 10.p722p25)八jlibooklse=inumsettext(=2tit卷 即.); jlibooklselllnum.add(tfibooklselllnum
16、); jlibooklse=inum.setbounds(3p230j00"40); tfibooklse=inumsesounds(10p722p25)八booklsaalwindowadd(jlibookname= booksid elwindowadd(jliauiom booklsa 一 elwindow.add(jlipres)八 booklsalelwindowadd(jlipublicaiionda<?); booklsalelwindow.add(jlipricing)-bookls 巴 elwindowadd(jlibooklse=inum)_b()oklsa
17、-elwindowadd(btnlokrbooklsalelwindowadd(bnlexo;btn_ok.setbounds(90,270,65,30);btn_exit.setbounds(250,270,65,30);btn_ok.addactionlistener(this);btn_exit.addactionlistener(this);book_sale_window.setvisible(true);public void actionperformed(actionevent e)preparedstatement pstmt=null;resultset rs= null;
18、if(e.getsource()=btn_exit)book_sale_window.dispose();if(e.getsource()=btn_ok) str_bookname = tf_bookname.gettext();str_autor = tf_autor.gettext();str_pres = tf_pres.gettext();str_publicationdate = tf_publicationdate.gettext();str_pricing = tf_pricing.gettext();buy_num = integer.parseint(tf_book_sell
19、_num.gettext();if(str_bookname.length()>0) connection con;statement stmt;string query;string query_end;stringdbclassname"co m.m icrosoft.jdbc.sqlserver.sqlserverdriverm;stringmyurl=njdbc:microsoft:sqlserver:/localhost:1433;databasename=bookm;/ 连接数据库里的库string user=msam;string password= "
20、people”;query 'update books set n;class.forname(dbclassname).newinstance();con=drivermanager.getconnection(myurluser,password);stmt = con.createstatement();from book wherepstmt=con.preparestatement(u,selectbookname=h,4- parameter_bookname);rs=pstmt.executequery();if(rs.next()store_num = rs.getin
21、t(hbookleftm);stmt.executeupdate(query+nbookname=h'+str_bookname+,hwhere bookname=,"+parameter_bookname+'"h);query_end='" where bookname="'+str_bookname+""; if(str_autor.length()>0)stmt.executeupdate(query+nautor=,h+str_autor+query_e nd);if(str_pres.l
22、ength()>0)stmt.executeupdate(query+npres=,h+str_pres+query_end);if(str_publicationdate.length()>0) stmt.executeupdate(query+npublicationdate=,h+str_publicationdate+query_end);if(str_pricing.length()>o) stmt.executeupdate(query+opricing=m,+str_pricing+query_end);if(buy_num <= store_num)st
23、mt.executeupdate(query+nbookleft=,k+(store_num-buy_num)+query_end);joptionpane.showmessagedialog(book_sell_management.this,h 销售成功!”);book_sale_window.dispose();stmt.close();con.close();catch(exception ex) 数据库的错误处理system.err.println(mexception:n+ex.getmessage();else if(buy_num > store_num)joptionp
24、ane.showmessagedialog(book_sell_management.this,h 库 存不足,销售失败“);elsejoptionpaneshowmessagedialog(book_sell_managemem.thisr 请 输入书名o °);版本信息:public class verison extends jframe implements actionlistenerjframe verison_window;定义版本信息组件button btn_exit = new button(h返 回”);container con;jlabel lab_head;
25、jlabel lab_name;jlabel labmaker;jlabel lab_ma;jlabel lab_zhang;jlabel lab_bai;verison()verison_window = new jframe(”关于”);初始化组件并进行设置 verison_window.setbounds(450,220,330,220);con = verison_window.getcontentpane();con.setlayout(null);lab_name = new jlabel("数据库原理及应用”); lab_name.setbounds( 115,0,11
26、0,30);lab.head = new jlabel(m课程设计-图书销售管理系统“); lab_head.setbounds(80,20,180,30);lab_maker = new jlabel("制作人:"); lab_maker.setbounds(60,50,80,30);lab_ma = new jlabel(h10 计科 2 班 1010311209 马强”); lab_ma.setbounds(80,70,180,30);lab_zhang = new jlabel("10 计科 2 班 1010311222 张露“); lab_zhang.s
27、etbounds(80,90,180,30);lab_bai = new jlabel(h10 计科 2 班 1010311223白雪峰”);lab_bai.setbounds(80,l 10,190,30);con.add(lab_head);将所有组件添加到容器中 con.add(lab_name);con.add(lab_maker);con.add(lab_ma);con.add(lab_zhang);con.add(lab_bai);con.add(btn_exit);btn_exit.setbounds(230,150,55,25);btn_exit.addactionlisten
28、er(this); /对返冋按钮设置监听verison_window.setvisible(true);)public void actionperformed(actionevent e)if(e.getsource() = btn_exit)verison_window.dispose();主窗口:public class landed extends frame implements actionlistener/*创建用八登陆窗口所需组件*/j frame log_i n_ wi n do w;/ 创建登陆窗口container con;/仓建登录窗口容器jlabel user;/创建
29、容器jlabel pass;button btn_enter = new button(m登 陆”);/创建按钮组件button btn_exit = new button(h退 出”);textfield username = new textfield();/创建文7输入组件textfield password = new textfield();/*对窗口进行排歹!j */landed() log_in_window = new jframe(n 登录系统”);log_in_window.setbounds(500,300,350,200);con = log_in_window.get
30、contentpane();con.setlayout(null);令登录窗口默认排列为空严排列账号组件*/user=new jlabel();user.settext(m 账号:”);user.setbounds(60, 30, 77, 25);user.add(username);username.setbounds(77,0, 140, 22);/*排列密码组件*/pass=new jlabel();pass.settext(u 密 码:”);pass.setbounds(60, 70, 70, 25);pass.add(password);password.setbounds(77,0
31、, 140, 22);password.setechocharc1*1);严组件添加至容器中*/con.add(user);con.add(pass);con.add(btn_enter);con.add(btn_exit);)btn_enter.setbounds(80,120,60,25);/按钮显示坐标和人小btn_exit.setbounds( 190,120,60,25);btn_exit.addactionlistener(this);对按钮添加监听btn_ente 匚 addactionlistenei*(this);log_in_window.setdefaultcloseop
32、eration(jframe.exit_on_close);/ 处义登录界面按钮作用log_in_windo w.set visible(true); /显示登陆界面/*按钮的监听*/public void actionperformed(actionevent e)if(e.getsource() = btn_exit) /退出按钮的操作system.exit(o);if(e.getsource() = btn_enter) 登陆按钮的操作string username = username.gettext(); 获収用八名、密码文本框里 的数据string password = pass
33、word.gettext();if(log_in_check(username,password)通过 verification 方法进行验证输入的用户名、密码是否止确joptionpaneshowmess“gedi"log(book_sell_mwnagementthisj 登 录成功”);/正确则提示登录成功log_in_wi ndow.dispose();/ 关闭用八登陆界面new management();/创建用丿''管理界面else joptionpane.showmessagedialogfbook-sellmanagement.this/1 密码 错 误”);/否则提示密码错误严检查用户密码*/p
温馨提示
- 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
- 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
- 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
- 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
- 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
- 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
- 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。
最新文档
- 陆上风电建设项目环境影响报告书
- 磷矿生产调度与信息化管理方案
- 环保设施建设项目环境影响评估方案
- 混合式储能系统的智能调度方案
- 公司资金调配智能化方案
- 公司质量追溯与改进机制方案
- 公司办公流程精细化方案
- 钢筋绑扎与安装方案
- 信息技术与教育公平策略考试及答案
- 电子废弃物金属回收工艺优化方案
- 基尔霍夫定律课件(共17张课件)
- 尿液常规检验-尿液沉渣检查(临床检验技术)
- 渣土运输车辆安全培训
- DL-T820.2-2019管道焊接接头超声波检测技术规程第2部分:A型脉冲反射法
- 起重吊装作业安全技术措施
- 春季保养与养生知识讲座
- 推土机配件供货合同
- 江西省修水县黄土坪金矿详查项目环评报告
- 慢性阻塞性肺疾病的早期筛查与管理
- 司法鉴定中的伦理道德问题与应对策略
- 汉唐美术空间表现研究:以敦煌壁画为中心
评论
0/150
提交评论