AlonsoYSal_FactuGES2/Source/Modulos/Contactos/Data/uDataModuleVendedores.pas
2019-11-18 10:36:42 +00:00

84 lines
2.0 KiB
ObjectPascal

unit uDataModuleVendedores;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, uDataModuleContactos, DB, uDADataTable, uDAScriptingProvider,
uDACDSDataTable, uDABINAdapter, uRORemoteService,
uROClient, uROBinMessage, uROWinInetHttpChannel, uROTypes,
uIDataModuleVendedores, uBizContactos, uDADesigntimeCall,
uDAInterfaces, uDAMemDataTable, uDADataStreamer, uDABin2DataStreamer,
uDARemoteDataAdapter;
type
TDataModuleVendedores = class(TDataModuleContactos, IDataModuleVendedores)
tbl_Vendedores: TDAMemDataTable;
ds_Vendedores: TDADataSource;
public
function GetItem(const ID : Integer) : IBizVendedor;
function NewItem : IBizVendedor;
function GetItems : IBizVendedor;
end;
implementation
{$R *.dfm}
uses
FactuGES_Intf, cxControls, schContactosClient_Intf, uDataTableUtils;
{ TDataModuleVendedores }
function TDataModuleVendedores.GetItem(const ID: Integer): IBizVendedor;
var
Condicion: TDAWhereExpression;
begin
ShowHourglassCursor;
try
Result := Self.GetItems;
with Result.DataTable.DynamicWhere do
begin
// (ID = :ID)
Condicion := NewBinaryExpression(NewField('', fld_ContactosID), NewConstant(ID, datInteger), dboEqual);
if IsEmpty then
Expression := Condicion
else
Expression := NewBinaryExpression(Expression, Condicion, dboAnd);
end;
finally
HideHourglassCursor;
end;
end;
function TDataModuleVendedores.GetItems: IBizVendedor;
var
AContacto : TDAMemDataTable;
begin
ShowHourglassCursor;
try
AContacto := CloneDataTable(tbl_Vendedores);
AContacto.BusinessRulesID := BIZ_CLIENT_VENDEDOR;
with TBizVendedor(AContacto.BusinessEventsObj) do
begin
DatosBancarios := _GetDatosBancarios;
end;
Result := (AContacto as IBizVendedor);
finally
HideHourglassCursor;
end;
end;
function TDataModuleVendedores.NewItem: IBizVendedor;
begin
Result := GetItem(ID_NULO)
end;
end.