Beispiel #1
0
        public Core.Business.AREACODE Select(System.Int32 id)
        {
            SqlServerUtility sql = new SqlServerUtility();

            SqlDataReader reader = sql.ExecuteSqlReader(SqlSelectAREACODE);

            if (reader != null && !reader.IsClosed && reader.Read())
            {
                Core.Business.AREACODE aREACODE = new Core.Business.AREACODE();

                if (!reader.IsDBNull(0)) aREACODE.PROVINCEID = reader.GetString(0);
                if (!reader.IsDBNull(1)) aREACODE.PROVINCENAME = reader.GetString(1);
                if (!reader.IsDBNull(2)) aREACODE.ProvinceAlias = reader.GetString(2);
                if (!reader.IsDBNull(3)) aREACODE.CITYID = reader.GetString(3);
                if (!reader.IsDBNull(4)) aREACODE.CITYNAME = reader.GetString(4);

                reader.Close();
                return aREACODE;
            }
            else
            {
                if (reader != null && !reader.IsClosed)
                    reader.Close();

                return null;
            }
        }
Beispiel #2
0
        public IEnumerable<Core.Business.AREACODE> GetAllAREACODE()
        {
            IList<Core.Business.AREACODE> aREACODElist = new List<Core.Business.AREACODE>();
            ImportSqlServerUtility sql = new ImportSqlServerUtility();

            SqlDataReader reader = sql.ExecuteSqlReader(SqlGetAllAREACODE);

            if(reader != null)
            {
                while(reader.Read())
                {
                    Core.Business.AREACODE aREACODE = new Core.Business.AREACODE();

                    if (!reader.IsDBNull(0)) aREACODE.PROVINCEID = reader.GetString(0);
                    if (!reader.IsDBNull(1)) aREACODE.PROVINCENAME = reader.GetString(1);
                    if (!reader.IsDBNull(2)) aREACODE.ProvinceAlias = reader.GetString(2);
                    if (!reader.IsDBNull(3)) aREACODE.CITYID = reader.GetString(3);
                    if (!reader.IsDBNull(4)) aREACODE.CITYNAME = reader.GetString(4);

                    aREACODE.MarkOld();
                    aREACODElist.Add(aREACODE);
                }
                reader.Close();
            }
            return aREACODElist;
        }