Ejemplo n.º 1
0
        //-----------------------------------------------------------------

        private List <Countries> Init(SqlCommand cmd)
        {
            SqlConnection con = db.GetConnection();

            cmd.Connection = con;
            List <Countries> l_Countries = new List <Countries>();

            try
            {
                con.Open();
                SqlDataReader   reader      = cmd.ExecuteReader();
                SmartDataReader smartReader = new SmartDataReader(reader);
                while (smartReader.Read())
                {
                    Countries m_Countries = new Countries(db.ConnectionString);
                    m_Countries.CountryId    = smartReader.GetInt16("CountryId");
                    m_Countries.CountryName  = smartReader.GetString("CountryName");
                    m_Countries.CountryDesc  = smartReader.GetString("CountryDesc");
                    m_Countries.IconPath     = smartReader.GetString("IconPath");
                    m_Countries.DisplayOrder = smartReader.GetInt16("DisplayOrder");
                    m_Countries.CrUserId     = smartReader.GetInt32("CrUserId");
                    m_Countries.CrDateTime   = smartReader.GetDateTime("CrDateTime");

                    l_Countries.Add(m_Countries);
                }
                reader.Close();
                return(l_Countries);
            }
            catch (SqlException err)
            {
                throw new ApplicationException("Data error: " + err.Message);
            }
            finally
            {
                db.closeConnection(con);
            }
        }
Ejemplo n.º 2
0
        //--------------------------------------------------------------
        public static List <Countries> Static_GetListOrderBy(string ConStr, string OrderBy)
        {
            Countries m_Countries = new Countries(ConStr);

            return(m_Countries.GetListOrderBy(OrderBy));
        }