unit uArticulosInventarioController;

interface

uses
  uDADataTable, uArticulosController, uBizArticulos, uBizInventario;

type
  IArticulosInventarioController = interface(IArticulosController)
  ['{33B26E09-ABE8-45A4-B9B3-E0E48F8EBB3E}']
  end;

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

implementation

{ TArticulosInventarioController }

uses Controls, cxControls, uIEditorElegirArticulosCatalogo;

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

end.
