示例#1
0
        /// <summary>
        /// 图片展示
        /// </summary>
        /// <param name="id">专辑Id</param>
        public ActionResult Show(string id, string page)
        {
            this.Internationalization();

            ImageModel model = new ImageModel();

            try
            {
                AlbumService albumService = new AlbumService();

                AlbumDetail albumDetail = albumService.GetAlbumDetail(Int32.Parse(id));

                if (albumDetail != null)
                {
                    int pageIndex = 1;
                    if (Int32.TryParse(page, out pageIndex))
                    {
                        model.Page = pageIndex;
                    }
                    else
                    {
                        model.Page = 1;
                    }
                    model.Album = albumDetail.Album;
                    model.Category = albumDetail.Category;
                    model.Images = albumDetail.Images;
                    model.Image = model.Images[model.Page - 1];
                    model.LastAlbum = albumDetail.LastAlbum;
                    model.NextAlbum = albumDetail.NextAlbum;
                    model.RelatedAlbum = albumDetail.RelatedAlbum;
                    model.RecommendAlbum = albumDetail.RecommendAlbum;
                    model.RelatedNews = new NewsService().GetRelatedNewsByAlbumId(model.Album.Id);
                }
            }
            catch (Exception e)
            {
                model = new ImageModel();
                model.Category = new Category();
                model.Album = new Album();
                model.Album.Title = e.Message;
                model.Album.Description = e.ToString();
            }

            model.Album = model.Album ?? new Album();
            model.Category = model.Category ?? new Category();
            //model.LastAlbum = model.LastAlbum ?? new Album();
            //model.NextAlbum = model.NextAlbum ?? new Album();
            model.RelatedAlbum = model.RelatedAlbum ?? new List<Album>();
            model.RecommendAlbum = model.RecommendAlbum ?? new List<Album>();

            return View(model);
        }
示例#2
0
        /// <summary>
        /// 类别及分页
        /// </summary>
        /// <param name="category">类别Id</param>
        /// <param name="page">类别分页页码</param>
        public ActionResult Category(string category, string page)
        {
            this.Internationalization();

            CategoryModel model = new CategoryModel();

            CategoryService categoryService = new CategoryService();
            AlbumService albumService = new AlbumService();

            model.Category = categoryService.GetCategoryById(category);
            model.PageSize = 30;//每页显示30张
            int pageIndex = 1;
            if (Int32.TryParse(page, out pageIndex))
            {
                model.PageIndex = pageIndex;
            }
            else
            {
                model.PageIndex = 1;
            }
            int count = 0;
            //分类列表
            model.Albums = albumService.GetAlbumByCategoryId(category, model.PageSize, model.PageIndex, out count);
            //分页
            if (model.Albums != null && model.Albums.Count > 0)
            {
                model.PageStep = 10; //页码10个
                model.AllCount = count;
                if (model.AllCount % model.PageSize == 0)
                {
                    model.PageCount = model.AllCount / model.PageSize;
                }
                else
                {
                    model.PageCount = model.AllCount / model.PageSize + 1;
                }
            }

            if (model.Category == null)
            {
                model.Category = new Category();
            }

            return View(model);
        }
示例#3
0
        /// <summary>
        /// 图片展示
        /// </summary>
        /// <param name="id">专辑Id</param>
        public ActionResult Show(string id)
        {
            this.Internationalization();

            ImageModel model = new ImageModel();

            try
            {
                AlbumService albumService = new AlbumService();

                AlbumDetail albumDetail = albumService.GetAlbumDetail(Int32.Parse(id));

                if (albumDetail != null)
                {
                    model.Album = albumDetail.Album;
                    model.Category = albumDetail.Category;
                    model.Images = albumDetail.Images;
                    model.LastAlbum = albumDetail.LastAlbum;
                    model.NextAlbum = albumDetail.NextAlbum;
                    model.RelatedAlbum = albumDetail.RelatedAlbum;
                    model.RecommendAlbum = albumDetail.RecommendAlbum;
                }
            }
            catch (Exception e)
            {
                model = new ImageModel();
                model.Category = new Category();
                model.Album = new Album();
                model.Album.Title = e.Message;
                model.Album.Description = e.ToString();
            }

            model.Album = model.Album ?? new Album();
            model.Category = model.Category ?? new Category();
            //model.LastAlbum = model.LastAlbum ?? new Album();
            //model.NextAlbum = model.NextAlbum ?? new Album();
            model.RelatedAlbum = model.RelatedAlbum ?? new List<Album>();
            model.RecommendAlbum = model.RecommendAlbum ?? new List<Album>();

            return View(model);
        }
示例#4
0
        public ActionResult Show(string id)
        {
            this.Internationalization();

            NewsModel model = new NewsModel();

            if (string.IsNullOrEmpty(id))
            {
                id = "1";
            }

            NewsService newsService = new NewsService();
            model.News = newsService.GetNewsById(Int32.Parse(id));

            //随机推荐
            //model.RecommendRandoms = newsService.GetRecommendRandom(6);

            //猜你喜欢
            //VideoService videoService = new VideoService();
            //model.Like = videoService.GetLike(16);

            //推荐新闻
            //model.RecommendNews = NewsService.GetRecommendRandom(10);

            //推荐小说
            //model.RecommendNovels = NovelService.GetRecommendRandom(10);

            if (model.News == null)
            {
                model.News = new Model.News();
                model.News.Title = "该新闻不存在或已被删除";
            }
            else
            {
                AlbumService albumService = new AlbumService();
                int outCount = 0;
                model.RelatedAlbum = albumService.GetAlbumList(string.Empty, model.News.Keywords, 8, 1, out outCount);
                model.RelatedNews = newsService.GetRelatedNews(model.News.Id);
            }

            return View(model);
        }
示例#5
0
        public ActionResult Show(string id)
        {
            this.Internationalization();

            NewsModel model = new NewsModel();

            if (string.IsNullOrEmpty(id))
            {
                id = "1";
            }

            NewsService newsService = new NewsService();
            model.News = newsService.GetNewsById(Int32.Parse(id));

            if (model.News == null)
            {
                model.News = new Model.News();
                model.News.Title = "该新闻不存在或已被删除";
            }
            else
            {
                AlbumService albumService = new AlbumService();
                int outCount = 0;
                model.RelatedAlbum = albumService.GetAlbumList(string.Empty, model.News.Keywords, 5, 1, out outCount);
                model.RelatedNews = newsService.GetRelatedNews(model.News.Id);
                model.LastNews = newsService.GetPrvNewsById(model.News.Id);
                model.NextNews = newsService.GetNextNewsById(model.News.Id);
            }

            return View(model);
        }
示例#6
0
文件: Cache.cs 项目: Oldsooh/XGDG
        /// <summary>
        /// 更新首页数据缓存
        /// </summary>
        public static void UpdateHomeData()
        {
            lock (HomeDataObj)
            {
                AlbumService albumService = new AlbumService();
                HomeData data = albumService.GetHomeData();

                homeData = new HomeModel();
                if (data != null)
                {
                    homeData.Slides = data.Slides;
                    homeData.NewUploads = data.NewUploads;
                    homeData.RecommendPictures = data.RecommendPictures;
                    //homeData.TopWomen = data.TopWomen;
                    //homeData.TopMen = data.TopMen;
                    homeData.RecommendPure = data.RecommendPure;
                    homeData.RecommendSexy = data.RecommendSexy;
                    homeData.RecommendStar = data.RecommendStar;
                    homeData.RecommendCostume = data.RecommendCostume;
                    homeData.RecommendStylishMan = data.RecommendStylishMan;
                }
            }
        }
示例#7
0
        //
        // GET: /Search/
        public ActionResult Index(string keywords, string page)
        {
            this.Internationalization();
            SearchModel model = new SearchModel();

            AlbumService albumService = new AlbumService();
            NewsService newsService = new NewsService();

            int tempPage = 1;

            if (!string.IsNullOrEmpty(page))
            {
                Int32.TryParse(page, out tempPage);
            }

            //专辑列表
            int tempCount = 0;
            int tempCount1 = 0;
            int pageSize = 20;

            model.NewsResult = newsService.GetNewsList(string.Empty, keywords, 6, tempPage, out tempCount);

            if (tempCount > 0 && model.NewsResult != null && model.NewsResult.Count > 6)
            {
                pageSize = 8;
            }

            model.AlbumResult = albumService.GetAlbumList(null, keywords, pageSize, tempPage, out tempCount1);
            model.TotalResultsCount = tempCount + tempCount1;
            model.TotalNewsCount = tempCount;
            model.TotalAlbumCount = tempCount1;

            if (tempCount1 == 0 && tempCount < 10)
            {
                model.RecommendAlbum = albumService.GetRecommendRandom(20);
            }

            tempCount = tempCount1 > tempCount ? tempCount1 : tempCount;
            //分页
            if ((model.AlbumResult != null && model.AlbumResult.Count > 0) || (model.NewsResult != null && model.NewsResult.Count > 0))
            {
                model.PageIndex = tempPage;
                model.PageSize = pageSize;
                model.PageStep = 10;
                model.AllCount = tempCount;
                if (model.AllCount % model.PageSize == 0)
                {
                    model.PageCount = model.AllCount / model.PageSize;
                }
                else
                {
                    model.PageCount = model.AllCount / model.PageSize + 1;
                }
            }

            //关键字
            model.Keywords = keywords;

            if (model.AlbumResult == null)
            {
                model.AlbumResult = new List<Album>();
            }

            return View(model);
        }
示例#8
0
文件: Cache.cs 项目: Oldsooh/XGDG
        /// <summary>
        /// 更新首页数据缓存
        /// </summary>
        public static void UpdateHomeData()
        {
            lock (HomeDataObj)
            {
                AlbumService albumService = new AlbumService();
                HomeData data = albumService.GetHomeData();

                homeData = new HomeModel();
                if (data != null)
                {
                    homeData.Slides = data.Slides;
                    homeData.NewUploads = data.NewUploads;
                    homeData.RecommendPictures = data.RecommendPictures;
                    homeData.TopWomen = data.TopWomen;
                    homeData.TopMen = data.TopMen;
                    homeData.RecommendPure = data.RecommendPure;
                    homeData.RecommendSexy = data.RecommendSexy;
                    homeData.RecommendStar = data.RecommendStar;
                    homeData.RecommendCostume = data.RecommendCostume;
                    homeData.RecommendStylishMan = data.RecommendStylishMan;
                }

                //homeData.Slides = albumService.GetAlbumBySlide();
                //homeData.NewUploads = albumService.GetAlbumByNew();
                //homeData.RecommendPictures = albumService.GetRecommendAlbumByCategoryId("All", 4);
                //homeData.TopWomen = albumService.GetRecommendAlbumByCategoryId("TopWomen", 7);
                //homeData.TopMen = albumService.GetRecommendAlbumByCategoryId("TopMen", 7);
                //homeData.RecommendPure = albumService.GetRecommendAlbumByCategoryId("Pure", 4);
                //homeData.RecommendSexy = albumService.GetRecommendAlbumByCategoryId("Sexy", 4);
                //homeData.RecommendStar = albumService.GetRecommendAlbumByCategoryId("Star", 4);
                //homeData.RecommendCostume = albumService.GetRecommendAlbumByCategoryId("Costume", 4);
                //homeData.RecommendStylishMan = albumService.GetRecommendAlbumByCategoryId("StylishMan", 4);
            }
        }
示例#9
0
        public ActionResult Index(string categoryId, string keywords, string page)
        {
            if (Session["UserId"] == null)
            {
                return Redirect("/admin/login");
            }

            AlbumService newsService = new AlbumService();

            int tempPage = 1;

            if (!string.IsNullOrEmpty(page))
            {
                Int32.TryParse(page, out tempPage);
            }

            ImagesModel model = new ImagesModel();

            //专辑类别列表
            model.Categories = categoryService.GetCategories("album");

            //当前选中专辑类别
            model.Category = new Category();
            if (!string.IsNullOrEmpty(categoryId))
            {
                if (model.Categories != null && model.Categories.Count > 0)
                {
                    foreach (var item in model.Categories)
                    {
                        if (item.Id == categoryId)
                        {
                            model.Category = item;
                        }
                    }
                }
            }

            //专辑列表
            int tempCount = 0;
            model.AlbumList = newsService.GetAlbumList(categoryId, keywords, 15, tempPage, out tempCount);
            //分页
            if (model.AlbumList != null && model.AlbumList.Count > 0)
            {
                model.PageIndex = tempPage;
                model.PageSize = 15;
                model.PageStep = 10;
                model.AllCount = tempCount;
                if (model.AllCount % model.PageSize == 0)
                {
                    model.PageCount = model.AllCount / model.PageSize;
                }
                else
                {
                    model.PageCount = model.AllCount / model.PageSize + 1;
                }
            }

            //关键字
            model.Keywords = keywords;

            return View(model);
        }