Exemple #1
0
 private void cmbNomi_SelectionChanged(object sender, SelectionChangedEventArgs e)
 {
     if ((string)cmbNomi.SelectedItem != "")
     {
         dgrAccoppiamenti.ItemsSource = CoppieUtility.VariMatch(CSVUtility.FindByName((string)cmbNomi.SelectedItem));
     }
 }
        public static double ConfrontaElementi(CSVElement first, CSVElement second)
        {
            double matchScore = 0;

            matchScore += ConfrontoInteressi(first.InMusica, second.InMusica);
            matchScore += ConfrontoInteressi(first.InFilm, second.InFilm);
            matchScore += ConfrontoInteressi(first.InGiappo, second.InGiappo);
            matchScore += ConfrontoInteressi(first.InLibri, second.InLibri);
            matchScore += ConfrontoInteressi(first.InSerieTV, second.InSerieTV);
            matchScore += ConfrontoInteressi(first.InGames, second.InGames);
            matchScore += ConfrontoInteressi(first.InSport, second.InSport);
            matchScore += ConfrontoInteressi(first.InOther, second.InOther);

            //Sabato sera
            if (!(first.SabTranq == 0 || second.SabTranq == 0))
            {
                matchScore += CoppieUtility.PointDifference(first.SabTranq, second.SabTranq);
            }

            if (!(first.SabLuoghi.ToLower() == "" || second.SabLuoghi.ToLower() == ""))
            {
                matchScore += NumeroCoseInComune(first.SabLuoghi.ToLower().Split(','), second.SabLuoghi.ToLower().Split(','), false);
            }

            if (!(first.SabHobby.ToLower() == "" || second.SabHobby.ToLower() == ""))
            {
                matchScore += NumeroCoseInComune(first.SabHobby.ToLower().Split(','), second.SabHobby.ToLower().Split(','), false);
            }

            if (!(first.SabCompagnia.ToLower() == "" || second.SabCompagnia.ToLower() == "") && (first.SabCompagnia == second.SabCompagnia))
            {
                matchScore += 10;
            }

            if (!(first.SabFine == 0 || second.SabFine == 0))
            {
                matchScore += CoppieUtility.PointDifference(first.SabFine, second.SabFine);
            }

            return(matchScore);
        }