Example #1
0
        /// <summary>
        /// 执行查询分页
        /// </summary>
        public void GetPageList()
        {
            if (_pageindex < 1)
            {
                _pageindex = 1;
            }

            #region 排序

            if (string.IsNullOrEmpty(_orderstring.Trim()))
            {
                if (_ordercolumn.Length != _ordertype.Length || _ordercolumn.Length < 1)
                {
                    throw new Exception("分页排序出错");
                }

                ArrayList OrderOutput = new ArrayList();
                for (int u = 0; u < _ordercolumn.Length; u++)
                {
                    OrderOutput.Add(_ordercolumn[u].ToString() + " " + _ordertype[u].ToString());
                }
                _orderstring = String.Join(",", (string[])OrderOutput.ToArray(typeof(string)));
            }

            #endregion

            ArrayList _ArrayList = EntityCore <table> .GetPageList(_pagesize, _pageindex, _sqlwhere, _sqlparms, _orderstring, _columns);

            if (_ArrayList.Count == 5)
            {
                _datalist    = (List <table>)_ArrayList[0];
                _dataset     = (DataSet)_ArrayList[1];
                _recordcount = int.Parse(_ArrayList[2].ToString());
                _pagecount   = int.Parse(_ArrayList[3].ToString());
                _pageindex   = int.Parse(_ArrayList[4].ToString());
            }
            else
            {
                throw new Exception("分页出错");
            }
        }