/// <summary> /// Handles message from client and send request to 3d party service. /// </summary> /// <param name="handledCommand">The command.</param> public void Handle(ExperianBusinessTargetingCommand handledCommand) { ExperianTargetBusiness3dPartyCommand cmd = new ExperianTargetBusiness3dPartyCommand { RegNumber = string.IsNullOrEmpty(handledCommand.RegistrationNumber) ? Optional <string> .Empty() : Optional <string> .Of(handledCommand.RegistrationNumber), CompanyName = handledCommand.CompanyName, IsLimited = handledCommand.IsLimited, PostCode = handledCommand.PostCode }; SendCommand(ThirdPartyService.Address, cmd, handledCommand); }
/// <summary> /// Handles a command. /// </summary> /// <param name="command">The command to handle.</param> /// <remarks> /// This method will be called when a command arrives on the bus and should contain /// the custom logic to execute when the command is received. /// </remarks> public void Handle(ExperianTargetBusiness3dPartyCommand command) { ResultInfoAccomulator <IEnumerable <Experian3dPartyCompanyInfo> > info = Experian.TargetBusiness(command.CompanyName, command.PostCode, command.IsLimited, command.RegNumber.HasValue ? command.RegNumber.GetValue() : ""); if (info.HasErrors) { //TODO : check again if (Transaction.Current != null) { Transaction.Current.Rollback(); base.RegisterError(info, command); } } else { SendReply(info, command, o => o.CompanyInfos = info.Result.ToArray()); } }