unit schParametrosClient_Intf;

interface

uses
  Classes, DB, SysUtils, uROClasses, uDADataTable;

const
  { Data table rules ids
       Feel free to change them to something more human readable
       but make sure they are unique in the context of your application }
  RID_ListaCentros = '{CE7EAA4D-6A5B-418E-931E-61BC59E87921}';
  RID_ListaColecciones = '{30AF285C-6577-445D-A759-78E8EC8275BF}';

  { Data table names }
  nme_ListaCentros = 'ListaCentros';
  nme_ListaColecciones = 'ListaColecciones';

  { ListaCentros fields }
  fld_ListaCentrosCODFILIAL = 'CODFILIAL';
  fld_ListaCentrosCODBARRA = 'CODBARRA';
  fld_ListaCentrosFILIAL = 'FILIAL';

  { ListaCentros field indexes }
  idx_ListaCentrosCODFILIAL = 0;
  idx_ListaCentrosCODBARRA = 1;
  idx_ListaCentrosFILIAL = 2;

  { ListaColecciones fields }
  fld_ListaColeccionesCOLECAO = 'COLECAO';
  fld_ListaColeccionesDESC_COLECAO = 'DESC_COLECAO';

  { ListaColecciones field indexes }
  idx_ListaColeccionesCOLECAO = 0;
  idx_ListaColeccionesDESC_COLECAO = 1;

type
  { IListaCentros }
  IListaCentros = interface(IDAStronglyTypedDataTable)
  ['{FF4F6460-CEBC-40C5-A2B9-7ED81AE90A7A}']
    { Property getters and setters }
    function GetCODFILIALValue: String;
    procedure SetCODFILIALValue(const aValue: String);
    function GetCODBARRAValue: String;
    procedure SetCODBARRAValue(const aValue: String);
    function GetFILIALValue: String;
    procedure SetFILIALValue(const aValue: String);


    { Properties }
    property CODFILIAL: String read GetCODFILIALValue write SetCODFILIALValue;
    property CODBARRA: String read GetCODBARRAValue write SetCODBARRAValue;
    property FILIAL: String read GetFILIALValue write SetFILIALValue;
  end;

  { TListaCentrosDataTableRules }
  TListaCentrosDataTableRules = class(TDADataTableRules, IListaCentros)
  private
  protected
    { Property getters and setters }
    function GetCODFILIALValue: String; virtual;
    procedure SetCODFILIALValue(const aValue: String); virtual;
    function GetCODBARRAValue: String; virtual;
    procedure SetCODBARRAValue(const aValue: String); virtual;
    function GetFILIALValue: String; virtual;
    procedure SetFILIALValue(const aValue: String); virtual;

    { Properties }
    property CODFILIAL: String read GetCODFILIALValue write SetCODFILIALValue;
    property CODBARRA: String read GetCODBARRAValue write SetCODBARRAValue;
    property FILIAL: String read GetFILIALValue write SetFILIALValue;

  public
    constructor Create(aDataTable: TDADataTable); override;
    destructor Destroy; override;

  end;

  { IListaColecciones }
  IListaColecciones = interface(IDAStronglyTypedDataTable)
  ['{6EACE103-97D5-4D08-9BA5-DC24826BD4C8}']
    { Property getters and setters }
    function GetCOLECAOValue: String;
    procedure SetCOLECAOValue(const aValue: String);
    function GetDESC_COLECAOValue: String;
    procedure SetDESC_COLECAOValue(const aValue: String);


    { Properties }
    property COLECAO: String read GetCOLECAOValue write SetCOLECAOValue;
    property DESC_COLECAO: String read GetDESC_COLECAOValue write SetDESC_COLECAOValue;
  end;

  { TListaColeccionesDataTableRules }
  TListaColeccionesDataTableRules = class(TDADataTableRules, IListaColecciones)
  private
  protected
    { Property getters and setters }
    function GetCOLECAOValue: String; virtual;
    procedure SetCOLECAOValue(const aValue: String); virtual;
    function GetDESC_COLECAOValue: String; virtual;
    procedure SetDESC_COLECAOValue(const aValue: String); virtual;

    { Properties }
    property COLECAO: String read GetCOLECAOValue write SetCOLECAOValue;
    property DESC_COLECAO: String read GetDESC_COLECAOValue write SetDESC_COLECAOValue;

  public
    constructor Create(aDataTable: TDADataTable); override;
    destructor Destroy; override;

  end;

implementation

uses Variants;

{ TListaCentrosDataTableRules }
constructor TListaCentrosDataTableRules.Create(aDataTable: TDADataTable);
begin
  inherited;
end;

destructor TListaCentrosDataTableRules.Destroy;
begin
  inherited;
end;

function TListaCentrosDataTableRules.GetCODFILIALValue: String;
begin
  result := DataTable.Fields[idx_ListaCentrosCODFILIAL].AsString;
end;

procedure TListaCentrosDataTableRules.SetCODFILIALValue(const aValue: String);
begin
  DataTable.Fields[idx_ListaCentrosCODFILIAL].AsString := aValue;
end;

function TListaCentrosDataTableRules.GetCODBARRAValue: String;
begin
  result := DataTable.Fields[idx_ListaCentrosCODBARRA].AsString;
end;

procedure TListaCentrosDataTableRules.SetCODBARRAValue(const aValue: String);
begin
  DataTable.Fields[idx_ListaCentrosCODBARRA].AsString := aValue;
end;

function TListaCentrosDataTableRules.GetFILIALValue: String;
begin
  result := DataTable.Fields[idx_ListaCentrosFILIAL].AsString;
end;

procedure TListaCentrosDataTableRules.SetFILIALValue(const aValue: String);
begin
  DataTable.Fields[idx_ListaCentrosFILIAL].AsString := aValue;
end;


{ TListaColeccionesDataTableRules }
constructor TListaColeccionesDataTableRules.Create(aDataTable: TDADataTable);
begin
  inherited;
end;

destructor TListaColeccionesDataTableRules.Destroy;
begin
  inherited;
end;

function TListaColeccionesDataTableRules.GetCOLECAOValue: String;
begin
  result := DataTable.Fields[idx_ListaColeccionesCOLECAO].AsString;
end;

procedure TListaColeccionesDataTableRules.SetCOLECAOValue(const aValue: String);
begin
  DataTable.Fields[idx_ListaColeccionesCOLECAO].AsString := aValue;
end;

function TListaColeccionesDataTableRules.GetDESC_COLECAOValue: String;
begin
  result := DataTable.Fields[idx_ListaColeccionesDESC_COLECAO].AsString;
end;

procedure TListaColeccionesDataTableRules.SetDESC_COLECAOValue(const aValue: String);
begin
  DataTable.Fields[idx_ListaColeccionesDESC_COLECAO].AsString := aValue;
end;


initialization
  RegisterDataTableRules(RID_ListaCentros, TListaCentrosDataTableRules);
  RegisterDataTableRules(RID_ListaColecciones, TListaColeccionesDataTableRules);

end.
