public ActionResult Reject(int outfitUpdaterId)
        {
            OutfitUpdater ou = _outfitUpdaterRepository.Get(outfitUpdaterId);

            ou.Status = OutfitUpdaterStatus.Rejected;
            _outfitUpdaterRepository.SaveOrUpdate(ou);
            return(Json(true));
        }
        private IList <OutfitUpdater> GetList(OutfitUpdater outfitUpdater, int page)
        {
            ViewData["styleAlerts"] = contentService.GetRandomStyleAlerts();
            int totalCount;
            IList <OutfitUpdater> lst = outfitUpdaterRepository.GetFor(outfitUpdater.Silouhette, outfitUpdater.ColorFamily, page, 24, out totalCount);

            ViewData["Pages"] = Common.PagingHelper.Paging(totalCount, page, 24, 6);
            ViewData["Id"]    = outfitUpdater.Id;
            return(lst);
        }
        private void ProcessList()
        {
            outfitUpdaterRepository.DbContext.BeginTransaction();
            foreach (OUImportationLine importationLine in lines)
            {
                OutfitUpdater outfitUpdater = outfitUpdaters.Find(e => e.ExternalId.Equals(importationLine.Sku));
                if (outfitUpdater == null)
                {
                    outfitUpdater = new OutfitUpdater();
                }
                if ((outfitUpdater.BuyUrl == importationLine.BuyUrl) && (outfitUpdater.Description == importationLine.Description) &&
                    (outfitUpdater.ExternalId == importationLine.Sku) && (outfitUpdater.ImageUrl == importationLine.ImageUrl) &&
                    (outfitUpdater.Keywords == importationLine.Keywords) && (outfitUpdater.Name == importationLine.Name) &&
                    (outfitUpdater.Price == importationLine.Price) && (outfitUpdater.Trends == importationLine.Trends) &&
                    (outfitUpdater.Partner == Partner) && (outfitUpdater.Silouhette == importationLine.Silouhette) &&
                    (outfitUpdater.Pattern == importationLine.Pattern) && (outfitUpdater.ColorFamily == importationLine.ColorFamily))
                {
                    continue;
                }
                outfitUpdater.BuyUrl      = importationLine.BuyUrl;
                outfitUpdater.Description = importationLine.Description;
                outfitUpdater.ExternalId  = importationLine.Sku;
                outfitUpdater.ImageUrl    = importationLine.ImageUrl;
                outfitUpdater.Keywords    = importationLine.Keywords;
                outfitUpdater.Name        = importationLine.Name;
                outfitUpdater.Partner     = Partner;
                outfitUpdater.Price       = importationLine.Price;
                outfitUpdater.Trends      = importationLine.Trends;

                if (outfitUpdater.Status == OutfitUpdaterStatus.Incomplete)
                {
                    if (outfitUpdater.Silouhette == null)
                    {
                        outfitUpdater.Silouhette = importationLine.Silouhette;
                    }
                    if (outfitUpdater.Pattern == null)
                    {
                        outfitUpdater.Pattern = importationLine.Pattern;
                    }
                    if (outfitUpdater.ColorFamily == null)
                    {
                        outfitUpdater.ColorFamily = importationLine.ColorFamily;
                    }
                    outfitUpdater.Status = importationLine.Status;
                }

                outfitUpdaterRepository.SaveOrUpdate(outfitUpdater);
                linesOk.Add(actualLine.ToString());
            }
            outfitUpdaterRepository.DbContext.CommitTransaction();
            lines = new List <OUImportationLine>();
            GC.Collect();
        }
        public ActionResult Index(int id, string closetOutfitId)
        {
            ViewData["closetOutfitId"] = closetOutfitId;
            OutfitUpdater         outfitUpdater = outfitUpdaterRepository.Get(id);
            IList <OutfitUpdater> lst           = GetList(outfitUpdater, 1);

            ////We need to be able to track the number of impressiones (views) of outfit updaters.
            foreach (OutfitUpdater ou in lst)
            {
                TrackingHelper.SaveOutfitUpdaterInfo(ou.Id.ToString(), closetOutfitId);
            }

            return(View(lst));
        }
        public ActionResult ChangePage(int Id, int Page)
        {
            OutfitUpdater outfitUpdater = outfitUpdaterRepository.Get(Id);

            return(View("Index", GetList(outfitUpdater, Page)));
        }
示例#6
0
        private void ProcessList()
        {
            if (lines.Count == 0)
            {
                return;
            }

            outfitUpdaterRepository.DbContext.BeginTransaction();
            foreach (ImportLine importationLine in lines)
            {
                OutfitUpdater outfitUpdater = outfitUpdaters.Find(e => e.ExternalId.Equals(importationLine.Sku) && e.Partner.Equals(partner));

                if (outfitUpdater == null)
                {
                    outfitUpdater = new OutfitUpdater();
                }

                int amountOfTrends = outfitUpdater.Trends.Count;

                ICollection <Trend> hsTrends = new HashSet <Trend>(outfitUpdater.Trends);
                outfitUpdater.Trends.Clear();
                foreach (Trend t in hsTrends.Union(importationLine.Trends))
                {
                    outfitUpdater.Trends.Add(t);
                }

                if (amountOfTrends == outfitUpdater.Trends.Count && (outfitUpdater.BuyUrl == importationLine.BuyUrl) && (outfitUpdater.Description == importationLine.Description) &&
                    (outfitUpdater.ExternalId == importationLine.Sku) && (outfitUpdater.ImageUrl == importationLine.ImageUrl) &&
                    (outfitUpdater.Keywords == importationLine.Keywords) && (outfitUpdater.Name == importationLine.Name) &&
                    (outfitUpdater.Price == importationLine.Price) &&
                    (outfitUpdater.Partner == partner) && (outfitUpdater.Silouhette == importationLine.Silouhette) &&
                    (outfitUpdater.Pattern == importationLine.Pattern) && (outfitUpdater.ColorFamily == importationLine.ColorFamily))
                {
                    continue;
                }

                // If it was processed before and has more trends, let's mark it as updated.
                if (amountOfTrends < outfitUpdater.Trends.Count)
                {
                    if (outfitUpdater.Status > OutfitUpdaterStatus.Valid)
                    {
                        outfitUpdater.Status = OutfitUpdaterStatus.Updated;
                    }
                }

                outfitUpdater.BuyUrl      = importationLine.BuyUrl;
                outfitUpdater.Description = importationLine.Description;
                outfitUpdater.ExternalId  = importationLine.Sku;
                outfitUpdater.ImageUrl    = importationLine.ImageUrl;
                outfitUpdater.Keywords    = importationLine.Keywords;
                outfitUpdater.Name        = importationLine.Name;
                outfitUpdater.Partner     = partner;
                outfitUpdater.Price       = importationLine.Price;
                outfitUpdater.Season      = SeasonHelper.CurrentSeason;

                if (outfitUpdater.Status == OutfitUpdaterStatus.Incomplete)
                {
                    if (outfitUpdater.Silouhette == null)
                    {
                        outfitUpdater.Silouhette = importationLine.Silouhette;
                    }
                    if (outfitUpdater.Pattern == null)
                    {
                        outfitUpdater.Pattern = importationLine.Pattern;
                    }
                    if (outfitUpdater.ColorFamily == null)
                    {
                        outfitUpdater.ColorFamily = importationLine.ColorFamily;
                    }

                    if (outfitUpdater.Silouhette != null &&
                        outfitUpdater.Pattern != null &&
                        outfitUpdater.ColorFamily != null)
                    {
                        outfitUpdater.Status = OutfitUpdaterStatus.Valid;
                    }
                }

                outfitUpdaterRepository.SaveOrUpdate(outfitUpdater);
            }

            outfitUpdaterRepository.DbContext.CommitTransaction();
        }