unit uArticulosPedidoClienteController;

interface

uses
  uDADataTable, uArticulosController, uBizArticulos;

type
  IArticulosPedidoClienteController = interface(IArticulosController)
  ['{B334F1FC-65B7-4E77-8D1B-A7CF12F6CF3C}']
  end;

  TArticulosPedidoClienteController = class(TArticulosController, IArticulosPedidoClienteController)
  public
    function ElegirArticulos(AArticulos : IBizArticulo; AMensaje: String; AMultiSelect: Boolean): IBizArticulo; override;
  end;

implementation

{ TArticulosPedidoClienteController }

uses Controls, uIEditorElegirArticulosPedidosCliente, uIEditorElegirArticulos;

function TArticulosPedidoClienteController.ElegirArticulos(AArticulos: IBizArticulo; AMensaje: String;
  AMultiSelect: Boolean): IBizArticulo;
var
  AEditor : IEditorElegirArticulosPedidosCliente;
begin
  Result := NIL;
  CreateEditor('EditorElegirArticulosPedidosCliente', IEditorElegirArticulosPedidosCliente, AEditor);
  if Assigned(AEditor) then
    try
       AEditor.Controller := Self;
       AEditor.Articulos := AArticulos;
       AEditor.MultiSelect := AMultiSelect;
       AEditor.Mensaje := AMensaje;
       if IsPositiveResult(AEditor.ShowModal) then
         Result := AEditor.ArticulosSeleccionados;
    finally
      AEditor.Release;
      AEditor := NIL;
    end;
end;

end.
