unit schArticulosServer_Intf;

interface

uses
  Classes, DB, SysUtils, uROClasses, uDADataTable, uDABusinessProcessor, FmtBCD, uROXMLIntf, schArticulosClient_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_ArticulosDelta = '{F37D2903-16AE-41E9-BC68-C84D2EE6B3E0}';

type
  { IArticulosDelta }
  IArticulosDelta = interface(IArticulos)
  ['{F37D2903-16AE-41E9-BC68-C84D2EE6B3E0}']
    { Property getters and setters }
    function GetOldIDValue : Integer;
    function GetOldREFERENCIAValue : String;
    function GetOldDESCRIPCIONValue : String;
    function GetOldFAMILIAValue : String;

    { Properties }
    property OldID : Integer read GetOldIDValue;
    property OldREFERENCIA : String read GetOldREFERENCIAValue;
    property OldDESCRIPCION : String read GetOldDESCRIPCIONValue;
    property OldFAMILIA : String read GetOldFAMILIAValue;
  end;

  { TArticulosBusinessProcessorRules }
  TArticulosBusinessProcessorRules = class(TDABusinessProcessorRules, IArticulos, IArticulosDelta)
  private
  protected
    { Property getters and setters }
    function GetIDValue: Integer; virtual;
    function GetIDIsNull: Boolean; virtual;
    function GetOldIDValue: Integer; virtual;
    function GetOldIDIsNull: Boolean; virtual;
    procedure SetIDValue(const aValue: Integer); virtual;
    procedure SetIDIsNull(const aValue: Boolean); virtual;
    function GetREFERENCIAValue: String; virtual;
    function GetREFERENCIAIsNull: Boolean; virtual;
    function GetOldREFERENCIAValue: String; virtual;
    function GetOldREFERENCIAIsNull: Boolean; virtual;
    procedure SetREFERENCIAValue(const aValue: String); virtual;
    procedure SetREFERENCIAIsNull(const aValue: Boolean); virtual;
    function GetDESCRIPCIONValue: String; virtual;
    function GetDESCRIPCIONIsNull: Boolean; virtual;
    function GetOldDESCRIPCIONValue: String; virtual;
    function GetOldDESCRIPCIONIsNull: Boolean; virtual;
    procedure SetDESCRIPCIONValue(const aValue: String); virtual;
    procedure SetDESCRIPCIONIsNull(const aValue: Boolean); virtual;
    function GetFAMILIAValue: String; virtual;
    function GetFAMILIAIsNull: Boolean; virtual;
    function GetOldFAMILIAValue: String; virtual;
    function GetOldFAMILIAIsNull: Boolean; virtual;
    procedure SetFAMILIAValue(const aValue: String); virtual;
    procedure SetFAMILIAIsNull(const aValue: Boolean); virtual;

    { Properties }
    property ID : Integer read GetIDValue write SetIDValue;
    property IDIsNull : Boolean read GetIDIsNull write SetIDIsNull;
    property OldID : Integer read GetOldIDValue;
    property OldIDIsNull : Boolean read GetOldIDIsNull;
    property REFERENCIA : String read GetREFERENCIAValue write SetREFERENCIAValue;
    property REFERENCIAIsNull : Boolean read GetREFERENCIAIsNull write SetREFERENCIAIsNull;
    property OldREFERENCIA : String read GetOldREFERENCIAValue;
    property OldREFERENCIAIsNull : Boolean read GetOldREFERENCIAIsNull;
    property DESCRIPCION : String read GetDESCRIPCIONValue write SetDESCRIPCIONValue;
    property DESCRIPCIONIsNull : Boolean read GetDESCRIPCIONIsNull write SetDESCRIPCIONIsNull;
    property OldDESCRIPCION : String read GetOldDESCRIPCIONValue;
    property OldDESCRIPCIONIsNull : Boolean read GetOldDESCRIPCIONIsNull;
    property FAMILIA : String read GetFAMILIAValue write SetFAMILIAValue;
    property FAMILIAIsNull : Boolean read GetFAMILIAIsNull write SetFAMILIAIsNull;
    property OldFAMILIA : String read GetOldFAMILIAValue;
    property OldFAMILIAIsNull : Boolean read GetOldFAMILIAIsNull;

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

  end;

implementation

uses
  Variants, uROBinaryHelpers, uDAInterfaces;

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

destructor TArticulosBusinessProcessorRules.Destroy;
begin
  inherited;
end;

function TArticulosBusinessProcessorRules.GetIDValue: Integer;
begin
  result := BusinessProcessor.CurrentChange.NewValueByName[fld_ArticulosID];
end;

function TArticulosBusinessProcessorRules.GetIDIsNull: Boolean;
begin
  result := VarIsNull(BusinessProcessor.CurrentChange.NewValueByName[fld_ArticulosID]);
end;

function TArticulosBusinessProcessorRules.GetOldIDValue: Integer;
begin
  result := BusinessProcessor.CurrentChange.OldValueByName[fld_ArticulosID];
end;

function TArticulosBusinessProcessorRules.GetOldIDIsNull: Boolean;
begin
  result := VarIsNull(BusinessProcessor.CurrentChange.OldValueByName[fld_ArticulosID]);
end;

procedure TArticulosBusinessProcessorRules.SetIDValue(const aValue: Integer);
begin
  BusinessProcessor.CurrentChange.NewValueByName[fld_ArticulosID] := aValue;
end;

procedure TArticulosBusinessProcessorRules.SetIDIsNull(const aValue: Boolean);
begin
  if aValue then
    BusinessProcessor.CurrentChange.NewValueByName[fld_ArticulosID] := Null;
end;

function TArticulosBusinessProcessorRules.GetREFERENCIAValue: String;
begin
  result := BusinessProcessor.CurrentChange.NewValueByName[fld_ArticulosREFERENCIA];
end;

function TArticulosBusinessProcessorRules.GetREFERENCIAIsNull: Boolean;
begin
  result := VarIsNull(BusinessProcessor.CurrentChange.NewValueByName[fld_ArticulosREFERENCIA]);
end;

function TArticulosBusinessProcessorRules.GetOldREFERENCIAValue: String;
begin
  result := BusinessProcessor.CurrentChange.OldValueByName[fld_ArticulosREFERENCIA];
end;

function TArticulosBusinessProcessorRules.GetOldREFERENCIAIsNull: Boolean;
begin
  result := VarIsNull(BusinessProcessor.CurrentChange.OldValueByName[fld_ArticulosREFERENCIA]);
end;

procedure TArticulosBusinessProcessorRules.SetREFERENCIAValue(const aValue: String);
begin
  BusinessProcessor.CurrentChange.NewValueByName[fld_ArticulosREFERENCIA] := aValue;
end;

procedure TArticulosBusinessProcessorRules.SetREFERENCIAIsNull(const aValue: Boolean);
begin
  if aValue then
    BusinessProcessor.CurrentChange.NewValueByName[fld_ArticulosREFERENCIA] := Null;
end;

function TArticulosBusinessProcessorRules.GetDESCRIPCIONValue: String;
begin
  result := BusinessProcessor.CurrentChange.NewValueByName[fld_ArticulosDESCRIPCION];
end;

function TArticulosBusinessProcessorRules.GetDESCRIPCIONIsNull: Boolean;
begin
  result := VarIsNull(BusinessProcessor.CurrentChange.NewValueByName[fld_ArticulosDESCRIPCION]);
end;

function TArticulosBusinessProcessorRules.GetOldDESCRIPCIONValue: String;
begin
  result := BusinessProcessor.CurrentChange.OldValueByName[fld_ArticulosDESCRIPCION];
end;

function TArticulosBusinessProcessorRules.GetOldDESCRIPCIONIsNull: Boolean;
begin
  result := VarIsNull(BusinessProcessor.CurrentChange.OldValueByName[fld_ArticulosDESCRIPCION]);
end;

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

procedure TArticulosBusinessProcessorRules.SetDESCRIPCIONIsNull(const aValue: Boolean);
begin
  if aValue then
    BusinessProcessor.CurrentChange.NewValueByName[fld_ArticulosDESCRIPCION] := Null;
end;

function TArticulosBusinessProcessorRules.GetFAMILIAValue: String;
begin
  result := BusinessProcessor.CurrentChange.NewValueByName[fld_ArticulosFAMILIA];
end;

function TArticulosBusinessProcessorRules.GetFAMILIAIsNull: Boolean;
begin
  result := VarIsNull(BusinessProcessor.CurrentChange.NewValueByName[fld_ArticulosFAMILIA]);
end;

function TArticulosBusinessProcessorRules.GetOldFAMILIAValue: String;
begin
  result := BusinessProcessor.CurrentChange.OldValueByName[fld_ArticulosFAMILIA];
end;

function TArticulosBusinessProcessorRules.GetOldFAMILIAIsNull: Boolean;
begin
  result := VarIsNull(BusinessProcessor.CurrentChange.OldValueByName[fld_ArticulosFAMILIA]);
end;

procedure TArticulosBusinessProcessorRules.SetFAMILIAValue(const aValue: String);
begin
  BusinessProcessor.CurrentChange.NewValueByName[fld_ArticulosFAMILIA] := aValue;
end;

procedure TArticulosBusinessProcessorRules.SetFAMILIAIsNull(const aValue: Boolean);
begin
  if aValue then
    BusinessProcessor.CurrentChange.NewValueByName[fld_ArticulosFAMILIA] := Null;
end;


initialization
  RegisterBusinessProcessorRules(RID_ArticulosDelta, TArticulosBusinessProcessorRules);

end.
