3 本程序的技术实现及具体功能 http://www.paper51.com 3.1 登录的界面与程序设计实现 copyright paper51.com
内容来自www.paper51.com
代码设计: 内容来自论文无忧网 www.paper51.com unit login; paper51.com interface 内容来自www.paper51.com uses http://www.paper51.com Windows, Messages, SysUtils,Variants, Classes, Graphics, Controls, Forms, http://www.paper51.com Dialogs, LabelButton,StdCtrls, ExtCtrls, XPMenu,dbm; 内容来自论文无忧网 www.paper51.com type 内容来自www.paper51.com TFrm_login = class(TForm) paper51.com
Label1: TLabel; http://www.paper51.com Image1: TImage; 内容来自www.paper51.com
Label2: TLabel; copyright paper51.com
Label3: TLabel; http://www.paper51.com Label4: TLabel; 内容来自www.paper51.com
choose1: TComboBox; copyright paper51.com Edit1: TEdit; copyright paper51.com
Button1: TButton; 内容来自www.paper51.com
Button2: TButton; paper51.com Button3: TButton; http://www.paper51.com
choose2: TComboBox; 内容来自论文无忧网 www.paper51.com procedureButton2Click(Sender: TObject); copyright paper51.com procedureButton1Click(Sender: TObject); http://www.paper51.com procedureFormCreate(Sender: TObject); 内容来自论文无忧网 www.paper51.com procedurechoose1Change(Sender: TObject); copyright paper51.com
procedureButton3Click(Sender: TObject); 内容来自www.paper51.com
private paper51.com { Privatedeclarations } paper51.com
i:integer; copyright paper51.com public http://www.paper51.com
{ Publicdeclarations } paper51.com
end; http://www.paper51.com
var 内容来自www.paper51.com
Frm_login: TFrm_login; http://www.paper51.com implementation paper51.com uses main,pulvar, mainN, passedit, passeditN; 内容来自www.paper51.com {$R *.dfm} copyright paper51.com procedure TFrm_login.Button2Click(Sender: TObject); http://www.paper51.com begin copyright paper51.com close; http://www.paper51.com Application.Terminate; http://www.paper51.com end; paper51.com procedure TFrm_login.Button1Click(Sender: TObject); copyright paper51.com var http://www.paper51.com username:variant; paper51.com pass:string; copyright paper51.com
begin 内容来自www.paper51.com choosename:=choose2.text; copyright paper51.com
if choose1.itemindex=1 then //判断用户选择何种职务 内容来自www.paper51.com username:=datam.ado_doctor.lookup('医生姓名',choosename,'密码') copyright paper51.com
else 内容来自www.paper51.com username:=datam.ado_nurse.lookup('护士姓名',choosename,'密码'); 内容来自论文无忧网 www.paper51.com if choosename='' then copyright paper51.com showmessage ('请先选择您的职务!')//姓名为空,则职务未选,给出错误提示 paper51.com else 内容来自www.paper51.com if edit1.text='' then http://www.paper51.com
showmessage ('请输入密码') //未输入密码,给出错误提示 paper51.com else copyright paper51.com begin paper51.com if varisnull(username) thenpass:='' else pass:=username; paper51.com if edit1.text<>pass then http://www.paper51.com begin 内容来自www.paper51.com
i:=i+1; http://www.paper51.com //定义i,用于计算输入密码错误次数,3次出错则退出程序 内容来自论文无忧网 www.paper51.com
if i>=3 then http://www.paper51.com
begin http://www.paper51.com Application.MessageBox(PChar('密码验证错误,拒绝访问!'), PChar('提示'), http://www.paper51.com MB_ICONEXCLAMATION); http://www.paper51.com
Application.Terminate; http://www.paper51.com close; 内容来自论文无忧网 www.paper51.com end; paper51.com application.messagebox(pchar('密码验证错误,重新录入!'),pchar('提示'), 内容来自论文无忧网 www.paper51.com MB_ICONQUESTION); copyright paper51.com
edit1.text:=''; 内容来自www.paper51.com edit1.SetFocus(); 内容来自www.paper51.com exit; copyright paper51.com end; 内容来自www.paper51.com if choose1.itemindex=1 then 内容来自www.paper51.com //用户选择“医生”职务则打开“医生操作台”窗体 copyright paper51.com begin http://www.paper51.com
//断开登录数据表连接 paper51.com datam.ADO_doctor.Close; copyright paper51.com datam.ADO_nurse.Close; http://www.paper51.com
// 登录窗体隐藏 http://www.paper51.com frm_login.Hide; 内容来自论文无忧网 www.paper51.com //窗体创建和显示 paper51.com frm_maind:=tfrm_maind.create(application); 内容来自www.paper51.com
frm_maind.showmodal; copyright paper51.com frm_login.close http://www.paper51.com end http://www.paper51.com else 内容来自论文无忧网 www.paper51.com //用户选择“护士“职务则打开“医生操作台”窗体 paper51.com begin paper51.com
datam.ADO_doctor.Close; paper51.com datam.ADO_nurse.Close; http://www.paper51.com frm_login.Hide; copyright paper51.com
frm_mainn:=tfrm_mainn.create(application); http://www.paper51.com frm_mainn.showmodal; 内容来自www.paper51.com frm_login.close; 内容来自论文无忧网 www.paper51.com end; paper51.com end; 内容来自www.paper51.com end; //过程结束 内容来自论文无忧网 www.paper51.com
内容来自论文无忧网 www.paper51.com |