コード例 #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
ファイル: Candy.cs プロジェクト: GeorgeManiya/EpamTraining
 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
ファイル: Core.cs プロジェクト: GeorgeManiya/EpamTraining
        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
ファイル: Lollipop.cs プロジェクト: GeorgeManiya/EpamTraining
 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;
 }