示例#1
0
        internal static EntityOffice Load(XmlNode iNode)
        {
            EntityOffice RetVal = null;

            if (iNode != null && iNode.Name.Equals("office"))
            {
                RetVal = new EntityOffice();

                string s = TambonHelper.GetAttributeOptionalString(iNode, "type");
                if (!String.IsNullOrEmpty(s))
                {
                    RetVal.Type = (OfficeType)Enum.Parse(typeof(OfficeType), s);
                }
                if (iNode.HasChildNodes)
                {
                    foreach (XmlNode lChildNode in iNode.ChildNodes)
                    {
                        if (lChildNode.Name == "officials")
                        {
                            EntityLeaderList lOfficials = EntityLeaderList.Load(lChildNode);
                            RetVal.OfficialsList = lOfficials;
                        }
                        if (lChildNode.Name == "url")
                        {
                            RetVal.Websites.Add(new Uri(lChildNode.InnerText));
                        }
                        if (lChildNode.Name == "address")
                        {
                            RetVal.Address = ThaiAddress.Load(lChildNode);
                        }
                        if (lChildNode.Name == "geo:Point")
                        {
                            RetVal.Location = GeoPoint.Load(lChildNode);
                        }
                    }
                }
            }
            return(RetVal);
        }