예제 #1
0
        private void backgroundWorker_DoWork(object sender, DoWorkEventArgs e)
        {
            int          i;
            string       operation = "";
            AbstractBase obj       = null;

            if (e.Argument != null)
            {
                operation = e.Argument.ToString();
            }
            backgroundWorker.ReportProgress(0, new BGReport("Connecting to SoccerBase (Operation: " + operation + ") ..."));
            using (SqlConnection connection = new SqlConnection(MainForm.STRCONN))
            {
                connection.Open();
                switch (operation)
                {
                case "Ivnet":
                    obj       = new BackgroundWorks.IvnetNS.Ivnet();
                    obj.Links = new Dictionary <string, string[]>()
                    {
                        { "Belgium,Pro League,2011/12", new string[] {
                              "http://invarius.ivnet.ru/soccer/champ/belgium/belgium.htm", ""
                          } },
                        { "Denmark,Superligaen,2011/12", new string[] {
                              "http://invarius.ivnet.ru/soccer/champ/denmark/denmark.htm", ""
                          } },
                        { "England,Premier League,2011/12", new string[] {
                              "http://invarius.ivnet.ru/soccer/champ/england/england.htm", ""
                          } },
                        { "France,Ligue 1,2011/12", new string[] {
                              "http://invarius.ivnet.ru/soccer/champ/france/france.htm", ""
                          } },
                        { "Germany,Bundesliga,2011/12", new string[] {
                              "http://invarius.ivnet.ru/soccer/champ/germany/germany.htm", ""
                          } },
                        { "Greece,Super League,2011/12", new string[] {
                              "http://invarius.ivnet.ru/soccer/champ/greece/greece.htm", ""
                          } },
                        { "Netherlands,Eredivisie,2011/12", new string[] {
                              "http://invarius.ivnet.ru/soccer/champ/nether/nether.htm", ""
                          } },
                        { "Italy,Serie A,2011/12", new string[] {
                              "http://invarius.ivnet.ru/soccer/champ/italy/italy.htm", ""
                          } },
                        { "Portugal,Liga Zon Sagres,2011/12", new string[] {
                              "http://invarius.ivnet.ru/soccer/champ/portugal/portugal.htm", ""
                          } },
                        { "Romania,First Division,2011/12", new string[] {
                              "http://invarius.ivnet.ru/soccer/champ/romania/romania.htm", ""
                          } },
                        { "Russia,Premier League,2011/12", new string[] {
                              "http://invarius.ivnet.ru/soccer/champ/russia/russia.htm", ""
                          } },
                        //{"Scotland,Premier League,2011/12", new string[] {"http://invarius.ivnet.ru/soccer/champ/scotland/scotland.htm",""}},
                        { "Spain,Primera Division,2011/12", new string[] {
                              "http://invarius.ivnet.ru/soccer/champ/spain/spain.htm", ""
                          } },
                        { "Turkey,Super Lig,2011/12", new string[] {
                              "http://invarius.ivnet.ru/soccer/champ/turkey/turkey.htm", ""
                          } },
                        { "Ukraine,Premier League,2011/12", new string[] {
                              "http://invarius.ivnet.ru/soccer/champ/ukraine/ukraine.htm", ""
                          } }
                    };
                    obj.Connection = connection;
                    obj.Table      = "Ivnet";
                    while (obj.enrLinks.MoveNext())
                    {
                        double percent = (double)(obj.Index + 1) / obj.Links.Count * 100;
                        backgroundWorker.ReportProgress((int)percent, new BGReport(obj.ProcessLink()));
                    }
                    break;

                case "NewIvnet":
                    BackgroundWorks.IvnetNS.Ivnet newIvnet = new BackgroundWorks.IvnetNS.Ivnet();
                    newIvnet.Links = new Dictionary <string, string[]>()
                    {
                        { "New matches", new string[] { "http://invarius.ivnet.ru/soccer/champ/champ.htm", "" } }
                    };
                    newIvnet.Connection = connection;
                    newIvnet.isNew      = true;
                    if (newIvnet.enrLinks.MoveNext())
                    {
                        backgroundWorker.ReportProgress(100, new BGReport(newIvnet.ProcessLink()));
                    }
                    break;

                case "SportRadar":
                    obj       = new SportRadar();
                    obj.Links = new Dictionary <string, string[]>()
                    {
                        { "Belgium,Pro League,2011/12", new string[] {
                              "http://stats.betradar.com/s4/gismo.php?&html=1&id=1827&clientid=4&state=2_1,3_33,22_1,5_3414,9_fixtures,231_full,23_1", ""
                          } },
                        { "Denmark,Superligaen,2011/12", new string[] {
                              "http://stats.betradar.com/s4/gismo.php?&html=1&id=1827&clientid=4&state=2_1,3_8,22_1,5_3376,9_fixtures,231_full,23_1", ""
                          } },
                        { "England,Premier League,2011/12", new string[] {
                              "http://stats.betradar.com/s4/gismo.php?&html=1&id=1827&clientid=4&state=2_1,3_1,22_1,5_3391,9_fixtures,231_full,23_1", ""
                          } },
                        { "France,Ligue 1,2011/12", new string[] {
                              "http://stats.betradar.com/s4/gismo.php?&html=1&id=1827&clientid=4&state=2_1,3_7,22_1,5_3380,9_fixtures,231_full,23_1", ""
                          } },
                        { "Germany,Bundesliga,2011/12", new string[] {
                              "http://stats.betradar.com/s4/gismo.php?&html=1&id=1827&clientid=4&state=2_1,3_30,22_1,5_3405,9_fixtures,231_full,23_1", ""
                          } },
                        { "Greece,Super League,2011/12", new string[] {
                              "http://stats.betradar.com/s4/gismo.php?&html=1&id=1827&clientid=4&state=2_1,3_67,22_1,5_3735,9_fixtures,231_full,23_1", ""
                          } },
                        { "Italy,Serie A,2011/12", new string[] {
                              "http://stats.betradar.com/s4/gismo.php?&html=1&id=1827&clientid=4&state=2_1,3_31,22_1,5_3639,9_fixtures,231_full,23_1", ""
                          } },
                        { "Netherlands,Eredivisie,2011/12", new string[] {
                              "http://stats.betradar.com/s4/gismo.php?&html=1&id=1827&clientid=4&state=2_1,3_35,22_1,5_3432,9_fixtures,231_full,23_1", ""
                          } },
                        { "Portugal,Liga Zon Sagres,2011/12", new string[] {
                              "http://stats.betradar.com/s4/gismo.php?&html=1&id=1827&clientid=4&state=2_1,3_44,22_1,5_3462,9_fixtures,231_full,23_1", ""
                          } },
                        { "Romania,First Division,2011/12", new string[] {
                              "http://stats.betradar.com/s4/gismo.php?&html=1&id=1827&clientid=4&state=2_1,3_77,22_1,5_3539,9_fixtures,231_full,23_1", ""
                          } },
                        { "Russia,Premier League,2011/12", new string[] {
                              "http://stats.betradar.com/s4/gismo.php?&html=1&id=1827&clientid=4&state=2_1,3_21,22_1,5_3288,9_fixtures,231_full,23_1", ""
                          } },
                        //{"Scotland,Premier League,2011/12", new string[] {
                        //    "http://stats.betradar.com/s4/gismo.php?&html=1&id=1827&clientid=4&state=2_1,3_22,22_1,5_3392,9_fixtures,231_full,23_2",""
                        //}},
                        { "Spain,Primera Division,2011/12", new string[] {
                              "http://stats.betradar.com/s4/gismo.php?&html=1&id=1827&clientid=4&state=2_1,3_32,22_1,5_3502,9_fixtures,231_full,23_1", ""
                          } },
                        { "Turkey,Super Lig,2011/12", new string[] {
                              "http://stats.betradar.com/s4/gismo.php?&html=1&id=1827&clientid=4&state=2_1,3_46,22_1,5_3831,9_fixtures,231_full,23_1", ""
                          } },
                        { "Ukraine,Premier League,2011/12", new string[] {
                              "http://stats.betradar.com/s4/gismo.php?&html=1&id=1827&clientid=4&state=2_1,3_86,22_1,5_3390,9_fixtures,231_full,23_1", ""
                          } }
                    };
                    obj.Connection = connection;
                    obj.Table      = "SportRadar";
                    while (obj.enrLinks.MoveNext())
                    {
                        double percent = (double)(obj.Index + 1) / obj.Links.Count * 100;
                        backgroundWorker.ReportProgress((int)percent, new BGReport(obj.ProcessLink()));
                    }
                    break;

                case "Link":
                    BackgroundWorks.IvnetNS.Link link = new BackgroundWorks.IvnetNS.Link();
                    link.Connection = connection;
                    link.process();
                    break;

                /* ------------------------------------------------------------------------ */
                case "Truncate":
                    SqlCommand sql = new SqlCommand("TRUNCATE TABLE dbo.archive", connection);
                    backgroundWorker.ReportProgress(10, new BGReport("Truncating archive ..."));
                    sql.ExecuteNonQuery();
                    sql = new SqlCommand("TRUNCATE TABLE dbo.Leagues", connection);
                    backgroundWorker.ReportProgress(40, new BGReport("Truncating Leagues ..."));
                    sql.ExecuteNonQuery();
                    sql = new SqlCommand("TRUNCATE TABLE dbo.history", connection);
                    backgroundWorker.ReportProgress(70, new BGReport("Truncating history ..."));
                    sql.ExecuteNonQuery();
                    break;

                case "Archive":
                    obj            = new SportRadar();
                    obj.Links      = archiveLinks;
                    obj.Table      = "archive";
                    obj.Connection = connection;
                    i = 1;
                    while (obj.enrLinks.MoveNext())
                    {
                        double percent = (double)(i++) / obj.Links.Count * 100;
                        backgroundWorker.ReportProgress((int)percent, new BGReport("  " + obj.ProcessLink()));
                    }
                    break;

                case "Leagues":
                    Leagues leagues = new Leagues();
                    leagues.Connection = connection;
                    backgroundWorker.ReportProgress(10, new BGReport("Processing Leagues ..."));
                    leagues.process();
                    break;

                case "History":
                    History history = new History();
                    History.mainForm   = this;
                    history.Connection = connection;
                    openExcel();
                    history.process();
                    closeExcel();
                    break;

                case "PrevAvgStrength":
                    PrevAvgStrength strength = new PrevAvgStrength();
                    PrevAvgStrength.mainForm = this;
                    strength.Connection      = connection;
                    openExcel();
                    strength.process();
                    closeExcel();
                    break;
                }
            }
        }
예제 #2
0
        public void process()
        {
            Ivnet.FixSportRadarID(Connection);
            string        q = "SELECT ID,Country,League,Season,Date,HomeTeam,AwayTeam,Guessed FROM dbo.Ivnet";
            SqlCommand    selectCmd, selectCmd2, modifyCmd;
            SqlDataReader reader, reader2;

            string[] ivnetDate;
            int      day;
            Dictionary <LeagueKey, LeagueValue> leaguesDict = new Dictionary <LeagueKey, LeagueValue>();
            Dictionary <TeamsKey, TeamsValue>   teamsDict = new Dictionary <TeamsKey, TeamsValue>();
            LeagueKey   lKey = new LeagueKey();
            LeagueValue lVal = new LeagueValue();
            TeamsKey    tKey = new TeamsKey();
            bool        guessed;

            using (reader = new SqlCommand(q, Connection).ExecuteReader())
            {
                while (reader.Read())
                {
                    q         = @"SELECT ID,Round,Date FROM dbo.SportRadar WHERE
                          Country=@Country AND League=@League AND Season=@Season AND HomeTeam=@HomeTeam AND AwayTeam=@AwayTeam AND
                          DATEPART(month,Date)=@Month AND DATEPART(day,Date) BETWEEN @DayStart AND @DayEnd";
                    selectCmd = new SqlCommand(q, Connection);
                    selectCmd.Parameters.AddWithValue("@Country",
                                                      Synonyms.Countries.ContainsKey(reader["Country"]) ? Synonyms.Countries[reader["Country"]] : reader["Country"]);
                    selectCmd.Parameters.AddWithValue("@League",
                                                      Synonyms.Leagues.ContainsKey(reader["Country"] + "|" + reader["League"]) ?
                                                      Synonyms.Leagues[reader["Country"] + "|" + reader["League"]] : reader["League"]);
                    selectCmd.Parameters.AddWithValue("@Season", reader["Season"]);
                    selectCmd.Parameters.AddWithValue("@HomeTeam",
                                                      Synonyms.Teams.ContainsKey(reader["Country"] + "|" + reader["HomeTeam"]) ?
                                                      Synonyms.Teams[reader["Country"] + "|" + reader["HomeTeam"]] : reader["HomeTeam"]);
                    selectCmd.Parameters.AddWithValue("@AwayTeam",
                                                      Synonyms.Teams.ContainsKey(reader["Country"] + "|" + reader["AwayTeam"]) ?
                                                      Synonyms.Teams[reader["Country"] + "|" + reader["AwayTeam"]] : reader["AwayTeam"]);
                    ivnetDate = reader["Date"].ToString().Split(' ');
                    selectCmd.Parameters.AddWithValue("@Month", Synonyms.Months[ivnetDate[0]]);
                    int.TryParse(ivnetDate[1], out day);
                    selectCmd.Parameters.AddWithValue("@DayStart", day - 2);
                    selectCmd.Parameters.AddWithValue("@DayEnd", day + 2);
                    using (reader2 = selectCmd.ExecuteReader())
                    {
                        if (reader2.Read())
                        {
                            q         = "UPDATE dbo.Ivnet SET SportRadarID=@SportRadarID,Round=@Round WHERE ID=@IvnetID";
                            modifyCmd = new SqlCommand(q, Connection);
                            modifyCmd.Parameters.AddWithValue("@SportRadarID", reader2["ID"]);
                            modifyCmd.Parameters.AddWithValue("@Round", reader2["Round"]);
                            modifyCmd.Parameters.AddWithValue("@IvnetID", reader["ID"]);
                            if (modifyCmd.ExecuteNonQuery() == 0)
                            {
                                Console.WriteLine("something is wrong");
                            }
                            lKey.Country = tKey.Country = reader["Country"].ToString();
                            lKey.League  = tKey.League = reader["League"].ToString();
                            lKey.Season  = tKey.Season = reader["Season"].ToString();
                            guessed      = !(reader["Guessed"] is DBNull) && (bool)reader["Guessed"];
                            if (!leaguesDict.ContainsKey(lKey))
                            {
                                lVal.Matches = 1;
                                lVal.Guessed = guessed ? 1 : 0;
                            }
                            else
                            {
                                lVal = leaguesDict[lKey];
                                lVal.Matches++;
                                if (guessed)
                                {
                                    lVal.Guessed++;
                                }
                            }
                            lVal.GuessedPercent = (int)((double)lVal.Guessed / lVal.Matches * 100);
                            leaguesDict[lKey]   = lVal;
                            doTeams(teamsDict, tKey, reader["HomeTeam"], guessed);
                            doTeams(teamsDict, tKey, reader["AwayTeam"], guessed);
                        }
                    }
                }
            }
            foreach (KeyValuePair <LeagueKey, LeagueValue> kvp in leaguesDict)
            {
                q         = "SELECT ID FROM dbo.Leagues WHERE Country=@Country AND League=@League AND Season=@Season";
                selectCmd = new SqlCommand(q, Connection);
                selectCmd.Parameters.AddWithValue("@Country", kvp.Key.Country);
                selectCmd.Parameters.AddWithValue("@League", kvp.Key.League);
                selectCmd.Parameters.AddWithValue("@Season", kvp.Key.Season);
                using (reader = selectCmd.ExecuteReader())
                {
                    DateTime startDate = new DateTime(), endDate = new DateTime();
                    q          = @"SELECT MIN(Date) Date FROM dbo.SportRadar WHERE Country=@Country AND League=@League AND Season=@Season";
                    selectCmd2 = new SqlCommand(q, Connection);
                    selectCmd2.Parameters.AddWithValue("@Country",
                                                       Synonyms.Countries.ContainsKey(kvp.Key.Country) ? Synonyms.Countries[kvp.Key.Country] : kvp.Key.Country);
                    selectCmd2.Parameters.AddWithValue("@League",
                                                       Synonyms.Leagues.ContainsKey(kvp.Key.Country + "|" + kvp.Key.League) ?
                                                       Synonyms.Leagues[kvp.Key.Country + "|" + kvp.Key.League] : kvp.Key.League);
                    selectCmd2.Parameters.AddWithValue("@Season", kvp.Key.Season);
                    using (reader2 = selectCmd2.ExecuteReader()) if (reader2.Read())
                        {
                            startDate = (DateTime)reader2["Date"];
                        }
                    q          = @"SELECT MAX(Date) Date FROM dbo.SportRadar WHERE Country=@Country AND League=@League AND Season=@Season";
                    selectCmd2 = new SqlCommand(q, Connection);
                    selectCmd2.Parameters.AddWithValue("@Country",
                                                       Synonyms.Countries.ContainsKey(kvp.Key.Country) ? Synonyms.Countries[kvp.Key.Country] : kvp.Key.Country);
                    selectCmd2.Parameters.AddWithValue("@League",
                                                       Synonyms.Leagues.ContainsKey(kvp.Key.Country + "|" + kvp.Key.League) ?
                                                       Synonyms.Leagues[kvp.Key.Country + "|" + kvp.Key.League] : kvp.Key.League);
                    selectCmd2.Parameters.AddWithValue("@Season", kvp.Key.Season);
                    using (reader2 = selectCmd2.ExecuteReader()) if (reader2.Read())
                        {
                            endDate = (DateTime)reader2["Date"];
                        }
                    if (reader.HasRows)
                    {
                        q         = @"UPDATE dbo.Leagues SET
                            StartDate=@StartDate, EndDate=@EndDate, Teams=@Teams, Matches=@Matches, Guessed=@Guessed, GuessedPercent=@GuessedPercent
                            WHERE ID=@ID";
                        modifyCmd = new SqlCommand(q, Connection);
                        reader.Read();
                        modifyCmd.Parameters.AddWithValue("@ID", reader["ID"]);
                    }
                    else
                    {
                        q         = @"INSERT INTO dbo.Leagues(
                                Country,League,Season,StartDate,EndDate,Teams,Matches,Guessed,GuessedPercent
                            ) VALUES(@Country,@League,@Season,@StartDate,@EndDate,@Teams,@Matches,@Guessed,@GuessedPercent)";
                        modifyCmd = new SqlCommand(q, Connection);
                        modifyCmd.Parameters.AddWithValue("@Country", kvp.Key.Country);
                        modifyCmd.Parameters.AddWithValue("@League", kvp.Key.League);
                        modifyCmd.Parameters.AddWithValue("@Season", kvp.Key.Season);
                    }
                    modifyCmd.Parameters.AddWithValue("@StartDate", startDate);
                    modifyCmd.Parameters.AddWithValue("@EndDate", endDate);
                    int teamsCount = 0;
                    foreach (KeyValuePair <TeamsKey, TeamsValue> tKVP in teamsDict)
                    {
                        if (tKVP.Key.Country == kvp.Key.Country && tKVP.Key.League == kvp.Key.League && tKVP.Key.Season == kvp.Key.Season)
                        {
                            teamsCount++;
                        }
                    }
                    modifyCmd.Parameters.AddWithValue("@Teams", teamsCount);
                    modifyCmd.Parameters.AddWithValue("@Matches", kvp.Value.Matches);
                    modifyCmd.Parameters.AddWithValue("@Guessed", kvp.Value.Guessed);
                    modifyCmd.Parameters.AddWithValue("@GuessedPercent", kvp.Value.GuessedPercent);
                    if (modifyCmd.ExecuteNonQuery() == 0)
                    {
                        Console.WriteLine("something is wrong");
                    }
                    //Console.WriteLine("key: {0}|{1}|{2}, value: {3}|{4}|{5}",
                    //    kvp.Key.Country, kvp.Key.League, kvp.Key.Season, kvp.Value.Matches, kvp.Value.Guessed, kvp.Value.GuessedPercent);
                }
            }
        }
예제 #3
0
        private void backgroundWorker_DoWork(object sender, DoWorkEventArgs e)
        {
            int i;
            string operation = "";
            AbstractBase obj = null;

            if (e.Argument != null) operation = e.Argument.ToString();
            backgroundWorker.ReportProgress(0, new BGReport("Connecting to SoccerBase (Operation: " + operation + ") ..."));
            using (SqlConnection connection = new SqlConnection(MainForm.STRCONN))
            {
                connection.Open();
                switch (operation)
                {
                    case "Ivnet":
                        obj = new BackgroundWorks.IvnetNS.Ivnet();
                        obj.Links = new Dictionary<string, string[]>(){
                            {"Belgium,Pro League,2011/12", new string[] {
                                "http://invarius.ivnet.ru/soccer/champ/belgium/belgium.htm",""
                            }},
                            {"Denmark,Superligaen,2011/12", new string[] {
                                "http://invarius.ivnet.ru/soccer/champ/denmark/denmark.htm",""
                            }},
                            {"England,Premier League,2011/12", new string[] {
                                "http://invarius.ivnet.ru/soccer/champ/england/england.htm",""
                            }},
                            {"France,Ligue 1,2011/12", new string[] {
                                "http://invarius.ivnet.ru/soccer/champ/france/france.htm",""
                            }},
                            {"Germany,Bundesliga,2011/12", new string[] {
                                "http://invarius.ivnet.ru/soccer/champ/germany/germany.htm",""
                            }},
                            {"Greece,Super League,2011/12", new string[] {
                                "http://invarius.ivnet.ru/soccer/champ/greece/greece.htm",""
                            }},
                            {"Netherlands,Eredivisie,2011/12", new string[] {
                                "http://invarius.ivnet.ru/soccer/champ/nether/nether.htm",""
                            }},
                            {"Italy,Serie A,2011/12", new string[] {
                                "http://invarius.ivnet.ru/soccer/champ/italy/italy.htm",""
                            }},
                            {"Portugal,Liga Zon Sagres,2011/12", new string[] {
                                "http://invarius.ivnet.ru/soccer/champ/portugal/portugal.htm",""
                            }},
                            {"Romania,First Division,2011/12", new string[] {
                                "http://invarius.ivnet.ru/soccer/champ/romania/romania.htm",""
                            }},
                            {"Russia,Premier League,2011/12", new string[] {
                                "http://invarius.ivnet.ru/soccer/champ/russia/russia.htm",""
                            }},
                            //{"Scotland,Premier League,2011/12", new string[] {"http://invarius.ivnet.ru/soccer/champ/scotland/scotland.htm",""}},
                            {"Spain,Primera Division,2011/12", new string[] {
                                "http://invarius.ivnet.ru/soccer/champ/spain/spain.htm",""
                            }},
                            {"Turkey,Super Lig,2011/12", new string[] {
                                "http://invarius.ivnet.ru/soccer/champ/turkey/turkey.htm",""
                            }},
                            {"Ukraine,Premier League,2011/12", new string[] {
                                "http://invarius.ivnet.ru/soccer/champ/ukraine/ukraine.htm",""
                            }}
                        };
                        obj.Connection = connection;
                        obj.Table = "Ivnet";
                        while (obj.enrLinks.MoveNext())
                        {
                            double percent = (double)(obj.Index + 1) / obj.Links.Count * 100;
                            backgroundWorker.ReportProgress((int)percent, new BGReport(obj.ProcessLink()));
                        }
                        break;
                    case "NewIvnet":
                        BackgroundWorks.IvnetNS.Ivnet newIvnet = new BackgroundWorks.IvnetNS.Ivnet();
                        newIvnet.Links = new Dictionary<string, string[]>()
                        {
                            {"New matches",new string[] {"http://invarius.ivnet.ru/soccer/champ/champ.htm",""}}
                        };
                        newIvnet.Connection = connection;
                        newIvnet.isNew = true;
                        if (newIvnet.enrLinks.MoveNext()) backgroundWorker.ReportProgress(100, new BGReport(newIvnet.ProcessLink()));
                        break;
                    case "SportRadar":
                        obj = new SportRadar();
                        obj.Links = new Dictionary<string,string[]>(){
                            {"Belgium,Pro League,2011/12", new string[] {
                                "http://stats.betradar.com/s4/gismo.php?&html=1&id=1827&clientid=4&state=2_1,3_33,22_1,5_3414,9_fixtures,231_full,23_1",""
                            }},
                            {"Denmark,Superligaen,2011/12", new string[] {
                                "http://stats.betradar.com/s4/gismo.php?&html=1&id=1827&clientid=4&state=2_1,3_8,22_1,5_3376,9_fixtures,231_full,23_1",""
                            }},
                            {"England,Premier League,2011/12", new string[] {
                                "http://stats.betradar.com/s4/gismo.php?&html=1&id=1827&clientid=4&state=2_1,3_1,22_1,5_3391,9_fixtures,231_full,23_1",""
                            }},
                            {"France,Ligue 1,2011/12", new string[] {
                                "http://stats.betradar.com/s4/gismo.php?&html=1&id=1827&clientid=4&state=2_1,3_7,22_1,5_3380,9_fixtures,231_full,23_1",""
                            }},
                            {"Germany,Bundesliga,2011/12", new string[] {
                                "http://stats.betradar.com/s4/gismo.php?&html=1&id=1827&clientid=4&state=2_1,3_30,22_1,5_3405,9_fixtures,231_full,23_1",""
                            }},
                            {"Greece,Super League,2011/12", new string[] {
                                "http://stats.betradar.com/s4/gismo.php?&html=1&id=1827&clientid=4&state=2_1,3_67,22_1,5_3735,9_fixtures,231_full,23_1",""
                            }},
                            {"Italy,Serie A,2011/12", new string[] {
                                "http://stats.betradar.com/s4/gismo.php?&html=1&id=1827&clientid=4&state=2_1,3_31,22_1,5_3639,9_fixtures,231_full,23_1",""
                            }},
                            {"Netherlands,Eredivisie,2011/12", new string[] {
                                "http://stats.betradar.com/s4/gismo.php?&html=1&id=1827&clientid=4&state=2_1,3_35,22_1,5_3432,9_fixtures,231_full,23_1",""
                            }},
                            {"Portugal,Liga Zon Sagres,2011/12", new string[] {
                                "http://stats.betradar.com/s4/gismo.php?&html=1&id=1827&clientid=4&state=2_1,3_44,22_1,5_3462,9_fixtures,231_full,23_1",""
                            }},
                            {"Romania,First Division,2011/12", new string[] {
                                "http://stats.betradar.com/s4/gismo.php?&html=1&id=1827&clientid=4&state=2_1,3_77,22_1,5_3539,9_fixtures,231_full,23_1",""
                            }},
                            {"Russia,Premier League,2011/12", new string[] {
                                "http://stats.betradar.com/s4/gismo.php?&html=1&id=1827&clientid=4&state=2_1,3_21,22_1,5_3288,9_fixtures,231_full,23_1",""
                            }},
                            //{"Scotland,Premier League,2011/12", new string[] {
                            //    "http://stats.betradar.com/s4/gismo.php?&html=1&id=1827&clientid=4&state=2_1,3_22,22_1,5_3392,9_fixtures,231_full,23_2",""
                            //}},
                            {"Spain,Primera Division,2011/12", new string[] {
                                "http://stats.betradar.com/s4/gismo.php?&html=1&id=1827&clientid=4&state=2_1,3_32,22_1,5_3502,9_fixtures,231_full,23_1",""
                            }},
                            {"Turkey,Super Lig,2011/12", new string[] {
                                "http://stats.betradar.com/s4/gismo.php?&html=1&id=1827&clientid=4&state=2_1,3_46,22_1,5_3831,9_fixtures,231_full,23_1",""
                            }},
                            {"Ukraine,Premier League,2011/12", new string[] {
                                "http://stats.betradar.com/s4/gismo.php?&html=1&id=1827&clientid=4&state=2_1,3_86,22_1,5_3390,9_fixtures,231_full,23_1",""
                            }}
                        };
                        obj.Connection = connection;
                        obj.Table = "SportRadar";
                        while (obj.enrLinks.MoveNext())
                        {
                            double percent = (double)(obj.Index + 1) / obj.Links.Count * 100;
                            backgroundWorker.ReportProgress((int)percent, new BGReport(obj.ProcessLink()));
                        }
                        break;
                    case "Link":
                        BackgroundWorks.IvnetNS.Link link = new BackgroundWorks.IvnetNS.Link();
                        link.Connection = connection;
                        link.process();
                        break;
                    /* ------------------------------------------------------------------------ */
                    case "Truncate":
                        SqlCommand sql = new SqlCommand("TRUNCATE TABLE dbo.archive", connection);
                        backgroundWorker.ReportProgress(10, new BGReport("Truncating archive ..."));
                        sql.ExecuteNonQuery();
                        sql = new SqlCommand("TRUNCATE TABLE dbo.Leagues", connection);
                        backgroundWorker.ReportProgress(40, new BGReport("Truncating Leagues ..."));
                        sql.ExecuteNonQuery();
                        sql = new SqlCommand("TRUNCATE TABLE dbo.history", connection);
                        backgroundWorker.ReportProgress(70, new BGReport("Truncating history ..."));
                        sql.ExecuteNonQuery();
                        break;
                    case "Archive":
                        obj = new SportRadar();
                        obj.Links = archiveLinks;
                        obj.Table = "archive";
                        obj.Connection = connection;
                        i = 1;
                        while (obj.enrLinks.MoveNext())
                        {
                            double percent = (double)(i++) / obj.Links.Count * 100;
                            backgroundWorker.ReportProgress((int)percent, new BGReport("  " + obj.ProcessLink()));
                        }
                        break;
                    case "Leagues":
                        Leagues leagues = new Leagues();
                        leagues.Connection = connection;
                        backgroundWorker.ReportProgress(10, new BGReport("Processing Leagues ..."));
                        leagues.process();
                        break;
                    case "History":
                        History history = new History();
                        History.mainForm = this;
                        history.Connection = connection;
                        openExcel();
                        history.process();
                        closeExcel();
                        break;
                    case "PrevAvgStrength":
                        PrevAvgStrength strength = new PrevAvgStrength();
                        PrevAvgStrength.mainForm = this;
                        strength.Connection = connection;
                        openExcel();
                        strength.process();
                        closeExcel();
                        break;
                }
            }
        }