【设计题目】 公寓管理系统
【设计目的】
①.熟悉delphi编程的环境;
②.熟练使用SQL Server数据库,及SQL;
③.能够系统地规划程序设计的步骤;
④.做一个合理、有效的系统,方便公寓管理;
【系统分析】
公寓管理系统是为方便管理公寓日常事务的系统,它应该具备的功能有:建立设置楼层信息,建立必要的学生档案,及学生的住宿情况,删除过期的学生档案,可以按多种方式查询学生的档案,登记来访人员的信息,登记贵重物品的搬出情况,记录和排序各寝室的卫生评比情况(尚未实现),记录各寝室的财产状况,等等。
要尽可能使系统人性化(易操作,界面友好),健壮(尽量避免系统错误,对用户的误操作加以限制)以及节省系统资源,等等。
【概要设计】
【详细设计】
● 本系统所用的是SQL Server数据库,用到了以下五个表:
本系统主要由菜单驱动,其主要功能描述如下:
登陆窗口:
procedure TForm_flash.SpeedButton1Click(Sender: TObject);
var
logname,pawor:string;
begin
query1.Close;
query1.SQL.Clear;
logname:=ComboBox1.Text;
query1.SQL.Add('select * from userinfo where username=:username and password=:password');
query1.ParamByName('username').AsString:=ComboBox1.Text;
query1.ParamByName('password').AsString:=Edit1.Text;
query1.Open;
if query1.RecordCount>=1 then
begin
pawor:=query1.FieldList.Fields[2].Value; //获得用户权限
application.CreateForm(Tform_main,form_main);
form_flash.Free;
form_main.Show;
form_main.StatusBar1.Panels[1].Text:=logname;
form_main.StatusBar1.Panels[3].Text:=pawor;
if pawor='超级用户' then
form_main.menu_config_uesr.Enabled:=true; //超级用户可以使用用户设置菜单项
end
else
begin
showmessage('Error:密码错误!');
edit1.Text:='';
edit1.SetFocus;
end ;
end;
主窗体:
procedure TForm_main.Timer1Timer(Sender: TObject);
var dow:string;
begin
case dayofweek(date()) of
1: dow:='日';
2: dow:='一';
3: dow:='二';
4: dow:='三';
5: dow:='四';
6: dow:='五';
7: dow:='六';
end;
statusbar1.Panels.Items[5].Text:=datetostr(date())+' '+timetostr(time());
statusbar1.Panels.Items[6].Text:='星期'+dow;
end;
procedure TForm_main.menu_config_uesrClick(Sender: TObject);
begin
application.CreateForm(TForm_userconfig,Form_userconfig);
Form_userconfig.ShowModal;
end;
procedure TForm_main.FormCreate(Sender: TObject);
begin
projectdir.Caption:=getcurrentdir; //获得工程所在的路径
end;(下面代码省略)
主要菜单:
系统设置: 学生管理: 出入登记:
楼层设置窗体:
procedure TForm_floorconfig1.But_submi