unit del1;
//Another simple MTS server
//By N.Elmanova
//01.12.1998
interface
uses
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
ComServ, ComObj, VCLCom, StdVcl, BdeProv, BdeMts, DataBkr, DBClient,
MtsRdm, Mtx, dels_TLB, DBTables, Provider, Db;
type
TdelDM = class(TMtsDataModule, IdelDM)
deltable: TTable;
DelProvider: TProvider;
Database2: TDatabase;
Query4: TQuery;
Session2: TSession;
private
{ Private declarations }
public
{ Public declarations }
protected
function GetDelivery: OleVariant; safecall;
procedure AddDelivery(OrdNum: Integer; const OrdName: WideString; const OrdAddr: WideString);
safecall;
procedure DelDelivery(OrdNum: Integer); safecall;
end;
var
delDM: TdelDM;
implementation
{$R *.DFM}
function TdelDM.GetDelivery: OleVariant;
begin
Result:=DelProvider.Data;
SetComplete;
end;
procedure TdelDM.AddDelivery(OrdNum: Integer;
const OrdName: WideString; const OrdAddr: WideString);
begin
try
deltable.open;
deltable.append;
deltable.fieldbyname('OrdNum').Value:=OrdNum;
deltable.fieldbyname('GoodsName').Value:=OrdName;
deltable.fieldbyname('Address').Value:=OrdAddr;
deltable.post;
deltable.close;
SetComplete;
except
SetAbort;
raise;
end;
end;
procedure TdelDM.DelDelivery(OrdNum: Integer);
begin
try
Query4.Params[0].Value:=OrdNum;
Query4.Prepare;
Query4.ExecSQL;
SetComplete;
except
SetAbort;
raise;
end;
end;
initialization
TComponentFactory.Create(ComServer, TdelDM,
Class_delDM, ciMultiInstance, tmApartment);
end.