unit schEDILogClient_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_EDILog = '{301F7728-2A2A-465E-89CD-4D36F00E1B31}';

  { Data table names }
  nme_EDILog = 'EDILog';

  { EDILog fields }
  fld_EDILogID = 'ID';
  fld_EDILogREPORT = 'REPORT';
  fld_EDILogFECHA = 'FECHA';
  fld_EDILogOK = 'OK';
  fld_EDILogERROR_MSG = 'ERROR_MSG';

  { EDILog field indexes }
  idx_EDILogID = 0;
  idx_EDILogREPORT = 1;
  idx_EDILogFECHA = 2;
  idx_EDILogOK = 3;
  idx_EDILogERROR_MSG = 4;

type
  { IEDILog }
  IEDILog = interface(IDAStronglyTypedDataTable)
  ['{7B8F10CA-504A-4F10-ADA7-4B805DB211FE}']
    { Property getters and setters }
    function GetIDValue: Integer;
    procedure SetIDValue(const aValue: Integer);
    function GetREPORTValue: String;
    procedure SetREPORTValue(const aValue: String);
    function GetFECHAValue: DateTime;
    procedure SetFECHAValue(const aValue: DateTime);
    function GetOKValue: Boolean;
    procedure SetOKValue(const aValue: Boolean);
    function GetERROR_MSGValue: String;
    procedure SetERROR_MSGValue(const aValue: String);


    { Properties }
    property ID: Integer read GetIDValue write SetIDValue;
    property REPORT: String read GetREPORTValue write SetREPORTValue;
    property FECHA: DateTime read GetFECHAValue write SetFECHAValue;
    property OK: Boolean read GetOKValue write SetOKValue;
    property ERROR_MSG: String read GetERROR_MSGValue write SetERROR_MSGValue;
  end;

  { TEDILogDataTableRules }
  TEDILogDataTableRules = class(TDADataTableRules, IEDILog)
  private
  protected
    { Property getters and setters }
    function GetIDValue: Integer; virtual;
    procedure SetIDValue(const aValue: Integer); virtual;
    function GetREPORTValue: String; virtual;
    procedure SetREPORTValue(const aValue: String); virtual;
    function GetFECHAValue: DateTime; virtual;
    procedure SetFECHAValue(const aValue: DateTime); virtual;
    function GetOKValue: Boolean; virtual;
    procedure SetOKValue(const aValue: Boolean); virtual;
    function GetERROR_MSGValue: String; virtual;
    procedure SetERROR_MSGValue(const aValue: String); virtual;

    { Properties }
    property ID: Integer read GetIDValue write SetIDValue;
    property REPORT: String read GetREPORTValue write SetREPORTValue;
    property FECHA: DateTime read GetFECHAValue write SetFECHAValue;
    property OK: Boolean read GetOKValue write SetOKValue;
    property ERROR_MSG: String read GetERROR_MSGValue write SetERROR_MSGValue;

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

  end;

implementation

uses Variants;

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

destructor TEDILogDataTableRules.Destroy;
begin
  inherited;
end;

function TEDILogDataTableRules.GetIDValue: Integer;
begin
  result := DataTable.Fields[idx_EDILogID].AsInteger;
end;

procedure TEDILogDataTableRules.SetIDValue(const aValue: Integer);
begin
  DataTable.Fields[idx_EDILogID].AsInteger := aValue;
end;

function TEDILogDataTableRules.GetREPORTValue: String;
begin
  result := DataTable.Fields[idx_EDILogREPORT].AsString;
end;

procedure TEDILogDataTableRules.SetREPORTValue(const aValue: String);
begin
  DataTable.Fields[idx_EDILogREPORT].AsString := aValue;
end;

function TEDILogDataTableRules.GetFECHAValue: DateTime;
begin
  result := DataTable.Fields[idx_EDILogFECHA].AsDateTime;
end;

procedure TEDILogDataTableRules.SetFECHAValue(const aValue: DateTime);
begin
  DataTable.Fields[idx_EDILogFECHA].AsDateTime := aValue;
end;

function TEDILogDataTableRules.GetOKValue: Boolean;
begin
  result := DataTable.Fields[idx_EDILogOK].AsBoolean;
end;

procedure TEDILogDataTableRules.SetOKValue(const aValue: Boolean);
begin
  DataTable.Fields[idx_EDILogOK].AsBoolean := aValue;
end;

function TEDILogDataTableRules.GetERROR_MSGValue: String;
begin
  result := DataTable.Fields[idx_EDILogERROR_MSG].AsString;
end;

procedure TEDILogDataTableRules.SetERROR_MSGValue(const aValue: String);
begin
  DataTable.Fields[idx_EDILogERROR_MSG].AsString := aValue;
end;


initialization
  RegisterDataTableRules(RID_EDILog, TEDILogDataTableRules);

end.
