Пример #1
0
        private ShopListCollection _getShopLists(string sql, int pPageIndex, int pPageSize)
        {
            ShopListCollection retobjs = new ShopListCollection();
            SqlDataReader      sdr     = null;
            ShopList           obj     = null;

            m_db.RunSql(sql, out sdr);
            if (null == sdr)
            {
                return(null);
            }
            int _curRecPos = 0;
            //计算页记录///
            long _startpos = 0;
            long _endpos   = 0;

            if (pPageIndex > -1)
            {
                _startpos = pPageIndex * pPageSize;
                _endpos   = _startpos + pPageSize;
            }
            while (sdr.Read())
            {
                if (_curRecPos > _endpos)
                {
                    break;
                }
                if (_curRecPos >= _startpos && _curRecPos < _endpos)
                {
                    obj = this._buildShopList(ref sdr);
                    if (null != obj)
                    {
                        retobjs.Add(obj);
                    }
                }
                _curRecPos++;
            }
            sdr.Close();
            if (retobjs.Count > 0)
            {
                return(retobjs);
            }
            else
            {
                return(null);
            }
        }
Пример #2
0
        private ShopListCollection _getShopLists(string sql)
        {
            ShopListCollection retobjs = new ShopListCollection();
            SqlDataReader      sdr     = null;

            m_db.RunSql(sql, out sdr);
            if (null == sdr)
            {
                return(null);
            }
            while (sdr.Read())
            {
                retobjs.Add(this._buildShopList(ref sdr));
            }
            sdr.Close();
            return(retobjs);
        }