예제 #1
0
파일: Users.cs 프로젝트: szp11/HGShareBBS
        /// <summary>
        ///根据用户多个id获取多个用户信息
        /// </summary>
        /// <param name="ids"></param>
        /// <returns></returns>
        public static List <UserVModel> GetUsersByIds(int[] ids)
        {
            if (ids == null || ids.Length == 0)
            {
                return(new List <UserVModel>());
            }
            var par = new DynamicParameters();

            par.Add("@UserIds", string.Join(",", ids), DbType.String);
            return(DapWrapper.InnerQueryProc <UserVModel>(DbConfig.ArticleManagerConnString, "proc_GetUsersByIds", par));
        }
예제 #2
0
        /// <summary>
        /// 获取AdminLog分页列表(自定义存储过程)
        /// </summary>
        /// <param name="pageIndex">页码</param>
        /// <param name="pageSize">每页显示条数</param>
        /// <param name="beginTime">开始时间</param>
        /// <param name="endTime">结束时间</param>
        /// <param name="recordCount">总记录数</param>
        /// <returns>AdminLog列表</returns>
        public static List <AdminLogInfo> GetAdminLogPageList(int pageIndex, int pageSize, DateTime?beginTime, DateTime?endTime, out int recordCount)
        {
            recordCount = 0;
            var par = new DynamicParameters();

            par.Add("@PageIndex", pageIndex, DbType.Int32);
            par.Add("@PageSize", pageSize, DbType.Int32);
            par.Add("@BeginTime", beginTime, DbType.DateTime);
            par.Add("@EndTime", !endTime.HasValue ? endTime : endTime.Value.AddDays(1).AddMilliseconds(-1), DbType.DateTime);
            par.Add("@TotalCount", recordCount, DbType.Int32, ParameterDirection.Output);
            var result = DapWrapper.InnerQueryProc <AdminLogInfo>(DbConfig.ArticleManagerConnString, "proc_GetAdminLogPageList", par);

            recordCount = par.Get <int>("@TotalCount");
            return(result);
        }
예제 #3
0
        /// <summary>
        /// 获取Article分页列表(自定义存储过程)
        /// </summary>
        /// <param name="pageIndex">页码</param>
        /// <param name="pageSize">每页显示条数</param>
        /// <param name="bType"></param>
        /// <param name="isJingHua"></param>
        /// <param name="recordCount">总记录数</param>
        /// <param name="type"></param>
        /// <returns>Article列表</returns>
        public static List <ArticleVModel> GetArticlePageList(int pageIndex, int pageSize, int type, int bType, int isJingHua, out int recordCount)
        {
            recordCount = 0;
            var par = new DynamicParameters();

            par.Add("@PageIndex", pageIndex, DbType.Int32);
            par.Add("@PageSize", pageSize, DbType.Int32);
            par.Add("@Type", type, DbType.Int32);
            par.Add("@BType", bType, DbType.Int32);
            par.Add("@IsJiaJing", isJingHua, DbType.Int32);
            par.Add("@TotalCount", recordCount, DbType.Int32, ParameterDirection.Output);
            var result = DapWrapper.InnerQueryProc <ArticleVModel>(DbConfig.ArticleManagerConnString, "proc_GetArticlePageList", par);

            recordCount = par.Get <int>("@TotalCount");
            return(result);
        }
예제 #4
0
        /// <summary>
        /// 获取Comment分页列表(自定义存储过程)
        /// </summary>
        /// <param name="pageIndex">页码</param>
        /// <param name="pageSize">每页显示条数</param>
        /// <param name="order"></param>
        /// <param name="recordCount">总记录数</param>
        /// <param name="aId"></param>
        /// <param name="authorId"></param>
        /// <returns>Comment列表</returns>
        public static List <CommentVModel> GetCommentPageList(int pageIndex, int pageSize, long aId, int authorId, string order, out int recordCount)
        {
            if (string.IsNullOrEmpty(order) || (order.ToLower() != "asc" || order.ToLower() != "desc"))
            {
                order = "ASC";
            }
            recordCount = 0;
            var par = new DynamicParameters();

            par.Add("@PageIndex", pageIndex, DbType.Int32);
            par.Add("@PageSize", pageSize, DbType.Int32);
            par.Add("@AId", aId, DbType.Int64);
            par.Add("@Order", order, DbType.String);
            par.Add("@AuthorId", authorId, DbType.Int32);
            par.Add("@TotalCount", recordCount, DbType.Int32, ParameterDirection.Output);
            var result = DapWrapper.InnerQueryProc <CommentVModel>(DbConfig.ArticleManagerConnString, "proc_GetCommentPageList", par);

            recordCount = par.Get <int>("@TotalCount");
            return(result);
        }
예제 #5
0
        /// <summary>
        /// 分页
        /// </summary>
        /// <param name="tableName">表名</param>
        /// <param name="fieldKey">主键</param>
        /// <param name="fieldShow">显示字段</param>
        /// <param name="fieldOrder">排序</param>
        /// <param name="where">条件</param>
        /// <param name="pageCurrent">页码</param>
        /// <param name="pageSize">页码大小</param>
        /// <param name="pageCount">页数</param>
        /// <param name="count">总记录数</param>
        /// <returns></returns>
        public static IList <T> GetPageList(string tableName, string fieldKey, string fieldShow, string fieldOrder, string where, int pageCurrent, int pageSize, out int pageCount, out int count)
        {
            pageCount = 0;
            count     = 0;
            var par = new DynamicParameters();

            par.Add("@tbname", tableName, DbType.String);
            par.Add("@FieldKey", fieldKey, DbType.String);
            par.Add("@PageCurrent", pageCurrent, DbType.Int32);
            par.Add("@PageSize", pageSize, DbType.Int32);
            par.Add("@FieldShow", fieldShow, DbType.String);
            par.Add("@FieldOrder", fieldOrder, DbType.String);
            par.Add("@Where", where, DbType.String);
            par.Add("@PageCount", pageCount, DbType.Int32, ParameterDirection.Output);
            par.Add("@Count", count, DbType.Int32, ParameterDirection.Output);
            var result = DapWrapper.InnerQueryProc <T>(DbConfig.ArticleManagerConnString, "sp_PageView", par);

            pageCount = par.Get <int>("@PageCount");
            count     = par.Get <int>("@Count");
            return(result);
        }