Exemplo n.º 1
0
        /// <summary>
        /// 查询前台显示的公告列表
        /// </summary>
        /// <param name="agent"></param>
        /// <param name="pageIndex"></param>
        /// <param name="pageSize"></param>
        /// <returns></returns>
        public BulletinInfo_Collection QueryDisplayBulletins(int 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", 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_Count_sql)
                                .SetInt("BulletinAgent", 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;
        }
Exemplo n.º 2
0
 /// <summary>
 /// 获取公告列表
 /// </summary>
 /// <param name="count">获取公告的条数</param>
 /// <returns>公告列表</returns>
 public static List <BulletinInfo_Query> GetNoticeList(int count)
 {
     _noticeList = WCFClients.ExternalClient.QueryDisplayBulletinCollection(BulletinAgent.Local, 0, 15, UserToken);
     if (_noticeList == null)
     {
         _noticeList = WCFClients.ExternalClient.QueryDisplayBulletinCollection(BulletinAgent.Local, 0, 15, UserToken);
     }
     return(_noticeList.BulletinList.OrderByDescending(a => a.IsPutTop).OrderByDescending(a => a.CreateTime).Take(count).ToList());
 }
Exemplo n.º 3
0
 /// <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);
     }
 }
Exemplo n.º 4
0
 /// <summary>
 /// 查询后台管理的公告列表
 /// </summary>
 public BulletinInfo_Collection QueryManagementBulletins(string key, EnableStatus status, int priority, int isPutTop, int pageIndex, int pageSize)
 {
     using (var bulletinManager = new BulletinManager())
     {
         int totalCount;
         var list       = bulletinManager.QueryAdminBulletinList(key, status, priority, isPutTop, pageIndex, pageSize, out totalCount);
         var collection = new BulletinInfo_Collection
         {
             TotalCount = totalCount,
         };
         collection.LoadList(list);
         return(collection);
     }
 }