111 lines
3.2 KiB
ObjectPascal
111 lines
3.2 KiB
ObjectPascal
|
|
{
|
|||
|
|
===============================================================================
|
|||
|
|
Copyright (<EFBFBD>) 2007. Rodax Software.
|
|||
|
|
===============================================================================
|
|||
|
|
Los contenidos de este fichero son propiedad de Rodax Software titular del
|
|||
|
|
copyright. Este fichero s<EFBFBD>lo podr<EFBFBD> ser copiado, distribuido y utilizado,
|
|||
|
|
en su totalidad o en parte, con el permiso escrito de Rodax Software, o de
|
|||
|
|
acuerdo con los t<EFBFBD>rminos y condiciones establecidas en el acuerdo/contrato
|
|||
|
|
bajo el que se suministra.
|
|||
|
|
-----------------------------------------------------------------------------
|
|||
|
|
Web: www.rodax-software.com
|
|||
|
|
===============================================================================
|
|||
|
|
Fecha primera versi<EFBFBD>n:
|
|||
|
|
Versi<EFBFBD>n actual: 1.0.0
|
|||
|
|
Fecha versi<EFBFBD>n actual:
|
|||
|
|
===============================================================================
|
|||
|
|
Modificaciones:
|
|||
|
|
|
|||
|
|
Fecha Comentarios
|
|||
|
|
---------------------------------------------------------------------------
|
|||
|
|
===============================================================================
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
unit uBizOscAddressBook;
|
|||
|
|
|
|||
|
|
interface
|
|||
|
|
|
|||
|
|
uses
|
|||
|
|
uDAInterfaces, uDADataTable, uDBSelectionListUtils, schTiendaWebClient_Intf;
|
|||
|
|
|
|||
|
|
const
|
|||
|
|
BIZ_CLIENT_OSC_ADDRESSBOOK = 'Client.OSC.AddressBook';
|
|||
|
|
|
|||
|
|
type
|
|||
|
|
IBizOscAddressBook = interface(Iosc_AddressBook)
|
|||
|
|
['{367AB44E-4E9B-4F40-B695-2ED1085C18E9}']
|
|||
|
|
function EsNuevo : Boolean;
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
TBizOscAddressBook = class(Tosc_AddressBookDataTableRules, IBizOscAddressBook, ISeleccionable)
|
|||
|
|
protected
|
|||
|
|
FSeleccionableInterface : ISeleccionable;
|
|||
|
|
procedure BeforeInsert(Sender: TDADataTable); override;
|
|||
|
|
procedure OnNewRecord(Sender: TDADataTable); override;
|
|||
|
|
public
|
|||
|
|
procedure IniciarValoresNuevo;
|
|||
|
|
function EsNuevo : Boolean;
|
|||
|
|
constructor Create(aDataTable: TDADataTable); override;
|
|||
|
|
destructor Destroy; override;
|
|||
|
|
|
|||
|
|
property SeleccionableInterface : ISeleccionable
|
|||
|
|
read FSeleccionableInterface
|
|||
|
|
write FSeleccionableInterface
|
|||
|
|
implements ISeleccionable;
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
implementation
|
|||
|
|
|
|||
|
|
{ TBizOscAddressBook }
|
|||
|
|
|
|||
|
|
uses
|
|||
|
|
SysUtils, uDataTableUtils, DB;
|
|||
|
|
|
|||
|
|
procedure TBizOscAddressBook.BeforeInsert(Sender: TDADataTable);
|
|||
|
|
var
|
|||
|
|
AMasterTable : TDADataTable;
|
|||
|
|
begin
|
|||
|
|
inherited;
|
|||
|
|
AMasterTable := DataTable.GetMasterDataTable;
|
|||
|
|
if Assigned(AMasterTable) and (AMasterTable.State = dsInsert) then
|
|||
|
|
AMasterTable.Post;
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
constructor TBizOscAddressBook.Create(aDataTable: TDADataTable);
|
|||
|
|
begin
|
|||
|
|
inherited;
|
|||
|
|
FSeleccionableInterface := TSeleccionable.Create(aDataTable);
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
destructor TBizOscAddressBook.Destroy;
|
|||
|
|
begin
|
|||
|
|
FSeleccionableInterface := NIL;
|
|||
|
|
inherited;
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
function TBizOscAddressBook.EsNuevo: Boolean;
|
|||
|
|
begin
|
|||
|
|
Result := (address_book_id < 0);
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
procedure TBizOscAddressBook.IniciarValoresNuevo;
|
|||
|
|
begin
|
|||
|
|
entry_country_id := 195; // Spain
|
|||
|
|
entry_zone_id := 161; // Madrid
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
procedure TBizOscAddressBook.OnNewRecord(Sender: TDADataTable);
|
|||
|
|
begin
|
|||
|
|
inherited;
|
|||
|
|
address_book_id := GetRecNo; // -1, -2, -3...
|
|||
|
|
IniciarValoresNuevo;
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
initialization
|
|||
|
|
RegisterDataTableRules(BIZ_CLIENT_OSC_ADDRESSBOOK, TBizOscAddressBook);
|
|||
|
|
|
|||
|
|
finalization
|
|||
|
|
|
|||
|
|
end.
|
|||
|
|
|