private void GetInvestments(AllInvestment allInvestment, InvestmentResponse result) { foreach (var tesouroDireto in allInvestment.TesouroDiretoResponse.TesourosDireto) { var investment = new Responses.Investment(); CalculationTesouro(investment, tesouroDireto); _investments.Add(investment); } foreach (var fundos in allInvestment.FundosResponse.Fundos) { var investment = new Responses.Investment(); CalculationFundos(investment, fundos); _investments.Add(investment); } foreach (var rendaFixa in allInvestment.LciResponse.Lcis) { var investment = new Responses.Investment(); CalculationRendaFixa(investment, rendaFixa); _investments.Add(investment); } result.Investimentos = _investments; }
public InvestmentResponse ExecuteAllInvestment(AllInvestment allInvestment) { var result = new InvestmentResponse(); GetTotalInvestment(allInvestment, result); GetInvestments(allInvestment, result); return(result); }
private static void GetTotalInvestment(AllInvestment allInvestment, InvestmentResponse result) { var rendaFixaValorInvestido = allInvestment.LciResponse.Lcis.Select(v => v.CapitalInvestido).Sum(); var tesouroValorInvestido = allInvestment.TesouroDiretoResponse.TesourosDireto.Select(t => t.ValorInvestido).Sum(); var fundosValorInvestido = allInvestment.FundosResponse.Fundos.Select(f => f.CapitalInvestido).Sum(); result.ValorTotal = rendaFixaValorInvestido + tesouroValorInvestido + fundosValorInvestido; }
/// <summary> /// 存管投资 /// </summary> /// <returns></returns> public async Task InvestAction(InvestmentReqeust investmentRequest, Action action, WebBrowser webBrowser = null) { SetWebbrowser.SumitForm(12); if (webBrowser == null) { webBrowser = new WebBrowser(); } webBrowser.ScriptErrorsSuppressed = true; //InvestmentReqeust investmentRequest = new InvestmentReqeust { Amount = 10000, CellPhone = registerSuccessInfo.CellPhone, ClientType = 900, ProductIdentifier = "33B97C6537564B3FB349B35C949A930F", ReturnUrl = "http://www.dev.ad.jinyinmao.com.cn/redirect/Home/?request=http://www.baidu.com", Pwd = registerSuccessInfo.Pwd }; InvestmentResponse investmentResponse = await this.jymService.InvestByService(investmentRequest); if (investmentResponse != null) { BankSercrityInfo bankSercrityInfo = investmentResponse.GatewayResponse; string url = $"http://fsgw.hkmdev.firstpay.com/phoenixFS-fsgw/gateway?data={HttpUtility.UrlEncode(bankSercrityInfo.Data)}&tm={HttpUtility.UrlEncode(bankSercrityInfo.Tm)}&merchantId=M20000002130"; //添加一个 webBrowser.Navigate(new Uri(url, UriKind.Absolute)); int index = 0; webBrowser.DocumentCompleted += (obj, e) => { if (webBrowser.ReadyState < WebBrowserReadyState.Complete) { return; } HtmlDocument htmlDocument = webBrowser.Document; if (index == 0) { if (htmlDocument != null) { Thread th = new Thread(() => { Thread.Sleep(1000); HtmlElement setPwd = htmlDocument.GetElementById("payPassword"); setPwd?.SetAttribute("value", "111111"); setPwd?.SetAttribute("data-status", "true"); HtmlElement submitBtn = htmlDocument.GetElementById("submitBtn"); submitBtn?.InvokeMember("click"); }) { IsBackground = true }; th.Start(); } } if (index == 2) { action(); } ++index; }; } }