unit uViewInformeBaseParametros;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, uViewBase, uViewInformeBaseGrid;

type
  IViewInformeBaseParametros = interface(IViewBase)
  ['{7830A245-0BB2-4E24-88AE-2D937A3FC904}']
    function GetModificable: Boolean;
    procedure SetModificable(const Value: Boolean);
    property Modificable : Boolean read GetModificable write SetModificable;

    procedure SetViewInformeBaseGrid (const Value : IViewInformeBaseGrid);
    function GetViewInformeBaseGrid : IViewInformeBaseGrid;
    property ViewInformeBaseGrid : IViewInformeBaseGrid read GetViewInformeBaseGrid write SetViewInformeBaseGrid;

    procedure Execute;
    procedure Refresh;
  end;

  TfrViewInformeBaseParametros = class(TfrViewBase, IViewInformeBaseParametros)
  protected
    FViewInformeBaseGrid : IViewInformeBaseGrid;
    FModificable : Boolean;
    function GetModificable: Boolean; virtual;
    procedure SetModificable(const Value: Boolean); virtual;
    procedure SetViewInformeBaseGrid (const Value : IViewInformeBaseGrid); virtual;
    function GetViewInformeBaseGrid : IViewInformeBaseGrid; virtual;
  public
    property Modificable : Boolean read GetModificable write SetModificable;
    property ViewInformeBaseGrid : IViewInformeBaseGrid read GetViewInformeBaseGrid write SetViewInformeBaseGrid;
    procedure Execute; virtual;
    procedure Refresh; override;
  end;


implementation

{$R *.dfm}

{ TfrViewInformeBaseParametros }


procedure TfrViewInformeBaseParametros.Execute;
begin
  if not Assigned(ViewInformeBaseGrid) then
    raise Exception.Create('Vista para el control no asignada (Execute)');
end;

function TfrViewInformeBaseParametros.GetModificable: Boolean;
begin
  Result := FModificable;
end;

function TfrViewInformeBaseParametros.GetViewInformeBaseGrid: IViewInformeBaseGrid;
begin
  Result := FViewInformeBaseGrid;
end;

procedure TfrViewInformeBaseParametros.Refresh;
begin
  inherited;
  if not Assigned(ViewInformeBaseGrid) then
    raise Exception.Create('Vista para el control no asignada (Refresh)');
end;

procedure TfrViewInformeBaseParametros.SetModificable(
  const Value: Boolean);
begin
  FModificable := Value;
end;

procedure TfrViewInformeBaseParametros.SetViewInformeBaseGrid(
  const Value: IViewInformeBaseGrid);
begin
  FViewInformeBaseGrid := Value;
end;

end.
