前两天试着玩GitHub,熟悉了英语,却把头脑给弄大了。
文件夹上传到GitHub总不成功,启动Gitshell后,不到一会,系统就崩了,explorer.exe无法工作,只得重启。
昨天关机、开机试了不少于10次,问题还没解决,先搁在那,等心缓一缓再弄。
有收获的是知道怎么从GitHub中拷贝别人的项目文件。
今天终于把搁置了几天的图书管理系统搞定了,完成了图书查询借阅功能和还书功能两大功能。
现在对这个小型系统做一个总结。
该系统由8个窗体构成,如下表所示:
窗体名称 | Unit文件 | 窗体功能 |
---|---|---|
Welcomeform | welcome.pas | 用户登录 |
Masterform | Master.pas | 图书管理界面 |
updatebookform | Updatebook.pas | 修改图书记录 |
updatepasswordform | updatepassword.pas | 修改密码 |
updatereaderform | updatereader.pas | 修改读者记录 |
readerform | reader.pas | 读者服务界面 |
readerselectform | readerselect.pas | 图书查询与借阅 |
readerbackform | readerback.pas | 图书归还 |
一、登录功能模块的实现
1、登录模块窗体的设计
radiogroup控件的边框没找到方法隐藏,如果你知道,麻烦在回复中告知。
2、登录模块的代码设计
unit Welcome;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls, DB, ADODB, ExtCtrls;
//uses master;
type
TForm1 = class(TForm)
GroupBox1: TGroupBox;
Label1: TLabel;
Edit1: TEdit;
Button1: TButton;
Button2: TButton;
Label2: TLabel;
Edit2: TEdit;
ADOConnection1: TADOConnection;
ADOTable1: TADOTable;
DataSource1: TDataSource;
RadioGroup1: TRadioGroup;
procedure Button1Click(Sender: TObject);
procedure Button2Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
uses master, reader; //引用加在实现部分。
{$R *.dfm}
var
time:Integer=0;
procedure TForm1.Button1Click(Sender: TObject);
var
str:string;
results:variant; //16字节可变类型
begin
ADOTable1.Active:=true;
{
if (edit2.Text='admin') and (edit1.Text='123456') then
showmessage('登陆成功!')
}
str:=Edit2.Text;
results:=ADOTable1.Lookup('LoadName',edit2.Text,'LoadPassword');
//showmessage(BoolToStr(results=edit1.Text,true));
if edit2.Text='' then
begin
Application.MessageBox('用户名不能为空!','提示',mb_ok);
edit2.SetFocus;
end
else
if not ADOTable1.Locate('LoadName',str,[loCaseInsensitive]) then
begin
Application.MessageBox('用户名不存在!','提示',mb_ok);
edit2.Text:='';
edit1.Text:='';
edit2.SetFocus;
end
else
if edit1.Text='' then
Application.MessageBox('密码不能为空!','提示',mb_ok)
else
if (results=edit1.Text) then //重建数据表才验证成功(开始以为是类型转化不对,其实不然)
begin
//showmessage('登陆成功!')
case RadioGroup1.ItemIndex of //RadioGroup的使用方法
0:
masterform.show;
//form1.Visible:=false;
1:
readerform.show;
end;
end
else
begin
time:=time+1;
if time<5 then
begin
showmessage('密码错误,请重新输入!');
edit1.Text:='';
//edit2.Text:='';
edit1.SetFocus; //焦点重新回到edit2
end
else
begin
messageDlg('对不起,密码输入错误达到5次!请退出。',mtInformation,[mbok],0);
application.Terminate;
end;
end;
end;
procedure TForm1.Button2Click(Sender: TObject);
begin
close; //关闭登陆窗口
end;
end.
二、管理员控制模块的实现
1、主界面
1.1、主界面窗体设计
1.2、代码设计