예제 #1
0
 /// <summary>
 /// 在线留言
 /// </summary>
 /// <returns></returns>
 public ActionResult Index(int page = 1)
 {
     GuestbookQuery guestBookQuery = new GuestbookQuery();
     guestBookQuery.JournalID = JournalID;
     guestBookQuery.CurrentPage = page;
     guestBookQuery.PageSize = 15;
     Pager<GuestbookEntity> pageGuestBook = new Pager<GuestbookEntity>();
     try
     {
         ISiteConfigFacadeService service = ServiceContainer.Instance.Container.Resolve<ISiteConfigFacadeService>();
         pageGuestBook = service.GetSiteGuestBookPageList(guestBookQuery);
         if (pageGuestBook != null)
         {
             ViewBag.PagerInfo = Utils.GetPageNumbers(page, pageGuestBook.TotalPage, "/Message/", 5);
         }
     }
     catch (Exception ex)
     {
         WKT.Log.LogProvider.Instance.Error("获取留言列表出现异常:" + ex.Message);
     }
     return View(pageGuestBook);
 }
예제 #2
0
 /// <summary>
 /// 将查询实体转换为Where语句
 /// <param name="query">查询实体</param>
 /// <returns>获取Where语句,不包含Where</returns>
 /// </summary>
 public string GuestbookQueryToSQLWhere(GuestbookQuery query)
 {
     return string.Empty;
 }
예제 #3
0
 /// <summary>
 /// 将查询实体转换为Order语句
 /// <param name="query">查询实体</param>
 /// <returns>获取Order语句,不包含Order</returns>
 /// </summary>
 public string GuestbookQueryToSQLOrder(GuestbookQuery query)
 {
     return " MessageID DESC";
 }
예제 #4
0
 public Pager<GuestbookEntity> GetGuestbookPageList(GuestbookQuery query)
 {
     int recordCount=0;
     string whereSQL=GuestbookQueryToSQLWhere(query);
     string orderBy=GuestbookQueryToSQLOrder(query);
     DataSet ds=db.GetPagingData("Guestbook","MessageID,JournalID,PMessageID,UserName,Email,Tel,Title,MessageContent,IP,AddDate",orderBy,whereSQL,query.CurrentPage,query.PageSize,out recordCount);
     Pager<GuestbookEntity>  pager=new Pager<GuestbookEntity>();
     if(ds!=null && ds.Tables.Count>0)
     {
          pager.ItemList= MakeGuestbookList(ds.Tables[0]);
     }
     pager.CurrentPage=query.CurrentPage;
     pager.PageSize=query.PageSize;
     pager.TotalRecords=recordCount;
     return pager;
 }
예제 #5
0
 public List<GuestbookEntity> GetGuestbookList(GuestbookQuery query)
 {
     List<GuestbookEntity> list = new List<GuestbookEntity>();
     StringBuilder sqlCommandText = new StringBuilder();
     sqlCommandText.Append("SELECT MessageID,JournalID,PMessageID,UserName,Email,Tel,Title,MessageContent,IP,AddDate FROM dbo.Guestbook WITH(NOLOCK)");
     string whereSQL = GuestbookQueryToSQLWhere(query);
     string orderBy=GuestbookQueryToSQLOrder(query);
     if(!string.IsNullOrEmpty(whereSQL)) sqlCommandText.Append(" WHERE " + whereSQL);
     if(!string.IsNullOrEmpty(orderBy)) sqlCommandText.Append(" ORDER BY " + orderBy);
     DbCommand cmd = db.GetSqlStringCommand(sqlCommandText.ToString());
     using(IDataReader dr = db.ExecuteReader(cmd))
     {
         list = MakeGuestbookList(dr);
     }
     return list;
 }
예제 #6
0
 /// <summary>
 /// 分页获取符合查询条件的数据
 /// </summary>
 /// <param name="guestbookQuery">GuestbookQuery查询实体对象</param>
 /// <returns>Pager<GuestbookEntity></returns>
 public Pager<GuestbookEntity> GetGuestbookPageList(GuestbookQuery guestbookQuery)
 {
     return GuestbookBusProvider.GetGuestbookPageList(guestbookQuery);
 }
예제 #7
0
 /// <summary>
 /// 获取所有符合查询条件的数据
 /// </summary>
 /// <param name="guestbookQuery">GuestbookQuery查询实体对象</param>
 /// <returns>List<GuestbookEntity></returns>
 public List<GuestbookEntity> GetGuestbookList(GuestbookQuery guestbookQuery)
 {
     return GuestbookBusProvider.GetGuestbookList(guestbookQuery);
 }
예제 #8
0
 /// <summary>
 /// 获取所有符合查询条件的数据
 /// </summary>
 /// <param name="guestbookQuery">GuestbookQuery查询实体对象</param>
 /// <returns>List<GuestbookEntity></returns>
 public List<GuestbookEntity> GetGuestbookList(GuestbookQuery guestbookQuery)
 {
     return GuestbookDataAccess.Instance.GetGuestbookList(guestbookQuery);
 }
예제 #9
0
 /// <summary>
 /// 将查询实体转换为Where语句
 /// <param name="query">查询实体</param>
 /// <returns>获取Where语句,不包含Where</returns>
 /// </summary>
 public string GuestbookQueryToSQLWhere(GuestbookQuery query)
 {
     StringBuilder strFilter = new StringBuilder("JournalID=" + query.JournalID);
     return strFilter.ToString();
 }
 public Pager<GuestbookEntity> GetGuestBookPageList(GuestbookQuery query)
 {
     IGuestbookService service = ServiceContainer.Instance.Container.Resolve<IGuestbookService>();
     Pager<GuestbookEntity> pager = service.GetGuestbookPageList(query);
     return pager;
 }
 /// <summary>
 /// 获取留言分页数据
 /// </summary>
 /// <param name="query"></param>
 /// <returns></returns>
 public Pager<GuestbookEntity> GetSiteGuestBookPageList(GuestbookQuery query)
 {
     HttpClientHelper clientHelper = new HttpClientHelper();
     Pager<GuestbookEntity> pager = clientHelper.Post<Pager<GuestbookEntity>, GuestbookQuery>(GetAPIUrl(APIConstant.SITE_GUESTBOOKIE_GETPAGELIST), query);
     return pager;
 }