Пример #1
0
        public string PrintFastOverdraftContract(long docId, ulong customerNumber, bool fromApprove = false)
        {
            string                      result       = null;
            LoanProductOrder            productOrder = _xBService.GetCreditLineOrder(docId);
            Card                        card         = _xBService.GetCardWithOutBallance(productOrder.ProductAccount.AccountNumber);
            Dictionary <string, string> contractInfo = _xBService.GetDepositCreditLineContractInfo((int)docId).ToDictionary(x => x.Key, x => x.Value);

            CreditLinePrecontractData precontractData = _xBService.GetCreditLinePrecontractData(productOrder.StartDate, productOrder.EndDate, productOrder.InterestRate,
                                                                                                0, card.CardNumber, productOrder.Currency, productOrder.Amount, 8);
            short  filialCode   = _xBService.GetCustomerFilial();
            double penaltyRate  = _xBInfoService.GetPenaltyRateOfLoans(54, productOrder.StartDate);
            string contractName = "CreditLineContract";

            Dictionary <string, string> parameters = new Dictionary <string, string>();

            parameters.Add(key: "customerNumberHB", value: customerNumber.ToString());

            Contract contract = null;

            if (fromApprove == true)
            {
                contract = new Contract();

                parameters.Add(key: "attachFile", value: "1");
                contract.AttachDocType  = 12;
                contract.AttachFile     = 1;
                contract.ContractName   = contractName;
                contract.DocID          = (int)docId;
                contract.ParametersList = new List <ContractServiceRef.StringKeyValue>();
            }

            parameters.Add(key: "appID", value: "0");
            parameters.Add(key: "bln_with_enddate", value: "True");
            parameters.Add(key: "visaNumberHB", value: card.CardNumber);
            parameters.Add(key: "HbDocID", value: docId.ToString());
            parameters.Add(key: "dateOfBeginningHB", value: productOrder.StartDate.ToString("dd/MMM/yy"));


            parameters.Add(key: "currencyHB", value: productOrder.Currency);
            parameters.Add(key: "penaltyAddPercentHB", value: penaltyRate.ToString());
            parameters.Add(key: "startCapitalHB", value: productOrder.Amount.ToString());
            parameters.Add(key: "clientTypeHB", value: "");
            parameters.Add(key: "filialCodeHB", value: filialCode.ToString());
            parameters.Add(key: "creditLineTypeHB", value: "54");
            parameters.Add(key: "provisionNumberHB", value: "01");
            parameters.Add(key: "interestRateHB", value: productOrder.InterestRate.ToString());
            parameters.Add(key: "securityCodeHB", value: contractInfo["security_code_2"].ToString());

            parameters.Add(key: "loanProvisionPercentHB", value: "0");

            parameters.Add(key: "interestRateFullHB", value: (precontractData.InterestRate / 100).ToString());
            parameters.Add(key: "connectAccountFullNumberHB", value: productOrder.ProductAccount.AccountNumber);
            parameters.Add(key: "interestRateEffectiveWithoutAccountServiceFee", value: precontractData.InterestRateEffectiveWithoutAccountServiceFee.ToString());
            parameters.Add(key: "dateOfNormalEndHB", value: productOrder.EndDate.ToString("dd/MMM/yy"));
            parameters.Add(key: "RepaymentKurs", value: contractInfo["repayment_kurs"].ToString() == null ? "0" : contractInfo["repayment_kurs"].ToString());

            result = _contractService.RenderContract(contractName, parameters, "FastOverdraftContract.pdf", contract);

            //File.WriteAllBytes(@"C:\YourPDFLoan.pdf", result);
            return(result);
        }