Ejemplo n.º 1
0
        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();
            }
        }
Ejemplo n.º 2
0
 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));
     }
 }
Ejemplo n.º 3
0
 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));
     }
 }
Ejemplo n.º 4
0
 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));
     }
 }
Ejemplo n.º 5
0
 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));
     }
 }