コード例 #1
0
        /// <summary>
        /// 分页查询 
        /// </summary>
        /// <param name="recordCount">输出参数 数据总数</param>
        /// <param name="criteria">查询条件对象</param>
        /// <param name="pageSize">每页显示数量</param>
        /// <param name="pageIndex">当前页索引</param>
        /// <returns>结果集 泛型</returns>
        public DataSet QueryDetaildataListPager(out string resultMsg, out decimal recordCount, CriteriaDetaildata criteria, int pageSize = 15, int pageIndex = 1)
        {
            recordCount = decimal.Zero;
            resultMsg = string.Empty;
            DataSet data = new DataSet();
            try
            {
                //存储过程名称
                string sql = "USP_DETAILDATA_SELECT_SEARCH_PAGER";

                //参数添加
                IList<DBParameter> parm = new List<DBParameter>();
                parm.Add(new DBParameter() { ParameterName = "PagerSize", ParameterValue = pageSize, ParameterInOut = BaseDict.ParmIn, ParameterType = DbType.String });
                parm.Add(new DBParameter() { ParameterName = "PagerIndex", ParameterValue = pageIndex, ParameterInOut = BaseDict.ParmIn, ParameterType = DbType.String });
                parm.Add(new DBParameter() { ParameterName = "RowCount", ParameterInOut = BaseDict.ParmOut, ParameterType = DbType.String });

                //查询执行
                using (data = DBHelper.ExecuteDataSet(sql, isStoredProc: true, parm: parm))
                {
                    foreach (var item in parm)
                    {
                        //获取输出参数值
                        if (item.ParameterName == "RowCount")
                        {
                            decimal.TryParse(item.ParameterValue.ToString(), out recordCount);
                            break;
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                resultMsg = string.Format("{0} {1}", BaseDict.ErrorPrefix, ex.ToString());
            }

            return data;
        }
コード例 #2
0
 public DataSet QueryDetaildataListPager(out string resultMsg, out decimal recordCount, CriteriaDetaildata criteria, int pageSize = 10, int pageIndex = 1)
 {
     ILogicDetaildata logicData = new LogicDetaildata();
     var data = logicData.QueryDetaildataListPager(out resultMsg, out recordCount, criteria, pageSize, pageIndex);
     return data;
 }