/// <summary> /// 查询前台显示的公告列表 /// </summary> /// <param name="agent"></param> /// <param name="pageIndex"></param> /// <param name="pageSize"></param> /// <returns></returns> public BulletinInfo_Collection QueryDisplayBulletins(BulletinAgent agent, int pageIndex, int pageSize) { pageIndex = pageIndex < 0 ? 0 : pageIndex; pageSize = pageSize > BusinessHelper.MaxPageSize ? BusinessHelper.MaxPageSize : pageSize; string QueryArticleList_sql = SqlModule.DataModule.FirstOrDefault(x => x.Key == "Data_QueryBulletinList_Web").SQL; var collection = DB.CreateSQLQuery(QueryArticleList_sql) .SetInt("@BulletinAgent", (int)agent) .SetInt("@PageIndex", pageIndex) .SetInt("@PageSize", pageSize).List <BulletinInfo_Query>().ToList(); var returnmodel = new BulletinInfo_Collection(); returnmodel.BulletinList = collection; string QueryArticleList_Count_sql = SqlModule.DataModule.FirstOrDefault(x => x.Key == "Data_QueryBulletinList_Web_Total").SQL; var totalCount = DB.CreateSQLQuery(QueryArticleList_sql) .SetInt("@BulletinAgent", (int)agent).First <int>(); returnmodel.TotalCount = totalCount; return(returnmodel); //string QueryArticleCount_sql = SqlModule.DataModule.FirstOrDefault(x => x.Key == "Data_QueryArticleList_TotalCount").SQL; //var list = CreateOutputQuery(Session.GetNamedQuery("Data_QueryBulletinList_Web")) // .AddInParameter("BulletinAgent", (int)agent) // .AddInParameter("PageIndex", pageIndex) // .AddInParameter("PageSize", pageSize) // .AddOutParameter("TotalCount", "Int32") // .List(out outputs); //totalCount = (int)outputs["TotalCount"]; //return list; }
/// <summary> /// 查询前台显示的公告列表 /// </summary> public BulletinInfo_Collection QueryDisplayBulletins(BulletinAgent agent, int pageIndex, int pageSize) { using (var bulletinManager = new BulletinManager()) { int totalCount; var list = bulletinManager.QueryDispayBulletinList(agent, pageIndex, pageSize, out totalCount); var collection = new BulletinInfo_Collection { TotalCount = totalCount, }; collection.LoadList(list); return(collection); } }
public IList QueryDispayBulletinList(BulletinAgent agent, int pageIndex, int pageSize, out int totalCount) { Session.Clear(); pageIndex = pageIndex < 0 ? 0 : pageIndex; pageSize = pageSize > BusinessHelper.MaxPageSize ? BusinessHelper.MaxPageSize : pageSize; Dictionary <string, object> outputs; var list = CreateOutputQuery(Session.GetNamedQuery("P_QueryBulletinList_Web")) .AddInParameter("BulletinAgent", (int)agent) .AddInParameter("PageIndex", pageIndex) .AddInParameter("PageSize", pageSize) .AddOutParameter("TotalCount", "Int32") .List(out outputs); totalCount = (int)outputs["TotalCount"]; return(list); }