示例#1
0
        protected virtual void CreateShoes()
        {
            if (_item.ItemClass != null)
            {
                ItemClassComponent component = _item.ItemClassComponents.First();

                ItemClass itemClass = _item.ItemClass;

                string sizeCode, widthCode, colorCode;

                switch (itemClass.Dimensions)
                {
                case 1:
                    sizeCode = itemClass.MatrixAttributeDisplayOrders.First(p => p.Attribute.Equals(component.Detail1) && p.Dimension == 1).Code;

                    _item.Dimensions.Add(GetShoeAttributeLabel(component.Detail1), new Attribute()
                    {
                        Code = sizeCode, Value = component.Detail1
                    });
                    _item.Dimensions.Add(DimensionName.Width, new Attribute()
                    {
                        Code = "M", Value = "M"
                    }); break;


                case 2:
                    sizeCode  = itemClass.MatrixAttributeDisplayOrders.First(p => p.Attribute.Equals(component.Detail1) && p.Dimension == 1).Code;
                    widthCode = itemClass.MatrixAttributeDisplayOrders.First(p => p.Attribute.Equals(component.Detail2) && p.Dimension == 2).Code;

                    _item.Dimensions.Add(GetShoeAttributeLabel(component.Detail1), new Attribute()
                    {
                        Code = sizeCode, Value = component.Detail1
                    });
                    _item.Dimensions.Add(DimensionName.Width, new Attribute()
                    {
                        Code = widthCode, Value = component.Detail2
                    }); break;

                case 3:
                    colorCode = itemClass.MatrixAttributeDisplayOrders.First(p => p.Attribute.Equals(component.Detail1) && p.Dimension == 1).Code;
                    sizeCode  = itemClass.MatrixAttributeDisplayOrders.First(p => p.Attribute.Equals(component.Detail2) && p.Dimension == 2).Code;
                    widthCode = itemClass.MatrixAttributeDisplayOrders.First(p => p.Attribute.Equals(component.Detail3) && p.Dimension == 3).Code;

                    _item.Dimensions.Add(DimensionName.Color, new Attribute()
                    {
                        Code = colorCode, Value = component.Detail1
                    });
                    _item.Dimensions.Add(GetShoeAttributeLabel(component.Detail2), new Attribute()
                    {
                        Code = sizeCode, Value = component.Detail2
                    });
                    _item.Dimensions.Add(DimensionName.Width, new Attribute()
                    {
                        Code = widthCode, Value = component.Detail3
                    }); break;
                }
            }
            else
            {
                string[] skuDetails = _item.ItemLookupCode.Split(new Char[1] {
                    '-'
                });

                switch (_item.DimCount)
                {
                case 1:
                    _item.Dimensions.Add(GetShoeAttributeLabel(skuDetails[1]), new Attribute()
                    {
                        Code = skuDetails[1], Value = skuDetails[1]
                    });
                    _item.Dimensions.Add(DimensionName.Width, new Attribute()
                    {
                        Code = "M", Value = "M"
                    }); break;

                case 2:
                    _item.Dimensions.Add(GetShoeAttributeLabel(skuDetails[1]), new Attribute()
                    {
                        Code = skuDetails[1], Value = skuDetails[1]
                    });
                    _item.Dimensions.Add(DimensionName.Width, new Attribute()
                    {
                        Code = skuDetails[2], Value = skuDetails[2]
                    }); break;

                default: throw new NotImplementedException("invalid sku");
                }
            }
        }
示例#2
0
        protected virtual void CreatePants()
        {
            if (_item.ItemClass != null)
            {
                ItemClassComponent component = _item.ItemClassComponents.First();
                ItemClass          itemClass = _item.ItemClass;

                string waistCode, inseamCode, colorCode;

                switch (itemClass.Dimensions)
                {
                case 1:
                    waistCode = itemClass.MatrixAttributeDisplayOrders.First(p => p.Attribute.Equals(component.Detail1) && p.Dimension == 1).Code;
                    _item.Dimensions.Add(DimensionName.Waist, new Attribute()
                    {
                        Code = waistCode, Value = component.Detail1
                    }); break;

                case 2:
                    waistCode  = itemClass.MatrixAttributeDisplayOrders.First(p => p.Attribute.Equals(component.Detail1) && p.Dimension == 1).Code;
                    inseamCode = itemClass.MatrixAttributeDisplayOrders.First(p => p.Attribute.Equals(component.Detail2) && p.Dimension == 2).Code;
                    _item.Dimensions.Add(DimensionName.Waist, new Attribute()
                    {
                        Code = waistCode, Value = component.Detail1
                    });
                    _item.Dimensions.Add(DimensionName.Inseam, new Attribute()
                    {
                        Code = inseamCode, Value = component.Detail2
                    }); break;

                case 3:
                    colorCode  = itemClass.MatrixAttributeDisplayOrders.First(p => p.Attribute.Equals(component.Detail1) && p.Dimension == 1).Code;
                    waistCode  = itemClass.MatrixAttributeDisplayOrders.First(p => p.Attribute.Equals(component.Detail2) && p.Dimension == 2).Code;
                    inseamCode = itemClass.MatrixAttributeDisplayOrders.First(p => p.Attribute.Equals(component.Detail3) && p.Dimension == 3).Code;
                    _item.Dimensions.Add(DimensionName.Color, new Attribute()
                    {
                        Code = colorCode, Value = component.Detail1
                    });
                    _item.Dimensions.Add(DimensionName.Waist, new Attribute()
                    {
                        Code = waistCode, Value = component.Detail2
                    });
                    _item.Dimensions.Add(DimensionName.Inseam, new Attribute()
                    {
                        Code = inseamCode, Value = component.Detail3
                    }); break;
                }
            }
            else
            {
                string[] skuDetails = _item.ItemLookupCode.Split(new Char[1] {
                    '-'
                });

                switch (skuDetails.Length)
                {
                case 2:
                    _item.Dimensions.Add(DimensionName.Waist, new Attribute()
                    {
                        Code = skuDetails[1], Value = skuDetails[1]
                    }); break;

                case 3:
                    _item.Dimensions.Add(DimensionName.Waist, new Attribute()
                    {
                        Code = skuDetails[1], Value = skuDetails[1]
                    });
                    _item.Dimensions.Add(DimensionName.Inseam, new Attribute()
                    {
                        Code = skuDetails[2], Value = skuDetails[2]
                    }); break;
                }
            }
        }