public void WallPaperConfig(WallPaperConfigView model, List <int> categoryIds, List <int> subcategoryIds, List <int> topicIds, List <int> propertyIds, string resourceFilePath) { var wallpaper = model.WallPaper.MakeSureNotNull() as WallPaper; var outcategoryIds = new List <int>(); var outsubcategoryIds = new List <int>(); var outtopicIds = new List <int>(); var outpropertyIds = new List <int>(); var incategoryIds = categoryIds.InIds(model.RelateCategoryIds, out outcategoryIds); var insubcategoryIds = subcategoryIds.InIds(model.RelateSubCategoryIds, out outsubcategoryIds); var intopicIds = topicIds.InIds(model.RelateTopicIds, out outtopicIds); var inpropertyIds = propertyIds.InIds(model.RelateMobilePropertyIds, out outpropertyIds); AddRelateCategory(incategoryIds, wallpaper.Id); AddRelateTopic(intopicIds, wallpaper.Id); AddRelateMobileProperty(inpropertyIds, wallpaper.Id); UpdateRelateCategory(outcategoryIds, wallpaper.Id); UpdateRelateSubCategory(outsubcategoryIds, wallpaper.Id); UpdateRelateTopic(outtopicIds, wallpaper.Id); UpdateRelateMobileProperty(outpropertyIds, wallpaper.Id); try { Upload(wallpaper, inpropertyIds, resourceFilePath); } catch (Exception ex) { LogHelper.Error(ex.Message); } }
public ActionResult Preview(WallPaperConfigView model, string type) { var imageViewlist = new List <ImageView>(); var thumbnailImagePrefix = ConfigKeys.TYD_WALLPAPER_THUMBNAIL_IMAGE_PREFIX.ConfigValue(); var originalImagePrefix = ConfigKeys.TYD_WALLPAPER_ORIGINAL_IMAGE_PREFIX.ConfigValue(); switch (type) { case Const.WALLPAPER_THUMBNAIL: foreach (var item in model.ThumbnailNames) { var imageView = new ImageView(); imageView.ImagePath = string.Format("{0}{1}", thumbnailImagePrefix, item); imageViewlist.Add(imageView); } break; case Const.WALLPAPER_ORIGINAL: foreach (var item in model.OriginalNames) { var urlView = new ImageView(); urlView.ImagePath = string.Format("{0}{1}", originalImagePrefix, item); imageViewlist.Add(urlView); } break; default: break; } ViewData["Imagelist"] = imageViewlist; return(View()); }
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")); }
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)); }