第38页 共53页
租房信息发布界面中,此窗体Formshow时,根据canmodify=false,设置保存按钮的enable属性,并进行控件颜色等的初始化操作等。
图7.5 租房信息发布界面 在此模块中,主要涉及到查询,为了实现组合查询,在此系统中,我们设计了一个通用查询窗体,不仅可以动态组合查询条件,而且还可以列出相对应字段在数据库中的值,通过比较关系,组合查询,显示查询结果。可以组合一个条件也可以多个条件一起查询,使用方便。在Delphi中新建一个窗体,将窗体的单元文件名保存为chaxun.pas,将窗体的Name属性设为chaxunf,Caption属性设为“查询条件”。在具体查询的时候,我们只需要直接调用就可以实现查询。通过声明convertname、converfieldtype方法获取字段名字和字段类型。调用FillBox方法添加列标题名,调用FillComboBox方法添加比较值,调用FillCondition方法添加比较关系。
窗体的布局如图7.6所示:
procedure Tchaxunf.Fillcondition(sSource: string; sTerm: Tcombobox); var
field_type: TFieldType; begin
field_type := Convertfieldtype(form_name, dbgrid_name, sSource); if (field_type = ftInteger) or (field_type = ftFloat) or (field_type = ftCurrency) then
图7.6 租房信息查看界面 第39页 共53页
begin
with sTerm.items do begin Clear;
sTerm.text := '='; add('='); add('<'); add('<='); add('>'); add('>='); add('<>'); end; end else begin
with sTerm.items do begin Clear;
sTerm.text := '='; add('='); add('<'); add('<='); add('>'); add('>='); add('<>'); add('≈'); add('!≈'); end; end; end;
procedure Fillbox(sForm: Tform; sDBGrid: TDBGrid; Sender: TObject); var
i: integer;
titlename: string;
field_type: TFieldType; begin
if (sender is TCombobox) then
TCombobox(sender).Items.Clear; if (sender is TListbox) then
TListbox(sender).Items.Clear; with sForm do
第40页 共53页
begin
for i := 0 to sDBGrid.Columns.Count - 1 do begin
titlename := sDBGrid.Columns[i].Title.Caption; field_type := sDBGrid.Columns[i].Field.DataType;
if (field_type <> ftgraphic) and (field_type <> ftblob) then begin
if (sender is TCombobox) then
TCombobox(sender).Items.Add(titlename); end; end; end; end;
procedure Tdmf.FillComboBox(Sender: TObject; TableName: string; FieldName: string); begin try
CDS_load.close;
CDS_load.CommandText := 'select distinct ' + fieldname + ' from ' + tablename + ' order by ' + fieldname; CDS_load.open; except exit; end;
Tcombobox(sender).clear; CDS_load.first;
while not (CDS_load.Eof) do begin
Tcombobox(sender).Items.add(CDS_load.fieldbyname(fieldname).asstring); CDS_load.next; end;
CDS_load.first;
Tcombobox(sender).text := CDS_load.fieldbyname(fieldname).asstring; CDS_load.close; end;
7.2.3 求购房信息查询子模块的界面设计
此界面的主要功能是为了方便中介录入求购信息,并方便业主查询求购信息,业主可以自主组合查询求购信息,对于此子模块的设计与租房信息查询子模块设计相似,在此就不再重复。
求购房信息查询界面、求购房录入界面、求购房信息查看界面如图7.6—图7.7所示:(求租房信息查询界面、求租房录入界面、求购房信息查看界面类似)
第41页 共53页
图7.6 求购房信息录入界面
图7.7 求购房信息查看界面 7.2.4 此模块遇到的问题及解决方法
遇到的问题是对于发布的信息的自动删除,解决的方法是通过判断当天的日期减去发布期限是不是大于发布日期实现。代码如下:
CDS_all.close;
CDS_all.CommandText:='select*fromsale_housesWHERE(GETDATE()-issuance_time)>potent_time';
CDS_all.Open; CDS_all.First;
while not CDS_all.IsEmpty do begin
CDS_all.Delete; CDS_all.Next; end;
CDS_all.ApplyUpdates(-1); end;
第42页 共53页
8 业务处理模块设计
8.1 业务处理模块的体系结构设计
8.1.1 业务处理模块功能简介
业务处理模块是对二手房中介机构具体业务的处理,有费用管理子模块、费用统计子模块组成。具体业务功能是在查询模块输入需求客户信息,点“收费”按钮,进入此费用管理录入模块,录入模块相关信息自动显示在费用管理和费用统计界面。普通客户在查询平台看到有合适的房源信息,就约定时间看房,则进行费用管理,涉及到收费编号、收取金额等信息,之后进行费用统计,根据收费管理信息进行统计。 8.1.2 业务处理模块功能图
业务处理 费用管理 费用统计 图8.1 业务处理模块功能图
8.2 业务处理模块的详细设计
8.2.1 费用管理子模块设计
此界面的主要功能是对看房的客户进行收费记录,在租房信息查询、售房信息查询、求租房信息查询、求购房信息查询界面都可以点“收费”按钮进入到收费录入界面。
中介费用管理录入界面如图7.3所示:
图8.3 费用管理录入界面