Exemplo n.º 1
0
        public bool HasValidCombinations()
        {
            currentFlavors  = FashionFlavors;
            currentGarments = Garments;
            lstStyleRules   = _styleRuleRepository.GetAll();

            return(ExecuteOutfitGenerator(null, false));
        }
Exemplo n.º 2
0
        public OutfitEngineProcessor(IStyleRuleRepository styleRuleRepository)
        {
            Check.Require(styleRuleRepository != null, "styleRuleRepository may not be null");
            this.styleRuleRepository = styleRuleRepository;

            lstStyleRules = styleRuleRepository.GetAll();
            logger        = log4net.LogManager.GetLogger(this.GetType().Namespace);
        }
Exemplo n.º 3
0
        private IList <OutfitUpdaterByPreCombination> GetOutfitUpdatersByPreCombinations(IEnumerable <OutfitUpdater> outfitUpdaters, IEnumerable <PreCombination> lst)
        {
            IList <StyleRule> lstStyleRules = styleRuleRepository.GetAll();
            IList <OutfitUpdaterByPreCombination> result = new List <OutfitUpdaterByPreCombination>();

            // Exclude By Rules
            foreach (PreCombination pcb in lst)
            {
                var styleRule = from s in lstStyleRules
                                where s.FashionFlavor.Id == pcb.FashionFlavor.Id
                                select s;

                StyleRule sr = styleRule.First <StyleRule>();

                logger.InfoFormat("Matching PrecombinationId : {0}", pcb.Id);

                foreach (OutfitUpdater outfitUpdater in outfitUpdaters)
                {
                    HashSet <ColorFamily> colorFamiliesHash = new HashSet <ColorFamily>();
                    if (pcb.Garment1 != null && pcb.Garment1.Id != 0 && !OutfitValidationService.IsAccessory(pcb.Garment1))
                    {
                        colorFamiliesHash.Add(pcb.Garment1.ColorFamily);
                    }
                    if (pcb.Garment2 != null && pcb.Garment2.Id != 0 && !OutfitValidationService.IsAccessory(pcb.Garment2))
                    {
                        colorFamiliesHash.Add(pcb.Garment2.ColorFamily);
                    }
                    if (pcb.Garment3 != null && pcb.Garment3.Id != 0 && !OutfitValidationService.IsAccessory(pcb.Garment3))
                    {
                        colorFamiliesHash.Add(pcb.Garment3.ColorFamily);
                    }
                    if (pcb.Garment4 != null && pcb.Garment4.Id != 0 && !OutfitValidationService.IsAccessory(pcb.Garment4))
                    {
                        colorFamiliesHash.Add(pcb.Garment4.ColorFamily);
                    }
                    if (pcb.Garment5 != null && pcb.Garment5.Id != 0 && !OutfitValidationService.IsAccessory(pcb.Garment5))
                    {
                        colorFamiliesHash.Add(pcb.Garment5.ColorFamily);
                    }
                    colorFamiliesHash.Add(outfitUpdater.ColorFamily);

                    HashSet <PatternType> pt = new HashSet <PatternType>();
                    if (pcb.Garment1 != null && pcb.Garment1.Id != 0 && !OutfitValidationService.IsAccessory(pcb.Garment1))
                    {
                        pt.Add(pcb.Garment1.PatternType);
                    }
                    if (pcb.Garment2 != null && pcb.Garment2.Id != 0 && !OutfitValidationService.IsAccessory(pcb.Garment2))
                    {
                        pt.Add(pcb.Garment2.PatternType);
                    }
                    if (pcb.Garment3 != null && pcb.Garment3.Id != 0 && !OutfitValidationService.IsAccessory(pcb.Garment3))
                    {
                        pt.Add(pcb.Garment3.PatternType);
                    }
                    if (pcb.Garment4 != null && pcb.Garment4.Id != 0 && !OutfitValidationService.IsAccessory(pcb.Garment4))
                    {
                        pt.Add(pcb.Garment4.PatternType);
                    }
                    if (pcb.Garment5 != null && pcb.Garment5.Id != 0 && !OutfitValidationService.IsAccessory(pcb.Garment5))
                    {
                        pt.Add(pcb.Garment5.PatternType);
                    }
                    pt.Add(outfitUpdater.Pattern.Type);

                    HashSet <StructureType> st = new HashSet <StructureType>();
                    if (pcb.Garment1 != null && pcb.Garment1.Id != 0 && !OutfitValidationService.IsAccessory(pcb.Garment1))
                    {
                        st.Add(pcb.Garment1.Silouhette.Structure.Type);
                    }
                    if (pcb.Garment2 != null && pcb.Garment2.Id != 0 && !OutfitValidationService.IsAccessory(pcb.Garment2))
                    {
                        st.Add(pcb.Garment2.Silouhette.Structure.Type);
                    }
                    if (pcb.Garment3 != null && pcb.Garment3.Id != 0 && !OutfitValidationService.IsAccessory(pcb.Garment3))
                    {
                        st.Add(pcb.Garment3.Silouhette.Structure.Type);
                    }
                    if (pcb.Garment4 != null && pcb.Garment4.Id != 0 && !OutfitValidationService.IsAccessory(pcb.Garment4))
                    {
                        st.Add(pcb.Garment4.Silouhette.Structure.Type);
                    }
                    if (pcb.Garment5 != null && pcb.Garment5.Id != 0 && !OutfitValidationService.IsAccessory(pcb.Garment5))
                    {
                        st.Add(pcb.Garment5.Silouhette.Structure.Type);
                    }
                    if (outfitUpdater.Silouhette.Structure != null)
                    {
                        st.Add(outfitUpdater.Silouhette.Structure.Type);
                    }

                    HashSet <ShapeType> sh = new HashSet <ShapeType>();
                    if (pcb.Garment1 != null && pcb.Garment1.Id != 0 && !OutfitValidationService.IsAccessory(pcb.Garment1))
                    {
                        sh.Add(pcb.Garment1.Silouhette.Shape.Type);
                    }
                    if (pcb.Garment2 != null && pcb.Garment2.Id != 0 && !OutfitValidationService.IsAccessory(pcb.Garment2))
                    {
                        sh.Add(pcb.Garment2.Silouhette.Shape.Type);
                    }
                    if (pcb.Garment3 != null && pcb.Garment3.Id != 0 && !OutfitValidationService.IsAccessory(pcb.Garment3))
                    {
                        sh.Add(pcb.Garment3.Silouhette.Shape.Type);
                    }
                    if (pcb.Garment4 != null && pcb.Garment4.Id != 0 && !OutfitValidationService.IsAccessory(pcb.Garment4))
                    {
                        sh.Add(pcb.Garment4.Silouhette.Shape.Type);
                    }
                    if (pcb.Garment5 != null && pcb.Garment5.Id != 0 && !OutfitValidationService.IsAccessory(pcb.Garment5))
                    {
                        sh.Add(pcb.Garment5.Silouhette.Shape.Type);
                    }
                    if (outfitUpdater.Silouhette.Shape != null)
                    {
                        sh.Add(outfitUpdater.Silouhette.Shape.Type);
                    }

                    if (OutfitValidationService.IsValidCombination(
                            colorFamiliesHash,
                            null,
                            pt,
                            st,
                            sr,
                            sh,
                            pcb.Garment1.Silouhette.Layers.Contains(LayerCode.Ai),
                            OutfitValidationService.IsAccessory(outfitUpdater.Silouhette)))
                    {
                        result.Add(new OutfitUpdaterByPreCombination(outfitUpdater, pcb));
                    }
                }
            }

            return(result);
        }