unit uBizAgentesServer; interface uses schContactosServer_Intf, uDAInterfaces, uDADelta, uDADataTable, uDABusinessProcessor, uBizContactosServer; const BIZ_SERVER_AGENTE = 'Server.Agente'; type TBizAgenteServer = 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_AGENTES = 'REF_AGENTES'; { TBizAgenteServer } function TBizAgenteServer.DarReferenciaContacto: String; begin Result := _DarReferenciaInterna(REF_AGENTES) end; procedure TBizAgenteServer.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_AgentesDatos'); try with ACommand do begin ParamByName('OLD_ID_EMPLEADO').Value := aChange.OldValueByName[fld_AgentesID]; Execute; end; finally ACommand := NIL; end; end; function TBizAgenteServer.IncrementarReferenciaContacto: Boolean; begin Result := _IncrementarReferenciaInterna(REF_AGENTES) end; procedure TBizAgenteServer.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_AgentesDatos'); try with ACommand do begin ParamByName('ID_AGENTE').Value := aChange.NewValueByName[fld_AgentesID]; ParamByName('FECHA_ALTA_EMPRESA').Value := aChange.NewValueByName[fld_AgentesFECHA_ALTA_EMPRESA]; ParamByName('FECHA_BAJA').Value := aChange.NewValueByName[fld_AgentesFECHA_BAJA]; ParamByName('CAUSA_BAJA').Value := aChange.NewValueByName[fld_AgentesCAUSA_BAJA]; Execute; end; finally ACommand := NIL; end; end; procedure TBizAgenteServer.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_AgentesDatos'); try with ACommand do begin ParamByName('OLD_ID_AGENTE').Value := aChange.OldValueByName[fld_AgentesID]; ParamByName('FECHA_ALTA_EMPRESA').Value := aChange.NewValueByName[fld_AgentesFECHA_ALTA_EMPRESA]; ParamByName('FECHA_BAJA').Value := aChange.NewValueByName[fld_AgentesFECHA_BAJA]; ParamByName('CAUSA_BAJA').Value := aChange.NewValueByName[fld_AgentesCAUSA_BAJA]; Execute; end; finally ACommand := NIL; end; end; initialization RegisterBusinessProcessorRules(BIZ_SERVER_AGENTE, TBizAgenteServer); end.