Пример #1
0
        private ArrayList GetElementList()
        {
            GeoHandlerClass cl = new GeoHandlerClass();

            ArrayList       l = new ArrayList();
            OleDbConnection c = new OleDbConnection(cl.ConnectionString);

            c.Open();

            OleDbCommand    cmd = new OleDbCommand("select * from TB_PROVINCIE where ID_TB_REGIONI = " + _idRegione.ToString(), c);
            OleDbDataReader r   = cmd.ExecuteReader();

            while (r.Read())
            {
                int id = r.IsDBNull(0) ? -1 : (int)r.GetValue(0);
                Key k  = new Key(id);

                string descrizione = r.IsDBNull(1) ? null : (string)r.GetValue(1);
                string sigla       = r.IsDBNull(2) ? null : (string)r.GetValue(2);
                int    idRegione   = r.IsDBNull(3) ? -1 : (int)r.GetValue(3);

                Provincia p = new Provincia(k, descrizione, idRegione, sigla);
                p.ListaComuni = new LazyComune(p.Id, SearchCityType.Province);


                l.Add(p);
            }
            r.Close();
            c.Close();
            return(l);
        }
Пример #2
0
        private ArrayList GetElementList()
        {
            GeoHandlerClass cl = new GeoHandlerClass();



            string query = "";

            if (_mode == SearchCityType.Regioni)
            {
                query = "Select * from TB_COMUNI where ID_TB_REGIONI = " + _id.ToString();
            }
            else
            {
                query = "Select * from TB_COMUNI where ID_TB_PROVINCIE = " + _id.ToString();
            }



            ArrayList       l = new ArrayList();
            OleDbConnection c = new OleDbConnection(cl.ConnectionString);

            c.Open();

            OleDbCommand    cmd = new OleDbCommand(query, c);
            OleDbDataReader r   = cmd.ExecuteReader();

            while (r.Read())
            {
                int id = r.IsDBNull(0) ? -1 : (int)r.GetValue(0);
                Key k  = new Key(id);

                string descrizione   = r.IsDBNull(1) ? null : (string)r.GetValue(1);
                int    idProvincia   = r.IsDBNull(2) ? -1 : (int)r.GetValue(2);
                int    idRegione     = r.IsDBNull(3) ? -1 : (int)r.GetValue(3);
                string cap           = r.IsDBNull(4) ? null : (string)r.GetValue(4);
                string codiceFiscale = r.IsDBNull(5) ? null : (string)r.GetValue(5);
                string codiceIstat   = r.IsDBNull(6) ? null : (string)r.GetValue(6);

                Comune com = new Comune(k, descrizione, idProvincia, idRegione, cap, codiceFiscale, codiceIstat);

                l.Add(com);
            }
            r.Close();
            c.Close();

            return(l);
        }