private void FilterReport() { if (FilteredReport == null) { return; } FilteredReport = new List <Participant>(Report); if (CategoryMode != "No Filter") { FilteredReport.RemoveAll(p => p.category_mode.ToLower() != CategoryMode.ToLower()); } if (CategoryOperator != "No Filter") { FilteredReport.RemoveAll(p => p.category_op.ToLower() != CategoryOperator.ToLower()); } if (CategoryPower != "No Filter") { FilteredReport.RemoveAll(p => p.category_power.ToLower() != CategoryPower.ToLower()); } if (CategoryOrigin == "Israeli") { FilteredReport.RemoveAll(p => !HolyLogParser.IsIsraeliStation(p.callsign)); } else if (CategoryOrigin == "Foreign") { FilteredReport.RemoveAll(p => HolyLogParser.IsIsraeliStation(p.callsign)); } if (CategoryStation != "No Filter") { if (CategoryStation == "Fixed") { FilteredReport.RemoveAll(p => p.squers > 1 || p.callsign.ToLower().Contains(@"/p")); } else if (CategoryStation == "Mobile") { FilteredReport.RemoveAll(p => p.squers < 2 || p.callsign.ToLower().Contains(@"/p")); } else if (CategoryStation == "Portable") { FilteredReport.RemoveAll(p => p.squers > 1 || !p.callsign.ToLower().Contains(@"/p")); } } DataContext = FilteredReport.OrderByDescending(p => p.score).ToList(); if (L_NUmOfParticipantsValue != null) { L_NUmOfParticipantsValue.Content = FilteredReport.Count(); } //Console.WriteLine("Category: " + CategoryMode + " : " + CategoryOperator + " : " + CategoryPower + " : " + CategoryStation); }
private void CalculateWorker_DoWork(object sender, DoWorkEventArgs e) { Report.Clear(); int iteration = 0; int participantsCount = RawData.participants.Count(); foreach (Participant p in RawData.participants.OrderByDescending(t => t.qsos)) { //GenerateLogFile(p); iteration++; if (p.is_manual == 0 && p.callsign.ToLower() == "4x6fr") { IEnumerable <QSO> qsos = from q in RawData.log where Helper.getBareCallsign(q.MyCall) == Helper.getBareCallsign(p.callsign) && IsValidDate(q) select q; int numOfSquers = qsos.DistinctBy(q => q.STX).Count(); HolyLogParser lop = new HolyLogParser(Services.GenerateAdif(qsos), HolyLogParser.IsIsraeliStation(p.callsign) ? HolyLogParser.Operator.Israeli : HolyLogParser.Operator.Foreign); lop.Parse(); Participant n = p; n.qsos = lop.ValidQsos;// qsos.Count(); n.score = lop.Result; n.squers = numOfSquers; n.mults = lop.Mults; n.points = lop.Points; Report.Add(n); } else { Participant n = p; n.qsos = p.qsos; n.score = p.points; n.squers = 0; n.mults = 0; n.points = p.points; Report.Add(n); } (sender as BackgroundWorker).ReportProgress(100 * iteration / participantsCount); } Report = Report.OrderByDescending(p => p.score).ToList(); FilteredReport = new List <Participant>(Report); string insert_hlwtest = GenerateMultipleInsert(FilteredReport); }