public decimal updateMacauslot()
 {
     DataTable dt = MacauslotHtml.GetTableInnerText();
     DateTime dtt = DateTime.Now.Date;
     using (DataClassesMatchDataContext match = new DataClassesMatchDataContext(Conn.conn))
     {
         foreach (DataRow aa in dt.Rows)
         {
             if (aa[0].ToString().IndexOf("★") != -1)
                 if (aa[4].ToString() != null)
                     if (aa[4].ToString().Length > 1)
                     {
                         MacauPredication mp = new MacauPredication();
                         mp.Record_datetime = dtt;
                         mp.Home_team = extract(aa[1].ToString());
                         mp.Away_team = extract(aa[5].ToString());
                         mp.Macauslot = aa[0].ToString().Trim();
                         mp.Predication = aa[4].ToString();
                         match.MacauPredication.InsertOnSubmit(mp);
                     }
         }
         match.SubmitChanges();
         return match.MacauPredication.Max(e => e.MacauPredication_id);
     }
 }
        private IEnumerable<Analysis_Review> UpdateARdata()
        {
            int i = 0;
            var ltlmars = from p in ltlAll
                          join q in marAll on p.Key equals q.Key
                          select p;

            foreach (var ltls in ltlmars)
            {
                i++;
                ProgressBarDelegate.DoSendPMessage(i);
                Application.DoEvents();

                var ltl = ltls.Value;
                Analysis_Review arevew = new Analysis_Review();
                myfit = "";
                macau = "";
                bjpk = 0;
                arevew.Live_table_lib_id = ltl.Live_table_lib_id;
                arevew.Match_time = ltl.Match_time;
                arevew.Match_type = ltl.Match_type;
                arevew.Home_team = ltl.Home_team;
                arevew.Away_team = ltl.Away_team;
                arevew.Home_team_big = ltl.Home_team_big;
                arevew.Away_team_big = ltl.Away_team_big;
                arevew.asia_odds = ltl.Status;
                var sg = lsAll[ltl.Home_team_big.ToString() + "-" + ltl.Away_team_big.ToString()]
                    .OrderByDescending(e => e.Live_Single_id).FirstOrDefault();
                if (sg != null)
                {
                    arevew.bj_host_odds = sg.Status;
                    arevew.bj_match_number = sg.Html_position;
                    double.TryParse(sg.Status, out bjpk);
                }

                mar = marAll[ltl.Live_table_lib_id].OrderByDescending(o => o.Analysis_result_id).FirstOrDefault();

                if (mar != null)
                    if (mar.Fit_win_loss != null)
                    {
                        smp = mpAll.Where(e => ltl.Home_team.Replace("(", "").Replace(")", "").IndexOf(e.Key) != -1)
                           .Select(e => e.Key).FirstOrDefault();
                        if (smp != null)
                        {
                            mp = mpAll[smp]
                             .Where(e => ltl.Away_team.Replace("(", "").Replace(")", "").IndexOf(e.Away_team) != -1)
                             .OrderByDescending(e => e.MacauPredication_id).FirstOrDefault();

                            if (mp != null)
                                macau = mp.Predication;
                        }
                        arevew.Analysis_result_id = mar.Analysis_result_id;
                        arevew.Pnn_fit = mar.Pnn_fit;
                        arevew.Grnn_fit = mar.Grnn_fit;
                        arevew.result_grnn = mar.Result_fit;
                        arevew.composite_fit = mar.Myfit;
                        arevew.Macau_predication = macau;
                        myfit = mar.Fit_win_loss.ToString();
                        myfit = myfit.Length < 5 ? myfit : myfit.Substring(0, 5);
                        arevew.Result_goals = mar.Result_goals;
                        arevew.Result_wdl = mar.Result_wdl;
                        arevew.ls_fit = double.Parse(myfit);
                        arevew.Home_goals = mar.Home_goals;
                        arevew.Away_goals = mar.Away_goals;
                        arevew.Home_w = mar.Home_w;
                        arevew.Home_d = mar.Home_d;
                        arevew.Home_l = mar.Home_l;
                        if (mar.Result_tb_lib_id != null)
                        {
                            if (mar.Result_tb_lib_id != null)
                            {
                                rtl = rtlAll[(int)mar.Result_tb_lib_id];
                                arevew.Result_tb_lib_id = rtl.Result_tb_lib_id;
                                arevew.full_home_goals = rtl.Full_home_goals;
                                arevew.full_away_goals = rtl.Full_away_goals;
                                arevew.asia_odds = rtl.Odds;
                            }
                        }
                    }
                int beijing = 0;
                SelectBjMatch(mar.Grnn_fit, bjpk, mar.Result_fit, ref beijing);
                arevew.bj_select = beijing;

                yield return arevew;
                //dcmdc2.Analysis_Review.InsertOnSubmit(arevew);
                //dcmdc2.SubmitChanges();
            }
        }
 partial void UpdateMacauPredication(MacauPredication instance);
 partial void DeleteMacauPredication(MacauPredication instance);
 partial void InsertMacauPredication(MacauPredication instance);