Esempio n. 1
0
        public ActionResult TopicDelete(int topicId)
        {
            var ret = dbContextService.Delete <WallPaperTopic>(topicId);

            WallPaperUIService.UpdateServerVersion <WallPaperTopic>();

            return(RedirectToAction("TopicList"));
        }
Esempio n. 2
0
        public ActionResult SubCategoryDelete(int subcategoryId)
        {
            var ret = dbContextService.Delete <WallPaperSubCategory>(subcategoryId);

            WallPaperUIService.UpdateServerVersion <WallPaperSubCategory>();

            return(RedirectToAction("SubCategoryList"));
        }
Esempio n. 3
0
        public ActionResult SubCategoryAdd()
        {
            var categorylist = WallPaperUIService.GetWallPaperCategoryList();

            ViewData["Categorylist"] = categorylist.GetSelectList();

            return(View());
        }
Esempio n. 4
0
        public ActionResult SubCategoryEdit(int subcategoryId)
        {
            var categorylist = WallPaperUIService.GetWallPaperCategoryList();

            ViewData["Categorylist"] = categorylist.GetSelectList();

            var subcategory = dbContextService.Single <WallPaperSubCategory>(subcategoryId);

            ViewData["IsUpdate"] = true;
            return(View("SubCategoryAdd", subcategory));
        }
Esempio n. 5
0
        public ActionResult WallPaperConfig(WallPaperConfigView model, FormCollection parameters)
        {
            var categoryIds    = parameters["category"].GetIds();
            var subcategoryIds = parameters["subcategory"].GetIds();
            var topicIds       = parameters["topic"].GetIds();
            var propertyIds    = parameters["property"].GetIds();

            var resourceFilePath = GetResourcePathThemeBase();

            WallPaperUIService.WallPaperConfig(model, categoryIds, subcategoryIds, topicIds, propertyIds, resourceFilePath);

            return(RedirectToAction("WallPaperList"));
        }
Esempio n. 6
0
        public ActionResult WallPaperConfig(int wallpaperId)
        {
            var resourceFilePath = GetResourcePathThemeBase();
            var wallpaper        = dbContextService.Single <WallPaper>(wallpaperId);

            ViewData["WallPaper"] = wallpaper;

            var config = new WallPaperConfigView();

            config.WallPaper = wallpaper;
            var similarRatio = WallPaperUIService.GetImageSimilarRatio(resourceFilePath, wallpaper);

            var originalWidth = WallPaperUIService.GetOriginalImagePixel(resourceFilePath, wallpaper).GetWidth();

            var categorylist    = WallPaperUIService.GetWallPaperCategoryList();
            var subcategorylist = WallPaperUIService.GetWallPaperSubCategoryList();
            var topiclist       = WallPaperUIService.GetWallPaperTopicList();
            var propertylist    = MobileUIService.GetSimilarMobilePropertyList(originalWidth, similarRatio);

            ViewData["Categorylist"]    = categorylist.GetSelectList();
            ViewData["SubCategorylist"] = subcategorylist.GetSelectList();
            ViewData["Topiclist"]       = topiclist.GetSelectList();
            ViewData["Propertylist"]    = propertylist.GetSelectList();

            var relatecategoryIds    = WallPaperUIService.GetRelateCategoryIds(wallpaperId).ToList();
            var relatesubcategoryIds = WallPaperUIService.GetRelateSubCategoryIds(wallpaperId).ToList();
            var relatetopicIds       = WallPaperUIService.GetRelateTopicIds(wallpaperId).ToList();
            var relatepropertyIds    = WallPaperUIService.GetRelateMobilePropertyIds(wallpaperId).ToList();

            var thumbnailNamelist = WallPaperUIService.GetImageNameListByMobileProperty(Const.WALLPAPER_THUMBNAIL, wallpaper, relatepropertyIds).ToList();
            var originalNamelist  = WallPaperUIService.GetImageNameListByMobileProperty(Const.WALLPAPER_ORIGINAL, wallpaper, relatepropertyIds).ToList();

            ViewData["ThumbnailNames"] = thumbnailNamelist;
            ViewData["OriginalNames"]  = originalNamelist;

            ViewData["RelateCategoryIds"]    = relatecategoryIds;
            ViewData["RelateSubCategoryIds"] = relatesubcategoryIds;
            ViewData["RelateTopicIds"]       = relatetopicIds;
            ViewData["RelatePropertyIds"]    = relatepropertyIds;

            config.RelateCategoryIds       = relatecategoryIds;
            config.RelateSubCategoryIds    = relatesubcategoryIds;
            config.RelateTopicIds          = relatetopicIds;
            config.RelateMobilePropertyIds = relatepropertyIds;
            config.ThumbnailNames          = thumbnailNamelist;
            config.OriginalNames           = originalNamelist;

            return(View(config));
        }
Esempio n. 7
0
        public ActionResult WallPaperSearchResult(int?page)
        {
            int pageNum   = page.HasValue ? page.Value : 1;
            var searchKey = Request.QueryString["textfield"];

            var wallpaperResult = (from p in WallPaperUIService.GetWallPaperList(searchKey)
                                   select new WallPaper
            {
                Id = p.Id,
                Title = p.Title,
                DownloadNumber = p.DownloadNumber,
                PublishTime = p.PublishTime,
                Status = p.Status
            }).AsQueryable <WallPaper>();
            var wallpaperlist = wallpaperResult.ToPagedList <WallPaper>(pageNum, pageSize);

            ViewData["WallPaperlist"] = wallpaperlist;
            ViewData["pageNum"]       = pageNum;
            ViewData["TotalCount"]    = wallpaperlist.Count;
            return(View("WallPaperList", wallpaperlist));
        }
Esempio n. 8
0
        public ActionResult CategoryEdit(WallPaperCategory model, HttpPostedFileBase logoFile)
        {
            var category = dbContextService.Single <WallPaperCategory>(model.Id);

            category.Name           = model.Name;
            category.Status         = model.Status;
            category.OrderNumber    = model.OrderNumber;
            category.Comment        = model.Comment;
            category.CreateDateTime = DateTime.Now;

            var logoFilePath = GetThemeLogoFilePath <WallPaperCategory>(model, logoFile);

            if (!string.IsNullOrEmpty(logoFilePath))
            {
                category.CategoryLogoUrl = string.Format("{0}{1}", THEME_LOGO_IMAGE_PREFIX, Path.GetFileName(logoFilePath));
            }

            dbContextService.Update <WallPaperCategory>(category);
            WallPaperUIService.UpdateServerVersion <WallPaperCategory>();

            return(RedirectToAction("CategoryList"));
        }
Esempio n. 9
0
        public ActionResult TopicEdit(WallPaperTopic model, HttpPostedFileBase logoFile)
        {
            var topic = dbContextService.Single <WallPaperTopic>(model.Id);

            topic.Name           = model.Name;
            topic.Status         = model.Status;
            topic.OrderNumber    = model.OrderNumber;
            topic.Summary        = model.Summary;
            topic.Comment        = model.Comment;
            topic.CreateDateTime = DateTime.Now;

            var logoFilePath = GetThemeLogoFilePath <WallPaperTopic>(model, logoFile);

            if (!string.IsNullOrEmpty(logoFilePath))
            {
                topic.TopicLogoUrl = string.Format("{0}{1}", THEME_LOGO_IMAGE_PREFIX, Path.GetFileName(logoFilePath));
            }

            dbContextService.Update <WallPaperTopic>(topic);
            WallPaperUIService.UpdateServerVersion <WallPaperTopic>();

            return(RedirectToAction("TopicList"));
        }
Esempio n. 10
0
        public ActionResult CategoryAdd(WallPaperCategory model)
        {
            var exist = dbContextService.Exists <WallPaperCategory>(x => x.Name == model.Name);

            if (exist)
            {
                TempData["errorMsg"] = "该分类已经存在!";
                return(View());
            }

            var logoFile     = Request.Files[Request.Files.Keys.Count - 1];
            var logoFilePath = GetThemeLogoFilePath <WallPaperCategory>(model, logoFile);

            if (!string.IsNullOrEmpty(logoFilePath))
            {
                model.CategoryLogoUrl = string.Format("{0}{1}", THEME_LOGO_IMAGE_PREFIX, Path.GetFileName(logoFilePath));
            }

            var ret = dbContextService.Add <WallPaperCategory>(model);

            WallPaperUIService.UpdateServerVersion <WallPaperCategory>();

            return(RedirectToAction("CategoryList"));
        }