📄 dm.pas
字号:
unit DM;
interface
uses
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
Db, DBTables;
type
TDataM = class(TDataModule)
DSTable: TDataSource;
DSQueryUser: TDataSource;
TableUser: TTable;
QueryUser: TQuery;
DSLog: TDataSource;
TableLog: TTable;
TableLogID: TIntegerField;
TableLogUserName: TStringField;
TableLogPassword: TStringField;
TableLogPurview: TIntegerField;
QueryService: TQuery;
DSQueryService: TDataSource;
QueryAgent: TQuery;
DSQueryAgent: TDataSource;
QueryServiceServType: TStringField;
QueryServiceServName: TStringField;
QueryServiceServTypeID: TIntegerField;
QueryServiceStartYear: TIntegerField;
QueryServiceStartMonth: TIntegerField;
QueryServiceStartDay: TIntegerField;
QueryServiceServTime: TIntegerField;
QueryServiceFee: TIntegerField;
QueryServiceUserID: TIntegerField;
QueryServiceStartDate: TDateField;
QueryService1: TQuery;
TableService1: TTable;
TableAgent: TTable;
DSAgentTable: TDataSource;
TableUpdate: TTable;
DSUpdate: TDataSource;
QueryUserLookup: TQuery;
DSUserLookup: TDataSource;
QueryServiceLookup: TQuery;
DSServiceLookup: TDataSource;
QueryAgentLookup: TQuery;
DSAgentLookup: TDataSource;
QueryUserLookupUserID: TIntegerField;
QueryUserLookupName: TStringField;
QueryUserLookupIDCard: TStringField;
QueryUserLookupPhone: TStringField;
QueryUserLookupAddress: TStringField;
QueryUserLookupCardNo: TStringField;
QueryUserLookupUserCardNo: TStringField;
QueryUserLookupAgentID: TIntegerField;
QueryUserLookupResistYear: TIntegerField;
QueryUserLookupResistMonth: TIntegerField;
QueryUserLookupResistDay: TIntegerField;
QueryUserLookupUserZIP: TStringField;
QueryUserLookupUserRemark: TMemoField;
QueryUserLookupResistDate: TDateField;
QueryServiceLookupServType: TStringField;
QueryServiceLookupServName: TStringField;
QueryServiceLookupServTypeID: TIntegerField;
QueryServiceLookupStartYear: TIntegerField;
QueryServiceLookupStartMonth: TIntegerField;
QueryServiceLookupStartDay: TIntegerField;
QueryServiceLookupServTime: TIntegerField;
QueryServiceLookupFee: TIntegerField;
QueryServiceLookupUserID: TIntegerField;
QueryAgentLookupAgentName: TStringField;
QueryAgentLookupAgentID: TIntegerField;
QueryServiceLookupStartDate: TDateField;
QueryUserUserID: TAutoIncField;
QueryUserName: TStringField;
QueryUserIDCard: TStringField;
QueryUserPhone: TStringField;
QueryUserAddress: TStringField;
QueryUserCardNo: TStringField;
QueryUserUserCardNo: TStringField;
QueryUserAgentID: TIntegerField;
QueryUserUserZIP: TStringField;
QueryUserUserRemark: TMemoField;
QueryUserLookupAgentName: TStringField;
QueryUserLookupPrintMark: TIntegerField;
QueryPrint: TQuery;
procedure QueryServiceLookupCalcFields(DataSet: TDataSet);
procedure QueryUserLookupCalcFields(DataSet: TDataSet);
private
{ Private declarations }
public
{ Public declarations }
function LoginPrepare:Boolean;
function Login(ID,Pwd:String):Boolean;
end;
var
DataM: TDataM;
implementation
{$R *.DFM}
{ TDataM }
function TDataM.Login(ID, Pwd: String): Boolean;
begin
Result:=False;
if LoginPrepare then
try
if TableLog.FindKey([ID]) then
if TableLog.FieldByName('Password').AsString = Pwd then
begin
Result:=True;
TableLog.Close;
end
else
MessageDlg('用户名或口令错误,请重新输入',mtWarning,[mbOK],0)
else
MessageDlg('用户名或口令错误,请重新输入',mtWarning,[mbOK],0)
finally
TableLog.Close;
end;
end;
function TDataM.LoginPrepare: Boolean;
begin
Result:=False;
try
TableLog.Open;
if TableLog.Active then
Result:=True;
except on EDataBaseError do
ShowMessage('程序登录发生错误!,请关闭。然后重新起动。');
end;
end;
procedure TDataM.QueryServiceLookupCalcFields(DataSet: TDataSet);
var
y,m,d:Integer;
begin
y:=QueryServiceLookupStartYear.Value;
m:=QueryServiceLookupStartMonth.Value;
d:=QueryServiceLookupStartDay.Value;
QueryServiceLookupStartDate.AsDateTime:=EncodeDate(y,m,d);
end;
procedure TDataM.QueryUserLookupCalcFields(DataSet: TDataSet);
var
y,m,d:Integer;
begin
y:=QueryUserLookupResistYear.Value;
m:=QueryUserLookupResistMonth.Value;
d:=QueryUserLookupResistDay.Value;
QueryUserLookupResistDate.AsDateTime:=EncodeDate(y,m,d);
end;
end.
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -