public ActionResult AddHomeFloorDetail(long id = 0L)
        {
            string          str;
            string          str1;
            HomeFloorDetail homeFloorDetail = new HomeFloorDetail()
            {
                Id = 0
            };
            HomeFloorInfo homeFloor = ServiceHelper.Create <IFloorService>().GetHomeFloor(id);

            if (homeFloor != null)
            {
                homeFloorDetail.Id        = homeFloor.Id;
                homeFloorDetail.TextLinks =
                    from item in homeFloor.FloorTopicInfo
                    where item.TopicType == Position.Top
                    select new HomeFloorDetail.TextLink()
                {
                    Id   = item.Id,
                    Name = item.TopicName,
                    Url  = item.Url
                };
                homeFloorDetail.ProductLinks =
                    from item in homeFloor.FloorTopicInfo
                    where item.TopicType != Position.Top
                    select new HomeFloorDetail.TextLink()
                {
                    Id   = (long)item.TopicType,
                    Name = item.Url,
                    Url  = item.TopicImage
                } into i
                orderby i.Id
                select i;
            }
            else
            {
                homeFloor = new HomeFloorInfo();
                List <HomeFloorDetail.TextLink> textLinks = new List <HomeFloorDetail.TextLink>();
                for (int num = 0; num < 10; num++)
                {
                    HomeFloorDetail.TextLink textLink = new HomeFloorDetail.TextLink()
                    {
                        Id   = num,
                        Name = "",
                        Url  = ""
                    };
                    textLinks.Add(textLink);
                }
                homeFloorDetail.ProductLinks = textLinks;
            }
            dynamic viewBag = base.ViewBag;

            str = (homeFloor == null ? "" : homeFloor.FloorName);
            viewBag.FloorName = str;
            dynamic obj = base.ViewBag;

            str1        = (homeFloor == null ? "" : homeFloor.SubName);
            obj.SubName = str1;
            return(View(homeFloorDetail));
        }
예제 #2
0
        /// <summary>
        /// 楼层四
        /// </summary>
        /// <param name="id"></param>
        /// <returns></returns>
        public ActionResult AddHomeFloorDetail4(long id = 0)
        {
            var homeFloorDetail = new HomeFloorDetail()
            {
                Id = 0
            };
            var homeFloor = _iFloorService.GetHomeFloor(id);

            if (homeFloor == null)
            {
                homeFloor = new HomeFloorInfo();
                var ProductLinks = new List <HomeFloorDetail.TextLink>();
                for (int i = 0; i < 10; i++)
                {
                    ProductLinks.Add(new HomeFloorDetail.TextLink
                    {
                        Id   = i,
                        Name = "",
                        Url  = ""
                    });
                }
                homeFloorDetail.ProductLinks = ProductLinks;
                homeFloorDetail.StyleLevel   = 3;
            }
            else
            {
                homeFloorDetail.Id = homeFloor.Id;

                //填充文字链接
                homeFloorDetail.TextLinks = homeFloor.FloorTopicInfo.Where(item => item.TopicType == Position.Top).Select(item => new HomeFloorDetail.TextLink()
                {
                    Id   = item.Id,
                    Name = item.TopicName,
                    Url  = item.Url
                });

                homeFloorDetail.ProductLinks = homeFloor.FloorTopicInfo
                                               .Where(item => item.TopicType != Position.Top)
                                               .Select(item => new HomeFloorDetail.TextLink()
                {
                    Id   = (long)item.TopicType,
                    Name = item.Url,
                    Url  = item.TopicImage,
                }).OrderBy(i => i.Id);
            }


            ViewBag.FloorName = homeFloor == null ? "" : homeFloor.FloorName;
            ViewBag.SubName   = homeFloor == null ? "" : homeFloor.SubName;
            return(View(homeFloorDetail));
        }
        public ActionResult AddHomeFloorDetail2(long id = 0L)
        {
            string          str;
            string          str1;
            HomeFloorDetail homeFloorDetail = new HomeFloorDetail()
            {
                Id = 0
            };
            HomeFloorInfo homeFloor = ServiceHelper.Create <IFloorService>().GetHomeFloor(id);

            if (homeFloor != null)
            {
                homeFloorDetail.Id             = homeFloor.Id;
                homeFloorDetail.DefaultTabName = homeFloor.DefaultTabName;
                homeFloorDetail.TextLinks      =
                    from item in homeFloor.FloorTopicInfo
                    where item.TopicType == Position.Top
                    select new HomeFloorDetail.TextLink()
                {
                    Id   = item.Id,
                    Name = item.TopicName,
                    Url  = item.Url
                };
                homeFloorDetail.ProductLinks =
                    from item in homeFloor.FloorTopicInfo
                    where item.TopicType != Position.Top
                    select new HomeFloorDetail.TextLink()
                {
                    Id   = (long)item.TopicType,
                    Name = item.Url,
                    Url  = item.TopicImage
                } into i
                orderby i.Id
                select i;
                homeFloorDetail.Tabs =
                    from item in homeFloor.Himall_FloorTabls
                    where item.FloorId == homeFloor.Id
                    select item into p
                    orderby p.Id
                    select p into item
                    select new HomeFloorDetail.Tab()
                {
                    Id     = item.Id,
                    Detail =
                        from detail in item.Himall_FloorTablDetails
                        where detail.TabId == item.Id
                        select detail into p
                        select new HomeFloorDetail.ProductDetail()
                    {
                        Id        = p.Id,
                        ProductId = p.ProductId
                    },
                    Name  = item.Name,
                    Count = (
                        from detail in item.Himall_FloorTablDetails
                        where detail.TabId == item.Id
                        select detail).Count(),
                    Ids = ArrayToString((
                                            from detail in item.Himall_FloorTablDetails
                                            where detail.TabId == item.Id
                                            select detail into p
                                            select p.ProductId).ToArray())
                };
            }
            else
            {
                homeFloor = new HomeFloorInfo();
                List <HomeFloorDetail.TextLink> textLinks = new List <HomeFloorDetail.TextLink>();
                for (int num = 0; num < 12; num++)
                {
                    HomeFloorDetail.TextLink textLink = new HomeFloorDetail.TextLink()
                    {
                        Id   = num,
                        Name = "",
                        Url  = ""
                    };
                    textLinks.Add(textLink);
                }
                homeFloorDetail.ProductLinks = textLinks;
                homeFloorDetail.StyleLevel   = 1;
            }
            if (homeFloorDetail.Tabs == null)
            {
                homeFloorDetail.Tabs = new List <HomeFloorDetail.Tab>();
            }
            dynamic viewBag = base.ViewBag;

            str = (homeFloor == null ? "" : homeFloor.FloorName);
            viewBag.FloorName = str;
            dynamic obj = base.ViewBag;

            str1        = (homeFloor == null ? "" : homeFloor.SubName);
            obj.SubName = str1;
            return(View(homeFloorDetail));
        }
        public JsonResult SaveHomeFloorDetail(string floorDetail)
        {
            HomeFloorDetail homeFloorDetail = JsonConvert.DeserializeObject <HomeFloorDetail>(floorDetail);
            HomeFloorInfo   homeFloorInfo   = new HomeFloorInfo()
            {
                Id             = homeFloorDetail.Id,
                FloorName      = homeFloorDetail.Name,
                SubName        = homeFloorDetail.SubName,
                DefaultTabName = homeFloorDetail.DefaultTabName,
                StyleLevel     = homeFloorDetail.StyleLevel,
                FloorBrandInfo = (
                    from item in homeFloorDetail.Brands
                    select new FloorBrandInfo()
                {
                    BrandId = item.Id,
                    FloorId = homeFloorDetail.Id
                }).ToList(),
                FloorTopicInfo = (
                    from i in homeFloorDetail.TextLinks
                    select new FloorTopicInfo()
                {
                    FloorId = homeFloorDetail.Id,
                    TopicImage = "",
                    TopicName = i.Name,
                    Url = i.Url,
                    TopicType = Position.Top
                }).ToList()
            };
            HomeFloorInfo         list            = homeFloorInfo;
            List <FloorTopicInfo> floorTopicInfos = (
                from i in homeFloorDetail.ProductLinks
                select new FloorTopicInfo()
            {
                FloorId = homeFloorDetail.Id,
                TopicImage = (string.IsNullOrWhiteSpace(i.Name) ? "" : i.Name),
                TopicName = "",
                Url = i.Url,
                TopicType = (Position)((int)i.Id)
            }).ToList();

            foreach (FloorTopicInfo floorTopicInfo in floorTopicInfos)
            {
                list.FloorTopicInfo.Add(floorTopicInfo);
            }
            if (homeFloorDetail.Tabs != null)
            {
                list.Himall_FloorTabls = (
                    from item in homeFloorDetail.Tabs
                    select new FloorTablsInfo()
                {
                    Id = item.Id,
                    Name = item.Name,
                    FloorId = homeFloorDetail.Id,
                    Himall_FloorTablDetails = (
                        from d in item.Detail
                        select new FloorTablDetailsInfo()
                    {
                        Id = d.Id,
                        TabId = item.Id,
                        ProductId = d.ProductId
                    }).ToList()
                }).ToList();
            }
            ServiceHelper.Create <IFloorService>().UpdateHomeFloorDetail(list);
            return(Json(new { success = true }));
        }
예제 #5
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="id"></param>
        /// <returns></returns>
        public ActionResult AddHomeFloorDetail9(long id = 0)
        {
            var homeFloorDetail = new HomeFloorDetail()
            {
                Id = 0
            };
            var homeFloor = _iFloorService.GetHomeFloor(id);

            if (homeFloor == null)
            {
                homeFloor = new HomeFloorInfo();
                var ProductLinks = new List <HomeFloorDetail.TextLink>();
                for (int i = 0; i < 13; i++)
                {
                    ProductLinks.Add(new HomeFloorDetail.TextLink
                    {
                        Id   = i,
                        Name = "",
                        Url  = ""
                    });
                }
                homeFloorDetail.ProductLinks = ProductLinks;
                homeFloorDetail.StyleLevel   = 1;
            }
            else
            {
                homeFloorDetail.Id             = homeFloor.Id;
                homeFloorDetail.DefaultTabName = homeFloor.DefaultTabName;

                homeFloorDetail.ProductLinks = homeFloor.FloorTopicInfo
                                               .Where(item => item.TopicType != Position.Top)
                                               .Select(item => new HomeFloorDetail.TextLink()
                {
                    Id   = (long)item.TopicType,
                    Name = item.Url,
                    Url  = item.TopicImage,
                }).OrderBy(i => i.Id);

                //填充文字链接
                homeFloorDetail.TextLinks = homeFloor.FloorTopicInfo.Where(item => item.TopicType == Position.Top).Select(item => new HomeFloorDetail.TextLink()
                {
                    Id   = item.Id,
                    Name = item.TopicName,
                    Url  = item.Url
                });
                homeFloorDetail.Tabs = homeFloor.Himall_FloorTabls
                                       .Where(item => item.FloorId == homeFloor.Id).OrderBy(p => p.Id)
                                       .Select(item => new HomeFloorDetail.Tab()
                {
                    Id     = item.Id,
                    Detail = item.Himall_FloorTablDetails.Where(detail => detail.TabId == item.Id)
                             .Select(p => new HomeFloorDetail.ProductDetail()
                    {
                        Id        = p.Id,
                        ProductId = p.ProductId
                    }),
                    Name  = item.Name,
                    Count = item.Himall_FloorTablDetails.Where(detail => detail.TabId == item.Id).Count(),
                    Ids   = ArrayToString(item.Himall_FloorTablDetails.Where(detail => detail.TabId == item.Id).Select(p => p.ProductId).ToArray())
                });
            }

            if (homeFloorDetail.Tabs == null)
            {
                homeFloorDetail.Tabs = new List <HomeFloorDetail.Tab>();
            }
            ViewBag.FloorName = homeFloor == null ? "" : homeFloor.FloorName;
            ViewBag.SubName   = homeFloor == null ? "" : homeFloor.SubName;
            return(View(homeFloorDetail));
        }
예제 #6
0
        /// <summary>
        /// 楼层3
        /// </summary>
        /// <param name="id"></param>
        /// <returns></returns>
        public ActionResult AddHomeFloorDetail3(long id = 0)
        {
            var homeFloorDetail = new HomeFloorDetail()
            {
                Id = 0
            };
            var homeFloor = _iFloorService.GetHomeFloor(id);

            if (homeFloor == null)
            {
                homeFloor = new HomeFloorInfo();
                var ProductLinks = new List <HomeFloorDetail.TextLink>();
                for (int i = 0; i < 1; i++)
                {
                    ProductLinks.Add(new HomeFloorDetail.TextLink
                    {
                        Id   = i,
                        Name = "",
                        Url  = ""
                    });
                }
                homeFloorDetail.ProductLinks = ProductLinks;
                homeFloorDetail.StyleLevel   = 2;
            }
            else
            {
                homeFloorDetail.Id             = homeFloor.Id;
                homeFloorDetail.DefaultTabName = homeFloor.DefaultTabName;

                //图片
                homeFloorDetail.ProductLinks = homeFloor.FloorTopicInfo
                                               .Where(item => item.TopicType != Position.Top)
                                               .Select(item => new HomeFloorDetail.TextLink()
                {
                    Id   = (long)item.TopicType,
                    Name = item.Url,
                    Url  = item.TopicImage,
                }).OrderBy(i => i.Id);


                //商品
                homeFloorDetail.ProductModules = homeFloor.FloorProductInfo
                                                 .Where(item => item.FloorId == homeFloor.Id).OrderBy(p => p.Id)
                                                 .Select(item => new HomeFloorDetail.ProductModule()
                {
                    Id          = item.Id,
                    price       = item.ProductInfo.MinSalePrice,
                    ProductId   = item.ProductId,
                    productImg  = HimallIO.GetProductSizeImage(item.ProductInfo.ImagePath, 1, (int)ImageSize.Size_50),
                    productName = item.ProductInfo.ProductName,
                    Tab         = item.Tab
                });
            }

            if (homeFloorDetail.Tabs == null)
            {
                homeFloorDetail.Tabs = new List <HomeFloorDetail.Tab>();
            }
            ViewBag.FloorName = homeFloor == null ? "" : homeFloor.FloorName;
            ViewBag.SubName   = homeFloor == null ? "" : homeFloor.SubName;
            return(View(homeFloorDetail));
        }