public virtual void AddFashionFlavor(FashionFlavor g) { if (!fashionFlavors.Contains(g)) { this.fashionFlavors.Add(g); } }
private IList <Content> GetListByFlavors() { IList <Content> lst = new List <Content>(); Content c1 = new Content(1); Content c2 = new Content(2); Content c3 = new Content(3); FashionFlavor ff1 = new FashionFlavor(); ff1.Name = "Flavor1"; FashionFlavor ff2 = new FashionFlavor(); ff1.Name = "Flavor2"; c1.Flavors.Add(ff1); c2.Flavors.Add(ff1); c3.Flavors.Add(ff2); lst.Add(c1); lst.Add(c2); lst.Add(c3); return(lst); }
public static string GetFashionFlavorThumbnailPath(FashionFlavor fashionFlavor) { string fileName = Path.GetFileNameWithoutExtension(fashionFlavor.Image); string ext = Path.GetExtension(fashionFlavor.Image); return(GetRootPath() + "/FashionFlavors/" + fileName + "_small" + ext); }
public PreCombination GetByGarments(IList <Garment> garments, FashionFlavor fashionFlavor) { ICriteria crit = Session.CreateCriteria(typeof(PreCombination)); for (int i = 0; i < garments.Count; i++) { // Make sure it is in any position to avoid duplicates. Disjunction dis = new Disjunction(); for (int j = 0; j < garments.Count; j++) { dis.Add(Restrictions.Eq(string.Format("Garment{0}", i + 1), garments[j].PreGarment)); } crit.Add(dis); } crit.SetMaxResults(1); PreCombination pc = crit.UniqueResult <PreCombination>(); return(pc); }
private void Add(List <UserFlavor> result, FashionFlavor fashionFlavor) { if (result.Exists(delegate(UserFlavor record){ if (record.Flavor.Id == fashionFlavor.Id) { return(true); } return(false); })) { result.Find(delegate(UserFlavor record){ if (record.Flavor.Id == fashionFlavor.Id) { return(true); } return(false); }).Weight++; } else { UserFlavor uf = new UserFlavor(); uf.Flavor = fashionFlavor; uf.Weight = 1; result.Add(uf); } }
public BrandSet(string description, string imageUri, FashionFlavor flavor) { this.description = description; this.imageUri = imageUri; this.flavor = flavor; }
/// <summary> /// Creates a new closet outfit in the system related with the current user. /// </summary> /// <param name="userId">User</param> /// <param name="garments">List of Garments</param> /// <param name="season">Season</param> /// <param name="visibility">Visibility</param> /// <exception cref="NotValidCombinationException">When a combination is not valid.</exception> public void CreateUserOutfit(int userId, IList <Garment> garments, Season season, ClosetOutfitVisibility visibility) { if (!OutfitValidationService.IsValidCombination(garments)) { throw new NotValidCombinationException(); } ClosetOutfit uo = new ClosetOutfit(); // HACK: We need the garments saved with 0 in the non filled fields to make sure we have no duplicates. Garment hack = garmentRepository.Get(0); foreach (Garment g in garments) { uo.AddComponent(g, hack); } uo.Rating.CalculateEditorRating(uo.Components); BasicUser bu = basicUserRepository.Get(userId); FashionFlavor ff = bu.GetPreferredFlavor(); uo.FashionFlavor = ff; uo.Closet = (bu as RegisteredUser).Closet; uo.SetSeason(season); uo.SetEventTypes(bu as RegisteredUser); uo.SetVisibility(visibility); //Agregar PreCombination PreCombination pc = preCombinationRepository.GetByGarments(uo.RetrieveCombinableComponents().ToList <Garment>(), ff); if (pc == null) { pc = new PreCombination(); pc.FashionFlavor = ff; for (int j = 0; j < garments.Count; j++) { Garment g = garments[j]; if (!OutfitValidationService.IsAccessory(g)) { pc.AddPreGarment(garments[j]); } } } uo.PreCombination = pc; uo.User = bu as RegisteredUser; if (!uo.IsValid()) { throw new NotValidCombinationException(); } closetOutfitRepository.DbContext.BeginTransaction(); // REVIEW: This may lead to orphaned records, given we cannot change the autonumeric for now because of the combination process. // TODO: Is better to check first if the Closet Outfit combination already exists and then proceed. preCombinationRepository.SaveOrUpdate(pc); try { closetOutfitRepository.SaveOrUpdate(uo); closetOutfitRepository.DbContext.BeginTransaction(); } catch { closetOutfitRepository.DbContext.RollbackTransaction(); throw new CombinationAlreadyExistsException(); } }
public StylePhotograph(string description, string imageUri, FashionFlavor flavor) { this.description = description; this.imageUri = imageUri; this.flavor = flavor; }
public UserFlavor(FashionFlavor fashionFlavor, decimal weight) { this.flavor = fashionFlavor; this.weight = weight; }
public bool ExecuteSet() { bool found = false; IList <Garment> garmentsA = (from g in lstGarments where g.Tags.Silouhette.Layers.Contains(LayerCode.A) select g).ToList(); IList <Garment> garmentsC = (from g in lstGarments where g.Tags.Silouhette.Layers.Contains(LayerCode.C) select g).ToList(); IList <Garment> garmentsD = (from g in lstGarments where g.Tags.Silouhette.Layers.Contains(LayerCode.D) select g).ToList(); IList <Garment> garmentsAii = (from g in lstGarments where g.Tags.Silouhette.Layers.Contains(LayerCode.Aii) select g).ToList(); IList <Garment> garmentsAi = (from g in lstGarments where g.Tags.Silouhette.Layers.Contains(LayerCode.Ai) select g).ToList(); IList <Garment> garmentsB = (from g in lstGarments where g.Tags.Silouhette.Layers.Contains(LayerCode.B) select g).ToList(); IList <Garment> garmentsCD = (from g in lstGarments where g.Tags.Silouhette.Layers.Contains(LayerCode.C) || g.Tags.Silouhette.Layers.Contains(LayerCode.D) select g).ToList(); IList <Garment> garmentsBCD = (from g in lstGarments where g.Tags.Silouhette.Layers.Contains(LayerCode.C) || g.Tags.Silouhette.Layers.Contains(LayerCode.D) || g.Tags.Silouhette.Layers.Contains(LayerCode.B) select g).ToList(); // A + B, A+C, A+D IEnumerable <Combination> comb = Combine(2, garmentsA, garmentsBCD, null, null, null); // Ai + Aii IEnumerable <Combination> combAiAii = Combine(2, garmentsAi, garmentsAii, null, null, null); // A+B+C, A+B+D IEnumerable <Combination> combABC_D = Combine(3, garmentsA, garmentsB, garmentsCD, null, null); // A+C+D IEnumerable <Combination> combACD = Combine(3, garmentsA, garmentsC, garmentsD, null, null); // Ai + Aii + B, Ai + Aii + C, Ai + Aii + D IEnumerable <Combination> combAii = Combine(3, garmentsAi, garmentsAii, garmentsBCD, null, null); // A+B+C+D IEnumerable <Combination> combABCD = Combine(4, garmentsA, garmentsB, garmentsC, garmentsD, null); // Ai + Aii + B + C, Ai + Aii + C + D IEnumerable <Combination> combAiAiiBC = Combine(4, garmentsAi, garmentsAii, garmentsB, garmentsC, null); IEnumerable <Combination> combAiAiiCD = Combine(4, garmentsAi, garmentsAii, garmentsC, garmentsD, null); // Ai + Aii + B + C + D IEnumerable <Combination> combAiAiiBCD = Combine(5, garmentsAi, garmentsAii, garmentsB, garmentsC, garmentsD); // Find accesories List <Garment> linqAccesories1 = (from g in lstAccesories where g.Tags.Silouhette.Layers.Contains(LayerCode.ACC1) select g).ToList(); List <Garment> linqAccesories2 = (from g in lstAccesories where g.Tags.Silouhette.Layers.Contains(LayerCode.ACC2) select g).ToList(); List <Garment> linqAccesories3 = (from g in lstAccesories where g.Tags.Silouhette.Layers.Contains(LayerCode.ACC3) select g).ToList(); List <Garment> linqAccesories4 = (from g in lstAccesories where g.Tags.Silouhette.Layers.Contains(LayerCode.ACC4) select g).ToList(); List <Garment> linqAccesories5 = (from g in lstAccesories where g.Tags.Silouhette.Layers.Contains(LayerCode.ACC5) select g).ToList(); List <Garment> linqAccesories6 = (from g in lstAccesories where g.Tags.Silouhette.Layers.Contains(LayerCode.ACC6) select g).ToList(); List <Garment> linqAccesories7 = (from g in lstAccesories where g.Tags.Silouhette.Layers.Contains(LayerCode.ACC7) select g).ToList(); List <Garment> linqAccesories8 = (from g in lstAccesories where g.Tags.Silouhette.Layers.Contains(LayerCode.ACC8) select g).ToList(); accesories1 = Combine(1, linqAccesories1, null, null, null, null); accesories2 = Combine(2, linqAccesories1, linqAccesories2, null, null, null); accesories23 = Combine(2, linqAccesories1, linqAccesories3, null, null, null); accesories24 = Combine(2, linqAccesories1, linqAccesories4, null, null, null); accesories25 = Combine(2, linqAccesories1, linqAccesories5, null, null, null); accesories26 = Combine(2, linqAccesories1, linqAccesories6, null, null, null); accesories27 = Combine(2, linqAccesories1, linqAccesories7, null, null, null); accesories28 = Combine(2, linqAccesories1, linqAccesories8, null, null, null); accesories3 = Combine(3, linqAccesories1, linqAccesories2, linqAccesories3, null, null); accesories4 = Combine(4, linqAccesories1, linqAccesories2, linqAccesories3, linqAccesories4, null); accesories5 = Combine(5, linqAccesories1, linqAccesories2, linqAccesories3, linqAccesories4, linqAccesories5); accesories6 = Combine(6, linqAccesories1, linqAccesories2, linqAccesories3, linqAccesories4, linqAccesories5, linqAccesories6, null, null); accesories7 = Combine(7, linqAccesories1, linqAccesories2, linqAccesories3, linqAccesories4, linqAccesories5, linqAccesories6, linqAccesories7, null); accesories8 = Combine(8, linqAccesories1, linqAccesories2, linqAccesories3, linqAccesories4, linqAccesories5, linqAccesories6, linqAccesories7, linqAccesories8); if (createRecords) { _closetRepository.DbContext.BeginTransaction(); Closet.StartProcessing(); _closetRepository.SaveOrUpdate(Closet); _closetRepository.DbContext.CommitTransaction(); } foreach (FashionFlavor fv in currentFlavors) { logger.DebugFormat("Started Flavor {0}.", fv.Name); currentFlavor = fv; IEnumerable <StyleRule> styleRule = from s in lstStyleRules where s.FashionFlavor.Id == fv.Id select s; currentStyleRule = styleRule.First(); for (int i = currentStyleRule.MinimumLayers; i <= currentStyleRule.MaximumLayers; i++) { bool recordsFound = false; logger.DebugFormat("Started Layers {0}", i); switch (i) { case 2: recordsFound = ExcludeCombinations(currentStyleRule, comb); recordsFound = recordsFound || ExcludeCombinations(currentStyleRule, combAiAii); break; case 3: recordsFound = ExcludeCombinations(currentStyleRule, combABC_D); recordsFound = recordsFound || ExcludeCombinations(currentStyleRule, combACD); recordsFound = recordsFound || ExcludeCombinations(currentStyleRule, combAii); break; case 4: recordsFound = ExcludeCombinations(currentStyleRule, combABCD); recordsFound = recordsFound || ExcludeCombinations(currentStyleRule, combAiAiiBC); recordsFound = recordsFound || ExcludeCombinations(currentStyleRule, combAiAiiCD); break; case 5: recordsFound = ExcludeCombinations(currentStyleRule, combAiAiiBCD); break; } // No need to continue to check. if (!createRecords && recordsFound) { return(recordsFound); } found = found || recordsFound; } } if (createRecords) { _closetRepository.DbContext.BeginTransaction(); if (found && Closet.FavoriteOutfit == null) { logger.DebugFormat("Setting default favorite"); int outfitId = _closetRepository.GetBestEditorRatedClosetOutfitId(Closet.Id); Closet.SetFavoriteOutfit(new ClosetOutfit(outfitId)); } Closet.MarkAsProcessed(); _closetRepository.SaveOrUpdate(Closet); _closetRepository.DbContext.CommitTransaction(); if (found) { logger.DebugFormat("Adding outfit updaters"); _outfitUpdaterService.MatchOutfitUpdatersForCloset(Closet.Id); logger.DebugFormat("Finish adding outfit updaters"); } } return(found); }
public static string GetFashionFlavorPath(FashionFlavor fashionFlavor) { return(GetRootPath() + "/FashionFlavors/" + fashionFlavor.Image); }
public static string GetFashionFlavorPath(FashionFlavor fashionFlavor) { return(rootPath + "res/FashionFlavors/shape_" + fashionFlavor.Id + ".gif"); }
public static string GetFashionFlavorThumbnailPath(FashionFlavor fashionFlavor) { return(rootPath + "res/FashionFlavors/shape_" + fashionFlavor.Id + "_small.gif"); }
private StyleRule CreateStyleRule(FashionFlavor fv) { StyleRule sr = new StyleRule(); sr.MaximumGarments = 10; sr.MinimumGarments = 2; sr.FashionFlavor = fv; int maximumLayers = 5; int minimumLayers = 2; switch (fv.Name) { case "Classic": maximumLayers = 5; minimumLayers = 3; sr.ColorBlending.MonotoneColor = true; sr.ColorBlending.NeutralColor = true; sr.Patterns.Add(new PatternRule { FromItem = PatternType.Solid, ToItem = PatternType.Solid }); sr.Patterns.Add(new PatternRule { FromItem = PatternType.Solid, ToItem = PatternType.Minimal }); sr.Structures.Add(new StructureRule { FromItem = StructureType.Structured, ToItem = StructureType.Structured }); sr.Structures.Add(new StructureRule { FromItem = StructureType.Structured, ToItem = StructureType.FlowingFluid }); sr.Structures.Add(new StructureRule { FromItem = StructureType.Structured, ToItem = StructureType.Relaxed }); sr.Structures.Add(new StructureRule { FromItem = StructureType.Structured, ToItem = StructureType.BodyConscious }); sr.Shapes.Add(new ShapeRule { FromItem = ShapeType.Slim, ToItem = ShapeType.Slim }); sr.Shapes.Add(new ShapeRule { FromItem = ShapeType.Slim, ToItem = ShapeType.Fitted }); sr.Shapes.Add(new ShapeRule { FromItem = ShapeType.Fitted, ToItem = ShapeType.Slim }); sr.Shapes.Add(new ShapeRule { FromItem = ShapeType.Fitted, ToItem = ShapeType.Fitted }); sr.AccessoriesAmount.Add(3); break; case "Romantic": maximumLayers = 5; minimumLayers = 1; sr.ColorBlending.MonotoneColor = true; sr.ColorBlending.AnalogousColor = true; sr.ColorBlending.NeutralColor = true; sr.AccessoriesAmount.Add(4); sr.Structures.Add(new StructureRule { FromItem = StructureType.Structured, ToItem = StructureType.FlowingFluid }); sr.Structures.Add(new StructureRule { FromItem = StructureType.FlowingFluid, ToItem = StructureType.FlowingFluid }); sr.Structures.Add(new StructureRule { FromItem = StructureType.FlowingFluid, ToItem = StructureType.Relaxed }); sr.Shapes.Add(new ShapeRule { FromItem = ShapeType.Slim, ToItem = ShapeType.Fitted }); sr.Shapes.Add(new ShapeRule { FromItem = ShapeType.Slim, ToItem = ShapeType.Loose }); sr.Shapes.Add(new ShapeRule { FromItem = ShapeType.Fitted, ToItem = ShapeType.Loose }); sr.Shapes.Add(new ShapeRule { FromItem = ShapeType.Loose, ToItem = ShapeType.Slim }); sr.Shapes.Add(new ShapeRule { FromItem = ShapeType.Loose, ToItem = ShapeType.Fitted }); break; case "Comfortable": maximumLayers = 3; minimumLayers = 1; sr.ColorBlending.ComplimentaryColor = true; sr.ColorBlending.NeutralPrimaryColor = true; sr.ColorBlending.NeutralSecondaryColor = true; sr.ColorBlending.NeutralColor = true; sr.Patterns.Add(new PatternRule { FromItem = PatternType.Solid, ToItem = PatternType.Solid }); sr.Patterns.Add(new PatternRule { FromItem = PatternType.Solid, ToItem = PatternType.Minimal }); sr.AccessoriesAmount.Add(1); sr.AccessoriesAmount.Add(3); sr.Structures.Add(new StructureRule { FromItem = StructureType.Structured, ToItem = StructureType.Relaxed }); sr.Structures.Add(new StructureRule { FromItem = StructureType.FlowingFluid, ToItem = StructureType.Relaxed }); sr.Structures.Add(new StructureRule { FromItem = StructureType.Relaxed, ToItem = StructureType.BodyConscious }); sr.Shapes.Add(new ShapeRule { FromItem = ShapeType.Fitted, ToItem = ShapeType.Fitted }); sr.Shapes.Add(new ShapeRule { FromItem = ShapeType.Fitted, ToItem = ShapeType.Loose }); sr.Shapes.Add(new ShapeRule { FromItem = ShapeType.Loose, ToItem = ShapeType.Fitted }); sr.Shapes.Add(new ShapeRule { FromItem = ShapeType.Loose, ToItem = ShapeType.Loose }); break; case "Sporty": maximumLayers = 3; minimumLayers = 1; sr.ColorBlending.ComplimentaryColor = true; sr.ColorBlending.NeutralPrimaryColor = true; sr.ColorBlending.NeutralSecondaryColor = true; sr.ColorBlending.NeutralColor = true; sr.AccessoriesAmount.Add(1); sr.AccessoriesAmount.Add(3); sr.Patterns.Add(new PatternRule { FromItem = PatternType.Solid, ToItem = PatternType.Solid }); sr.Patterns.Add(new PatternRule { FromItem = PatternType.Solid, ToItem = PatternType.Minimal }); sr.Structures.Add(new StructureRule { FromItem = StructureType.Structured, ToItem = StructureType.BodyConscious }); sr.Structures.Add(new StructureRule { FromItem = StructureType.Relaxed, ToItem = StructureType.Relaxed }); sr.Structures.Add(new StructureRule { FromItem = StructureType.Relaxed, ToItem = StructureType.BodyConscious }); sr.Shapes.Add(new ShapeRule { FromItem = ShapeType.Slim, ToItem = ShapeType.Slim }); sr.Shapes.Add(new ShapeRule { FromItem = ShapeType.Slim, ToItem = ShapeType.Fitted }); sr.Shapes.Add(new ShapeRule { FromItem = ShapeType.Fitted, ToItem = ShapeType.Slim }); sr.Shapes.Add(new ShapeRule { FromItem = ShapeType.Fitted, ToItem = ShapeType.Fitted }); break; case "Preppy": maximumLayers = 5; minimumLayers = 2; sr.ColorBlending.NeutralPrimaryColor = true; sr.AccessoriesAmount.Add(1); sr.AccessoriesAmount.Add(3); sr.Patterns.Add(new PatternRule { FromItem = PatternType.Solid, ToItem = PatternType.Solid }); sr.Patterns.Add(new PatternRule { FromItem = PatternType.Solid, ToItem = PatternType.Minimal }); sr.Structures.Add(new StructureRule { FromItem = StructureType.Structured, ToItem = StructureType.Structured }); sr.Structures.Add(new StructureRule { FromItem = StructureType.Structured, ToItem = StructureType.Relaxed }); sr.Structures.Add(new StructureRule { FromItem = StructureType.Relaxed, ToItem = StructureType.Relaxed }); sr.Shapes.Add(new ShapeRule { FromItem = ShapeType.Fitted, ToItem = ShapeType.Fitted }); sr.Shapes.Add(new ShapeRule { FromItem = ShapeType.Fitted, ToItem = ShapeType.Loose }); sr.Shapes.Add(new ShapeRule { FromItem = ShapeType.Loose, ToItem = ShapeType.Fitted }); break; case "Glam": maximumLayers = 3; minimumLayers = 1; sr.ColorBlending.MonotoneColor = true; sr.ColorBlending.ComplimentaryColor = true; sr.ColorBlending.NeutralPrimaryColor = true; sr.ColorBlending.NeutralSecondaryColor = true; sr.AccessoriesAmount.Add(5); sr.Patterns.Add(new PatternRule { FromItem = PatternType.Solid, ToItem = PatternType.Solid }); sr.Patterns.Add(new PatternRule { FromItem = PatternType.Solid, ToItem = PatternType.Minimal }); sr.Structures.Add(new StructureRule { FromItem = StructureType.Structured, ToItem = StructureType.Structured }); sr.Structures.Add(new StructureRule { FromItem = StructureType.Structured, ToItem = StructureType.BodyConscious }); sr.Structures.Add(new StructureRule { FromItem = StructureType.Relaxed, ToItem = StructureType.BodyConscious }); sr.Structures.Add(new StructureRule { FromItem = StructureType.BodyConscious, ToItem = StructureType.BodyConscious }); sr.Shapes.Add(new ShapeRule { FromItem = ShapeType.Slim, ToItem = ShapeType.Slim }); sr.Shapes.Add(new ShapeRule { FromItem = ShapeType.Slim, ToItem = ShapeType.Fitted }); sr.Shapes.Add(new ShapeRule { FromItem = ShapeType.Fitted, ToItem = ShapeType.Slim }); sr.Shapes.Add(new ShapeRule { FromItem = ShapeType.Fitted, ToItem = ShapeType.Fitted }); break; case "Bohemian": maximumLayers = 5; minimumLayers = 3; sr.ColorBlending.AnalogousColor = true; sr.ColorBlending.ComplimentaryColor = true; sr.ColorBlending.NeutralPrimaryColor = true; sr.AccessoriesAmount.Add(4); sr.Patterns.Add(new PatternRule { FromItem = PatternType.Solid, ToItem = PatternType.Bold }); sr.Patterns.Add(new PatternRule { FromItem = PatternType.Solid, ToItem = PatternType.Minimal }); sr.Patterns.Add(new PatternRule { FromItem = PatternType.Minimal, ToItem = PatternType.Minimal }); sr.Patterns.Add(new PatternRule { FromItem = PatternType.Minimal, ToItem = PatternType.Bold }); sr.Patterns.Add(new PatternRule { FromItem = PatternType.Bold, ToItem = PatternType.Bold }); sr.Structures.Add(new StructureRule { FromItem = StructureType.Structured, ToItem = StructureType.FlowingFluid }); sr.Structures.Add(new StructureRule { FromItem = StructureType.FlowingFluid, ToItem = StructureType.FlowingFluid }); sr.Structures.Add(new StructureRule { FromItem = StructureType.FlowingFluid, ToItem = StructureType.Relaxed }); sr.Shapes.Add(new ShapeRule { FromItem = ShapeType.Slim, ToItem = ShapeType.Fitted }); sr.Shapes.Add(new ShapeRule { FromItem = ShapeType.Slim, ToItem = ShapeType.Loose }); sr.Shapes.Add(new ShapeRule { FromItem = ShapeType.Fitted, ToItem = ShapeType.Fitted }); sr.Shapes.Add(new ShapeRule { FromItem = ShapeType.Fitted, ToItem = ShapeType.Loose }); sr.Shapes.Add(new ShapeRule { FromItem = ShapeType.Loose, ToItem = ShapeType.Fitted }); sr.Shapes.Add(new ShapeRule { FromItem = ShapeType.Loose, ToItem = ShapeType.Loose }); break; case "Trendy": maximumLayers = 5; minimumLayers = 1; sr.ColorBlending.MonotoneColor = true; sr.ColorBlending.AnalogousColor = true; sr.ColorBlending.ComplimentaryColor = true; sr.ColorBlending.NeutralPrimaryColor = true; sr.ColorBlending.NeutralSecondaryColor = true; sr.ColorBlending.NeutralColor = true; sr.AccessoriesAmount.Add(4); sr.Patterns.Add(new PatternRule { FromItem = PatternType.Solid, ToItem = PatternType.Solid }); sr.Patterns.Add(new PatternRule { FromItem = PatternType.Solid, ToItem = PatternType.Minimal }); sr.Patterns.Add(new PatternRule { FromItem = PatternType.Solid, ToItem = PatternType.Bold }); sr.Patterns.Add(new PatternRule { FromItem = PatternType.Minimal, ToItem = PatternType.Bold }); sr.Structures.Add(new StructureRule { FromItem = StructureType.Structured, ToItem = StructureType.Structured }); sr.Structures.Add(new StructureRule { FromItem = StructureType.Structured, ToItem = StructureType.FlowingFluid }); sr.Structures.Add(new StructureRule { FromItem = StructureType.Structured, ToItem = StructureType.Relaxed }); sr.Structures.Add(new StructureRule { FromItem = StructureType.Structured, ToItem = StructureType.BodyConscious }); sr.Structures.Add(new StructureRule { FromItem = StructureType.FlowingFluid, ToItem = StructureType.FlowingFluid }); sr.Structures.Add(new StructureRule { FromItem = StructureType.FlowingFluid, ToItem = StructureType.Relaxed }); sr.Structures.Add(new StructureRule { FromItem = StructureType.FlowingFluid, ToItem = StructureType.BodyConscious }); sr.Structures.Add(new StructureRule { FromItem = StructureType.Relaxed, ToItem = StructureType.Relaxed }); sr.Structures.Add(new StructureRule { FromItem = StructureType.Relaxed, ToItem = StructureType.BodyConscious }); sr.Structures.Add(new StructureRule { FromItem = StructureType.BodyConscious, ToItem = StructureType.BodyConscious }); sr.Shapes.Add(new ShapeRule { FromItem = ShapeType.Slim, ToItem = ShapeType.Fitted }); sr.Shapes.Add(new ShapeRule { FromItem = ShapeType.Slim, ToItem = ShapeType.Loose }); sr.Shapes.Add(new ShapeRule { FromItem = ShapeType.Fitted, ToItem = ShapeType.Slim }); sr.Shapes.Add(new ShapeRule { FromItem = ShapeType.Fitted, ToItem = ShapeType.Fitted }); sr.Shapes.Add(new ShapeRule { FromItem = ShapeType.Loose, ToItem = ShapeType.Slim }); sr.Shapes.Add(new ShapeRule { FromItem = ShapeType.Loose, ToItem = ShapeType.Fitted }); break; } sr.MaximumLayers = maximumLayers; sr.MinimumLayers = minimumLayers; return(sr); }
public bool ExecuteSet() { bool found = false; IList <Garment> garmentsA = (from g in lstGarments where g.Tags.Silouhette.Layers.Contains(LayerCode.A) select g).ToList <Garment>(); IList <Garment> garmentsC = (from g in lstGarments where g.Tags.Silouhette.Layers.Contains(LayerCode.C) select g).ToList <Garment>(); IList <Garment> garmentsD = (from g in lstGarments where g.Tags.Silouhette.Layers.Contains(LayerCode.D) select g).ToList <Garment>(); IList <Garment> garmentsAii = (from g in lstGarments where g.Tags.Silouhette.Layers.Contains(LayerCode.Aii) select g).ToList <Garment>(); IList <Garment> garmentsAi = (from g in lstGarments where g.Tags.Silouhette.Layers.Contains(LayerCode.Ai) select g).ToList <Garment>(); IList <Garment> garmentsB = (from g in lstGarments where g.Tags.Silouhette.Layers.Contains(LayerCode.B) select g).ToList <Garment>(); IList <Garment> garmentsCD = (from g in lstGarments where g.Tags.Silouhette.Layers.Contains(LayerCode.C) || g.Tags.Silouhette.Layers.Contains(LayerCode.D) select g).ToList <Garment>(); IList <Garment> garmentsBCD = (from g in lstGarments where g.Tags.Silouhette.Layers.Contains(LayerCode.C) || g.Tags.Silouhette.Layers.Contains(LayerCode.D) || g.Tags.Silouhette.Layers.Contains(LayerCode.B) select g).ToList <Garment>(); // A + B, A+C, A+D IEnumerable <Combination> comb = Combine(2, garmentsA, garmentsBCD, null, null, null); // A+B+C, A+B+D IEnumerable <Combination> combABC_D = Combine(3, garmentsA, garmentsB, garmentsCD, null, null); // A+C+D IEnumerable <Combination> combACD = Combine(3, garmentsA, garmentsC, garmentsD, null, null); // Ai + Aii + B, Ai + Aii + C, Ai + Aii + D IEnumerable <Combination> combAii = Combine(3, garmentsAi, garmentsAii, garmentsBCD, null, null); // A+B+C+D IEnumerable <Combination> combABCD = Combine(4, garmentsA, garmentsB, garmentsC, garmentsD, null); // Ai + Aii + B + C, Ai + Aii + C + D IEnumerable <Combination> combAiAiiBC = Combine(4, garmentsAi, garmentsAii, garmentsB, garmentsC, null); IEnumerable <Combination> combAiAiiCD = Combine(4, garmentsAi, garmentsAii, garmentsC, garmentsD, null); // Ai + Aii + B + C + D IEnumerable <Combination> combAiAiiBCD = Combine(5, garmentsAi, garmentsAii, garmentsB, garmentsC, garmentsD); // Find accesories var linqAccesories1 = (from g in lstAccesories where g.Tags.Silouhette.Layers.Contains(LayerCode.ACC1) select g).ToList <Garment>(); var linqAccesories2 = (from g in lstAccesories where g.Tags.Silouhette.Layers.Contains(LayerCode.ACC2) select g).ToList <Garment>(); var linqAccesories3 = (from g in lstAccesories where g.Tags.Silouhette.Layers.Contains(LayerCode.ACC3) select g).ToList <Garment>(); var linqAccesories4 = (from g in lstAccesories where g.Tags.Silouhette.Layers.Contains(LayerCode.ACC4) select g).ToList <Garment>(); var linqAccesories5 = (from g in lstAccesories where g.Tags.Silouhette.Layers.Contains(LayerCode.ACC5) select g).ToList <Garment>(); var linqAccesories6 = (from g in lstAccesories where g.Tags.Silouhette.Layers.Contains(LayerCode.ACC6) select g).ToList <Garment>(); var linqAccesories7 = (from g in lstAccesories where g.Tags.Silouhette.Layers.Contains(LayerCode.ACC7) select g).ToList <Garment>(); var linqAccesories8 = (from g in lstAccesories where g.Tags.Silouhette.Layers.Contains(LayerCode.ACC8) select g).ToList <Garment>(); accesories1 = Combine(1, linqAccesories1, null, null, null, null); accesories2 = Combine(2, linqAccesories1, linqAccesories2, null, null, null); accesories3 = Combine(3, linqAccesories1, linqAccesories2, linqAccesories3, null, null); accesories4 = Combine(4, linqAccesories1, linqAccesories2, linqAccesories3, linqAccesories4, null); accesories5 = Combine(5, linqAccesories1, linqAccesories2, linqAccesories3, linqAccesories4, linqAccesories5); accesories6 = Combine(6, linqAccesories1, linqAccesories2, linqAccesories3, linqAccesories4, linqAccesories5, linqAccesories6, null, null); accesories7 = Combine(7, linqAccesories1, linqAccesories2, linqAccesories3, linqAccesories4, linqAccesories5, linqAccesories6, linqAccesories7, null); accesories8 = Combine(8, linqAccesories1, linqAccesories2, linqAccesories3, linqAccesories4, linqAccesories5, linqAccesories6, linqAccesories7, linqAccesories8); foreach (FashionFlavor fv in currentFlavors) { logger.DebugFormat("Started Flavor {0}.", fv.Name); this.currentFlavor = fv; var styleRule = from s in lstStyleRules where s.FashionFlavor.Id == fv.Id select s; currentStyleRule = styleRule.First <StyleRule>(); for (int i = currentStyleRule.MinimumLayers; i <= currentStyleRule.MaximumLayers; i++) { bool recordsFound = false; logger.DebugFormat("Started Layers {0}", i); switch (i) { case 2: recordsFound = ExcludeCombinations(currentStyleRule, comb); break; case 3: recordsFound = ExcludeCombinations(currentStyleRule, combABC_D); recordsFound = recordsFound || ExcludeCombinations(currentStyleRule, combACD); recordsFound = recordsFound || ExcludeCombinations(currentStyleRule, combAii); break; case 4: recordsFound = ExcludeCombinations(currentStyleRule, combABCD); recordsFound = recordsFound || ExcludeCombinations(currentStyleRule, combAiAiiBC); recordsFound = recordsFound || ExcludeCombinations(currentStyleRule, combAiAiiCD); break; case 5: recordsFound = ExcludeCombinations(currentStyleRule, combAiAiiBCD); break; } // No need to continue to check. if (!createRecords && recordsFound) { return(recordsFound); } found = found || recordsFound; } } if (createRecords && found) { logger.DebugFormat("Adding outfit updaters"); outfitUpdaterService.MatchOutfitUpdatersForCloset(Closet.Id); logger.DebugFormat("Finish adding outfit updaters"); } return(found); }