Пример #1
0
 public ActionResult WaterfallPhotoListData(string keyword, string type, int startIndex)
 {
     keyword = InjectionFilter.Filter(keyword);
     Maticsoft.BLL.SNS.Photos photos = new Maticsoft.BLL.SNS.Photos();
     PhotoList model = new PhotoList();
     ((dynamic) base.ViewBag).BasePageSize = this._basePageSize;
     startIndex = (startIndex > 1) ? (startIndex + 1) : 0;
     int endIndex = (startIndex > 1) ? ((startIndex + this._waterfallDetailCount) - 1) : this._waterfallDetailCount;
     if (photos.GetSearchCountByQ(keyword) < 1)
     {
         return new EmptyResult();
     }
     model.PhotoListWaterfall = photos.GetListByKeyWord(keyword, type, startIndex, endIndex, "");
     string valueByCache = Maticsoft.BLL.SysManage.ConfigSystem.GetValueByCache("SNSIsStatic");
     if ((model.PhotoListWaterfall != null) && (model.PhotoListWaterfall.Count > 0))
     {
         foreach (PostContent content in model.PhotoListWaterfall)
         {
             if (valueByCache != "true")
             {
                 content.StaticUrl = (string) ((((dynamic) base.ViewBag).BasePath + "Photo/Detail/") + content.TargetId);
                 continue;
             }
             content.StaticUrl = string.IsNullOrWhiteSpace(content.StaticUrl) ? ((string) ((((dynamic) base.ViewBag).BasePath + "Photo/Detail/") + content.TargetId)) : content.StaticUrl;
         }
     }
     return base.View(base.CurrentThemeViewPath + "/Photo/PhotoListWaterfall.cshtml", model);
 }
Пример #2
0
 public ActionResult Photo(int? pageIndex)
 {
     ((dynamic) base.ViewBag).Title = "图片搜索";
     string inputString = string.IsNullOrWhiteSpace(base.Request.Params["keyword"]) ? "" : base.Server.UrlDecode(base.Request.Params["keyword"]);
     string orderby = string.IsNullOrWhiteSpace(base.Request.Params["type"]) ? "hot" : base.Request.Params["type"];
     inputString = InjectionFilter.Filter(inputString);
     this.LogKeyWord(inputString);
     PhotoList model = new PhotoList();
     Maticsoft.BLL.SNS.Photos photos = new Maticsoft.BLL.SNS.Photos();
     int pageSize = this._basePageSize + this._waterfallSize;
     ((dynamic) base.ViewBag).BasePageSize = this._basePageSize;
     pageIndex = new int?((pageIndex.HasValue && (pageIndex.Value > 1)) ? pageIndex.Value : 1);
     int startIndex = (pageIndex.Value > 1) ? (((pageIndex.Value - 1) * pageSize) + 1) : 0;
     int endIndex = (pageIndex.Value > 1) ? ((startIndex + this._basePageSize) - 1) : this._basePageSize;
     int searchCountByQ = 0;
     searchCountByQ = photos.GetSearchCountByQ(inputString);
     ((dynamic) base.ViewBag).CurrentPageAjaxStartIndex = endIndex;
     int num5 = pageIndex.Value * pageSize;
     ((dynamic) base.ViewBag).CurrentPageAjaxEndIndex = (num5 > searchCountByQ) ? searchCountByQ : num5;
     if (searchCountByQ >= 1)
     {
         ((dynamic) base.ViewBag).sequence = orderby;
         int? nullable = pageIndex;
         model.PhotoPagedList = photos.GetListByKeyWord(inputString, orderby, startIndex, endIndex, "").ToPagedList<PostContent>(nullable.HasValue ? nullable.GetValueOrDefault() : 1, pageSize, new int?(searchCountByQ));
         string valueByCache = Maticsoft.BLL.SysManage.ConfigSystem.GetValueByCache("SNSIsStatic");
         if ((model.PhotoPagedList != null) && (model.PhotoPagedList.Count > 0))
         {
             foreach (PostContent content in model.PhotoPagedList)
             {
                 if (valueByCache != "true")
                 {
                     content.StaticUrl = (string) ((((dynamic) base.ViewBag).BasePath + "Photo/Detail/") + content.TargetId);
                     continue;
                 }
                 content.StaticUrl = string.IsNullOrWhiteSpace(content.StaticUrl) ? ((string) ((((dynamic) base.ViewBag).BasePath + "Photo/Detail/") + content.TargetId)) : content.StaticUrl;
             }
         }
         if (base.Request.IsAjaxRequest())
         {
             return this.PartialView("PhotoList", model);
         }
     }
     return base.View(model);
 }