Beispiel #1
0
        public static AssociationQuestion CreateFromXml(XmlNode xmlNode)
        {
            AssociationQuestion result = new AssociationQuestion();

            XmlAttribute attr;

            attr = xmlNode.Attributes[xmlFieldQuestion];
            if (attr != null && !string.IsNullOrEmpty(attr.Value))
            {
                result.questionSerie.Add(new AssociationQuestionPart(attr.Value));
            }

            attr = xmlNode.Attributes[xmlFieldNumber];
            if (attr != null && !string.IsNullOrEmpty(attr.Value))
            {
                int temp;
                if (int.TryParse(attr.Value, out temp))
                {
                    result.Number = temp;
                }
            }

            attr = xmlNode.Attributes[xmlFieldShowPosition];
            if (attr != null && !string.IsNullOrEmpty(attr.Value))
            {
                int temp;
                if (int.TryParse(attr.Value, out temp))
                {
                    result.ShowPosition = temp;
                }
            }

            attr = xmlNode.Attributes[xmlFieldTime];
            if (attr != null && !string.IsNullOrEmpty(attr.Value))
            {
                double temp;
                if (double.TryParse(attr.Value, out temp))
                {
                    result.Time = temp;
                }
            }

            foreach (XmlNode node in xmlNode.ChildNodes)
            {
                result.questionSerie.Add(AssociationQuestionPart.CreateFromXml(node));
            }

            return(result);
        }
Beispiel #2
0
        public static AssociationQuestionPart CreateFromXml(XmlNode xmlNode)
        {
            AssociationQuestionPart result = new AssociationQuestionPart();

            XmlAttribute attr;

            attr = xmlNode.Attributes[xmlFieldWord];
            if (attr != null)
            {
                result.Word = attr.Value;
            }

            attr = xmlNode.Attributes[xmlFieldNetName];
            if (attr != null)
            {
                result.NetName = attr.Value;
            }

            return(result);
        }