This repository has been archived on 2024-11-28. You can view files and clone it, but cannot push or open issues or pull requests.
Noviseda_FactuGES2/Source/Modulos/Contactos/Model/uBizVendedoresServer.pas
2009-12-18 18:19:08 +00:00

119 lines
3.0 KiB
ObjectPascal

unit uBizVendedoresServer;
interface
uses
schContactosServer_Intf, uDAInterfaces, uDADelta,
uDADataTable, uDABusinessProcessor, uBizContactosServer;
const
BIZ_SERVER_VENDEDOR = 'Server.Vendedor';
type
TBizVendedorServer = class(TBizContactosServer)
protected
function DarReferenciaContacto : String; override;
function IncrementarReferenciaContacto : Boolean; override;
procedure Insert_Datos_Contacto(aChange: TDADeltaChange); override;
procedure Update_Datos_Contacto(aChange: TDADeltaChange); override;
procedure Delete_Datos_Contacto(aChange: TDADeltaChange); override;
end;
implementation
uses
uDataModuleServer, uDAClasses,
schContactosClient_Intf, uBusinessUtils;
const
REF_VENDEDORES = 'REF_VENDEDORES';
{ TBizVendedorServer }
function TBizVendedorServer.DarReferenciaContacto: String;
begin
Result := _DarReferenciaInterna(REF_VENDEDORES);
end;
procedure TBizVendedorServer.Delete_Datos_Contacto(aChange: TDADeltaChange);
var
ASchema : TDASchema;
ACurrentConn : IDAConnection;
ACommand : IDASQLCommand;
begin
inherited;
ASchema := BusinessProcessor.Schema;
ACurrentConn := GetBusinessProcessorConnection(BusinessProcessor);
ACommand := ASchema.NewCommand(ACurrentConn, 'Delete_VendedoresDatos');
try
with ACommand do
begin
ParamByName('OLD_ID_VENDEDOR').Value := aChange.OldValueByName[fld_VendedoresID];
Execute;
end;
finally
ACommand := NIL;
end;
end;
function TBizVendedorServer.IncrementarReferenciaContacto: Boolean;
begin
Result := _IncrementarReferenciaInterna(REF_VENDEDORES)
end;
procedure TBizVendedorServer.Insert_Datos_Contacto(aChange: TDADeltaChange);
var
ASchema : TDASchema;
ACurrentConn : IDAConnection;
ACommand : IDASQLCommand;
begin
inherited;
ASchema := BusinessProcessor.Schema;
ACurrentConn := GetBusinessProcessorConnection(BusinessProcessor);
ACommand := ASchema.NewCommand(ACurrentConn, 'Insert_VendedoresDatos');
try
with ACommand do
begin
ParamByName('ID_VENDEDOR').Value := aChange.NewValueByName[fld_VendedoresID];
ParamByName('COMISION').Value := aChange.NewValueByName[fld_VendedoresCOMISION];
Execute;
end;
finally
ACommand := NIL;
end;
end;
procedure TBizVendedorServer.Update_Datos_Contacto(aChange: TDADeltaChange);
var
ASchema : TDASchema;
ACurrentConn : IDAConnection;
ACommand : IDASQLCommand;
begin
inherited;
ASchema := BusinessProcessor.Schema;
ACurrentConn := GetBusinessProcessorConnection(BusinessProcessor);
ACommand := ASchema.NewCommand(ACurrentConn, 'Update_VendedoresDatos');
try
with ACommand do
begin
ParamByName('OLD_ID_VENDEDOR').Value := aChange.OldValueByName[fld_VendedoresID];
ParamByName('COMISION').Value := aChange.NewValueByName[fld_VendedoresCOMISION];
Execute;
end;
finally
ACommand := NIL;
end;
end;
initialization
RegisterBusinessProcessorRules(BIZ_SERVER_VENDEDOR, TBizVendedorServer);
end.