Exemple #1
0
 public static PartStorePosition CreateByPossible(PartModel part, IEnumerable <ConcretePartModel> concreteParts)
 {
     return(new PartStorePosition()
     {
         Part = part,
         MaterialPositions = part.PossibleMaterials.Select(material =>
                                                           PartStoreMaterialPosition.CreateByPossible(
                                                               material, concreteParts.Where(cpart => cpart.SelectedMaterial.Id == material.Id)
                                                               )
                                                           ).ToList()
     });
 }
Exemple #2
0
        public static PartStorePosition CreateByConcrete(PartModel part, IEnumerable <ConcretePartModel> concreteParts)
        {
            PartStorePosition position = new PartStorePosition()
            {
                Part = part
            };

            IEnumerable <IGrouping <MaterialModel, ConcretePartModel> > materialGroups = concreteParts.GroupBy(
                cpart => cpart.SelectedMaterial, new MaterialModel.MaterialComparer()
                );

            foreach (IGrouping <MaterialModel, ConcretePartModel> materialGroup in materialGroups)
            {
                position.MaterialPositions.Add(PartStoreMaterialPosition.CreateByConcrete(materialGroup.Key, materialGroup.ToList()));
            }

            return(position);
        }
        public static PartStoreMaterialPosition CreateByConcrete(MaterialModel material, IEnumerable <ConcretePartModel> concreteParts)
        {
            PartStoreMaterialPosition position = new PartStoreMaterialPosition()
            {
                Material = material
            };

            IEnumerable <IGrouping <PartColorModel, ConcretePartModel> > colorGroups = concreteParts.GroupBy(
                part => part.SelectedColor, new PartColorModel.ColorComparer()
                );

            foreach (IGrouping <PartColorModel, ConcretePartModel> colorGroup in colorGroups)
            {
                position.ColorPositions.Add(new PartStoreMaterialColorPosition(colorGroup.Key, colorGroup.Count()));
            }

            return(position);
        }