public static void RefreshProfit(IEnumerable<Recommend> recs, Person p) { p.Total = recs.Count(); p.Win = recs.Count((i) => i.PreferResult == PreferResult.Win); p.WinHalf = recs.Count((i) => i.PreferResult == PreferResult.WinHalf); p.Lose = recs.Count((i) => i.PreferResult == PreferResult.Lose); p.LoseHalf = recs.Count((i) => i.PreferResult == PreferResult.LoseHalf); p.Draw = recs.Count((i) => i.PreferResult == PreferResult.Useless); p.Profit = p.WinHalf * 0.5f + p.Win - p.LoseHalf * 0.5f - p.Lose; }
public static Person PersonFromReader(IDataRecord reader) { Person p = new Person(); p.Draw = int.Parse(reader["Draw"].ToString()); p.Lose = int.Parse(reader["Lose"].ToString()); p.LoseHalf = int.Parse(reader["LoseHalf"].ToString()); p.Name = reader["Name"].ToString(); p.Profit = float.Parse(reader["Profit"].ToString()); p.Total = int.Parse(reader["Total"].ToString()); p.Win = int.Parse(reader["Win"].ToString()); p.WinHalf = int.Parse(reader["WinHalf"].ToString()); return p; }
/// <summary> /// 加载某个人的记录 /// </summary> /// <param name="name"></param> public void Load(string name) { Title = name; Person = new Person() { Name = name }; Action<Recommend> refresh = (rec) => { new Action(() => AddRecommend(rec)).RunOnUI(); }; Action refreshFinish = () => { new Action(() => RefreshRecommends()).RunOnUI(); }; YieldRoiProvider.Instance.GetPersonRecommends(name, refresh, refreshFinish); }
private static Person TopPersonFromStrings(IList<string> r) { /* 排名:第462名 会员名称:小兵突击 净胜:-7.5场 总发布:14场 全赢:3场 赢半:0场 全输:10场 输半:1场 走水:0场 */ Person p = new Person(); p.Name = r[1]; float profit = 0.0f; float.TryParse(r[2].Substring(0, r[2].Length - 1), out profit); p.Profit = profit; int total = 0; int.TryParse(r[3].Substring(0, r[3].Length - 1), out total); p.Total = total; int win = 0; int.TryParse(r[4].Substring(0, r[4].Length - 1), out win); p.Win = win; int halfWin = 0; int.TryParse(r[5].Substring(0, r[5].Length - 1), out halfWin); p.WinHalf = halfWin; int lose = 0; int.TryParse(r[6].Substring(0, r[6].Length - 1), out lose); p.Lose = lose; int halfLose = 0; int.TryParse(r[7].Substring(0, r[7].Length - 1), out halfLose); p.LoseHalf = halfLose; int draw = 0; int.TryParse(r[8].Substring(0, r[8].Length - 1), out draw); p.Draw = draw; return p; }
private string GetDescription(Person p, float totalYield, float totalRoi, float currentYield, float currentRoi) { return string.Format("共推荐{0}场,{1}胜{2}半胜{3}走{4}输{5}输半,总Yield:{6},当前期Yield:{7},总ROI:{8},当前期ROI:{9}", p.Total, p.Win, p.WinHalf, p.Draw, p.Lose, p.LoseHalf, totalYield, currentYield, totalRoi, currentRoi); }
private void OnPerson(Person p) { person.Add(p); }