/// <summary> /// 评论取数据的存储过程 /// </summary> /// <typeparam name="T"></typeparam> /// <param name="tabelName"></param> /// <param name="where"></param> /// <param name="orderString"></param> /// <param name="orderType"></param> /// <returns></returns> public object QueryPaginationList <T>(string tabelName, string columns, string where, string orderString, int pageIndex, int pageSize = 20, int orderType = 1) where T : Kingsun.DB.Action, new() { try { PageParameter param = new PageParameter(); param.OrderColumns = orderString; param.TbNames = tabelName; param.IsOrderByASC = orderType; param.Columns = "*"; param.Columns = string.IsNullOrEmpty(columns) ? "*" : columns; param.PageIndex = pageIndex; param.PageSize = pageSize; //param.Where param.Where = string.IsNullOrEmpty(where) ? "" : where; List <System.Data.Common.DbParameter> list = new List <System.Data.Common.DbParameter>(); list = param.getParameterList(); System.Data.DataSet ds = ExecuteProcedure("proc_commentPageView", list); if (ds != null && ds.Tables.Count == 2) { object returnData = new { Total = ds.Tables[1].Rows[0][0], List = FillData <T>(ds.Tables[0]) }; return(returnData); } else { return(new { Total = 0, List = new List <T>() }); } } catch { throw; } }
/// <summary> /// 得到实体List /// </summary> /// <typeparam name="T"></typeparam> /// <param name="tabelName"></param> /// <param name="where"></param> /// <param name="orderString"></param> /// <param name="orderType"></param> /// <returns></returns> public tb_UserMessageAll <T> QueryPageList <T>(string tabelName, string where, string orderString, int pageIndex, int pageSize = 20, int orderType = 1) where T : Kingsun.DB.Action, new() { try { PageParameter param = new PageParameter(); param.OrderColumns = orderString; param.TbNames = tabelName; param.IsOrderByASC = orderType; param.Columns = "*"; param.PageIndex = pageIndex; param.PageSize = pageSize; //param.Where param.Where = string.IsNullOrEmpty(where) ? "1=1" : where; List <System.Data.Common.DbParameter> list = new List <System.Data.Common.DbParameter>(); list = param.getParameterList(); System.Data.DataSet ds = ExecuteProcedure("proc_pageView", list); if (ds != null && ds.Tables.Count == 2) { //object returnData = new //{ // Total = ds.Tables[1].Rows[0][0], // List = FillData<T>(ds.Tables[0]) //}; tb_UserMessageAll <T> tb = new tb_UserMessageAll <T>(); tb.Total = ds.Tables[1].Rows[0][0].ToString(); tb.ListT = FillData <T>(ds.Tables[0]); return(tb); } else { tb_UserMessageAll <T> tb = new tb_UserMessageAll <T>(); return(tb); } } catch { throw; } }