这一部分是登陆窗体logno
unit logno;
interface
uses
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
DBCtrls, StdCtrls, Buttons, Mask,db, ExtCtrls, ToolWin, ComCtrls, XPMenu;
type
TFlogno = class(TForm)
Image1: TImage;
StaticText1: TStaticText;
Bevel1: TBevel;
Label1: TLabel;
Label2: TLabel;
Label3: TLabel;
Edit1: TEdit;
editm: TMaskEdit;
look: TComboBox;
Panel1: TPanel;
BitBtn1: TBitBtn;
BitBtn2: TBitBtn;
XPMenu1: TXPMenu;
procedure FormCreate(Sender: TObject);
procedure Edit1Exit(Sender: TObject);
procedure Edit1KeyPress(Sender: TObject; var Key: Char);
procedure FormKeyPress(Sender: TObject; var Key: Char);
procedure SpeedButton1Click(Sender: TObject);
procedure SpeedButton2Click(Sender: TObject);
procedure editmKeyPress(Sender: TObject; var Key: Char);
procedure lookChange(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Flogno: TFlogno;
lon:integer;
logno_ok:bool;
implementation
uses mdata, main;
{$R *.DFM}
procedure TFlogno.FormCreate(Sender: TObject);
begin
lon:=0;
main.admme:=9999;
logno_ok:=false;
fmdata.dadm.First;
while not fmdata.dadm.Eof do
begin
look.Items.Add(trim(fmdata.dadm.FieldByName('admname').asstring));
fmdata.dadm.next;
end;
end;
procedure TFlogno.Edit1Exit(Sender: TObject);
var serch:bool;
begin
serch:=fmdata.dadm.Locate('admindex',vararrayof([edit1.text]),
[]);
if serch then
look.text:=fmdata.dadm.fieldbyname('admname').asstring
else
look.text:='';
end;
procedure TFlogno.Edit1KeyPress(Sender: TObject; var Key: Char);
begin
{
if (key=#8) then
else
if (key<>#13) then
begin
if (key<#48) or (key>#57) then
key:=#0;
if (length(edit1.Text)=4) then
key:=#0;
end;}
if not (key in['0'..'9',#13,#8]) then
key:=#0;
end;
procedure TFlogno.FormKeyPress(Sender: TObject; var Key: Char);
begin
if key=#13 then
Perform(WM_NEXTDLGCTL, 0, 0);
end;
procedure TFlogno.SpeedButton1Click(Sender: TObject);
var str1,str2,str3,str4:string;
begin
str1:=editm.text;
str2:=trim(fmdata.dadm.fieldbyname('admma').asstring);
str3:=edit1.text;
str4:=trim(fmdata.dadm.fieldbyname('admindex').asstring);
if fmdata.dadm.FieldByName('online').asboolean then
begin
showmessage('该用户已经登陆到服务器上了,请你不要再用该用户名登陆!!!');
end
else
begin
if (str1=str2) and (str3=str4) then
begin
logno_ok:=true;
fmdata.dadm.Edit;
fmdata.dadm.FieldByName('LONDTS').AsDateTime:=date+time;
//fmdata.dadm.fieldbyname('lonts').asdatetime:=time;
fmdata.dadm.FieldByName('online').AsBoolean:=logno_ok;
fmdata.dadm.FieldByName('londte').clear;
//fmdata.dadm.fieldbyname('lonte').clear;
fmdata.dadm.ApplyUpdates(-1);
main.admname:=fmdata.dadm.fieldbyname('admname').asstring;
main.admindex:=str4;
main.admme:=fmdata.dadm.fieldbyname('admme').asinteger;
close;
end
else
begin
lon:=lon+1;
editm.Clear;
edit1.SetFocus;
end;
if lon>2 then
begin
logno_ok:=false;
close;
end;
end;
end;
procedure TFlogno.SpeedButton2Click(Sender: TObject);
begin
logno_ok:=false;
close;
end;
procedure TFlogno.editmKeyPress(Sender: TObject; var Key: Char);
begin
if key=#13 then
BitBtn1.Click();
end;
procedure TFlogno.lookChange(Sender: TObject);
begin
fmdata.dadm.First;
fmdata.dadm.MoveBy(look.ItemIndex);
//showmessage(inttostr());
edit1.Text:=fmdata.dadm.fieldbyname('admindex').asstring;
end;
end.
//这一部分是你登陆部分
program Mclient;
uses
Forms,
uimage in 'uimage.pas' {fimage},
addimage in 'addimage.pas' {faddimage},
main in 'main.pas' {Fmain},
logno in 'logno.pas' {Flogno},
look in 'look.pas' {flook},
admdel in 'admdel.pas' {fadmdel},
admedit in 'admedit.pas' {fadmedit},
admini in 'admini.pas' {fadmin},
mdata in 'mdata.pas' {fmdata: TDataModule},
GIFImage in '../Bg&kl cs/gifimage.pas',
pr in 'pr.pas' {fprint},
sm in 'sm.pas' {fsm},
aub in 'aub.pas' {about};
{$R *.RES}
begin
Application.Initialize;
try
begin
Application.CreateForm(Tfmdata, fmdata);
flogno:= Tflogno.Create(Application);
flogno.ShowModal;
if logno.logno_ok then
begin
Application.CreateForm(TFmain, Fmain);//在这里建立主窗体
Application.CreateForm(Tfimage, fimage);
Application.Run;
end
else
begin
application.run;
application.Terminate;
end;
end;
except
begin
application.MessageBox('重新运行设置程序,修改网络信息','有限公司',0);
application.Terminate;
end;
end;
end.