📄 dmu.pas
字号:
unit DMU;
interface
uses
SysUtils, Classes, DB, ADODB,Windows,Forms, DCPcrypt, Md5;
type
TDM = class(TDataModule)
adoCon: TADOConnection;
adoInquire: TADOQuery;
adoBokInform: TADOQuery;
adoBConcern: TADOQuery;
adoBookCase: TADOQuery;
adoLoanOption: TADOQuery;
adoClass: TADOQuery;
adoTemp: TADOQuery;
adoReader: TADOQuery;
adoAddReader: TADOQuery;
adoRechargeable: TADOQuery;
BalaCcou: TADOQuery;
adoTemp2: TADOQuery;
adoMoney: TADOQuery;
adoLoan: TADOQuery;
adoUser: TADOQuery;
dcpMD5: TDCP_md5;
adoUser2: TADOQuery;
adoLP: TADOQuery;
private
{ Private declarations }
public
procedure adoConConnect();
Function MD5(Str:String):String;
Procedure adoLpCon(boo:Boolean;Name:String);
Function LP(LPName:String):Boolean;
{ Public declarations }
end;
var
DM: TDM;
implementation
uses frmMainU;
{$R *.dfm}
procedure TDM.adoConConnect;
begin
adocon.Close;
adocon.Provider:='Microsoft.Jet.OLEDB.4.0;Data Source='+ExtractFilePath(Application.ExeName)+'Data\DB.mdb;Persist Security Info=False;Jet OLEDB:Database Password=TBBRS13913966';
end;
function TDM.MD5(Str: String): String;
var
Read,len:integer;
HashDigest: array[0..31] of byte;
Pass:String;
begin
Dm.dcpMD5.Init;
Dm.dcpMD5.UpdateStr(str);
Dm.dcpMD5.Final(HashDigest);
len:=Dm.dcpMD5.HashSize;
Pass:='';
for Read:= 0 to ((len div 8)-1) do
Pass:= Pass + IntToHex(HashDigest[Read],2);
Result:=Pass;
end;
procedure TDM.adoLpCon(boo:Boolean;Name:String);
begin
if boo then
begin
adoLP.Close;
adoLP.SQL.Clear;
adoLP.SQL.Text:='Select * from lpUser where Name='+QuotedStr(Name);
adoLP.Open;
end
else
adoLP.Close;
end;
function TDM.LP(LPName: String): Boolean;
begin
if not adoLp.Active then
exit;
if adoLP.FieldByName(LPName).AsString='1' then
Result:=True
else
begin
MessageBox(0,'对不起,你没有权限操作该功能!','错误',MB_OK+MB_ICONSTOP+MB_TASKMODAL);
ReSult:=False;
end;
end;
end.
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -