unit schReferenciasServer_Intf;

interface

uses
  Classes, DB, SysUtils, uROClasses, uDADataTable, uDABusinessProcessor, schReferenciasClient_Intf;

const
  { Delta 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_ReferenciasDelta = '{6821A7E8-268E-4BD1-977E-0225B4DBA778}';

type
  { IReferenciasDelta }
  IReferenciasDelta = interface(IReferencias)
  ['{6821A7E8-268E-4BD1-977E-0225B4DBA778}']
    { Property getters and setters }
    function GetOldCODIGOValue : String;
    function GetOldDESCRIPCIONValue : String;
    function GetOldVALORValue : String;
    function GetOldID_EMPRESAValue : Integer;

    { Properties }
    property OldCODIGO : String read GetOldCODIGOValue;
    property OldDESCRIPCION : String read GetOldDESCRIPCIONValue;
    property OldVALOR : String read GetOldVALORValue;
    property OldID_EMPRESA : Integer read GetOldID_EMPRESAValue;
  end;

  { TReferenciasBusinessProcessorRules }
  TReferenciasBusinessProcessorRules = class(TDABusinessProcessorRules, IReferencias, IReferenciasDelta)
  private
  protected
    { Property getters and setters }
    function GetCODIGOValue: String; virtual;
    function GetOldCODIGOValue: String; virtual;
    procedure SetCODIGOValue(const aValue: String); virtual;
    function GetDESCRIPCIONValue: String; virtual;
    function GetOldDESCRIPCIONValue: String; virtual;
    procedure SetDESCRIPCIONValue(const aValue: String); virtual;
    function GetVALORValue: String; virtual;
    function GetOldVALORValue: String; virtual;
    procedure SetVALORValue(const aValue: String); virtual;
    function GetID_EMPRESAValue: Integer; virtual;
    function GetOldID_EMPRESAValue: Integer; virtual;
    procedure SetID_EMPRESAValue(const aValue: Integer); virtual;

    { Properties }
    property CODIGO : String read GetCODIGOValue write SetCODIGOValue;
    property OldCODIGO : String read GetOldCODIGOValue;
    property DESCRIPCION : String read GetDESCRIPCIONValue write SetDESCRIPCIONValue;
    property OldDESCRIPCION : String read GetOldDESCRIPCIONValue;
    property VALOR : String read GetVALORValue write SetVALORValue;
    property OldVALOR : String read GetOldVALORValue;
    property ID_EMPRESA : Integer read GetID_EMPRESAValue write SetID_EMPRESAValue;
    property OldID_EMPRESA : Integer read GetOldID_EMPRESAValue;

  public
    constructor Create(aBusinessProcessor: TDABusinessProcessor); override;
    destructor Destroy; override;

  end;

implementation

uses
  Variants, uROBinaryHelpers;

{ TReferenciasBusinessProcessorRules }
constructor TReferenciasBusinessProcessorRules.Create(aBusinessProcessor: TDABusinessProcessor);
begin
  inherited;
end;

destructor TReferenciasBusinessProcessorRules.Destroy;
begin
  inherited;
end;

function TReferenciasBusinessProcessorRules.GetCODIGOValue: String;
begin
  result := BusinessProcessor.CurrentChange.NewValueByName[fld_ReferenciasCODIGO];
end;

function TReferenciasBusinessProcessorRules.GetOldCODIGOValue: String;
begin
  result := BusinessProcessor.CurrentChange.OldValueByName[fld_ReferenciasCODIGO];
end;

procedure TReferenciasBusinessProcessorRules.SetCODIGOValue(const aValue: String);
begin
  BusinessProcessor.CurrentChange.NewValueByName[fld_ReferenciasCODIGO] := aValue;
end;

function TReferenciasBusinessProcessorRules.GetDESCRIPCIONValue: String;
begin
  result := BusinessProcessor.CurrentChange.NewValueByName[fld_ReferenciasDESCRIPCION];
end;

function TReferenciasBusinessProcessorRules.GetOldDESCRIPCIONValue: String;
begin
  result := BusinessProcessor.CurrentChange.OldValueByName[fld_ReferenciasDESCRIPCION];
end;

procedure TReferenciasBusinessProcessorRules.SetDESCRIPCIONValue(const aValue: String);
begin
  BusinessProcessor.CurrentChange.NewValueByName[fld_ReferenciasDESCRIPCION] := aValue;
end;

function TReferenciasBusinessProcessorRules.GetVALORValue: String;
begin
  result := BusinessProcessor.CurrentChange.NewValueByName[fld_ReferenciasVALOR];
end;

function TReferenciasBusinessProcessorRules.GetOldVALORValue: String;
begin
  result := BusinessProcessor.CurrentChange.OldValueByName[fld_ReferenciasVALOR];
end;

procedure TReferenciasBusinessProcessorRules.SetVALORValue(const aValue: String);
begin
  BusinessProcessor.CurrentChange.NewValueByName[fld_ReferenciasVALOR] := aValue;
end;

function TReferenciasBusinessProcessorRules.GetID_EMPRESAValue: Integer;
begin
  result := BusinessProcessor.CurrentChange.NewValueByName[fld_ReferenciasID_EMPRESA];
end;

function TReferenciasBusinessProcessorRules.GetOldID_EMPRESAValue: Integer;
begin
  result := BusinessProcessor.CurrentChange.OldValueByName[fld_ReferenciasID_EMPRESA];
end;

procedure TReferenciasBusinessProcessorRules.SetID_EMPRESAValue(const aValue: Integer);
begin
  BusinessProcessor.CurrentChange.NewValueByName[fld_ReferenciasID_EMPRESA] := aValue;
end;


initialization
  RegisterBusinessProcessorRules(RID_ReferenciasDelta, TReferenciasBusinessProcessorRules);

end.
