unit schFamiliasServer_Intf;

interface

uses
  Classes, DB, SysUtils, uROClasses, uDADataTable, uDABusinessProcessor, FmtBCD, uROXMLIntf, schFamiliasClient_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_FamiliasDelta = '{CEAAE8BD-8120-4DF5-9246-6C0E96C56111}';

type
  { IFamiliasDelta }
  IFamiliasDelta = interface(IFamilias)
  ['{CEAAE8BD-8120-4DF5-9246-6C0E96C56111}']
    { Property getters and setters }
    function GetOldIDValue : Integer;
    function GetOldDESCRIPCIONValue : String;

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

  { TFamiliasBusinessProcessorRules }
  TFamiliasBusinessProcessorRules = class(TDABusinessProcessorRules, IFamilias, IFamiliasDelta)
  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;

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

destructor TFamiliasBusinessProcessorRules.Destroy;
begin
  inherited;
end;

function TFamiliasBusinessProcessorRules.GetIDValue: Integer;
begin
  result := BusinessProcessor.CurrentChange.NewValueByName[fld_FamiliasID];
end;

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

function TFamiliasBusinessProcessorRules.GetOldIDValue: Integer;
begin
  result := BusinessProcessor.CurrentChange.OldValueByName[fld_FamiliasID];
end;

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

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

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

function TFamiliasBusinessProcessorRules.GetDESCRIPCIONValue: String;
begin
  result := BusinessProcessor.CurrentChange.NewValueByName[fld_FamiliasDESCRIPCION];
end;

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

function TFamiliasBusinessProcessorRules.GetOldDESCRIPCIONValue: String;
begin
  result := BusinessProcessor.CurrentChange.OldValueByName[fld_FamiliasDESCRIPCION];
end;

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

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

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


initialization
  RegisterBusinessProcessorRules(RID_FamiliasDelta, TFamiliasBusinessProcessorRules);

end.
