Пример #1
0
 public static SubGroupProduct FromXElement(XContainer element, GroupProduct group)
 {
     return(new SubGroupProduct(
                element.GetXAttributeValue("ID").ToInt(),
                element.GetXAttributeValue("Name"),
                group.Id)
     {
         Group = group
     });
 }
Пример #2
0
        public static XElement ToXElementSubGroups(XElement element, GroupProduct obj)
        {
            element.GetXElements("SubGroup").Remove();

            foreach (var sg in obj.SubGroups)
            {
                element.Add(SubGroupProduct.ToXElement(sg));
            }

            return(element);
        }
Пример #3
0
        public static GroupProduct FromXElement(XContainer element)
        {
            var group = new GroupProduct(
                element.GetXAttributeValue("Group", "ID").ToInt(),
                element.GetXAttributeValue("Group", "Name"));

            foreach (var subGroup in element.Elements("SubGroup"))
            {
                group.SubGroups.Add(SubGroupProduct.FromXElement(subGroup, group));
            }

            return(group);
        }
Пример #4
0
        public static XElement ToXElement(GroupProduct obj)
        {
            var groupElement = new XElement("Palette",
                                            new XElement("Group",
                                                         new XAttribute("Name", obj.Name),
                                                         new XAttribute("ID", obj.Id)));

            foreach (var sg in obj.SubGroups)
            {
                groupElement.Add(SubGroupProduct.ToXElement(sg));
            }

            return(groupElement);
        }