unit schFabricantesServer_Intf;

interface

uses
  Classes, DB, SysUtils, uROClasses, uDADataTable, uDABusinessProcessor, FmtBCD, uROXMLIntf, schFabricantesClient_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_FabricantesDelta = '{4EA345C5-9E36-44DF-8403-CBEE4967A1B5}';

type
  { IFabricantesDelta }
  IFabricantesDelta = interface(IFabricantes)
  ['{4EA345C5-9E36-44DF-8403-CBEE4967A1B5}']
    { Property getters and setters }
    function GetOldIDValue : Integer;
    function GetOldDESCRIPCIONValue : String;

    { Properties }
    property OldID : Integer read GetOldIDValue;
    property OldDESCRIPCION : String read GetOldDESCRIPCIONValue;
  end;

  { TFabricantesBusinessProcessorRules }
  TFabricantesBusinessProcessorRules = class(TDABusinessProcessorRules, IFabricantes, IFabricantesDelta)
  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 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;

    { 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 DESCRIPCION : String read GetDESCRIPCIONValue write SetDESCRIPCIONValue;
    property DESCRIPCIONIsNull : Boolean read GetDESCRIPCIONIsNull write SetDESCRIPCIONIsNull;
    property OldDESCRIPCION : String read GetOldDESCRIPCIONValue;
    property OldDESCRIPCIONIsNull : Boolean read GetOldDESCRIPCIONIsNull;

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

  end;

implementation

uses
  Variants, uROBinaryHelpers, uDAInterfaces;

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

destructor TFabricantesBusinessProcessorRules.Destroy;
begin
  inherited;
end;

function TFabricantesBusinessProcessorRules.GetIDValue: Integer;
begin
  result := BusinessProcessor.CurrentChange.NewValueByName[fld_FabricantesID];
end;

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

function TFabricantesBusinessProcessorRules.GetOldIDValue: Integer;
begin
  result := BusinessProcessor.CurrentChange.OldValueByName[fld_FabricantesID];
end;

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

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

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

function TFabricantesBusinessProcessorRules.GetDESCRIPCIONValue: String;
begin
  result := BusinessProcessor.CurrentChange.NewValueByName[fld_FabricantesDESCRIPCION];
end;

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

function TFabricantesBusinessProcessorRules.GetOldDESCRIPCIONValue: String;
begin
  result := BusinessProcessor.CurrentChange.OldValueByName[fld_FabricantesDESCRIPCION];
end;

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

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

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


initialization
  RegisterBusinessProcessorRules(RID_FabricantesDelta, TFabricantesBusinessProcessorRules);

end.
