unit uTiendasEmpresaController; interface uses Windows, Forms, Classes, Controls, Contnrs, SysUtils, uDADataTable, uIntegerListUtils, uBizEmpresasTiendas, uIDataModuleEmpresas; type ITiendasEmpresaController = interface ['{5DCF4163-7FA0-4560-9E5E-FA2A99EA4F59}'] procedure VerTienda(ATienda : IBizEmpresasTiendas); function DarListaTiendas: TStringList; end; TTiendasEmpresaController = class(TInterfacedObject, ITiendasEmpresaController) private FDataModule : IDataModuleEmpresas; public procedure VerTienda(ATienda : IBizEmpresasTiendas); function DarListaTiendas: TStringList; constructor Create; virtual; destructor Destroy; override; end; implementation { TTiendasEmpresaController } uses uDataModuleEmpresas, schEmpresasClient_Intf, uIEditorTiendaEmpresa, uEditorRegistryUtils, cxControls, uFactuGES_App; constructor TTiendasEmpresaController.Create; begin inherited; FDataModule := TDataModuleEmpresas.Create(Nil); end; function TTiendasEmpresaController.DarListaTiendas: TStringList; var ATiendas: IBizEmpresasTiendas; i : integer; begin ATiendas := AppFactuGES.EmpresaActiva.Tiendas; ATiendas.DataTable.Active := True; Result := TStringList.Create; try with Result do begin Add(Format('%s=%d', [CTE_TODAS, CTE_ID_TODAS])); ATiendas.DataTable.First; while not ATiendas.DataTable.EOF do begin Add(Format('%s=%d', [ATiendas.NOMBRE, ATiendas.ID])); ATiendas.DataTable.Next; end; end; finally ATiendas := NIL; end; end; destructor TTiendasEmpresaController.Destroy; begin FDataModule := Nil; inherited; end; procedure TTiendasEmpresaController.VerTienda(ATienda: IBizEmpresasTiendas); 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.