unit uPluginContactos;

interface

uses
  uModuleController, uInterfaces, uHostManager, Menus, Classes, ActnList,
  ImgList, Controls, PngImageList;

type
  IMCContactos = interface(IInterface)
    ['{5AEC5F35-F8CD-4CE4-B750-625D7000487C}']

  end;
  
  TPluginContactos = class(TModuleController, IMCContactos)
    actClientes: TAction;
    actProveedores: TAction;
    Compras1: TMenuItem;
    ExtraImages: TPngImageList;
    LargeImages: TPngImageList;
    MainMenu: TMainMenu;
    ModuleActionList: TActionList;
    Proveedores1: TMenuItem;
    Resumen1: TMenuItem;
    SmallImages: TPngImageList;
    Ventas1: TMenuItem;
    Obras1: TMenuItem;
    Instaladores1: TMenuItem;
    actInstaladores: TAction;
    N1: TMenuItem;
    N2: TMenuItem;
    N3: TMenuItem;
    actVendedores: TAction;
    Vendedores1: TMenuItem;
    N4: TMenuItem;
    procedure actClientesExecute(Sender: TObject);
    procedure actProveedoresExecute(Sender: TObject);
    procedure actInstaladoresExecute(Sender: TObject);
    procedure actVendedoresExecute(Sender: TObject);
  public
    constructor Create(AOwner: TComponent); override;
    destructor Destroy; override;
  end;
  
implementation

{$R *.dfm}

uses
  Forms, Dialogs, uGUIBase, uCustomEditor, SysUtils, uContactosController,
  uClientesController, uProveedoresController,
  uInstaladoresController, uVendedoresController,
  uContactosViewRegister, uBizContactos;

function GetModule : TModuleController;
begin
  Result := TPluginContactos.Create(NIL);
end;

exports
  GetModule name GET_MODULE_FUNC;

{
******************************* TModuleContactos *******************************
}
procedure TPluginContactos.actClientesExecute(Sender: TObject);
var
  AClientesController : IClientesController;
  AClientes : IBizCliente;
begin
  AClientesController := TClientesController.Create;
  AClientes := (AClientesController.BuscarTodos as IBizCliente);
  AClientesController.VerTodos(AClientes);
end;

procedure TPluginContactos.actProveedoresExecute(Sender: TObject);
var
  AProveedoresController : IProveedoresController;
  AProveedores : IBizProveedor;
begin
  AProveedoresController := TProveedoresController.Create;
  AProveedores := (AProveedoresController.BuscarTodos as IBizProveedor);
  AProveedoresController.VerTodos(AProveedores);
end;

procedure TPluginContactos.actInstaladoresExecute(Sender: TObject);
var
  AInstaladoresController : IInstaladoresController;
  AInstaladores : IBizInstalador;
begin
  AInstaladoresController := TInstaladoresController.Create;
  AInstaladores := (AInstaladoresController.BuscarTodos as IBizInstalador);
  AInstaladoresController.VerTodos(AInstaladores);
end;

procedure TPluginContactos.actVendedoresExecute(Sender: TObject);
var
  AVendedoresController : IVendedoresController;
  AVendedores : IBizVendedor;
begin
  AVendedoresController := TVendedoresController.Create;
  AVendedores := (AVendedoresController.BuscarTodos as IBizVendedor);
  AVendedoresController.VerTodos(AVendedores);
end;

constructor TPluginContactos.Create(AOwner: TComponent);
begin
  inherited;
  uContactosViewRegister.RegisterViews;
end;

destructor TPluginContactos.Destroy;
begin
  uContactosViewRegister.UnregisterViews;
  inherited;
end;

initialization
  uHostManager.RegisterModuleClass(TPluginContactos);

finalization
  uHostManager.UnRegisterModuleClass(TPluginContactos);

end.
