示例#1
0
        public override XElement ToXElement(string @namespace)
        {
            var elements = new List <XElement>();

            if (!ContactPersonPrimary.IsEmpty)
            {
                elements.Add(ContactPersonPrimary.ToXElement(@namespace));
            }
            if (!string.IsNullOrEmpty("ContactPosition"))
            {
                elements.Add(new XElement(XName.Get("ContactPosition", @namespace), ContactPosition));
            }
            if (!ContactAddress.IsEmpty)
            {
                elements.Add(ContactAddress.ToXElement(@namespace));
            }
            if (!string.IsNullOrEmpty("ContactPosition"))
            {
                elements.Add(new XElement(XName.Get("ContactVoiceTelephone", @namespace), ContactVoiceTelephone));
            }
            if (!string.IsNullOrEmpty("ContactPosition"))
            {
                elements.Add(new XElement(XName.Get("ContactFacsimileTelephone", @namespace), ContactFacsimileTelephone));
            }
            if (!string.IsNullOrEmpty("ContactPosition"))
            {
                elements.Add(new XElement(XName.Get("ContactElectronicMailAddress", @namespace), ContactElectronicMailAddress));
            }

            return(new XElement(XName.Get("ContactInformation", @namespace), elements.ToArray()));
        }
示例#2
0
        public override void WriteXml(XmlWriter writer)
        {
            if (!ContactPersonPrimary.IsEmpty)
            {
                writer.WriteStartElement("ContactPersonPrimary", Namespace);
                ContactPersonPrimary.WriteXml(writer);
                writer.WriteEndElement();
            }

            if (!string.IsNullOrEmpty(ContactPosition))
            {
                writer.WriteElementString("ContactPosition", ContactPosition);
            }

            if (!ContactAddress.IsEmpty)
            {
                writer.WriteStartElement("ContactAddress", Namespace);
                ContactAddress.WriteXml(writer);
                writer.WriteEndElement();
            }

            if (!string.IsNullOrEmpty(ContactVoiceTelephone))
            {
                writer.WriteElementString("ContactVoiceTelephone", ContactVoiceTelephone);
            }
            if (!string.IsNullOrEmpty(ContactFacsimileTelephone))
            {
                writer.WriteElementString("ContactFacsimileTelephone", ContactFacsimileTelephone);
            }
            if (!string.IsNullOrEmpty(ContactElectronicMailAddress))
            {
                writer.WriteElementString("ContactElectronicMailAddress", ContactElectronicMailAddress);
            }
        }
示例#3
0
        public override void ReadXml(XmlReader reader)
        {
            if (CheckEmptyNode(reader, "ContactInformation", Namespace))
            {
                return;
            }

            while (!reader.EOF)
            {
                if (reader.IsStartElement())
                {
                    var isEmpty = reader.IsEmptyElement;
                    switch (reader.LocalName)
                    {
                    case "ContactPersonPrimary":
                        ContactPersonPrimary.ReadXml(reader.ReadSubtree());
                        break;

                    case "ContactPosition":
                        ContactPosition = reader.ReadElementContentAsString();
                        break;

                    case "ContactAddress":
                        ContactAddress.ReadXml(reader.ReadSubtree());
                        break;

                    case "ContactVoiceTelephone":
                        ContactVoiceTelephone = reader.ReadElementContentAsString();
                        break;

                    case "ContactFacsimileTelephone":
                        ContactFacsimileTelephone = reader.ReadElementContentAsString();
                        break;

                    case "ContactElectronicMailAddress":
                        ContactElectronicMailAddress = reader.ReadElementContentAsString();
                        break;

                    default:
                        reader.Skip();
                        break;
                    }
                }
                else
                {
                    reader.Read();
                }
            }
        }
示例#4
0
        public ContactInformation(XElement node, string @namespace)
        {
            var element = node.Element(XName.Get("ContactPersonPrimary", @namespace));
            if (element != null) ContactPersonPrimary = new ContactPersonPrimary(element, @namespace);

            element = node.Element(XName.Get("ContactPosition", @namespace));
            if (element != null) ContactPosition = element.Value;

            element = node.Element(XName.Get("ContactAddress", @namespace));
            if (element != null) ContactAddress = new ContactAddress(element, @namespace);

            element = node.Element(XName.Get("ContactVoiceTelephone", @namespace));
            if (element != null) ContactVoiceTelephone = element.Value;
            element = node.Element(XName.Get("ContactFacsimileTelephone", @namespace));
            if (element != null) ContactFacsimileTelephone = element.Value;
            element = node.Element(XName.Get("ContactElectronicMailAddress", @namespace));
            if (element != null) ContactElectronicMailAddress = element.Value;
        }
示例#5
0
        public ContactInformation(XElement node, string @namespace)
        {
            var element = node.Element(XName.Get("ContactPersonPrimary", @namespace));

            if (element != null)
            {
                ContactPersonPrimary = new ContactPersonPrimary(element, @namespace);
            }

            element = node.Element(XName.Get("ContactPosition", @namespace));
            if (element != null)
            {
                ContactPosition = element.Value;
            }

            element = node.Element(XName.Get("ContactAddress", @namespace));
            if (element != null)
            {
                ContactAddress = new ContactAddress(element, @namespace);
            }

            element = node.Element(XName.Get("ContactVoiceTelephone", @namespace));
            if (element != null)
            {
                ContactVoiceTelephone = element.Value;
            }
            element = node.Element(XName.Get("ContactFacsimileTelephone", @namespace));
            if (element != null)
            {
                ContactFacsimileTelephone = element.Value;
            }
            element = node.Element(XName.Get("ContactElectronicMailAddress", @namespace));
            if (element != null)
            {
                ContactElectronicMailAddress = element.Value;
            }
        }