Пример #1
0
 public GiftComponent(int weight, int sugar, string name, string companyName, Wrapper wrapper, GiftComponentMakingType makingType)
 {
     _weight = weight;
     _sugar = sugar;
     _name = name;
     _companyName = companyName;
     _wrapper = wrapper;
     _makingType = makingType;
 }
Пример #2
0
 public ChocolateEgg(int weight, int sugar, int chocolate, string name, string companyName, Wrapper wrapper, GiftComponentMakingType makingType, InediblePart toy)
     : base(weight, sugar, name, companyName, wrapper, makingType)
 {
     _chocolate = chocolate;
     _toy = toy;
 }
Пример #3
0
 public Candy(int weight, int sugar, int chocolate, string name, string companyName, Wrapper wrapper, GiftComponentMakingType makingType)
     : base(weight, sugar, name, companyName, wrapper, makingType)
 {
     _chocolate = chocolate;
 }
Пример #4
0
        private static void GetGiftComponentPart(GiftComponent giftComponent, XElement element)
        {
            var weight = element.Element("Weight");
            if(weight != null)
            {
                giftComponent.Weight = (int)weight;
            }

            var sugar = element.Element("Sugar");
            if (sugar != null)
            {
                giftComponent.Sugar = (int)sugar;
            }

            var name = element.Element("Name");
            if (name != null)
            {
                giftComponent.Name = name.ToString();
            }

            var companyName = element.Element("CompanyName");
            if (companyName != null)
            {
                giftComponent.CompanyName = companyName.ToString();
            }

            var makingType = element.Attribute("MakingType");
            if(makingType != null)
            {
                giftComponent.MakingType = (GiftComponentMakingType)Enum.Parse(typeof(GiftComponentMakingType), makingType.Value);
            }

            var wrapper = element.Element("Wrapper");
            if (wrapper != null)
            {
                var wrap = new Wrapper();
                var wrapperType = wrapper.Attribute("WrapperType");
                if(wrapperType != null)
                {
                    wrap.WrapperType = (WrapperType)Enum.Parse(typeof(WrapperType), wrapperType.Value);
                }
                var wrapperWeight = wrapper.Element("Weight");
                if(wrapperWeight != null)
                {
                    wrap.Weight = (int)wrapperWeight;
                }

                giftComponent.Wrapper = wrap;
            }
        }
Пример #5
0
 public Lollipop(int weight, int sugar, string name, string companyName, Wrapper wrapper, GiftComponentMakingType makingType, InediblePart stick)
     : base(weight, sugar, name, companyName, wrapper, makingType)
 {
     _stick = stick;
 }