Componentes.Terceros.RemObj.../official/5.0.23.613/Data Abstract for Delphi/Samples/MegaDemo/OrdersService_Impl.pas

98 lines
3.1 KiB
ObjectPascal

unit OrdersService_Impl;
{----------------------------------------------------------------------------}
{ This unit was automatically generated by the RemObjects SDK after reading }
{ the RODL file associated with this project . }
{ }
{ This is where you are supposed to code the implementation of your objects. }
{----------------------------------------------------------------------------}
interface
uses
{vcl:} Classes, SysUtils,
{RemObjects:} uROClientIntf, uROTypes, uROServer, uROServerIntf, uROSessions,
{Required:} uRORemoteDataModule,
{Ancestor Implementation:} DataAbstractService_Impl,
{Used RODLs:} DataAbstract4_Intf,
{Generated:} MegaDemoLibrary_Intf, uDAClasses, uDADataStreamer,
uDABinAdapter, uDAScriptingProvider, uDABusinessProcessor;
type
{ TOrdersService }
TOrdersService = class(TDataAbstractService, IOrdersService)
bpCustomers: TDABusinessProcessor;
BinDataStreamer: TDABinDataStreamer;
Schema: TDASchema;
procedure DataAbstractServiceBeforeAcquireConnection(aSender: TObject;
var aConnectionName: string);
private
protected
{ IOrdersService methods }
function GetCustomerOrders(const CustomerID: string): Binary;
end;
implementation
{$R *.dfm}
uses
{Generated:} MegaDemoLibrary_Invk,
MegaDemoServer_Data, MegaDemoServer_Main;
procedure Create_OrdersService(out anInstance: IUnknown);
begin
anInstance := TOrdersService.Create(nil);
end;
{ OrdersService }
function TOrdersService.GetCustomerOrders(const CustomerID: string): Binary;
var
aTableNameArray: StringArray;
aTableRequestInfoArray: TableRequestInfoArray;
aTableRequestInfo: TableRequestInfo;
begin
// This method reads all the orders of the specified customer and also filters
// based on the current employee's ID. The employee ID has been previously stored
// in the session upon the call to LoginService.Login.
aTableNameArray := StringArray.Create;
aTableRequestInfoArray := TableRequestInfoArray.Create;
try
aTableNameArray.Add('OrdersByCustomer');
aTableRequestInfo := aTableRequestInfoArray.Add;
with aTableRequestInfo do begin
IncludeSchema := True;
MaxRecords := -1;
UserFilter := '';
with Parameters.Add do begin
Name := 'CustomerID';
Value := CustomerID;
end;
with Parameters.Add do begin
Name := 'EmployeeID';
Value := Session['EmployeeID'];
end;
end;
Result := GetData(aTableNameArray, aTableRequestInfoArray)
finally
aTableRequestInfoArray.Free;
aTableNameArray.Free;
end;
end;
procedure TOrdersService.DataAbstractServiceBeforeAcquireConnection(
aSender: TObject; var aConnectionName: string);
begin
// Reads the connection name from the main form.
aConnectionName := MegaDemoServer_MainForm.GetSelectedConnectionName;
end;
initialization
TROClassFactory.Create('OrdersService', Create_OrdersService, TOrdersService_Invoker);
finalization
end.