private void ImportData() { if (!File.Exists("bd.data")) { return; } List <UnicData> db = UnicData.Load("bd.data"); List <UnicData> rezultList = new List <UnicData>(); List <string> filesData = new List <string>() { "Fonbet.data", "Marafon.data", "Olimp.data", "Zenit.data" }; foreach (string fileName in filesData) { List <SiteRow> data = SiteRow.Load(fileName); foreach (SiteRow siteRow in data) { UnicData rez = FindData(siteRow.TeamName, db); if (rez != null) { var team2 = siteRow.Match.Replace(siteRow.TeamName, "").Replace(" - ", "").Trim(); UnicData rez2 = FindData(siteRow.TeamName, db); if (rez2 != null) { rezultList.Add(rez); } } } } rezultList = rezultList.OrderBy(x => x.Id).ToList(); rezultList = ToUnic(rezultList); UnicData.Save("bd_Import.data", rezultList); Loger.Add($"База для импорта готова. В ней {rezultList.Count} записей"); }
private void LoadData() { try { FonbetData = SiteRow.Load("Fonbet.data"); OlimpData = SiteRow.Load("Olimp.data"); MarafonData = SiteRow.Load("Marafon.data"); ZenitData = SiteRow.Load("Zenit.data"); PariMatchData = SiteRow.Load("PariMatch.data"); Base = new ObservableCollection <UnicData>(UnicData.Load("bd.data").OrderBy(x => x.Id)); } catch { Base = new ObservableCollection <UnicData>(); } Base.CollectionChanged += Base_CollectionChanged; if (Base.Count != 0) { foreach (UnicData key in Base) { foreach (SiteRow t in FonbetData) { if (t.TeamName == key.Value) { t.IsUsed = true; } } foreach (SiteRow t in OlimpData) { if (t.TeamName == key.Value) { t.IsUsed = true; } } foreach (SiteRow t in MarafonData) { if (t.TeamName == key.Value) { t.IsUsed = true; } } foreach (SiteRow t in ZenitData) { if (t.TeamName == key.Value) { t.IsUsed = true; } } foreach (SiteRow t in PariMatchData) { if (t.TeamName == key.Value) { t.IsUsed = true; } } } } Fonbet = new ObservableCollection <SiteRow>(FonbetData.OrderBy(x => x.Sport).ThenBy(x => x.TimeStart)); Olimp = new ObservableCollection <SiteRow>(OlimpData.OrderBy(x => x.Sport).ThenBy(x => x.TimeStart)); Marafon = new ObservableCollection <SiteRow>(MarafonData.OrderBy(x => x.Sport).ThenBy(x => x.TimeStart)); Zenit = new ObservableCollection <SiteRow>(ZenitData.OrderBy(x => x.Sport).ThenBy(x => x.TimeStart)); PariMatch = new ObservableCollection <SiteRow>(PariMatchData.OrderBy(x => x.Sport).ThenBy(x => x.TimeStart)); }