This repository has been archived on 2024-12-02. You can view files and clone it, but cannot push or open issues or pull requests.
AlonsoYSal_FactuGES/Modulos/Intervalos/Cliente/uDataModuleIntervalos.pas
2007-06-21 16:02:50 +00:00

86 lines
2.0 KiB
ObjectPascal

unit uDataModuleIntervalos;
interface
uses {vcl:} SysUtils, Classes, DB, DBClient,
{RemObjects:} uDAClientDataModule, uDADataTable, uDABINAdapter,
uROServiceComponent, uRORemoteService, uROClient, uROBinMessage,
uROWinInetHttpChannel, uDAScriptingProvider, uDACDSDataTable,
uBizIntervalos;
type
TdmIntervalos = class(TDAClientDataModule)
DABINAdapter: TDABINAdapter;
RORemoteService: TRORemoteService;
tbl_Intervalos: TDACDSDataTable;
ds_Intervalos: TDADataSource;
procedure DAClientDataModuleCreate(Sender: TObject);
private
public
function GetItems: IBizIntervalos;
function GetItem(Codigo : Integer): IBizIntervalos;
end;
var
dmIntervalos: TdmIntervalos;
implementation
{$R *.DFM}
uses
Controls, Forms, uDAInterfaces, DataAbstract_Intf, FactuGES_Intf,
uDataTableUtils, uROTypes, uEditorPreview,
Dialogs, schIntervalosClient_Intf, uDataModuleBase, uDBSelectionList;
const
MAX_RECORDS = 100;
procedure TdmIntervalos.DAClientDataModuleCreate(Sender: TObject);
begin
RORemoteService.Channel := dmBase.Channel;
RORemoteService.Message := dmBase.Message;
end;
function TdmIntervalos.GetItems: IBizIntervalos;
var
dtIntervalos: TDACDSDataTable;
ACursor: TCursor;
begin
ACursor := Screen.Cursor;
Screen.Cursor := crHourGlass;
try
dtIntervalos := TDACDSDataTable.Create(NIL);
CloneDataTable(tbl_Intervalos, dtIntervalos);
dtIntervalos.BusinessRulesID := 'BizIntervalos';
Result := (dtIntervalos as IBizIntervalos);
finally
Screen.Cursor := ACursor;
end;
end;
function TdmIntervalos.GetItem(Codigo: Integer): IBizIntervalos;
var
AIntervalo: IBizIntervalos;
begin
AIntervalo := GetItems;
with AIntervalo.DataTable do
begin
if Active then Active := False;
Where.Clear;
Where.AddCondition(fld_IntervalosCODIGO, cEqual, Codigo);
Active := True;
end;
Result := AIntervalo;
end;
initialization
dmIntervalos := TdmIntervalos.Create(nil);
finalization
FreeAndNil(dmIntervalos);
end.