📄 uaspvendor.pas
字号:
unit uASPVendor;
{$WARN SYMBOL_PLATFORM OFF}
interface
uses
ComObj, ActiveX, AspTlb, aspVendorBiz_TLB, StdVcl, dmASPVendor, SysUtils;
type
TmtsASPVendor = class(TASPMTSObject, ImtsASPVendor)
private
FASPVendorDM: TASPVendorDM;
FEmail: string;
FTelephone: string;
FZipCode: string;
FBankAccount: string;
FContactMan: string;
FCurrentBank: string;
FFax: string;
FMobilePhone: string;
FOperatorMobilePhone: string;
FOperatorname: string;
FOperatorTelePhone: string;
FWebSite: string;
protected
function ChangePassword(const AUserId, AOldPassword,
ANewPassword: WideString): WordBool; safecall;
function Login(const AUserId, APassword: WideString): WordBool; safecall;
function GetVendorInfoByVendorId(const AId: WideString): WordBool;
safecall;
function SetVendorInfoByVendorId(const AId, AZipCode, ATelephone,
AMobilePhone, AFax, AContactMan, AEmail, AWebSite, ACurrentBank,
ABankAccount, AOperatorMobilePhone, AOperatorname,
AOperatorTelePhone: WideString): WordBool; safecall;
function Get_Email: WideString; safecall;
function Get_Telephone: WideString; safecall;
function Get_ZipCode: WideString; safecall;
function Get_BankAccount: WideString; safecall;
function Get_ContactMan: WideString; safecall;
function Get_CurrentBank: WideString; safecall;
function Get_Fax: WideString; safecall;
function Get_MobilePhone: WideString; safecall;
function Get_OperatorMobilePhone: WideString; safecall;
function Get_Operatorname: WideString; safecall;
function Get_OperatorTelePhone: WideString; safecall;
function Get_WebSite: WideString; safecall;
public
procedure Initialize;override;
destructor Destroy;override;
end;
implementation
uses ComServ;
function TmtsASPVendor.ChangePassword(const AUserId, AOldPassword,
ANewPassword: WideString): WordBool;
begin
result := false;
FASPVendorDM.cdsVendor.Close;
FASPVendorDM.cdsVendor.CommandText := 'select id, password from t_vendor where id='+
QuotedStr(AUserId);
FASPVendorDM.cdsVendor.Open;
if FASPVendorDM.cdsVendor.RecordCount>0 then
if FASPVendorDM.cdsVendor.FieldByName('Password').AsString = AOldPassword then
begin
try
FASPVendorDM.cdsVendor.CommandText := 'update t_vendor set password='+QuotedStr(ANewPassword)+
' where id='+QuotedStr(AUserId);
FASPVendorDM.cdsVendor.Execute;
result := true;
except
FASPVendorDM.cdsVendor.Close;
raise;
end;
end;
end;
function TmtsASPVendor.Login(const AUserId,
APassword: WideString): WordBool;
begin
result := false;
FASPVendorDM.cdsVendor.Close;
FASPVendorDM.cdsVendor.CommandText := 'select * from t_vendor where id='+QuotedStr(AUserId);
FASPVendorDM.cdsVendor.Open;
if FASPVendorDM.cdsVendor.Locate('Id', AUserId, []) then
if FASPVendorDM.cdsVendor.FieldByName('Password').AsString = APassword then
result := true;
FASPVendorDM.cdsVendor.Close;
end;
procedure TmtsASPVendor.Initialize;
begin
inherited;
FASPVendorDM := TASPVendorDM.Create(nil);
end;
destructor TmtsASPVendor.Destroy;
begin
FASPVendorDM.Free;
inherited;
end;
function TmtsASPVendor.GetVendorInfoByVendorId(
const AId: WideString): WordBool;
begin
result := false;
FASPVendorDM.cdsVendor.Close;
FASPVendorDM.cdsVendor.CommandText := 'select * from t_vendor where id='+QuotedStr(AId);
FASPVendorDM.cdsVendor.Open;
if FASPVendorDM.cdsVendor.RecordCount>0 then
begin
try
FZipCode := FASPVendorDM.cdsVendor.FieldByName('ZipCode').AsString;
FTelephone := FASPVendorDM.cdsVendor.FieldByName('Telephone').AsString;
FMobilePhone := FASPVendorDM.cdsVendor.FieldByName('MobilePhone').AsString;
FFax := FASPVendorDM.cdsVendor.FieldByName('Fax').AsString;
FContactMan := FASPVendorDM.cdsVendor.FieldByName('ContactMan').AsString;
FEmail := FASPVendorDM.cdsVendor.FieldByName('Email').AsString;
FWebSite := FASPVendorDM.cdsVendor.FieldByName('WebSite').AsString;
FCurrentBank := FASPVendorDM.cdsVendor.FieldByName('CurrentBank').AsString;
FBankAccount := FASPVendorDM.cdsVendor.FieldByName('BankAccount').AsString;
FOperatorMobilePhone := FASPVendorDM.cdsVendor.FieldByName('OperatorMobilePhone').AsString;
FOperatorname := FASPVendorDM.cdsVendor.FieldByName('Operatorname').AsString;
FOperatorTelePhone := FASPVendorDM.cdsVendor.FieldByName('OperatorTelePhone').AsString;
FASPVendorDM.cdsVendor.Close;
result := true;
except
FASPVendorDM.cdsVendor.Close;
raise;
end;
end;
end;
function TmtsASPVendor.SetVendorInfoByVendorId(const AId, AZipCode,
ATelephone, AMobilePhone, AFax, AContactMan, AEmail, AWebSite,
ACurrentBank, ABankAccount, AOperatorMobilePhone, AOperatorname,
AOperatorTelePhone: WideString): WordBool;
var
LSql: string;
begin
result := false;
FASPVendorDM.cdsVendor.Close;
FASPVendorDM.cdsVendor.CommandText := 'select * from t_vendor where id='+QuotedStr(AId);
FASPVendorDM.cdsVendor.Open;
if FASPVendorDM.cdsVendor.RecordCount>0 then
begin
try
FASPVendorDM.cdsVendor.Close;
LSql := 'update t_Vendor set Zipcode='+QuotedStr(AZipcode)+', Telephone='+QuotedStr(ATelephone)+
', MobilePhone='+QuotedStr(AMobilePhone)+', Fax='+QuotedStr(AFax)+', ContactMan='+QuotedStr(AContactMan)+
', Email='+QuotedStr(AEmail)+', WebSite='+QuotedStr(AWebSite) + ', CurrentBank='+QuotedStr(ACurrentBank)+
', BankAccount='+QuotedStr(ABankAccount)+', OperatorMobilePhone='+QuotedStr(AOperatorMobilePhone)+', Operatorname='+QuotedStr(AOperatorname)+
', OperatorTelePhone='+QuotedStr(AOperatorTelePhone)+' where id='+QuotedStr(AId);
FASPVendorDM.cdsVendor.CommandText := LSql;
FASPVendorDM.cdsVendor.Execute;
FASPVendorDM.cdsVendor.Close;
result := true;
except
FASPVendorDM.cdsVendor.Close;
raise;
end;
end;
end;
function TmtsASPVendor.Get_Email: WideString;
begin
result := FEmail;
end;
function TmtsASPVendor.Get_Telephone: WideString;
begin
result := FTelephone;
end;
function TmtsASPVendor.Get_ZipCode: WideString;
begin
result := FZipCode;
end;
function TmtsASPVendor.Get_BankAccount: WideString;
begin
result := FBankAccount;
end;
function TmtsASPVendor.Get_ContactMan: WideString;
begin
result := FContactMan;
end;
function TmtsASPVendor.Get_CurrentBank: WideString;
begin
result := FCurrentBank;
end;
function TmtsASPVendor.Get_Fax: WideString;
begin
result := FFax;
end;
function TmtsASPVendor.Get_MobilePhone: WideString;
begin
result := FMobilePhone;
end;
function TmtsASPVendor.Get_OperatorMobilePhone: WideString;
begin
result := FOperatorMobilePhone;
end;
function TmtsASPVendor.Get_Operatorname: WideString;
begin
result := FOperatorname;
end;
function TmtsASPVendor.Get_OperatorTelePhone: WideString;
begin
result := FOperatorTelePhone;
end;
function TmtsASPVendor.Get_WebSite: WideString;
begin
result := FWebSite;
end;
initialization
TAutoObjectFactory.Create(ComServer, TmtsASPVendor, Class_mtsASPVendor,
ciMultiInstance, tmApartment);
end.
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -