UML学生信息管理系统(需求分析+毕业论文+源程序) 第7页
奖励和处罚情况。如果发现基本信息有错误的话,有权进行修改,而且学生有权打印自己的成绩单。图9-34是查询修改界面窗体。
图34查询修改界面
代 码 分 析 与 实 现
上面对程序界面设计进行了详细的设计,基本完成了程序界面的设计工作。程序代码是程序的核心所在,是系统开发的灵魂。下面对系统的代码做具体的分析。
用户登录的代码实现
学生管理信息系统启动时,首先出现的是系统主界面。单击系统主界面中工具栏的“用户登录”按钮,就弹出用户登录界面。程序从配置文件中获取管理员和学生的密码,和用户输入的密码比较,如果密码正确,则根据身份配权限;如果不正确,则提示用户重输或退出:重输3次以上,系统自动退出。代码如下:
Proctdure TLoginFrm.BitBtn1Click(Sender:TObject);//“用户登陆”按钮的单击事件
Var pwdfile:textfile;
PwdStr:string;
Begin
if RadioButton1.checked=True then
assingnfile(pwdfile,’.\Admini.cfg’);
if RadioButton2.checked=True then
assingfile(pwdfile,’.\student.cfg’);
reset(pwdfile);
readln(pwdfile,pwdStr);
closefile(pwdfile);
Times:=Times=1;
If edit1.Text=PwdStr then
begin
close;
StuMainFrm.Enabled:=True
StuMainFrm.PageControll.ActivePage:=StuMainFrm.Tabsheet6;
StuMainFrm.PageControll.Visible:=true;
if Radiobuttonl.checked=True then
begin
StuMainFrm.ToolButton2.Enabled:=Ture;
StuMainFrm.Toolbutton3.Enabled:=True;
StuMainFrm.ToolButton4.Enabled:=True;
StuMainFrm.ToolButton5.Enabled:=True;
StuMainFrm.ToolButton8.Enabled:=True;
StuMainFrm.ToolButton6.Enabled:=True;
end;
if RadioButton2.checked=True then
begin
StuMainFrm.ToolButton6.Enabled:=True;
end;
end
else
begin
if MessageDlg(‘密码输入错误,是否退出?’,mtContirmation,[mbYes,mbNo],0)=mryes
then
begin
close;
StuMainFrm.Enabled:=True;
end
else
begin
if times<3 then editl.SetFocus
else
begin
MessageDlg(‘对不起,密码输入严重错误,请退出!’,mtInformation,[mbOk],0);
Application.Terminate;
end;end;
end;
end;
为了防止用户多次重输密码,限制了输入了次数为3次,因此需要对次数进行初始化,活加代码如下:
Procedure TLoginFrm.FormShow(Sender:TObject);
Begin
Times:=0;
End;
成绩管理的代码实现
当管理员选择了一位学生后,输入各科成绩,程序把数据保存到数据库。代码如下:
Procedure TStuMainFrm.BitBtn9Click(Sender:TObject);//“添加”按钮的单击事件
var StuNo,StuName:string;
i:integer;
begin
with Query do
begin
close;
Sql.Clear;
Sql.Add(‘Select StuNo from Score Whers StuNo=’+’’’’+DbEdit6.Text+’’’’);
Open;
if recordcount=0 then
begin
StuNo:=DbEdit6.Text;
StuName:=DbEdit7.Text;
for i:=l to 12 do
begin
if Course[i]<>’0’then
with Table5 do
begin
Open;
Append;
SetFields([nil,StuNo,kStuName,Course[i],Score[i]]);
Post;
end;
end;
end else
MessageDlg(‘对不起,该记录已经存在!’,mtInformation,[mbOk],0);
end;
end;
学籍变更的代码实现
当管理员选择了学籍需要变更的学生后,输入变更项和变更时间,程序把数据保存到数据库。代码如下:
procedure TStuMainFrm.BitbtnlClick(Sender: Tobject);//“添加”按钮的单击事件
var StuNo,StuName,StuClass,StuDepart.ChangeName,ChangeRemark:string;
begin
winth Table2 do
begin
Open;
StuNo:=Editl.text;
StuName:=Edit2.text;
StuClass:=Edit3.text;
StuDepart:=Edit4.text;
ChangeName:=ComboBoxl.Text;
ChangeRemark:=Edit5.text;
append;
SetFields([StuNo,StuName,StuClass,StuDepart,ChangeName,ChangeRemark,
Formatdatetime(‘dddddde’,DateTimePicker2.Dat)]);
Post;
end;
end;
奖励管理的代码实现
当管理员选择了需要奖励的学生后,选择了奖项和奖励时后,程序把数据保存到数据库。代码如下:
procedure TStuMainFrm.bitbtn3Click(Sender: TObject);//“添加”按钮的单击事件
var StuNo,StuName,StuClass,StuDepart,EncourageName:sering;
begin
with Table3 do
begin
Open;
StuNo:=Edit6.text;
StuName:=Edit7.text;
StuClass:=Edit8.text;
StuDepart:=Edit9.text;
if RadioButtonl.checked=true then
EncourageName:=RadioButtonl.Caption;
if RadioButton2.checked=true then
EncourageName:=RadioButton2.Caption;
if RadioButton3.checked=true then
EncourageName:=RadioButton3.lCaption;
if RadioButton4.checked=true then
EncourageName:=RadioButton4.Caption;
if RadioButton5.checked=true then
EncourageName:=RadioButton5.Caption;
if RadioButton6.checked=true then
EncourageName:=RadioButton6.Caption;
if RadioButton7.checked=true then
EncourageName:=RadioButton7.Capiton;
if RadioButton8.checked=true then
EncourageName:=RadioButton8.Caption;
append;
SetFields([StuNo,StuName,StuClass,StuDepart,EncourageName,
Formatdatetime(‘dddddd’,DateTimePickerl.Dat)]);
Post; end;end:
上一页 [1] [2] [3] [4] [5] [6] [7] [8] 下一页
UML学生信息管理系统(需求分析+毕业论文+源程序) 第7页下载如图片无法显示或论文不完整,请联系qq752018766