Example #1
0
        public ActionResult List()
        {
            WishList wl = wishListRepository.GetForUser(this.ProxyLoggedUser);

            if (wl == null)
            {
                wl = new WishList();
            }

            ViewData["styleAlerts"] = contentService.GetRandomStyleAlerts(this.ProxyFlavors);
            return(View(wl));
        }
Example #2
0
        private void GetGarmentsListData(RegisteredUser user, GarmentsListData gld)
        {
            ViewData["UserName"]    = User.Identity.Name;
            ViewData["styleAlerts"] = contentService.GetRandomStyleAlerts(1);
            gld.ForEdit             = true;
            gld.Controller          = "GarmentSelector";
            gld.Action     = "GoToMyGarments";
            gld.EventTypes = user.EventTypes;
            foreach (ClosetGarment closetGarment in closetRepository.GetGarmentsForUser(user))
            {
                gld.MyGarmentsIds += closetGarment.Garment.Id + ",";
                gld.MyGarments.Add(closetGarment);
            }
            if (!string.IsNullOrEmpty(gld.MyGarmentsIds))
            {
                gld.MyGarmentsIds = gld.MyGarmentsIds.TrimEnd(',');
            }

            WishList wl = wishListRepository.GetForUser(user);

            if (wl != null)
            {
                foreach (WishGarment wishGarment in wl.Garments)
                {
                    gld.MyWishGarmentsIds += wishGarment.Garment.Id + ",";
                    gld.MyWishGarments.Add(wishGarment);
                }
                if (!string.IsNullOrEmpty(gld.MyWishGarmentsIds) && gld.MyWishGarmentsIds.Length > 0)
                {
                    gld.MyWishGarmentsIds = gld.MyWishGarmentsIds.TrimEnd(',');
                }
            }

            if (!string.IsNullOrEmpty(gld.NewGarmentsIds))
            {
                List <int> newGarmentsIds = new List <int>();
                foreach (string id in gld.NewGarmentsIds.Split(new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries))
                {
                    if (!string.IsNullOrEmpty(id) && id != " ")
                    {
                        newGarmentsIds.Add(Convert.ToInt32(id));
                    }
                }
                gld.NewGarments = garmentRepository.GetByIds(newGarmentsIds);
            }

            if (!string.IsNullOrEmpty(gld.NewWishGarmentsIds))
            {
                List <int> newWishGarmentsIds = new List <int>();
                foreach (string id in gld.NewWishGarmentsIds.Split(new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries))
                {
                    if (!string.IsNullOrEmpty(id) && id != " ")
                    {
                        newWishGarmentsIds.Add(Convert.ToInt32(id));
                    }
                }
                gld.NewWishGarments = garmentRepository.GetByIds(newWishGarmentsIds);
            }

            //if (gld.FashionFlavors != null)
            {
                #region Fix For Categories Order
                List <Silouhette> silouhettes = silouhetteRepository.ListEnabled() as List <Silouhette>;
                List <Silouhette> temp        = new List <Silouhette>();
                temp.AddRange(silouhettes.FindAll(x => x.Category.Id < 10));
                temp.AddRange(silouhettes.FindAll(x => x.Category.Id.Equals(12)));
                temp.AddRange(silouhettes.FindAll(x => x.Category.Id > 9 && x.Category.Id != 12));
                gld.Silouhettes = temp;
                #endregion

                if (gld.Silouhettes != null)
                {
                    gld.Fabrics      = fabricRepository.GetForSilouhette(gld.Silouhettes[0], gld.EventTypes);
                    gld.FabricId     = gld.Fabrics.FirstOrDefault().Id;
                    gld.SilouhetteId = gld.Silouhettes[0].Id;
                    Pattern solid = patternRepository.GetSolid();
                    gld.Garments  = garmentRepository.GetBySelection(gld.Silouhettes[0], gld.Fabrics.FirstOrDefault(), solid, gld.EventTypes, gld.MyGarments, gld.MyWishGarments);
                    gld.PatternId = solid.Id;
                    gld.Patterns  = gld.Silouhettes[0].AvailablePatterns;
                }
            }
            //IList<FashionFlavor> flavors = fashionFlavorRepository.GetAll();
            //foreach (FashionFlavor flavor in flavors)
            //    if(!gld.FashionFlavors.Exists(delegate(FashionFlavor record) { if (record.Id == flavor.Id) { return true; } return false; }))
            //        gld.FashionFlavorsAlternative.Add(flavor);
        }