Esempio n. 1
0
        private void RefreshOutputs()
        {
            var builder   = new Builder(KitSpecification, Design);
            var buildPlan = builder.Create();

            m_buildSteps = new KitBuildStepList();
            m_parts      = new KitPartList();

            var yardages = new List <KitBuildItem>();

            foreach (var buildStep in buildPlan.BuildSteps)
            {
                var kitBuildStep = new KitBuildStep(buildStep.StepNumber, buildStep.Description);
                m_buildSteps.Add(kitBuildStep);

                foreach (var input in buildStep.Consumes)
                {
                    var kitBuildItem = CreateKitBuildItem(input);
                    kitBuildStep.Consumes.Add(kitBuildItem);

                    if (kitBuildItem.BuildItemType == BuildComponentTypes.Yardage)
                    {
                        yardages.Add(kitBuildItem);
                    }
                }

                foreach (var output in buildStep.Produces)
                {
                    kitBuildStep.Produces.Add(CreateKitBuildItem(output));
                }
            }

            var partIndex = 0;

            foreach (var yardage in yardages)
            {
                var areaSize = Area.GetSmallestContainingStandardArea(yardage.Area);
                var part     = m_parts.Where(r => r.Sku == yardage.FabricStyles[0].Sku && r.AreaSize == areaSize).SingleOrDefault();
                if (part == null)
                {
                    partIndex += 1;

                    part = new KitPart(
                        "P." + partIndex,
                        yardage.FabricStyles[0].Sku,
                        areaSize,
                        1,
                        yardage.FabricStyles[0].Color);
                    m_parts.Add(part);
                }
                else
                {
                    part.Quantity += 1;
                }

                yardage.PartId = part.Id;
            }
        }
Esempio n. 2
0
        protected KitPart(KitPart prototype)
        {
            if (prototype == null)
            {
                throw new ArgumentNullException(nameof(prototype));
            }

            m_id       = prototype.m_id;
            m_sku      = prototype.m_sku;
            m_areaSize = prototype.m_areaSize;
            m_quantity = prototype.m_quantity;
            m_color    = prototype.m_color;
        }