Ejemplo n.º 1
0
        private static List <Opfer> FindMatches(Stolperstein stone, List <Opfer> victims)
        {
            List <Opfer> matches = new List <Opfer>();

            foreach (Opfer victim in victims)
            {
                if (victim.Geburtsort == stone.Ort &&
                    victim.Strasse == stone.Strasse &&
                    victim.Hausnummer == stone.Hausnummer)
                {
                    victim.MatchingCount += 1;
                    matches.Add(victim);
                }
            }
            return(matches);
        }
Ejemplo n.º 2
0
        private static List <Stolperstein> CollectMemorialStones(ConsoleLogger logger, MySqlConnection connection)
        {
            List <Stolperstein> memorialStones = new List <Stolperstein>();

            MySqlCommand command = new MySqlCommand("SELECT id, strasse, hausnummer, ort FROM tbl_st_maps_address;", connection);

            using (MySqlDataReader reader = command.ExecuteReader())
            {
                int col1 = reader.GetOrdinal("id");
                int col2 = reader.GetOrdinal("strasse");
                int col3 = reader.GetOrdinal("hausnummer");
                int col4 = reader.GetOrdinal("ort");

                int counter = 0;

                while (reader.Read())
                {
                    object obj1 = reader.GetValue(col1);
                    object obj2 = reader.GetValue(col2);
                    object obj3 = reader.GetValue(col3);
                    object obj4 = reader.GetValue(col4);

                    int    val1 = Convert.ToInt32(obj1);
                    string val2 = obj2 == DBNull.Value ? null : (string)obj2;
                    string val3 = obj3 == DBNull.Value ? null : (string)obj3;
                    string val4 = obj4 == DBNull.Value ? null : (string)obj4;

                    Stolperstein stolperstein = new Stolperstein()
                    {
                        ID         = val1,
                        Strasse    = val2,
                        Hausnummer = val3,
                        Ort        = val4
                    };
                    logger.Log($"[{counter}] {stolperstein.ToString()}");

                    memorialStones.Add(stolperstein);
                    counter += 1;
                }
            }
            return(memorialStones);
        }