public void Use(Action <IXBInfoService> action) { NetTcpBinding binding = new NetTcpBinding(); string endpointUrl = _config["WCFExternalServices:XBInfoService:EndpointAddress"]; binding.MaxBufferPoolSize = 5242880; binding.MaxBufferSize = 6553600; binding.MaxReceivedMessageSize = 6553600; binding.ReaderQuotas.MaxArrayLength = 2500000; EndpointAddress endpoint = new EndpointAddress(endpointUrl); IXBInfoService client = ProxyManager <IXBInfoService> .GetProxy(nameof(IXBInfoService), binding, endpoint); byte Language = _cacheHelper.GetLanguage(); string ClientIP = _cacheHelper.GetClientIp(); XBSInfo.SourceType Source = (XBSInfo.SourceType)_cacheHelper.GetSourceType(); XBS.AuthorizedCustomer authorizedCustomer = _cacheHelper.GetAuthorizedCustomer(); XBSInfo.AuthorizedCustomer authorizedCustomerInfo = new XBSInfo.AuthorizedCustomer { CustomerNumber = authorizedCustomer.CustomerNumber, UserName = authorizedCustomer.UserName, UserId = authorizedCustomer.UserId }; client.InitOnlineAsync(ClientIP, Language, Source, authorizedCustomerInfo).Wait(); bool success = false; try { action(client); ((IClientChannel)client).Close(); success = true; } catch (FaultException ex) { ((IClientChannel)client).Close(); throw; } catch (TimeoutException ex) { } catch (Exception ex) { ((IClientChannel)client).Abort(); throw; } finally { if (!success) { ((IClientChannel)client).Abort(); } ((IClientChannel)client).Close(); ((IClientChannel)client).Dispose(); } }
public IActionResult PrintDepositLoanContract(PrintContractRequest request) { if (ModelState.IsValid) { SingleResponse <string> response = new SingleResponse <string>(); XBS.AuthorizedCustomer authorizedCustomer = _cacheHelper.GetAuthorizedCustomer(); response.Result = _xbService.PrintDepositLoanContract(request.Id, authorizedCustomer.CustomerNumber, false); response.ResultCode = ResultCodes.normal; return(ResponseExtensions.ToHttpResponse(response)); } else { return(ValidationError.GetValidationErrorResponse(ModelState)); } }
public IActionResult GetLoansDramContract(LoanContractRequest request) { if (ModelState.IsValid) { SingleResponse <string> response = new SingleResponse <string>(); response.ResultCode = ResultCodes.normal; XBS.AuthorizedCustomer authorizedCustomer = _cacheHelper.GetAuthorizedCustomer(); response.Result = _xbService.GetLoansDramContract(request.DocId, request.ProductType, request.FromApprove, authorizedCustomer.CustomerNumber); return(ResponseExtensions.ToHttpResponse(response)); } else { return(ValidationError.GetValidationErrorResponse(ModelState)); } }
public IActionResult GetMaxAvailableAmountForNewLoan(CurrencyRequest request) { if (ModelState.IsValid) { SingleResponse <double> response = new SingleResponse <double>() { ResultCode = ResultCodes.normal }; XBS.AuthorizedCustomer authorizedCustomer = _cacheHelper.GetAuthorizedCustomer(); response.Result = _xbService.GetMaxAvailableAmountForNewLoan(request.Currency, authorizedCustomer.CustomerNumber); return(ResponseExtensions.ToHttpResponse(response)); } else { return(ValidationError.GetValidationErrorResponse(ModelState)); } }
public IActionResult GetMaxAvailableAmountForNewCreditLine(GetMaxAvailableAmountForNewCreditLine request) { if (ModelState.IsValid) { SingleResponse <double> response = new SingleResponse <double>() { ResultCode = ResultCodes.normal }; XBS.AuthorizedCustomer authorizedCustomer = _cacheHelper.GetAuthorizedCustomer(); response.Result = _xbService.GetMaxAvailableAmountForNewCreditLine(request.ProductId, request.CreditLineType, request.ProvisionCurrency, request.ExistRequiredEntries, authorizedCustomer.CustomerNumber); return(ResponseExtensions.ToHttpResponse(response)); } else { return(ValidationError.GetValidationErrorResponse(ModelState)); } }