unit uTiendasEmpresaController; interface uses Windows, Forms, Classes, Controls, Contnrs, SysUtils, uDADataTable, uIntegerListUtils, uBizEmpresasTiendas, uIDataModuleEmpresas, uControllerBase; type ITiendasEmpresaController = interface(IControllerBase) ['{5DCF4163-7FA0-4560-9E5E-FA2A99EA4F59}'] function Buscar(const ID: Integer): IBizEmpresaTienda; function BuscarTodas: IBizEmpresaTienda; procedure Ver(ATienda : IBizEmpresaTienda); function Nueva : IBizEmpresaTienda; end; TTiendasEmpresaController = class(TControllerBase, ITiendasEmpresaController) private FDataModule : IDataModuleEmpresas; public constructor Create; override; destructor Destroy; override; function Buscar(const ID: Integer): IBizEmpresaTienda; function BuscarTodas: IBizEmpresaTienda; procedure Ver(ATienda : IBizEmpresaTienda); function Nueva : IBizEmpresaTienda; end; implementation { TTiendasEmpresaController } uses uDataModuleEmpresas, schEmpresasClient_Intf, uIEditorTiendaEmpresa, uEditorRegistryUtils, cxControls, uFactuGES_App; function TTiendasEmpresaController.Buscar(const ID: Integer): IBizEmpresaTienda; begin Result := FDataModule.GetTienda(ID); end; function TTiendasEmpresaController.BuscarTodas: IBizEmpresaTienda; begin Result := FDataModule.GetTiendas; end; constructor TTiendasEmpresaController.Create; begin inherited; FDataModule := TDataModuleEmpresas.Create(Nil); end; destructor TTiendasEmpresaController.Destroy; begin FDataModule := Nil; inherited; end; function TTiendasEmpresaController.Nueva: IBizEmpresaTienda; begin Result := FDataModule.NewTienda; end; procedure TTiendasEmpresaController.Ver(ATienda: IBizEmpresaTienda); var AEditor : IEditorTiendaEmpresa; begin AEditor := NIL; ShowHourglassCursor; try CreateEditor('EditorTiendaEmpresa', IEditorTiendaEmpresa, AEditor); if Assigned(AEditor) then with AEditor do begin Tienda := ATienda; Controller := Self; ShowModal; Release; end; finally AEditor := NIL; HideHourglassCursor; end; end; end.