コード例 #1
0
        public void top20Algorithm()
        {
            using (DataClassesMatchDataContext matches = new DataClassesMatchDataContext(Conn.conn))
            {
                int i = 0;
                foreach (var id in idExc)
                {
                    i++;
                    ProgressBarDelegate.DoSendPMessage(i);
                    Application.DoEvents();
                    RowNumberLimit r = new RowNumberLimit(id);
                    r.initCurveFit();
                    Match_analysis_result mar = new Match_analysis_result();
                    mar.Live_table_lib_id = r.live_id;
                    mar.Pre_algorithm = "top20";
                    mar.Pre_match_count = r.Top20Count;
                    mar.Home_goals = r.HomeGoals;
                    mar.Away_goals = r.AwayGoals;
                    mar.Home_w = r.hWin;
                    mar.Home_d = r.hDraw;
                    mar.Home_l = r.hLose;
                    mar.Fit_win_loss = r.CureFitWinLoss();
                    mar.Fit_goals = r.CureFitGoals();
                    mar.Fit_odd_even = r.CureFitOddEven();
                    matches.Match_analysis_result.InsertOnSubmit(mar);

                    //2011.10.8  销毁
                    r.Dispose();

                }
                matches.SubmitChanges();
            }
        }
コード例 #2
0
        public void top20Algorithm()
        {
            using (DataClassesMatchDataContext matches = new DataClassesMatchDataContext(Conn.conn))
            {
                int i = 0;
                foreach (int liveid in idExc)
                {
                    i++;
                    ProgressBarDelegate.DoSendPMessage(i);
                    Application.DoEvents();
                    r = new RowNumberLimit(liveid);
                    r.initCurveFit();
                    //match_analysis_result mar = new match_analysis_result();

                    mar = matches.Match_analysis_result
                        .Where(e => e.Live_table_lib_id == liveid)
                        .First();//查找需要更新的数据

                    mar.Live_table_lib_id = r.live_id;
                    mar.Pre_algorithm = "top20";
                    mar.Pre_match_count = r.Top20Count;
                    mar.Home_goals = r.HomeGoals;
                    mar.Away_goals = r.AwayGoals;

                    mar.Home_w = r.hWin;
                    mar.Home_d = r.hDraw;
                    mar.Home_l = r.hLose;

                    mar.Fit_win_loss = r.CureFitWinLoss();
                    mar.Fit_goals = r.CureFitGoals();
                    mar.Fit_odd_even = r.CureFitOddEven();//直接赋值,修改完成

                    //2011.9.22   修改成利用积分进行运算
                    mar.Recent_scores = r.RecentScores; //增加最后一轮的分数
                    mar.Recent_2scores = r.Recent2Scores;
                    mar.Recent_3scores = r.Recent3Scores;
                    mar.Recent_4scores = r.Recent4Scores;
                    mar.Recent_5scores = r.Recent5Scores;
                    mar.Recent_6scores = r.Recent6Scores;


                    //2011.6.22
                    mar.Cross_goals = r.CrossGoals;


                    //2011.6.16
                    //【交战+概率1+拟合+进球+概率30】
                    mar.Myfit =
                        //交战
                        ForecastCross(r.CrossGoals) + ":" +
                        //概率1
                        ForecastD(mar.Home_w, mar.Home_d, mar.Home_l) + ":" +
                        //拟合+进球+概率30
                        ForecastWL(mar.Fit_win_loss, mar.Home_goals, mar.Away_goals, mar.Home_w, mar.Home_l);


                    //更新北京单场
                    sg = lss[r.home_team_big.ToString() + r.away_team_big.ToString()].FirstOrDefault();
                    if (sg != null)
                        mar.Pre_algorithm = sg.Html_position;

                    sgerror = lss[r.away_team_big.ToString() + r.home_team_big.ToString()].FirstOrDefault();
                    if (sgerror != null)
                        mar.Pre_algorithm = sgerror.Html_position;

                    //r.Close();

                    //缩短数据更新周期
                    if (i % 100 == 0)
                    {
                        matches.SubmitChanges();
                        //GC.Collect(); GC.Collect(); Application.DoEvents();
                    }

                    //2011.10.8.   这里销毁
                    r.Dispose();
                }
                matches.SubmitChanges();
            }
        }