unit uDataModuleFamilias;

interface

uses
  SysUtils, Classes, DB, uIDataModuleFamilias, uBizFamilias, uDAInterfaces, uDADataTable,
  uDAScriptingProvider, uDAMemDataTable, uDADataStreamer, uDABin2DataStreamer,
  uDARemoteDataAdapter, uROClient, uRORemoteService, uDataModuleBase;

type
  TDataModuleFamilias = class(TDataModuleBase, IDataModuleFamilias)
    RORemoteService: TRORemoteService;
    rda_Familias: TDARemoteDataAdapter;
    Bin2DataStreamer: TDABin2DataStreamer;
    tbl_Familias: TDAMemDataTable;
    ds_Familias: TDADataSource;
    procedure DAClientDataModuleCreate(Sender: TObject);
  protected
    procedure AsignarClaseNegocio(AFamilia: TDADataTable);
  public
    function GetItems : IBizFamilia;
  end;

implementation
{$R *.DFM}

uses
  FactuGES_Intf, uDataModuleConexion, uDataTableUtils, cxControls,
  schFamiliasClient_Intf;

{ TdmFamilias }

procedure TDataModuleFamilias.AsignarClaseNegocio(AFamilia: TDADataTable);
begin
  AFamilia.BusinessRulesID := BIZ_CLIENT_FAMILIA;
end;

procedure TDataModuleFamilias.DAClientDataModuleCreate(Sender: TObject);
begin
  RORemoteService.Channel := dmConexion.Channel;
  RORemoteService.Message := dmConexion.Message;
end;

function TDataModuleFamilias.GetItems: IBizFamilia;
var
  AFamilia : TDAMemDataTable;
begin
  ShowHourglassCursor;
  try
    AFamilia := CloneDataTable(tbl_Familias);
    AsignarClaseNegocio(AFamilia);
    Result := (AFamilia as IBizFamilia);
  finally
    HideHourglassCursor;
  end;
end;


end.
