房屋中介系统实习报告_第1页
房屋中介系统实习报告_第2页
房屋中介系统实习报告_第3页
房屋中介系统实习报告_第4页
房屋中介系统实习报告_第5页
已阅读5页,还剩58页未读 继续免费阅读

下载本文档

版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领

文档简介

1、 目 录第1章 系统设计111系统的需求分析112系统功能模块设计213系统用例图设计214系统业务流程图3第2章 数据库设计421概念设计422逻辑设计423物理设计424数据完整性设计6第3章 数据库编程631视图632存储过程733触发器9第4章 系统功能的设计与实现1241登陆功能的设计与实现1242主界面的设计与实现13第5章 总结4451系统的不足与展望4452体会44参考文献44第1章 系统设计11系统的需求分析 经过对房屋中介系统的需求分析,确定最终用户包括客户和员工。超级用户为:房产中介管理员。主要的实体对象有:1、管理员2、员工3、客户,(这三者都是用户,对用户设一张表,存

2、储信息和权限)4、房源(包括求购房产信息、求租房产信息、出售房产信息、出租房产信息)5、交易(交易的基本信息,可以单独列一张表)6、咨询(员工对客户的回答及客户对交易的提问在列一张表)7、考勤(用于对员工的出勤查询和奖罚制定,包含每次出勤的记录以及统计信息)一、用户管理部分: 1、处理用户注册:当有员工或客户加入时,依据条件添加用户并分配相关权限。注册免费,但是查询时到满意的房源时,想要获得联系方式就要交费。 2、处理用户登录:根据不同角色选择界面。 管理员拥有最全面,全部权限。 客户只有查询、提交、删除自己的出售出租,求购求租房产信息的权限。 客户和员工第一次注册时可以修改自己的信息,然后只

3、有对分配的业务进行提交及查询自己信息的权限。 3、用户可以查询、提交、删除自己的出售出租,求购求租房产信息。(员工除外):客户根据自己的客户编号来提交信息,可以查询符合条件的房源,来获取联系方式,达成交易,记录在交易表上。 4、员工可以添加房源信息。 5、用户可以提交与查询交易信息。 6、用户可以查询自己的基本信息。 7、用户可以修改用户自己密码。二、管理员管理部分1、 处理管理员登录2、 管理员可以添加,查询,修改,删除客户与员工信息。3、 管理员可以发布与更新出售出租房产信息。4、 管理员可以修改与删除求购求租房产信息。5、 管理员可以查询与修改交易信息。6、 管理员可以查询与修改咨询信息

4、。7、 管理员可以查询与修改考勤信息。8、 管理员可以对员工和客户颁发工资和奖励。管理员可以修改管理员密码。 12系统功能模块设计系统功能模块如下所示:系统的功能介绍:1、 数据录入功能:录入系统的基本信息,例如:客户信息、员工信息、房源信息、咨询信息、交易信息、考勤信息。2、 数据查询功能:在员工表、客户表与房源表之间建立视图,方便客户和员工对房源的查询。建立存储过程,可以查询每个表的信息。3、 数据统计功能:在交易表上建立视图,生成交易的简易统计结果。4、 数据更新功能:建立存储过程,可以通过查询时更新数据。5、房产中介管理系统交易管理房源管理用户管理退出考勤管理咨询管理退出系统添加房源添

5、加交易添加咨询查询咨询查询考勤删除考勤修改考勤添加考勤删除咨询修改咨询查询交易修改交易删除交易查询房源删除房源修改房源员工管理客户管理删除用户查询客户修改用户添加用户13系统用例图设计系统use case图如下所示:14系统业务流程图系统业务流程图如下所示: 第2章 数据库设计21概念设计 根据系统需求分析可得系统数据库的e-r图如下所示:22逻辑设计根据e-r图得出逻辑设计如下: 用户(账号、密码、类型、姓名、性别、联系电话、住址、注册日期、用户状态、用户钱数)房源(房源编号、房源类型、户型、面积、地址、楼层、价格、发布人id、发布时间、房源状态)交易(交易号、成交价格、成交时间、房源编号、

6、房主、交易人、交易类型)咨询(咨询人id、咨询内容、咨询时间、回复内容、回复时间、回复人id)考勤(id、登录时间、注销时间、登录次数、绩点) 23物理设计 customer表(用户表)house表(房源表)deal表(交易表)consult表(咨询表)checkload表(考勤表)24数据完整性设计主键及外键约束、缺省约束、非空约束、check约束、规则约束的说明(1) 主键及外键约束、非空约束id为customer表的主键,hno为house表的主键,ctime为consult表的主键,dno为deal表的主键,ltime为checkload表的主键,not null.(2) 使用默认值h

7、no、dno为自动增值型,每次加一。 (3) check约束htime,dtime、cbirth、ctime、atime默认值为getdate();(ctype=管理员 or ctype=员工 or ctype=客户)(ctype=管理员 or ctype=员工 or ctype=客户);(csex=女 or csex=男);(hleixing=求购 or hleixing=求租 or hleixing=出售 or hleixing=出租)(hstate=未成交 or hstate=已成交) 第3章 数据库编程31视图 1查看详细房源视图 该视图显示未成交的房源的详细信息,可根据提供的房源信息

8、进行满足条件的搜索功能; 代码:create view dbo.查看详细房源asselect hid , hno, hleixing, htype, harea, haddress, hfloor, hprice,htime,hstatefrom dbo.housewhere (hstate not in (已成交) 运行效果图: 2员工业绩查询视图 该视图显示该员工经手成交的业务的详细信息。 代码:create view dbo.员工业绩查询asselect id 员工id,sum(dno) 交易总数,sum(dprice) 累计金额 from deal,customer,house whe

9、re deal.hno=house.hno and house.hid=customer.id and customer.ctype=员工group by id 运行效果图:32存储过程1添加房源 当需要增加新的房源时,调用该存储过程代码:create proc dbo.添加房源hleixing char(10),htype char(10),harea int,haddress char(10),hfloor char(10),hprice money,id char(10)asinsert into house(hleixing ,htype ,harea ,haddress ,hfloo

10、r ,hprice ,hid )values(hleixing ,htype ,harea,haddress,hfloor,hprice,id) 运行效果图: 2添加交易 当需要增加新的交易时,调用该存储过程代码:create proc dbo.添加交易-传递三个值dprice money,hno int,id char(10)dprice money,hno int,id char(10)-当前员工编号asdeclare hname char(10),dname char(10),dleixing char(10)select hname =cname,dleixing =hleixing

11、from house,customer where hid=id and hno =hno select dname =cname from customer where id =id insert into deal (dprice ,hno ,hname ,dname, dleixing )values(dprice ,hno ,hname,dname,dleixing ) 运行效果图:3添加用户 当需要增加新的用户时,调用该存储过程代码:create proc dbo.添加用户id char(10),ccode char(10),ctype char(10),cname char(10)

12、,csex char(2),cphone char(10),clocal char(10),cstate char(10),cmoney moneyasinsert into customer (id ,ccode ,ctype ,cname ,csex ,cphone ,clocal ,cstate,cmoney)values(id,ccode,ctype ,cname,csex,cphone,clocal,闲,cmoney) 运行效果图:33触发器1删除记录触发器 当删除用户信息时,把与他有关的房源信息都删除。代码:create trigger dbo.删除on dbo.customera

13、fter deleteasdelete from house where hid=(select id from deleted) 运行效果图:删除前:删除后:2添加考勤记录触发器 当添加用户信息时,相应的添加考勤记录。代码:create trigger dbo.添加考勤初始记录on dbo.customerafter insertasdeclare lid char(10),loadtime datetime,downtime datetime, ltimes int, grade intselect lid = id from insertedset loadtime =getdate (

14、)set downtime=getdate ()insert into checkload values (lid,loadtime,downtime,1,0) 运行效果图:插入用户前:插入用户后:3添加咨询记录触发器 当添加用户信息时,相应的添加咨询记录。 代码:create trigger dbo.添加客户咨询记录on dbo.customerafter insertasif not exists (select * from inserted where ctype=客户)returndeclare cid char(10),ctime date,atime date,aid char(

15、10)set ctime=getdate()set atime=getdate()select cid=id from inserted where ctype=客户select top 1 aid=id from customer where ctype=员工 and cstate=闲insert into consultvalues(cid,未知,ctime,未知,atime,aid)update customerset cstate=忙where ctype=员工 and id=aid 运行效果图:添加用户前:添加用户后:4修改房源状态触发器 当添加用户信息时,相应的添加咨询记录。 代码

16、:create trigger dbo.修改房源状态 on dbo.dealafter insertasdeclare a intselect a=hno from insertedupdate house set hstate=已成交where hno=a 运行效果图:修改房源状态前:修改房源状态后:5修改员工状态触发器 当添加交易信息时,相应的修改与该业务相关员工状态记录。 代码:create trigger dbo.修改员工状态on dbo.dealafter insertasdeclare id char(10)select id=id from deal,customer where

17、 cname=dnameupdate customerset cstate=闲where ctype in(员工,管理员) and id=id 运行效果图:修改员工状态前:修改员工状态后: 第4章 系统功能的设计与实现41登陆功能的设计与实现为了避免非授权用户进入系统,设计并实现登陆窗口。当输入合法用户信息后,方可访问本系统。合法用户都是向管理员申请注册后获得的身份。包括员工和客户。运行效果图如下所示:主要代码:using system;using system.collections.generic;using system.componentmodel;using system.data;

18、using system.drawing;using system.linq;using system.text;using system.windows.forms;using system.data.sqlclient;namespace 房产中介管理系统 public partial class form1 : form public form1() initializecomponent(); /登陆判断 private void button1_click(object sender, eventargs e) if (textbox2.text = | textbox1.text

19、= )messagebox.show(请输入登录名或密码!);textbox2.focus(); elsestring str = data source =pc-20120426czm;initial catalog = fczj;integrated security = sspi; sqlconnection con = new sqlconnection(str); con.open(); sqlcommand com = new sqlcommand();com.connection = con; com.commandtype = commandtype.text; com.com

20、mandtext = select ctype from customer where id= + textbox1.text + and ccode= + textbox2.text + ; sqldatareader myread = com.executereader(); if (myread.read() string ctype = myreadctype.tostring ().trim(); this.hide(); form2 f2 = new form2(); f2.id = textbox1.text; f2 .ccode = textbox2.text; switch

21、(ctype) case 管理员: f2.tab = 2; f2.text = 管理员+textbox1.text + 已登录; break ; case 员工: f2.tab = 0; f2.text = 员工+textbox1.text + 已登录; break; case 客户: f2.tab = 1; f2.text = 客户+textbox1.text + 已登录; break; f2.show(); else messagebox.show(对不起,您输入有误!); textbox2.text = ; textbox1.text = ; textbox1.focus(); myre

22、ad.close(); /登陆关闭 private void button2_click(object sender, eventargs e) this.close(); private void textbox1_keypress(object sender, keypresseventargs e) if (e.keychar = r) textbox2.focus(); private void textbox2_keypress(object sender, keypresseventargs e) if (e.keychar = (char)13) button1_click(nu

23、ll, null); 42主界面的设计与实现说明:主界面只有三个:(管理员界面和员工界面及最主要的客户界面)使用tabcontrol分页控件区分:主界面加载代码:using system;using system.collections.generic;using system.componentmodel;using system.data;using system.drawing;using system.linq;using system.text;using system.windows.forms;using system.data.sqlclient;namespace 房产中介管

24、理系统public partial class form2 : formpublic int ab = 0; public int tab = 0; public string id = ;public string ccode = ;public static string stron = data source =microsof-ef05ac ;initial catalog = fczj;integrated security = sspi;public string select =;public sqlconnection conn = new sqlconnection(stro

25、n);public form2() initializecomponent();/系统主界面 /显示系统时间private void timer1_tick(object sender, eventargs e)this.toolstripbutton1.text =当前时间为:+ datetime.now.tostring();/关闭主界面private void button1_click(object sender, eventargs e) application.exit(); / 登陆权限分配及加载某些代码模块private void form2_load(object sende

26、r, eventargs e)string sc =; /权限分配if (tab = 2) this .tabcontrol1.selectedindex = 2; /管理员 tabcontrol1.tabpages1.enabled = false;/ 权限设置 tabcontrol1.tabpages0.enabled = false;/加载管理员模块的房源select = select * from house;try sqldataadapter adapter = new sqldataadapter(select , conn);dataset dstable = new data

27、set(); adapter.fill(dstable, testtable);datagridview4.datasource = dstable.tablestesttable; datagridview4.show();catch (exception ex) messagebox.show(ex.message); finally conn.close(); else if (tab = 1) this.tabcontrol1.selectedindex = 1; /客户 tabcontrol1.tabpages0.enabled = false;/ 权限设置tabcontrol1.t

28、abpages2.enabled = false;/加载客户模块的房源button21_click(null, null);/加载客户信息button31_click(null, null);/加载客户咨询内容和员工回复内容select = select cid 客户id ,ctext 咨询内容,ctime 咨询日期 from consult where cid= + id ;trysqldataadapter adapter = new sqldataadapter(select, conn);/实例化数据库适配器datasetdstable=newdataset();adapter.fil

29、l(dstable,testtable);datagridview6.datasource = dstable.tablestesttable;datagridview6.show(); catch(exceptionex) messagebox.show(ex.message); finally conn.close(); sc = select aid 员工id,atext 回复内容,atime 回复日期 from consult where cid= + id ;try sqldataadapter adapter = new sqldataadapter(sc, conn);/实例化数

30、据库适配器dataset dstable = new dataset(); adapter.fill(dstable, testtable); datagridview7.datasource = dstable.tablestesttable;datagridview7.show(); catch (exception ex) messagebox.show(ex.message); finally conn.close(); else if (tab = 0) this.tabcontrol1.selectedindex = 0; /员工 tabcontrol1.tabpages2.ena

31、bled = false;/ 权限设置tabcontrol1.tabpages1.enabled = false;/加载员工模块的房源button20_click(null, null);/加载员工回复内容 /加载客户咨询内容和员工回复内容select = select cid 客户id ,ctext 咨询内容,ctime 咨询日期 from consult where aid= + id+ ;try sqldataadapter adapter = new sqldataadapter(select, conn);/实例化数据库适配器dataset dstable = new dataset

32、();adapter.fill(dstable, testtable);datagridview9.datasource = dstable.tablestesttable; datagridview9.show();catch (exception ex) messagebox.show(ex.message); finally conn.close(); sc = select aid 员工id,atext 回复内容,atime 回复日期 from consult where aid= + id ;try sqldataadapter adapter = new sqldataadapte

33、r(sc, conn);/实例化数据库适配器dataset dstable = new dataset(); adapter.fill(dstable, testtable); datagridview10.datasource = dstable.tablestesttable; datagridview10.show();catch (exception ex) messagebox.show(ex.message); finally conn.close(); /记录考勤select = declare lid char(10),loadtime datetime,downtime da

34、tetime,ltimes int,grade int set lid =+id+set loadtime=getdate();select += select ltimes =ltimes from checkload where lid =+id+set ltimes=ltimes+1;select += select grade =grade from checkload where lid =+id+;select += insert into checkload values (lid ,loadtime ,downtime ,ltimes ,grade );sqlcommand c

35、md = new sqlcommand(select, conn);try conn.open();cmd.executenonquery();catch (exception ex) messagebox.show(ex.message); finally conn.close(); textbox10.text = 如:求租、求购、出租、出售、两室一厅、三室一厅、一室一厅、天津、浙江、北京、上海; /form2关闭private void form2_formclosed(object sender, formclosedeventargs e) select = declare load

36、time datetime, downtime datetime,grade int ,gradeday int ,gradeend int,gradestart int set downtime=getdate();select += select top 1 grade =grade from checkload where lid = +id + order by loadtime desc ;select += select top 1 loadtime =loadtime from checkload where lid = + id + order by loadtime desc

37、 ;select+= set gradestart=datepart(hour,loadtime) set gradeend=datepart(hour ,downtime) set gradeday=gradeend-gradestart set grade =grade+gradeday;select += update checkload set downtime=downtime , grade =grade where ltimes =(select top 1 ltimes from checkload where lid=10001 order by loadtime desc)

38、;sqlcommand cmd = new sqlcommand(select, conn);try conn.open();cmd.executenonquery();catch (exception ex) messagebox.show(ex.message); finally conn.close(); application.exit();/重新登录private void button2_click(object sender, eventargs e) this.hide(); form1 f1 = new form1();f1.show();4.2.1当客户登陆成功后,会弹出主

39、界面,显示客户主页运行效果图如下所示:1当客户登陆成功后,会弹出主界面,当选择房源跟进信息后显示该页。运行效果图如下所示:主要代码:/高级搜索private void button3_click(object sender, eventargs e) select = select hno 房源编号,hleixing 房源类型,htype 房源户型,harea 房源面积,haddress 房源地址 ,hfloor 所在楼层,hprice 预售价,hid 房主id,htime 发布时间,hstate 房源状态 from house where;if (combobox2.text = ) mes

40、sagebox.show(房源状态不能为空!); return; if(combobox2.text =已成交 & textbox1.text =) select += hstate=已成交 ; else if (combobox2.text =已成交& textbox1.text!=)switch (textbox1.text)case 求租: select += hleixing=求租 and hstate=已成交 ; break ;case 求购: select += hleixing=求购 and hstate=已成交; break;case 出租: select += hleixin

41、g=出租 and hstate=已成交; break;case 出售: select += hleixing=出售 and hstate=已成交; break;case 两室一厅: select += htype=两室一厅 and hstate=已成交; break;case 三室一厅: select += htype=三室一厅 and hstate=已成交; break;case 一室一厅: select += htype=一室一厅 and hstate=已成交; break;case 天津: select += haddress=天津 and hstate=已成交; break;case

42、浙江: select += hleixing=浙江 and hstate=已成交; break;case 北京: select += hleixing=北京 and hstate=已成交; break;case 上海: select += hleixing=上海 and hstate=已成交; break; else if (combobox2.text =未成交& textbox1.text =) select += hstate=未成交 ;else if (combobox2.text =未成交& textbox1.text !=) switch (textbox1.text)case 求

43、租: select += hleixing=求租and hstate=未成交 ; break;case 求购: select += hleixing=求购 and hstate=未成交; break;case 出租: select += hleixing=出租 and hstate=未成交; break;case 出售: select += hleixing=出售 and hstate=未成交; break;case 两室一厅: select += htype=两室一厅and hstate=未成交 ; break;case 三室一厅: select += htype=三室一厅 and hsta

44、te=未成交;break;case 一室一厅: select += htype=一室一厅 and hstate=未成交; break;case 天津: select += haddress=天津 and hstate=未成交; break;case 浙江: select += hleixing=浙江 and hstate=未成交; break;case 北京: select += hleixing=北京 and hstate=未成交; break;case 上海: select += hleixing=上海 and hstate=未成交; break; try sqldataadapter a

45、dapter = new sqldataadapter(select, conn);dataset dstable = new dataset(); adapter.fill(dstable, testtable);datagridview2.datasource = dstable.tablestesttable; datagridview2.show(); catch (exception ex) messagebox.show(ex.message); finally conn.close(); /添加房源private void button4_click(object sender,

46、 eventargs e)if (combobox3.text = & textbox2.text = & combobox12.text = & textbox4.text = & combobox4.text = & combobox10.text = )messagebox.show(不能为空!); return; sqlcommand cmd = new sqlcommand(添加房源,conn );cmd.commandtype = commandtype.storedprocedure; /调用存储过程sqlparameter hleixing = new sqlparameter

47、(hleixing, sqldbtype.char, 10);hleixing.direction = parameterdirection.input;hleixing.value = combobox3.text.trim (); cmd.parameters.add(hleixing);sqlparameter htype = new sqlparameter(htype, sqldbtype.char, 20);htype.direction = parameterdirection.input; htype.value = combobox4.text.trim();cmd.para

48、meters.add(htype);sqlparameter harea = new sqlparameter(harea, sqldbtype.int);harea.direction = parameterdirection.input;harea.value = combobox12 .text.trim(); cmd.parameters.add(harea);sqlparameter haddress = new sqlparameter(haddress, sqldbtype.char, 40);haddress.direction = parameterdirection.inp

49、ut;haddress.value = textbox4.text.trim(); cmd.parameters.add(haddress);sqlparameter hfloor = new sqlparameter(hfloor, sqldbtype.char , 10);hfloor.direction = parameterdirection.input;hfloor.value = textbox2.text.trim(); cmd.parameters.add(hfloor);sqlparameter hprice = new sqlparameter(hprice, sqldbt

50、ype.money );hprice.direction = parameterdirection.input;hprice.value = combobox10.text.trim(); cmd.parameters.add(hprice);sqlparameter id= new sqlparameter(id, sqldbtype.char, 10); id.value = id;cmd.parameters.add(id);try conn.open(); cmd.executenonquery(); messagebox.show(已成功!); catch (exception ex) messagebox.show(ex.message); finally conn.close(); string sc = select * from house ;trysqldataadapter adapter = new sqldataadapter(sc, conn);/实例化数据库适配器dataset dstable = new dataset(); adapter.fill(dstable, testtable); datagridview2.datasource = dstable.table

温馨提示

  • 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
  • 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
  • 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
  • 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
  • 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
  • 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
  • 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。

评论

0/150

提交评论