コード例 #1
0
        private void DateTimeControls(int day, int month, int year)
        {
            SetStoreStatus("Date/Time Controls");
            using (var db = new MatchModel())
            {
                Date date = db.Dates.FirstOrDefault(x => x.Day == day && x.Year == year && x.Month == month);
                if (date == null)
                {
                    db.Dates.Add(new Date(day, month, year));
                    db.SaveChanges();
                }
                HashSet <string> times    = new HashSet <string>(analysedMatches.Select(x => x.MatchTime).ToList());
                List <string>    dbTimes  = db.Times.Select(x => x.StrTime).ToList();
                List <string>    newTimes = times.Except(dbTimes).ToList();

                if (newTimes.Count > 0)
                {
                    foreach (var newTime in newTimes)
                    {
                        db.Times.Add(new Time(newTime));
                    }

                    db.SaveChanges();
                }
            }
            ImportReport.ImportDate = day + "." + month + "." + year;
        }
コード例 #2
0
        private void CheckGeneralResults(MatchModel db, List <MatchResult> newMatchResults)
        {
            int count = 0;

            foreach (var newMatchResult in newMatchResults)
            {
                GeneralResult generalResult = new GeneralResult();
                generalResult.MsResultType         = GetMsResultType(newMatchResult.MatchHomeScore, newMatchResult.MatchAwayScore);
                generalResult.FhResultType         = GetFhResultType(newMatchResult.FirstHalfHomeScore, newMatchResult.FirstHalfAwayScore);
                generalResult.TgResultType         = GetTgResultType(newMatchResult.MatchHomeScore, newMatchResult.MatchAwayScore);
                generalResult.MgResultType         = GetMgResultType(newMatchResult.MatchHomeScore, newMatchResult.MatchAwayScore);
                generalResult.FhUpDownResultType   = GetUpDownResultType(newMatchResult.FirstHalfHomeScore, newMatchResult.FirstHalfAwayScore, 1.5, SpecialSim.FHUPDOWN);
                generalResult.UpDown15ResultType   = GetUpDownResultType(newMatchResult.MatchHomeScore, newMatchResult.MatchAwayScore, 1.5, SpecialSim.UPDOWN15);
                generalResult.UpDown25ResultType   = GetUpDownResultType(newMatchResult.MatchHomeScore, newMatchResult.MatchAwayScore, 2.5, SpecialSim.UPDOWN25);
                generalResult.UpDown35ResultType   = GetUpDownResultType(newMatchResult.MatchHomeScore, newMatchResult.MatchAwayScore, 3.5, SpecialSim.UPDOWN35);
                generalResult.FhMsResultType       = GetFhMsResultType(generalResult.MsResultType, generalResult.FhResultType);
                generalResult.FirstDcResultType    = GetFirstDcResultType((Result)generalResult.MsResultType);
                generalResult.SecondDcResultType   = GetSecondDcResultType((Result)generalResult.MsResultType);
                generalResult.FirstFhDcResultType  = GetFirstFhDcResultType((Result)generalResult.FhResultType);
                generalResult.SecondFhDcResultType = GetSecondFhDcResultType((Result)generalResult.FhResultType);

                if (db.GeneralResults
                    .FirstOrDefault(
                        x => x.FhMsResultType == generalResult.FhMsResultType &&
                        x.TgResultType == generalResult.TgResultType &&
                        x.UpDown35ResultType == generalResult.UpDown35ResultType &&
                        x.UpDown25ResultType == generalResult.UpDown25ResultType &&
                        x.UpDown15ResultType == generalResult.UpDown15ResultType &&
                        x.FhUpDownResultType == generalResult.FhUpDownResultType &&
                        x.FhResultType == generalResult.FhResultType &&
                        x.MsResultType == generalResult.MsResultType &&
                        x.MgResultType == generalResult.MgResultType) == null)
                {
                    count++;
                    generalResult.AddMatchResult(newMatchResult);
                    db.SaveChanges();
                }
                else
                {
                    if (!generalResult.MatchResults.Select(x => x.MatchResultId).Contains(newMatchResult.MatchResultId))
                    {
                        generalResult.AddMatchResult(newMatchResult);
                        db.SaveChanges();
                    }
                }
            }
            ImportReport.NewGeneralResultCount = count;
        }
コード例 #3
0
        private void TeamControls()
        {
            SetStoreStatus("New Team Controls");
            HashSet <string> teamNames = new HashSet <string>(analysedMatches.Select(x => x.HomeTeamName).ToList());

            teamNames.UnionWith(analysedMatches.Select(x => x.AwayTeamName).ToList());

            Dictionary <string, string> adaptedTeamNames = new Dictionary <string, string>();

            foreach (var teamName in teamNames)
            {
                string adaptedTeamName = teamName.Replace(" ", "").ToLower();
                adaptedTeamNames.Add(teamName, adaptedTeamName);
            }


            using (var db = new MatchModel())
            {
                List <string> dbTeamNames  = db.Teams.Select(x => x.AdaptedTeamName).ToList();
                List <string> newTeamNames = adaptedTeamNames.Values.Except(dbTeamNames).ToList();
                List <Team>   newTeams     = new List <Team>();
                foreach (var newAdaptedTeamName in newTeamNames)
                {
                    string teamName = adaptedTeamNames.First(x => x.Value == newAdaptedTeamName).Key;
                    newTeams.Add(new Team(teamName, newAdaptedTeamName));
                }
                db.Teams.AddRange(newTeams);
                db.SaveChanges();
                ImportReport.NewTeamCount = newTeamNames.Count;
            }
        }
コード例 #4
0
        private void RemoveUselessOddCombinations(BackgroundWorker backgroundWorker)
        {
            removedIds = new HashSet <int>();
            HashSet <string> currentRemovedValues = new HashSet <string>();


            foreach (var item in processedOddCombResults.Where(x => x.Value.Count == 0 && oddCombValueIds.Keys.Contains(x.Key)))
            {
                removedIds.Add(oddCombValueIds[item.Key]);
            }

            foreach (var item in processedOddCombResults.Where(x => x.Value.Count == 0))
            {
                currentRemovedValues.Add(item.Key);
            }

            foreach (var currentRemovedValue in currentRemovedValues)
            {
                processedOddCombResults.Remove(currentRemovedValue);
                processedOddCombFullOddIds.Remove(currentRemovedValue);
            }

            using (var db = new MatchModel())
            {
                db.OddCombinations.RemoveRange(db.OddCombinations.AsParallel().Where(x => removedIds.Contains(x.OddCombinationId)));
                db.SaveChanges();
            }
            ImportReport.RemovedOddCombinationCount = removedIds.Count;
            backgroundWorker.ReportProgress(70);
        }
コード例 #5
0
 private void RemoveAnalysedMatches(int day, int month, int year)
 {
     SetStoreStatus("Removing Analysed Matches");
     using (var db = new MatchModel())
     {
         db.AnalysedMatches.RemoveRange(db.AnalysedMatches.Where(x => x.MatchDay == day && x.MatchMonth == month && x.MatchYear == year));
         db.SaveChanges();
     }
 }
コード例 #6
0
 private void RemoveSelectedDate()
 {
     using (var db = new MatchModel())
     {
         storeTabAnalysedMatches = new List <AnalysedMatch>(db.AnalysedMatches.Where(x => x.MatchDay == day && x.MatchMonth == month && x.MatchYear == year).ToList());
         db.AnalysedMatches.RemoveRange(storeTabAnalysedMatches);
         db.SaveChanges();
     }
 }
コード例 #7
0
 private void SaveNewColumnNumbers()
 {
     using (var db = new MatchModel())
     {
         List <ExcelColumn> ExcelColumns = db.ExcelColumns.ToList();
         foreach (DataGridViewRow row in grdExcelColumns.Rows)
         {
             ExcelColumns.First(x => x.ColumnName.Equals(row.Cells[0].Value.ToString())).ColumntNumber = int.Parse(row.Cells[1].Value.ToString());
         }
         db.SaveChanges();
     }
 }
コード例 #8
0
        private void OldAnalysedMatchControls(MatchModel db, int day, int month, int year)
        {
            List <AnalysedMatch> storedMatches = db.AnalysedMatches.Where(x => x.MatchYear == year && x.MatchMonth == month && x.MatchDay == day).ToList();

            if (storedMatches != null)
            {
                if (storedMatches.Count > 0)
                {
                    db.AnalysedMatches.RemoveRange(storedMatches);
                    db.SaveChanges();
                }
            }
        }
コード例 #9
0
        //-----
        private void BtnResetColNumbers_Click(object sender, EventArgs e)
        {
            using (var db = new MatchModel())
            {
                List <ExcelColumn> dbExcelColumns = db.ExcelColumns.ToList();
                foreach (var dbExcelColumn in dbExcelColumns)
                {
                    dbExcelColumn.ColumntNumber = dbExcelColumn.RealColumntNumber;
                }

                db.SaveChanges();
            }
            SetExcelColumns();
        }
コード例 #10
0
        //-----
        private void BtnStoreLimits_Click(object sender, EventArgs e)
        {
            using (var db = new MatchModel())
            {
                List <AnalyseLimit> dbAnalyseLimits = db.AnalyseLimits.ToList();
                foreach (var analyseLimit in analyseLimits)
                {
                    dbAnalyseLimits.First(x => x.AnalyseLimitId == analyseLimit.Id).SetValues(analyseLimit.textValues["Max"], analyseLimit.textValues["Min"]);
                }

                db.SaveChanges();
            }
            SetLblNotification("Stored");
        }
コード例 #11
0
        private void InsertNewOddCombinations(BackgroundWorker backgroundWorker)
        {
            try
            {
                using (var db = new MatchModel())
                {
                    newOddCombinations = new List <OddCombination>();
                    foreach (var newOddCombResultItem in newOddCombResults)
                    {
                        int count = 0;
                        foreach (var fullOddId in processedOddCombFullOddIds[newOddCombResultItem.Key])
                        {
                            count = count + fullOddMatchCounts[fullOddId];
                        }

                        newOddCombinations.Add(new OddCombination(newOddCombResultItem.Key, string.Join("|", newOddCombResultItem.Value), string.Join("|", newOddCombFullOddIds[newOddCombResultItem.Key]), count));
                    }

                    db.OddCombinations.AddRange(newOddCombinations);
                    db.SaveChanges();
                    ImportReport.NewOddCombinationCount = newOddCombinations.Count;

                    foreach (var newOddCombination in newOddCombinations)
                    {
                        HashSet <int> ids = new HashSet <int>();
                        foreach (var item in newOddCombination.FullOddIds.Split('|'))
                        {
                            int id = int.Parse(item);

                            if (!updatedFullOddOddCombIds.ContainsKey(id))
                            {
                                updatedFullOddOddCombIds.Add(id, new HashSet <int>());
                            }

                            updatedFullOddOddCombIds[id].Add(newOddCombination.OddCombinationId);
                        }
                    }
                }
            }
            catch (Exception e)
            {
                string str = e.ToString();
                throw;
            }

            backgroundWorker.ReportProgress(80);
        }
コード例 #12
0
        private List <MatchResult> StoreNewMatchResults(MatchModel db)
        {
            List <MatchResult> newMatchResults      = new List <MatchResult>();
            List <MatchResult> insertedMatchResults = new List <MatchResult>();

            foreach (var analysedMatch in analysedMatches)
            {
                MatchResult matchResult = new MatchResult
                {
                    MatchHomeScore     = analysedMatch.MsHomeScore,
                    MatchAwayScore     = analysedMatch.MsAwayScore,
                    FirstHalfHomeScore = analysedMatch.FhHomeScore,
                    FirstHalfAwayScore = analysedMatch.FhAwayScore
                };

                MatchResult newMR = newMatchResults
                                    .FirstOrDefault(x =>
                                                    x.MatchAwayScore == matchResult.MatchAwayScore &&
                                                    x.MatchHomeScore == matchResult.MatchHomeScore &&
                                                    x.FirstHalfHomeScore == matchResult.FirstHalfHomeScore &&
                                                    x.FirstHalfAwayScore == matchResult.FirstHalfAwayScore);

                if (newMR == null)
                {
                    newMatchResults.Add(matchResult);
                }
            }
            foreach (var newMatchResult in newMatchResults)
            {
                MatchResult matchResult = db.MatchResults
                                          .FirstOrDefault(x =>
                                                          x.MatchHomeScore == newMatchResult.MatchHomeScore &&
                                                          x.MatchAwayScore == newMatchResult.MatchAwayScore &&
                                                          x.FirstHalfHomeScore == newMatchResult.FirstHalfHomeScore &&
                                                          x.FirstHalfAwayScore == newMatchResult.FirstHalfAwayScore);

                if (matchResult == null)
                {
                    db.MatchResults.Add(newMatchResult);
                    db.SaveChanges();
                    insertedMatchResults.Add(newMatchResult);
                }
            }
            ImportReport.NewMatchResultCount = newMatchResults.Count;
            return(insertedMatchResults);
        }
コード例 #13
0
        private void MatchControls(BackgroundWorker backgroundWorker)
        {
            List <Match> addedMatches = new List <Match>();

            using (var db = new MatchModel())
            {
                db.Database.CommandTimeout = Int32.MaxValue;
                int                val            = 0;
                List <FullOdd>     dbFullOdds     = db.FullOdds.ToList();
                List <MatchResult> dbMatchResults = db.MatchResults.ToList();
                List <Team>        dbTeams        = db.Teams.ToList();
                List <League>      dbLeagues      = db.Leagues.ToList();
                List <Date>        dates          = db.Dates.ToList();
                List <Time>        dbTimes        = db.Times.ToList();
                string             adaptedHomeTeamName;
                string             adaptedAwayTeamName;
                int                counter = 0;
                foreach (var analysedMatch in analysedMatches)
                {
                    SetStoreStatus("Storing : " + analysedMatch.HomeTeamName + "-" + analysedMatch.AwayTeamName);
                    FullOdd fullOdd = dbFullOdds.First(x => x.Value == analysedMatch.FullOdd);
                    League  league  = dbLeagues.First(x => x.LeagueName == analysedMatch.LeagueName);
                    adaptedHomeTeamName = analysedMatch.HomeTeamName.Replace(" ", "").ToLower();
                    adaptedAwayTeamName = analysedMatch.AwayTeamName.Replace(" ", "").ToLower();
                    Team        homeTeam    = dbTeams.First(x => x.AdaptedTeamName == adaptedHomeTeamName);
                    Team        awayTeam    = dbTeams.First(x => x.AdaptedTeamName == adaptedAwayTeamName);
                    Time        time        = dbTimes.First(x => x.StrTime == analysedMatch.MatchTime);
                    MatchResult matchResult = dbMatchResults
                                              .First(x =>
                                                     x.FirstHalfHomeScore == analysedMatch.FhHomeScore &&
                                                     x.FirstHalfAwayScore == analysedMatch.FhAwayScore &&
                                                     x.MatchHomeScore == analysedMatch.MsHomeScore &&
                                                     x.MatchAwayScore == analysedMatch.MsAwayScore);
                    Date  date  = dates.First(x => x.Day == analysedMatch.MatchDay && x.Month == analysedMatch.MatchMonth && x.Year == analysedMatch.MatchYear);
                    Match match = new Match();
                    match.SetMatch(date, time, homeTeam, awayTeam, league, matchResult, fullOdd, analysedMatch.MatchCode);
                    val = 10 + ((20 * ++counter) / analysedMatches.Count);
                    addedMatches.Add(match);
                    backgroundWorker.ReportProgress(val);
                }
                db.SaveChanges();
            }
            newMatchIds = new HashSet <int>(addedMatches.Select(x => x.MatchId));
            ImportReport.NewMatchCount = newMatchIds.Count;
        }
コード例 #14
0
        //-----
        private void LeagueControls()
        {
            SetStoreStatus("New League Controls");
            using (var db = new MatchModel())
            {
                HashSet <string> currentLeagueNames = new HashSet <string>(analysedMatches.Select(x => x.LeagueName).ToList());
                List <string>    dbLeagueNames      = db.Leagues.Select(x => x.LeagueName).ToList();
                HashSet <string> newLeagueNames     = new HashSet <string>(currentLeagueNames.Except(dbLeagueNames));
                List <League>    newLeagues         = new List <League>();
                foreach (var newLeagueName in newLeagueNames)
                {
                    newLeagues.Add(new League(newLeagueName));
                }

                db.Leagues.AddRange(newLeagues);
                db.SaveChanges();
                ImportReport.NewLeagueCount = newLeagues.Count;
            }
        }
コード例 #15
0
        //-----
        private void FullOddUpdateControls(BackgroundWorker backgroundWorker)
        {
            SetStoreStatus("Full Odd Controls");
            try
            {
                using (var db = new MatchModel())
                {
                    List <FullOdd> dbFullOdds = db.FullOdds.AsParallel().ToList();
                    foreach (var dbFullOdd in dbFullOdds)
                    {
                        if (updatedFullOddOddCombIds.Keys.Contains(dbFullOdd.FullOddId))
                        {
                            dbFullOdd.OddCombinationIds = string.Join("|", updatedFullOddOddCombIds[dbFullOdd.FullOddId]);
                        }
                        else if (dbFullOdd.OddCombinationIds != null && dbFullOdd.OddCombinationIds != "")
                        {
                            SortedSet <int> oddCombIds = new SortedSet <int>();
                            foreach (var item in dbFullOdd.OddCombinationIds.Split('|'))
                            {
                                oddCombIds.Add(int.Parse(item));
                            }

                            dbFullOdd.OddCombinationIds = string.Join("|", oddCombIds.Except(removedIds));
                        }
                        dbFullOdd.IntersectedResults = string.Join("|", fullOddResults[dbFullOdd.FullOddId]);
                    }
                    db.SaveChanges();
                }
            }
            catch (Exception e)
            {
                string sds = e.ToString();
                throw;
            }

            backgroundWorker.ReportProgress(90);
        }
コード例 #16
0
        public void ApplyMatchOperations(BackgroundWorker backgroundWorker)
        {
            int day   = 0;
            int month = 0;
            int year  = 0;
            var dailyAnalysedMatches = analysedMatches.GroupBy(x => new { x.MatchDay, x.MatchMonth, x.MatchYear });

            using (var db = new MatchModel())
            {
                foreach (var dateItem in dailyAnalysedMatches)
                {
                    day   = (int)dateItem.Key.MatchDay;
                    month = (int)dateItem.Key.MatchMonth;
                    year  = (int)dateItem.Key.MatchYear;
                    OldAnalysedMatchControls(db, day, month, year);

                    foreach (var analysedMatch in dateItem)
                    {
                        db.AnalysedMatches.Add(analysedMatch);
                    }
                }
                db.SaveChanges();
            }
        }
コード例 #17
0
        private void FullOddControls()
        {
            SetStoreStatus("FullOdd Controls");
            List <FullOdd> newFullOdds = new List <FullOdd>();

            using (var db = new MatchModel())
            {
                List <string> newOddValues = analysedMatches.Select(x => x.FullOdd).Except(db.FullOdds.AsParallel().Select(x => x.Value)).ToList();
                foreach (var newOddValue in newOddValues)
                {
                    newFullOdds.Add(new FullOdd(newOddValue));
                }

                db.FullOdds.AddRange(newFullOdds);
                db.SaveChanges();
            }
            newFullOddIdValues = new Dictionary <int, string[]>();
            foreach (var newFullOdd in newFullOdds)
            {
                newFullOddIdValues.Add(newFullOdd.FullOddId, newFullOdd.Value.Split('|'));
            }

            ImportReport.NewFullOddCount = newFullOdds.Count;
        }
コード例 #18
0
        private void UpdateCurrentOddCombs(BackgroundWorker backgroundWorker)
        {
            updatedFullOddOddCombIds = new Dictionary <int, HashSet <int> >();
            updatedOddCombvalues     = new HashSet <string>();
            using (var db = new MatchModel())
            {
                List <OddCombination> oddCombs = db.OddCombinations.AsParallel().Where(x => processedOddCombResults.Keys.Contains(x.Value)).ToList();
                int counter = 0;
                foreach (var oddComb in oddCombs)
                {
                    counter++;
                    updatedOddCombvalues.Add(oddComb.Value);
                    int count = 0;
                    foreach (var fullOddId in processedOddCombFullOddIds[oddComb.Value])
                    {
                        count = count + fullOddMatchCounts[fullOddId];
                        if (!updatedFullOddOddCombIds.ContainsKey(fullOddId))
                        {
                            updatedFullOddOddCombIds.Add(fullOddId, new HashSet <int>());
                        }

                        updatedFullOddOddCombIds[fullOddId].Add(oddComb.OddCombinationId);
                    }
                    oddComb.ResultOrders = string.Join("|", processedOddCombResults[oddComb.Value]);
                    oddComb.FullOddIds   = string.Join("|", processedOddCombFullOddIds[oddComb.Value]);
                    oddComb.MatchCount   = count;

                    if (counter % 10000 == 0)
                    {
                        db.SaveChanges();
                    }
                }
                db.SaveChanges();
                ImportReport.UpdatedOddCombinationCount = counter;
                backgroundWorker.ReportProgress(75);
            }

            // try
            // {
            //
            //     DataTable dataTable = new DataTable();
            //     dataTable.Columns.Add("OddCombinationId");
            //     dataTable.Columns.Add("ResultOrders");
            //     dataTable.Columns.Add("FullOddIds");
            //     dataTable.Columns.Add("MatchCount");
            //     updatedOddCombvalues = new HashSet<string>();
            //     foreach (var item in processedOddCombResults.Where(x => oddCombValueIds.Keys.Contains(x.Key)))
            //     {
            //         updatedOddCombvalues.Add(item.Key);
            //         int id = oddCombValueIds[item.Key];
            //         int count = 0;
            //         foreach (var fullOddId in processedOddCombFullOddIds[item.Key])
            //         {
            //             count = count + fullOddMatchCounts[fullOddId];
            //             if (!updatedFullOddOddCombIds.ContainsKey(fullOddId))
            //                 updatedFullOddOddCombIds.Add(fullOddId, new HashSet<int>());
            //
            //             updatedFullOddOddCombIds[fullOddId].Add(id);
            //         }
            //         dataTable.Rows.Add(id, string.Join("|", item.Value), string.Join("|", processedOddCombFullOddIds[item.Key]), count);
            //     }
            //     using (SQLiteConnection con = new SQLiteConnection(EmbedValueController.connectionString))
            //     {
            //         using (SQLiteCommand cmd = new SQLiteCommand("Update_OddCombinations"))
            //         {
            //             cmd.CommandType = CommandType.StoredProcedure;
            //             cmd.Connection = con;
            //             cmd.Parameters.AddWithValue("@updateElement", dataTable);
            //             con.Open();
            //             cmd.ExecuteNonQuery();
            //             con.Close();
            //         }
            //     }
            //     ImportReport.UpdatedOddCombinationCount = dataTable.Rows.Count;
            //
            // }
            // catch (Exception e)
            // {
            //     string sada = e.ToString();
            //     throw;
            // }
        }
コード例 #19
0
        private void PartialOddUpdateControls(BackgroundWorker backgroundWorker)
        {
            SetStoreStatus("Partial Odd Controls");
            using (var db = new MatchModel())
            {
                Dictionary <string, int> currentPartialOddValueIds = new Dictionary <string, int>();
                Dictionary <PartialOddType, Dictionary <string, SortedSet <int> > > currentPartialOdds = new Dictionary <PartialOddType, Dictionary <string, SortedSet <int> > >();
                Dictionary <PartialOddType, Dictionary <string, SortedSet <int> > > newPartialOdds     = new Dictionary <PartialOddType, Dictionary <string, SortedSet <int> > >();
                HashSet <int> updatedIds = new HashSet <int>();

                List <PartialOdd> dbPartialOdds = db.PartialOdds.ToList();

                foreach (var partialOddType in partialOddTypes)
                {
                    currentPartialOdds.Add(partialOddType, new Dictionary <string, SortedSet <int> >());
                    newPartialOdds.Add(partialOddType, new Dictionary <string, SortedSet <int> >());
                }

                foreach (var dbPartialOdd in dbPartialOdds)
                {
                    List <string> strFullOddIds = dbPartialOdd.FullOddIds.Split('|').ToList();
                    List <int>    intFullOddIDs = new List <int>();
                    foreach (var item in strFullOddIds)
                    {
                        intFullOddIDs.Add(int.Parse(item));
                    }

                    currentPartialOddValueIds.Add(dbPartialOdd.OddValues, dbPartialOdd.PartialOddId);
                    currentPartialOdds[(PartialOddType)dbPartialOdd.PartialOddType].Add(dbPartialOdd.OddValues, new SortedSet <int>(intFullOddIDs));
                }
                backgroundWorker.ReportProgress(35);
                List <FullOdd> newFullOdds = db.FullOdds.AsParallel().Where(x => newFullOddIdValues.Keys.Contains(x.FullOddId)).ToList();
                foreach (var newFullOdd in newFullOdds)
                {
                    foreach (var tempPartialOdd in GetTempPartialOdds(newFullOdd.Value))
                    {
                        string str = string.Join("|", tempPartialOdd.Value);
                        if (!currentPartialOdds[tempPartialOdd.Key].ContainsKey(str))
                        {
                            if (!newPartialOdds[tempPartialOdd.Key].ContainsKey(str))
                            {
                                newPartialOdds[tempPartialOdd.Key].Add(str, new SortedSet <int>());
                            }

                            newPartialOdds[tempPartialOdd.Key][str].Add(newFullOdd.FullOddId);
                        }
                        else
                        {
                            currentPartialOdds[tempPartialOdd.Key][str].Add(newFullOdd.FullOddId);
                            updatedIds.Add(currentPartialOddValueIds[str]);
                        }
                    }
                }
                backgroundWorker.ReportProgress(40);

                foreach (var uptadedPartialOdd in dbPartialOdds.Where(x => updatedIds.Contains(x.PartialOddId)))
                {
                    uptadedPartialOdd.FullOddIds = string.Join("|", currentPartialOdds[(PartialOddType)uptadedPartialOdd.PartialOddType][uptadedPartialOdd.OddValues]);
                }
                db.SaveChanges();

                List <PartialOdd> newDbPartialOdds = new List <PartialOdd>();
                foreach (var partialOddType in newPartialOdds)
                {
                    int intPartialOddType = (int)partialOddType.Key;
                    foreach (var oddValues in partialOddType.Value)
                    {
                        newDbPartialOdds.Add(new PartialOdd(intPartialOddType, oddValues.Key, string.Join("|", oddValues.Value)));
                    }
                }
                db.PartialOdds.AddRange(newDbPartialOdds);
                db.SaveChanges();
                ImportReport.NewPartialOddCount     = newDbPartialOdds.Count;
                ImportReport.UpdatedPartialOddCount = updatedIds.Count;
                backgroundWorker.ReportProgress(45);
            }
        }