📄 vendorbizdm.pas
字号:
unit VendorBizDm;
{$WARN SYMBOL_PLATFORM OFF}
interface
uses
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
ComServ, ComObj, VCLCom, StdVcl, bdemts, DataBkr, DBClient,
MtsRdm, Mtx, VendorBiz_TLB, DB, MConnect, Variants;
type
TmtsVendorBiz = class(TMtsDataModule, ImtsVendorBiz)
DCOMConVendor: TDCOMConnection;
cdsVendor: TClientDataSet;
procedure MtsDataModuleCreate(Sender: TObject);
private
{ Private declarations }
protected
class procedure UpdateRegistry(Register: Boolean; const ClassID, ProgID: string); override;
function LogIn(const AUserId, APassword: WideString): WordBool; safecall;
function ChangePassword(const AOldPassword, ANewPassword,
VendorId: WideString): WordBool; safecall;
public
{ Public declarations }
end;
var
mtsVendorBiz: TmtsVendorBiz;
implementation
uses BizDBConfig;
{$R *.DFM}
class procedure TmtsVendorBiz.UpdateRegistry(Register: Boolean; const ClassID, ProgID: string);
begin
if Register then
begin
inherited UpdateRegistry(Register, ClassID, ProgID);
EnableSocketTransport(ClassID);
EnableWebTransport(ClassID);
end else
begin
DisableSocketTransport(ClassID);
DisableWebTransport(ClassID);
inherited UpdateRegistry(Register, ClassID, ProgID);
end;
end;
function TmtsVendorBiz.LogIn(const AUserId,
APassword: WideString): WordBool;
begin
result := false;
cdsVendor.Open;
if cdsVendor.Locate('Id', AUserId, []) then
result := (cdsVendor.FieldByName('Password').AsString = APassword);
end;
function TmtsVendorBiz.ChangePassword(const AOldPassword, ANewPassword,
VendorId: WideString): WordBool;
begin
result := false;
cdsVendor.Open;
if cdsVendor.Locate('Id', varArrayof([VendorId]), []) then
begin
if cdsVendor.FieldByName('Password').AsString = AOldPassword then
begin
try
cdsVendor.FieldByName('Password').AsString := ANewPassword;
SetComplete;
result := true;
cdsVendor.Close;
except
SetAbort;
cdsVendor.Close;
raise;
end;
end;
end;
end;
procedure TmtsVendorBiz.MtsDataModuleCreate(Sender: TObject);
begin
DCOMConVendor.ComputerName := GetComputerName;
end;
initialization
TComponentFactory.Create(ComServer, TmtsVendorBiz,
Class_mtsVendorBiz, ciMultiInstance, tmApartment);
end.
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -