Пример #1
0
        private List <CategoriaImpianto> RecuperaCategoriePrivate()
        {
            List <CategoriaImpianto> categorie = new List <CategoriaImpianto>();

            SqlServerExecuteObject sseo = null;
            SqlDataReader          dr   = null;

            string sSql = "SELECT CategoriaImpiantoID, Nome_IT, Nome_EN, FileIcona FROM dbo.TBL_CategorieImpianti;";

            sseo             = new SqlServerExecuteObject();
            sseo.CommandText = sSql;
            sseo.CommandType = CommandType.Text;

            dr = SqlProvider.ExecuteReaderObject(sseo);

            while (dr.Read())
            {
                CategoriaImpianto categoria = RiempiIstanza(dr);
                categorie.Add(categoria);
            }

            if (dr != null)
            {
                dr.Close();
                dr.Dispose();
            }

            return(categorie);
        }
Пример #2
0
        private CategoriaImpianto RiempiIstanza(SqlDataReader dr)
        {
            if (dr == null)
            {
                throw new ArgumentNullException("dr");
            }

            CategoriaImpianto categoria = new CategoriaImpianto();

            categoria.ID        = dr.GetInt32(0);
            categoria._nome_IT  = dr.GetString(1);
            categoria._nome_EN  = dr.GetString(2);
            categoria.FileIcona = dr.GetString(3);
            return(categoria);
        }