📄 ulogin.pas
字号:
unit ulogin;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, base, ExtCtrls, SUIForm, SUIButton, StdCtrls, SUIEdit;
type
Tfrmlogin = class(Tbaseform)
Image1: TImage;
edtuser: TsuiEdit;
edtpassword: TsuiEdit;
Label1: TLabel;
Label2: TLabel;
suiButton1: TsuiButton;
suiButton2: TsuiButton;
procedure suiButton2Click(Sender: TObject);
procedure suiButton1Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
frmlogin: Tfrmlogin;
implementation
uses umain, pub ,adodb;
{$R *.dfm}
procedure Tfrmlogin.suiButton2Click(Sender: TObject);
begin
inherited;
close;
end;
procedure Tfrmlogin.suiButton1Click(Sender: TObject);
var tmp:tadoquery;
begin
inherited;
if trim(edtuser.Text)='' then
begin
application.MessageBox('用户名不能为空!','提示',mb_ok+mb_iconinformation);
exit;
end;
if trim(edtpassword.Text)='' then
begin
application.MessageBox('密码不能为空!','提示',mb_ok+mb_iconinformation);
exit;
end;
tmp:=tadoquery.Create(nil);
tmp.ConnectionString:=frmmain.adc.ConnectionString;
pub.showrecord(tmp,'*','users where username='+''''+edtuser.Text+''''+' and userpassword='+''''+edtpassword.Text+'''','username');
if tmp.RecordCount<1 then
begin
application.MessageBox('用户名或密码错误,请重新输入!','提示',mb_ok+mb_iconwarning);
tmp.Free;
edtuser.Clear;
edtpassword.Clear;
exit;
end
else
begin
frmmain.sb.Panels[0].Text:='欢迎您 '+edtuser.Text;
frmmain.user:=trim(edtuser.Text);
frmmain.login:=true;
if tmp.FieldByName('system').AsBoolean =false then
begin
frmmain.N5.Enabled :=false;
frmmain.N7.Enabled :=false;
frmmain.N8.Enabled :=false;
end;
if tmp.FieldByName('code').AsBoolean =false then
frmmain.C1.Enabled :=false;
if tmp.FieldByName('stu').AsBoolean =false then
frmmain.T1.Enabled :=false;
if tmp.FieldByName('static').AsBoolean =false then
frmmain.N24.Enabled :=false;
if tmp.FieldByName('report').AsBoolean =false then
frmmain.R1.Enabled :=false;
pub.savelog(tmp,trim(edtuser.Text));
tmp.Free;
close;
end;
end;
end.
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -