public FundInfo Get(int id) { FundInfo fund = new FundInfo(); fund = FundBl.GetFundById(id); return(fund); }
public static FundInfo GetFundTaxi() { DBHelper helper = null; try { helper = new DBHelper(_conStr); var info = new FundInfo(); List <SqlParameter> parsList = new List <SqlParameter>(); parsList.Add(new SqlParameter("@_BotProfit", System.Data.SqlDbType.Int) { Direction = System.Data.ParameterDirection.Output }); info.Config = helper.GetInstanceSP <FundConfig>("[dbo].[LuckyDice_GetFundInfo]", parsList.ToArray()); info.BotProfit = int.Parse(parsList[0].Value.ToString()); return(info); } catch (Exception ex) { NLogManager.PublishException(ex); } finally { helper.Close(); } return(null); }
private FundInfo getFundInfoFromDB(string hash) { if (hash == "0x0000000000000000000000000000000000000000") { return(new FundInfo { hash = hash, symbol = "eth", decimals = 18 }); } var findStr = new JObject { { "fundHash", hash } }.ToString(); var queryRes = mh.GetData(lConn.connStr, lConn.connDB, projTokenCol, findStr); if (queryRes.Count == 0) { return(null); } var item = queryRes[0]; var res = new FundInfo { hash = hash, symbol = item["fundSymbol"].ToString(), decimals = long.Parse(item["fundDecimals"].ToString()) }; return(res); }
public FundInfo Calculate(decimal currentNavPrice, FundPurchased fund) { FundInfo fundInfo = new FundInfo { Name = fund.Name, SchemeCode = fund.SchemeCode }; decimal investedAmount = 0, navsPurchased = 0, currentValue = 0, profitLoss = 0; if (fund.NavsPurchased.HasValue) { navsPurchased = fund.NavsPurchased.Value; investedAmount = navsPurchased * fund.NavPurchasePrice; } else if (fund.AmountInvested.HasValue) { investedAmount = fund.AmountInvested.Value; navsPurchased = investedAmount / fund.NavPurchasePrice; } currentValue = currentNavPrice * navsPurchased; profitLoss = currentValue - investedAmount; fundInfo.AmountInvested = Round(investedAmount); fundInfo.CurrentValue = Round(currentValue); fundInfo.NavCurrentPrice = Round(currentNavPrice); fundInfo.NavPurchasePrice = Round(fund.NavPurchasePrice); fundInfo.NavsPurchased = Round(navsPurchased); fundInfo.Percentage = Round((profitLoss / investedAmount) * 100); fundInfo.ProfitValue = Round(profitLoss); fundInfo.PurchaseDate = fund.PurchaseDate; return(fundInfo); }
public static FundInfo[] GetAllFunds() { ArrayList al = new ArrayList(); int retValue = -1; //Generated Code for query : dbo.GetAllVendors using (SqlDataReader dr = ProjManagementAdmin.GetAllFunds(out retValue)) //Initialize and retrieve code for Datareader goes here { while (dr.Read()) { FundInfo fund = new FundInfo(); fund.FundId = Convert.ToInt32(dr["fund_id"]); fund.FundDesc = dr["fund_desc"].ToString(); fund.FundAmount = Convert.ToSingle(dr["fund_amount"]); fund.ReceivedDate = Convert.ToDateTime(dr["received_date"]); fund.ChangedDate = Convert.ToDateTime(dr["changed_date"]); fund.ChangedBy = dr["changed_by"].ToString(); al.Add(fund); } //dr.Close(); } FundInfo[] allInfo = new FundInfo[al.Count]; al.CopyTo(allInfo); return(allInfo); }
/// <summary> /// 根据orgCode得到manageOrg /// </summary> /// <param name="orgCode"></param> /// <returns></returns> public static string GetOrgName(object CombineType, object orgCode, int length) { if (CombineType.ToString() == "0") { string code = orgCode == null ? string.Empty : orgCode.ToString(); if (code.Length == 0) { return(""); // "(none)"; } FundInfoBLL fundBll = new FundInfoBLL(); //基金bll FundInfo info = fundBll.GetManageOrg(int.Parse(code)); if (null == info) { return(""); } if (string.IsNullOrEmpty(info.ManageOrg)) { return(""); } return(Comm.Common.GetCut(info.ManageOrg, length)); } else { return(orgCode.ToString()); } }
private void HandlerBaseInfoSource(string pageSource, FundInfo fundInfo) { var keyValues = pageSource.GetFirstHtmlTagValueByAttri("table", "class", "info w790") .GetHtmlTagValue("tr") .SelectMany(t => { var replaceA = Regex.Replace(t, "</?a[^>]*>", ""); var array = Regex.Replace(replaceA, "(<[^>]*>)+", "|").Trim('|').Split('|'); var lastIndex = array.Length % 2 == 0 ? array.Length - 2 : array.Length - 3; var list = new List <KeyValuePair <string, string> >(); for (int i = 0; i <= lastIndex; i += 2) { list.Add(new KeyValuePair <string, string>(array[i], array[i + 1])); } return(list); }).Where(t => t.Key != null); foreach (var item in keyValues) { var key = item.Key; var value = item.Value; switch (key) { case "基金全称": fundInfo.FundFullName = value; break; case "基金简称": fundInfo.FundName = value; break; case "基金类型": fundInfo.FundType = value; break; case "发行日期": fundInfo.IssueDay = value; break; case "成立日期/规模": fundInfo.BirthStatus = value; break; case "资产规模": fundInfo.FundAmount = value; break; case "份额规模": fundInfo.FundCount = value; break; case "跟踪标的": fundInfo.TrackingTarget = value; break; } } }
public static int UpdateFundInfo(FundInfo info) { if (info == null) { return(0); } info.UpdateTime = DateTime.Now; return(_db.Update(info)); }
public async Task <ActionResult <bool> > AddFundToPortfolioAsync(FundInfo fundInfo) { _logger.LogDebug("In PortfolioController:AddFundToPortfolioAsync"); bool status = await _portfolioService.AddFundToPortfolioAsync(fundInfo); _logger.LogDebug("Returning from PortfolioController:AddFundToPortfolioAsync"); return(Ok(status)); }
public static int AddNewFund(FundInfo fund) { if (fund == null) { throw new ArgumentNullException("fund"); } int retValue = -1; return(ProjManagementAdmin.AddNewFund(fund, out retValue)); }
public HttpResponseMessage Post(FundInfo fund) { try { FundBl.AddNewFund(fund); return(new HttpResponseMessage(HttpStatusCode.OK)); } catch (Exception) { return(new HttpResponseMessage(HttpStatusCode.BadRequest)); } }
private FundInfo getFundInfoFromChain(string hash) { var symbol = EthHelper.getTokenSymbol(hash, type); var decimals = EthHelper.getTokenDecimals(hash, type); var res = new FundInfo { hash = hash, symbol = symbol, decimals = decimals }; return(res); }
public static HttpResponseMessage UpdateFund(FundInfo fund) { try { int val = FundDal.UpdateFund(fund); return(new HttpResponseMessage(HttpStatusCode.OK)); } catch (Exception ex) { Console.WriteLine("EXCEPTION: " + ex); return(new HttpResponseMessage(HttpStatusCode.BadRequest)); } }
private void putFundInfoToDB(FundInfo info, string projId) { var newdata = new JObject { { "projId", projId }, { "fundHash", info.hash }, { "fundSymbol", info.symbol }, { "fundDecimals", info.decimals }, { "fundTotal", "0" }, { "fundTotalTp", "0" } }.ToString(); mh.PutData(lConn.connStr, lConn.connDB, projTokenCol, newdata); }
private void HandleTransactionInfoSource(string pageSource, FundInfo fundInfo) { var info = new TransactionInfo(); var keyValues = pageSource.GetHtmlTagValueByAttri("div", "class", "boxitem w790") .Select(t => { var key = t.GetFirstHtmlTagValueByAttri("label", "class", "left")?.GetHtmlTagContent(); return(new KeyValuePair <string, string>(key, t)); }) .Where(t => t.Key != null); foreach (var item in keyValues) { switch (item.Key) { case "交易确认日": var temp = item.Value.GetHtmlTagValue("td").ToList(); info.BuyConfirmDate = temp[1].GetHtmlTagContent(); info.SellConfirmDate = temp[3].GetHtmlTagContent(); break; case "运作费用": temp = item.Value.GetHtmlTagValue("td").ToList(); info.ManageRate = temp[1].GetHtmlTagContent(); info.HostingRate = temp[3].GetHtmlTagContent(); info.SalesServiceRate = temp[5].GetHtmlTagContent(); break; default: if (item.Key.Contains("认购费率")) { info.ApplyRates = GetTransactionRates(item.Value); } else if (item.Key.Contains("申购费率")) { info.BuyRates = GetTransactionRates(item.Value); } else if (item.Key.Contains("赎回费率")) { info.SellRates = GetTransactionRates(item.Value); } break; } } fundInfo.TransactionInfo = info; }
public Tuple <decimal, decimal> GetRecieveAndCreditMoney() { CurrentUserInfo currentUser = AuthManager.GetCurrentUser(); if (currentUser == null) { throw new CustomException(404, "获取信息失败,请重新登录"); } FundInfo fundInfo = payMentClientProxy.GetRecieveAndCreditMoney(currentUser.CashbagCode, currentUser.CashbagKey); if (fundInfo == null) { throw new CustomException(400, "获取余额信息失败!"); } return(Tuple.Create <decimal, decimal>(fundInfo.RecieveAmount, fundInfo.CreditMoney)); }
/// <summary> /// 使用简单爬虫爬取<paramref name="url"/> /// </summary> /// <param name="url">爬虫URL地址</param> /// <param name="fundInfo">基金信息</param> /// <param name="action">页面源码处理方法</param> /// <returns></returns> protected async Task <string> StartSimpleCrawler(string url, FundInfo fundInfo, Action <string, FundInfo> action) { var crawler = new SimpleCrawler(); crawler.OnStartEvent += (sender, args) => { WriteLog($"{args.ThreadId} 开始休眠"); RandomSleep(3, 15); WriteLog($"{args.ThreadId} 休眠结束,开始爬取"); }; crawler.OnCompletedEvent += (sender, args) => { WriteLog($"{args.ThreadId} 爬取结束,开始处理"); action?.Invoke(args.PageSource, fundInfo); WriteLog($"{args.ThreadId} 处理结束"); }; return(await crawler.Start(url)); }
/// <summary> /// funding list /// </summary> /// <returns></returns> public static FundInfo GetFundingList(IRESTService rESTService) { Dictionary <string, string> dic = new Dictionary <string, string> { { "code", "007301,202015,007339" } }; var res = rESTService.Get(FDConst.FundBaseUrl, dic); FundInfo fundInfo = JsonConvert.DeserializeObject <FundInfo>(res); if (fundInfo.code.Equals(200)) { return(fundInfo); } else { throw new Exception("Get Failed!"); } }
public static FundInfo GetFundById(int fundId) { int retValue = -1; FundInfo fund = new FundInfo(); //Generated Code for query : dbo.GetAllVendors using (SqlDataReader dr = ProjManagementAdmin.GetFundById(fundId, out retValue)) //Initialize and retrieve code for Datareader goes here { while (dr.Read()) { fund.FundId = Convert.ToInt32(dr["fund_id"]); fund.FundDesc = dr["fund_desc"].ToString(); fund.FundAmount = Convert.ToSingle(dr["fund_amount"]); fund.ReceivedDate = Convert.ToDateTime(dr["received_date"]); fund.ChangedDate = Convert.ToDateTime(dr["changed_date"]); fund.ChangedBy = dr["changed_by"].ToString(); } //dr.Close(); } return(fund); }
public async Task <bool> AddFundToPortfolioAsync(FundInfo fundInfo) { _logger.LogDebug($"PortfolioService:AddFundToPortfolioAsync: Adding new fund {fundInfo.FundName} to portfolio"); var status = false; await appDb.Connection.OpenAsync(); using (var cmd = appDb.Connection.CreateCommand()) { cmd.CommandText = SqlQueries.ADD_FUND; cmd.Parameters.Add("@amcfundid", MySqlConnector.MySqlDbType.Int32).Value = fundInfo.FundId; cmd.Parameters.Add("@units", MySqlConnector.MySqlDbType.Double).Value = fundInfo.NumberOfUnits; cmd.Parameters.Add("@purchasetype", MySqlConnector.MySqlDbType.VarChar).Value = fundInfo.PurchaseType; cmd.Parameters.Add("@purchasedate", MySqlConnector.MySqlDbType.Date).Value = fundInfo.PurchaseDate; await cmd.ExecuteNonQueryAsync(); status = true; } _logger.LogDebug("PortfolioService:AddFundToPortfolioAsync: Added new fund to the portfolio successfuly"); return(status); }
public Simulation(Country country) { InitializeComponent(); Country = country; Changes = new int[Country.CitiesCount]; Binding FundBind = new Binding { Source = Country, Path = new PropertyPath("Fund"), Mode = BindingMode.OneWay }; Binding NewFundBind = new Binding { Source = Country, Path = new PropertyPath("NewFund"), Mode = BindingMode.OneWay }; if (Country.Name.Length > 17) { CountryName.Content = Country.Name.Substring(0, 14) + "..."; } else { CountryName.Content = Country.Name; } if (Country.DiseaseName.Length > 22) { DiseaseName.Content = Country.DiseaseName.Substring(0, 19) + "..."; } else { DiseaseName.Content = Country.DiseaseName; } FundInfo.SetBinding(TextBlock.TextProperty, FundBind); NewFundInfo.SetBinding(TextBlock.TextProperty, NewFundBind); CostInfo.Text = Country.Cost.ToString(); Binding WeekBind = new Binding { Source = Country, Path = new PropertyPath("Week"), Mode = BindingMode.OneWay }; Week.SetBinding(Label.ContentProperty, WeekBind); Month.Content = "(" + months[Country.Month] + ")"; int width = 1260 / Country.CitiesCount; for (int i = 0; i < Country.CitiesCount; i++) { var CityStackPanel = new StackPanel { Width = width, Orientation = Orientation.Horizontal }; Rectangle rectanglePurple = new Rectangle { Width = width * 0.4, Height = 500, Fill = purpleBrush, Stroke = darkBrush }; Canvas.SetLeft(rectanglePurple, width * (0.3 + i)); Canvas.SetTop(rectanglePurple, 95); MainCanvas.Children.Add(rectanglePurple); Rectangle rectangleRed = new Rectangle { Width = width * 0.4 - 2, Height = Math.Ceiling((double)Country.Cities[i].People.Ill / Country.Cities[i].People.Total * 500), Fill = redBrush }; Canvas.SetLeft(rectangleRed, width * (0.3 + i) + 1); Canvas.SetTop(rectangleRed, 95 + 500 - rectangleRed.Height); MainCanvas.Children.Add(rectangleRed); Rectangle rectangleGreen = new Rectangle { Width = width * 0.4 - 2, Height = (double)Country.Cities[i].People.Immune / Country.Cities[i].People.Total * 500, Fill = greenBrush }; Canvas.SetLeft(rectangleGreen, width * (0.3 + i) + 1); Canvas.SetTop(rectangleGreen, 95 + 500 - rectangleRed.Height - rectangleGreen.Height); MainCanvas.Children.Add(rectangleGreen); Cities.Children.Add(CityStackPanel); var CityName = new TextBlock { Width = width - 45, TextWrapping = TextWrapping.Wrap, TextAlignment = TextAlignment.Center, Style = this.Resources["TextBlockStyle"] as Style }; if (Country.Cities[i].Name.Length > 13) { CityName.Text = Country.Cities[i].Name.Substring(0, 10) + "..."; } else { CityName.Text = Country.Cities[i].Name; } var EmptySpace = new Label { Width = 5 }; CityStackPanel.Children.Add(CityName); CityStackPanel.Children.Add(EmptySpace); string template = XamlWriter.Save(CountryInfo.Template); StringReader stringReader = new StringReader(template); XmlReader xmlReader = XmlReader.Create(stringReader); var infButton = new Button { Template = (ControlTemplate)XamlReader.Load(xmlReader), Height = 20, Width = 20, VerticalAlignment = VerticalAlignment.Top }; var ToolTipContent = new Grid(); ToolTipContent.RowDefinitions.Add(new RowDefinition()); ToolTipContent.RowDefinitions.Add(new RowDefinition()); ToolTipContent.RowDefinitions.Add(new RowDefinition()); ToolTipContent.RowDefinitions.Add(new RowDefinition()); ToolTipContent.RowDefinitions.Add(new RowDefinition()); ToolTipContent.ColumnDefinitions.Add(new ColumnDefinition()); #region var row0 = new StackPanel { Orientation = Orientation.Horizontal }; row0.SetValue(Grid.RowProperty, 0); row0.SetValue(Grid.ColumnProperty, 0); var Total = new TextBlock { Style = this.Resources["TextBlockStyle"] as Style, Text = "Население: " + Country.Cities[i].People.Total.ToString() }; row0.Children.Add(Total); ToolTipContent.Children.Add(row0); #endregion #region var row1 = new StackPanel { Orientation = Orientation.Horizontal }; row1.SetValue(Grid.RowProperty, 1); row1.SetValue(Grid.ColumnProperty, 0); var Ill = new TextBlock { Style = this.Resources["TextBlockStyle"] as Style, Text = "Больные: " }; row1.Children.Add(Ill); Binding IllBind = new Binding { Source = Country.Cities[i].People, Path = new PropertyPath("Ill"), Mode = BindingMode.OneWay }; var part10 = new TextBlock { Style = this.Resources["TextBlockStyle"] as Style }; part10.SetBinding(TextBlock.TextProperty, IllBind); //IllCity.SetBinding(TextBlock.TextProperty, IllBind); row1.Children.Add(part10); var part11 = new TextBlock { Style = this.Resources["TextBlockStyle"] as Style, Text = " (+" }; row1.Children.Add(part11); Binding NewIllBind = new Binding { Source = Country.Cities[i].People, Path = new PropertyPath("NewIll"), Mode = BindingMode.OneWay }; var part12 = new TextBlock { Style = this.Resources["TextBlockStyle"] as Style }; part12.SetBinding(TextBlock.TextProperty, NewIllBind); //NewIllCity.SetBinding(TextBlock.TextProperty, NewIllBind); row1.Children.Add(part12); var part13 = new TextBlock { Style = this.Resources["TextBlockStyle"] as Style, Text = ")" }; row1.Children.Add(part13); ToolTipContent.Children.Add(row1); #endregion #region var row2 = new StackPanel { Orientation = Orientation.Horizontal }; row2.SetValue(Grid.RowProperty, 2); row2.SetValue(Grid.ColumnProperty, 0); var Recovered = new TextBlock { Style = this.Resources["TextBlockStyle"] as Style, Text = "Выздоровевшие: " }; row2.Children.Add(Recovered); Binding RecoveredBind = new Binding { Source = Country.Cities[i].People, Path = new PropertyPath("Recovered"), Mode = BindingMode.OneWay }; var part20 = new TextBlock { Style = this.Resources["TextBlockStyle"] as Style }; part20.SetBinding(TextBlock.TextProperty, RecoveredBind); row2.Children.Add(part20); var part21 = new TextBlock { Style = this.Resources["TextBlockStyle"] as Style, Text = " (+" }; row2.Children.Add(part21); Binding NewRecoveredBind = new Binding { Source = Country.Cities[i].People, Path = new PropertyPath("NewRecovered"), Mode = BindingMode.OneWay }; var part22 = new TextBlock { Style = this.Resources["TextBlockStyle"] as Style }; part22.SetBinding(TextBlock.TextProperty, NewRecoveredBind); row2.Children.Add(part22); var part23 = new TextBlock { Style = this.Resources["TextBlockStyle"] as Style, Text = ")" }; row2.Children.Add(part23); ToolTipContent.Children.Add(row2); #endregion #region var row3 = new StackPanel { Orientation = Orientation.Horizontal }; row3.SetValue(Grid.RowProperty, 3); row3.SetValue(Grid.ColumnProperty, 0); var Vaccinated = new TextBlock { Style = this.Resources["TextBlockStyle"] as Style, Text = "Вакцинированные: " }; row3.Children.Add(Vaccinated); Binding VaccinatedBind = new Binding { Source = Country.Cities[i].People, Path = new PropertyPath("Vaccinated"), Mode = BindingMode.OneWay }; var part30 = new TextBlock { Style = this.Resources["TextBlockStyle"] as Style }; part30.SetBinding(TextBlock.TextProperty, VaccinatedBind); row3.Children.Add(part30); var part31 = new TextBlock { Style = this.Resources["TextBlockStyle"] as Style, Text = " (+" }; row3.Children.Add(part31); Binding NewVaccinatedBind = new Binding { Source = Country.Cities[i].People, Path = new PropertyPath("NewVaccinated"), Mode = BindingMode.OneWay }; var part32 = new TextBlock { Style = this.Resources["TextBlockStyle"] as Style }; part32.SetBinding(TextBlock.TextProperty, NewVaccinatedBind); row3.Children.Add(part32); var part33 = new TextBlock { Style = this.Resources["TextBlockStyle"] as Style, Text = ")" }; row3.Children.Add(part33); ToolTipContent.Children.Add(row3); #endregion #region var row4 = new StackPanel { Orientation = Orientation.Horizontal }; row4.SetValue(Grid.RowProperty, 4); row4.SetValue(Grid.ColumnProperty, 0); var Traffic = new TextBlock { Style = this.Resources["TextBlockStyle"] as Style, Text = "Насыщенность транспорта: " + Country.Cities[i].Traffic.ToString() }; row4.Children.Add(Traffic); ToolTipContent.Children.Add(row4); #endregion var InfToolTip = new ToolTip { Content = ToolTipContent, Placement = System.Windows.Controls.Primitives.PlacementMode.Top }; infButton.ToolTip = InfToolTip; CityStackPanel.Children.Add(infButton); var label2 = new Label { Width = 20 }; CityStackPanel.Children.Add(label2); } if (Country.Week == Country.Weeks) { NextWeekButton.Visibility = Visibility.Hidden; VaccinateButton.Visibility = Visibility.Hidden; } }
public static int AddNewFund(FundInfo fund) { return(FundDal.AddNewFund(fund)); }
/// <summary> /// 基本概况 /// </summary> /// <param name="fundId"></param> /// <param name="fundInfo"></param> private async Task GetBaseInfo(string fundId, FundInfo fundInfo) { var url = $"http://fundf10.eastmoney.com/jbgk_{fundId}.html"; await StartSimpleCrawler(url, fundInfo, HandlerBaseInfoSource); }
public HttpResponseMessage Post(FundInfo fund) { return(FundBl.UpdateFund(fund)); }
public static FundInfo GetFundInfo(string fundCode) { try { var web = new HtmlWeb(); var doc = web.Load($"http://fundf10.eastmoney.com/jbgk_{fundCode}.html"); var rows = doc.DocumentNode.SelectNodes("//table[@class='info w790']/tr"); var info = new FundInfo { FundFullName = rows[0].SelectNodes("td")[0].InnerText, FundName = rows[0].SelectNodes("td")[1].InnerText, FundCode = fundCode, FundType = rows[1].SelectNodes("td")[1].InnerText, Administrator = rows[4].SelectNodes("td")[0].InnerText, Trustee = rows[4].SelectNodes("td")[1].InnerText, Manager = rows[5].SelectNodes("td")[0].InnerText, Benchmark = rows.Count == 10 ? rows[9].SelectNodes("td")[0].InnerText : rows[8].SelectNodes("td")[0].InnerText, Tracking = rows.Count == 10 ? rows[9].SelectNodes("td")[1].InnerText : rows[8].SelectNodes("td")[1].InnerText, IssueDate = rows[2].SelectNodes("td")[0].InnerText.TryParseDateTime("yyyy年MM月dd日") }; var dateRegex = new Regex("\\d{4}年\\d{2}月\\d{2}日"); var match = dateRegex.Match(rows[2].SelectNodes("td")[1].InnerText); if (match.Success) { info.BeginDate = match.Value.TryParseDateTime("yyyy年MM月dd日"); } var numRegex = new Regex("(\\d+.?\\d*)亿"); match = numRegex.Match(rows[3].SelectNodes("td")[0].InnerText); if (match.Success) { info.Scale = decimal.Parse(match.Groups[1].Value) * 100000000; } match = numRegex.Match(rows[3].SelectNodes("td")[1].InnerText); if (match.Success) { info.Share = decimal.Parse(match.Groups[1].Value) * 100000000; } var numRegex2 = new Regex("(\\d+.?\\d*)元"); match = numRegex2.Match(rows[5].SelectNodes("td")[1].InnerText); if (match.Success) { info.Bonus = decimal.Parse(match.Groups[1].Value); } var percentRegex = new Regex("(\\d+.?\\d*)%"); match = percentRegex.Match(rows[6].SelectNodes("td")[0].InnerText); if (match.Success) { info.ManagementRate = decimal.Parse(match.Groups[1].Value) / 100; } match = percentRegex.Match(rows[6].SelectNodes("td")[1].InnerText); if (match.Success) { info.EscrowRate = decimal.Parse(match.Groups[1].Value) / 100; } match = percentRegex.Match(rows[7].SelectNodes("td")[0].InnerText); if (match.Success) { info.SaleServiceRate = decimal.Parse(match.Groups[1].Value) / 100; } match = percentRegex.Match(rows[7].SelectNodes("td")[1].InnerText); if (match.Success) { info.MaxSubscriptionRate = decimal.Parse(match.Groups[1].Value) / 100; } if (rows.Count == 9) { var tds = doc.DocumentNode.SelectNodes("//table[@class='info w790']/td"); match = percentRegex.Match(tds[0].SelectNodes("span")[0].InnerText); if (match.Success) { info.MaxPurchaseRate = decimal.Parse(match.Groups[1].Value) / 100; } match = percentRegex.Match(tds[1].InnerText); if (match.Success) { info.MaxRedeemRate = decimal.Parse(match.Groups[1].Value) / 100; } } else { match = percentRegex.Match(rows[8].SelectNodes("td")[0].InnerText); if (match.Success) { info.MaxPurchaseRate = decimal.Parse(match.Groups[1].Value) / 100; } match = percentRegex.Match(rows[8].SelectNodes("td")[1].InnerText); if (match.Success) { info.MaxRedeemRate = decimal.Parse(match.Groups[1].Value) / 100; } } var boxes = doc.DocumentNode.SelectNodes("//div[@class='boxitem w790']"); info.InvestmentTarget = boxes[0].SelectSingleNode("p").InnerText.Trim(); info.InvestmentPhilosophy = boxes[1].SelectSingleNode("p").InnerText.Trim(); info.InvestmentScope = boxes[2].SelectSingleNode("p").InnerText.Trim(); info.InvestmentStrategy = boxes[3].SelectSingleNode("p").InnerText.Trim(); info.DividendPolicy = boxes[4].SelectSingleNode("p").InnerText.Trim(); info.Risk = boxes[5].SelectSingleNode("p").InnerText.Trim(); return(info); } catch (Exception e) { Log.Error(e, $"EmService.GetFundInfo {fundCode} 获取基金信息失败"); return(null); } }
private void ShowTotalInfo() { int selectedchargeUserId = 0; DataTable tbHandIn = AccountBookController.GetAccountList(dtpFrom.Value, dtpEnd.Value); List <PrivyAccountBook> lstAllBooks = new List <PrivyAccountBook>(); #region 得到缴款员 Hashtable htCharge = new Hashtable(); for (int i = 0; i < tbHandIn.Rows.Count; i++) { int chargeUserId = Convert.ToInt32(tbHandIn.Rows[i]["AccountCode"]); if (!htCharge.ContainsKey(chargeUserId)) { htCharge.Add(chargeUserId, chargeUserId); } } #endregion #region 生成账单明细,并合并 foreach (object obj in htCharge) { int chargeUserId = Convert.ToInt32(((DictionaryEntry)obj).Value); DataRow[] drsAccount = tbHandIn.Select("ACCOUNTCODE=" + chargeUserId, "ACCOUNTDATE asc"); int[] accountIdList = new int[drsAccount.Length]; for (int i = 0; i < drsAccount.Length; i++) { accountIdList[i] = Convert.ToInt32(drsAccount[i]["ACCOUNTID"]); } DataTable tbInvoice; DataTable tbInvoiceDetail; AccountBookController.GetAccountData(chargeUserId, accountIdList, out tbInvoice, out tbInvoiceDetail); //个人所有账单 List <PrivyAccountBook> lstBook = new List <PrivyAccountBook>(); for (int i = 0; i < drsAccount.Length; i++) { int accountId = Convert.ToInt32(drsAccount[i]["ACCOUNTID"]); PrivyAccountBook book = AccountBookController.GetPrivyAccountBook(chargeUserId, accountId, tbInvoice, tbInvoiceDetail, tbHandIn); lstBook.Add(book); } PrivyAccountBook totalBook = AccountBookController.CollectPrivyAccountBook(lstBook); lstAllBooks.Add(totalBook); } #endregion CollectAccountBook allBook = AccountBookController.CollectAllAccountBook(lstAllBooks); List <FundInfo> lstFundInfo = new List <FundInfo>(); if (allBook.TallyPart.Details != null) { for (int i = 0; i < allBook.TallyPart.Details.Length; i++) { lstFundInfo.Add(allBook.TallyPart.Details[i]); } } FundInfo fdFavor = new FundInfo(); fdFavor.Money = allBook.FavorPart.TotalMoney; fdFavor.PayName = "优惠金额"; lstFundInfo.Add(fdFavor); FundInfo fdCash = new FundInfo(); fdCash.Money = allBook.CashPart.TotalMoney; fdCash.PayName = "实收现金"; lstFundInfo.Add(fdCash); FundInfo[] allInfo = lstFundInfo.ToArray(); DataTable tbTotalInfo = new DataTable(); for (int i = 0; i < 10; i++) { DataColumn col = new DataColumn(); col.ColumnName = "C_" + i.ToString(); tbTotalInfo.Columns.Add(col); } int colIndex = 0; tbTotalInfo.Rows.Add(tbTotalInfo.NewRow()); int rowIndex = tbTotalInfo.Rows.Count - 1; //记账 for (int i = 0; i < allInfo.Length; i++) { if (colIndex == 10) { tbTotalInfo.Rows.Add(tbTotalInfo.NewRow()); rowIndex = tbTotalInfo.Rows.Count - 1; colIndex = 0; } tbTotalInfo.Rows[rowIndex][colIndex] = allInfo[i].PayName; tbTotalInfo.Rows[rowIndex][colIndex + 1] = allInfo[i].Money; colIndex = colIndex + 2; } dgvTotalInfo.Tag = allInfo; tbTotalInfo.Columns.Add("C_EMPTY"); tbTotalInfo.Rows[tbTotalInfo.Rows.Count - 1]["C_EMPTY"] = "合计:" + allBook.InvoiceItemSumTotal.ToString(); dgvTotalInfo.DataSource = tbTotalInfo; dgvTotalInfo.Columns[dgvTotalInfo.Columns.Count - 1].AutoSizeMode = DataGridViewAutoSizeColumnMode.Fill; for (int i = 0; i < dgvTotalInfo.Columns.Count; i++) { if (i % 2 == 1) { dgvTotalInfo.Columns[i].DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleRight; } else { dgvTotalInfo.Columns[i].DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleCenter; } } }
public async Task <bool> AddFundToPortfolioAsync(FundInfo fundInfo) { return(await Task.FromResult(true)); }
public static int UpdateFund(FundInfo fund) { int retValue = -1; return(ProjManagementAdmin.UpdateFund(fund, out retValue)); }