Exemplo n.º 1
0
        internal void ReadFromXml(XmlNode iNode)
        {
            if (iNode != null)
            {
                foreach (XmlNode lNode in iNode.ChildNodes)
                {
                    switch (lNode.Name)
                    {
                    case "postcode":
                        PostalCode = TambonHelper.GetAttributeOptionalInt(lNode, "code", 0);
                        break;

                    case "street":
                        Street = TambonHelper.GetAttribute(lNode, "value");
                        break;

                    case "village":
                        Muban     = TambonHelper.GetAttributeOptionalInt(lNode, "number", 0);
                        MubanName = TambonHelper.GetAttributeOptionalString(lNode, "name");
                        break;

                    case "tambon":
                        Tambon   = TambonHelper.GetAttribute(lNode, "name");
                        _geocode = TambonHelper.GetAttributeOptionalInt(lNode, "geocode", 0);
                        break;
                    }
                }
            }
        }
Exemplo n.º 2
0
        internal static EntityLeader Load(XmlNode node)
        {
            EntityLeader result = null;

            if (node != null && node.Name.Equals("official"))
            {
                result           = new EntityLeader();
                result.Name      = TambonHelper.GetAttribute(node, "name");
                result.English   = TambonHelper.GetAttributeOptionalString(node, "english");
                result.Telephone = TambonHelper.GetAttributeOptionalString(node, "telephone");
                result.CellPhone = TambonHelper.GetAttributeOptionalString(node, "cellphone");
                result.Comment   = TambonHelper.GetAttributeOptionalString(node, "comment");

                result.BeginOfTermYear = TambonHelper.GetAttributeOptionalInt(node, "beginyear", 0);
                result.EndOfTermYear   = TambonHelper.GetAttributeOptionalInt(node, "endyear", 0);
                result.Index           = TambonHelper.GetAttributeOptionalInt(node, "index", 0);
                result.BeginOfTerm     = TambonHelper.GetAttributeOptionalDateTime(node, "begin");
                result.EndOfTerm       = TambonHelper.GetAttributeOptionalDateTime(node, "end");

                String position = TambonHelper.GetAttribute(node, "title");
                result.Position = (EntityLeaderType)Enum.Parse(typeof(EntityLeaderType), position);

                String personTitle = TambonHelper.GetAttributeOptionalString(node, "nametitle");
                if (!String.IsNullOrEmpty(personTitle))
                {
                    result.Title = (PersonTitle)Enum.Parse(typeof(PersonTitle), position);
                }
            }
            return(result);
        }
Exemplo n.º 3
0
 private void LoadContents(XmlNode iNode)
 {
     foreach (XmlNode lNode in iNode.ChildNodes)
     {
         RoyalGazetteContent lContent = RoyalGazetteContent.CreateContentObject(lNode.Name);
         if (lContent != null)
         {
             lContent.DoLoad(lNode);
             BoardMeetingTopic lTopic = new BoardMeetingTopic();
             lTopic.Topic     = lContent;
             lTopic.Effective = TambonHelper.GetAttributeOptionalDateTime(lNode, "effective");
             String s = TambonHelper.GetAttributeOptionalString(lNode, "type");
             if (String.IsNullOrEmpty(s))
             {
                 s = TambonHelper.GetAttributeOptionalString(lNode, "new");
             }
             if (!String.IsNullOrEmpty(s))
             {
                 lTopic.Type = (EntityType)Enum.Parse(typeof(EntityType), s);
             }
             lTopic.FindGazette();
             Contents.Add(lTopic);
         }
     }
 }
Exemplo n.º 4
0
 internal override void DoLoad(XmlNode iNode)
 {
     base.DoLoad(iNode);
     if (iNode != null && iNode.Name.Equals(XmlLabel))
     {
         OldName    = TambonHelper.GetAttribute(iNode, "oldname");
         OldEnglish = TambonHelper.GetAttributeOptionalString(iNode, "oldenglish");
         Name       = TambonHelper.GetAttribute(iNode, "name");
     }
 }
 internal override void DoLoad(XmlNode iNode)
 {
     base.DoLoad(iNode);
     if (iNode != null && iNode.Name.Equals(XmlLabel))
     {
         String AreaString = TambonHelper.GetAttributeOptionalString(iNode, "newarea");
         if (!String.IsNullOrEmpty(AreaString))
         {
             Area = Convert.ToSingle(AreaString);
         }
     }
 }
 internal override void DoLoad(XmlNode node)
 {
     base.DoLoad(node);
     if (node != null && node.Name.Equals(XmlLabel))
     {
         String SubdivisionsString = TambonHelper.GetAttributeOptionalString(node, "subdivisions");
         if (!String.IsNullOrEmpty(SubdivisionsString))
         {
             NumberOfSubdivision = Convert.ToInt32(SubdivisionsString);
         }
     }
 }
 override internal void DoLoad(XmlNode iNode)
 {
     base.DoLoad(iNode);
     if (iNode != null && iNode.Name.Equals(XmlLabel))
     {
         string lTypeString = TambonHelper.GetAttributeOptionalString(iNode, "type");
         if (!String.IsNullOrEmpty(lTypeString))
         {
             Type = (EntityType)Enum.Parse(typeof(EntityType), lTypeString);
         }
     }
 }
Exemplo n.º 8
0
 virtual internal void DoLoad(XmlNode iNode)
 {
     if (iNode != null)
     {
         Geocode       = TambonHelper.GetAttributeOptionalInt(iNode, "geocode", 0);
         TambonGeocode = TambonHelper.GetAttributeOptionalInt(iNode, "tambon", 0);
         Name          = TambonHelper.GetAttributeOptionalString(iNode, "name");
         English       = TambonHelper.GetAttributeOptionalString(iNode, "english");
         Owner         = TambonHelper.GetAttributeOptionalInt(iNode, "owner", 0);
         foreach (XmlNode lNode in iNode.ChildNodes)
         {
             var lContent = RoyalGazetteContent.CreateContentObject(lNode.Name);
             if (lContent != null)
             {
                 lContent.DoLoad(lNode);
                 mSubEntries.Add(lContent);
             }
         }
     }
 }
Exemplo n.º 9
0
        internal static BoardMeetingEntry Load(XmlNode node)
        {
            BoardMeetingEntry result = null;

            if (node != null && node.Name.Equals("boardmeeting"))
            {
                result = new BoardMeetingEntry();
                String url = TambonHelper.GetAttributeOptionalString(node, "url");
                if (!String.IsNullOrEmpty(url))
                {
                    result.WebLink = new Uri(url);
                }
                result.Date          = TambonHelper.GetAttributeDateTime(node, "date");
                result.BoardNumber   = TambonHelper.GetAttribute(node, "board");
                result.MeetingNumber = Convert.ToInt32(TambonHelper.GetAttribute(node, "number"));

                result.LoadContents(node);
            }

            return(result);
        }
Exemplo n.º 10
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);
        }
Exemplo n.º 11
0
 internal override void DoLoad(XmlNode iNode)
 {
     base.DoLoad(iNode);
     if (iNode != null && iNode.Name.Equals(XmlLabel))
     {
         String s = TambonHelper.GetAttributeOptionalString(iNode, "type");
         if (!String.IsNullOrEmpty(s))
         {
             Status = (EntityType)Enum.Parse(typeof(EntityType), s);
         }
         NewParent = TambonHelper.GetAttributeOptionalInt(iNode, "parent", 0);
         foreach (XmlNode lNode in iNode.ChildNodes)
         {
             if (lNode.Name == RoyalGazetteContentReassign.XmlLabel)
             {
                 var lContent = new RoyalGazetteContentReassign();
                 lContent.DoLoad(lNode);
                 mSubEntries.Add(lContent);
             }
         }
     }
 }
Exemplo n.º 12
0
        internal static RoyalGazette Load(XmlNode iNode)
        {
            RoyalGazette RetVal = null;

            if (iNode != null && iNode.Name.Equals("entry"))
            {
                RetVal             = new RoyalGazette();
                RetVal.Description = TambonHelper.GetAttributeOptionalString(iNode, "description");
                RetVal.URI         = TambonHelper.GetAttribute(iNode, "uri");
                RetVal.Title       = TambonHelper.GetAttribute(iNode, "title");
                RetVal.SubTitle    = TambonHelper.GetAttributeOptionalString(iNode, "subtitle");
                RetVal.Volume      = Convert.ToInt32(TambonHelper.GetAttribute(iNode, "volume"));
                RetVal.Issue       = new RoyalGazetteIssue(TambonHelper.GetAttribute(iNode, "issue"));
                RetVal.PageInfo    = new RoyalGazettePageinfo(TambonHelper.GetAttribute(iNode, "page"));
                Int32 lPageEnd = TambonHelper.GetAttributeOptionalInt(iNode, "pageend", 0);
                if (lPageEnd != 0)
                {
                    RetVal.PageInfo.PageEnd = lPageEnd;
                }
                RetVal.Sign        = TambonHelper.GetAttributeOptionalDateTime(iNode, "sign");
                RetVal.Effective   = TambonHelper.GetAttributeOptionalDateTime(iNode, "effective");
                RetVal.Publication = TambonHelper.GetAttributeDateTime(iNode, "publication");
                RetVal.SignedBy    = TambonHelper.GetAttributeOptionalString(iNode, "signedby");
                String s = TambonHelper.GetAttributeOptionalString(iNode, "signedbyfunction");
                if (!String.IsNullOrEmpty(s))
                {
                    RetVal.SignedByPosition = (GazetteSignPosition)Enum.Parse(typeof(GazetteSignPosition), s);
                }
                Int32 lEffectiveRelative = TambonHelper.GetAttributeOptionalInt(iNode, "effectiveafter", -1);
                if (lEffectiveRelative >= 0)
                {
                    RetVal.Effective = RetVal.Publication.AddDays(lEffectiveRelative);
                }
                RetVal.LoadContents(iNode);
            }

            return(RetVal);
        }
Exemplo n.º 13
0
        public static EntityLeaderList Load(XmlNode iNode)
        {
            EntityLeaderList RetVal = null;

            if (iNode != null && iNode.Name.Equals("officials"))
            {
                RetVal        = new EntityLeaderList();
                RetVal.Source = TambonHelper.GetAttributeOptionalString(iNode, "source");

                if (iNode.HasChildNodes)
                {
                    foreach (XmlNode lChildNode in iNode.ChildNodes)
                    {
                        EntityLeader lCurrent = EntityLeader.Load(lChildNode);
                        if (lCurrent != null)
                        {
                            RetVal.Add(lCurrent);
                        }
                    }
                }
            }
            return(RetVal);
        }
Exemplo n.º 14
0
 override internal void DoLoad(XmlNode iNode)
 {
     base.DoLoad(iNode);
     if (iNode != null && iNode.Name.Equals(XmlLabel))
     {
         string lTypeString = TambonHelper.GetAttributeOptionalString(iNode, "type");
         if (!String.IsNullOrEmpty(lTypeString))
         {
             Type = (EntityType)Enum.Parse(typeof(EntityType), lTypeString);
         }
         lTypeString = TambonHelper.GetAttributeOptionalString(iNode, "capitaltype");
         if (!String.IsNullOrEmpty(lTypeString))
         {
             TypeCapital = (EntityType)Enum.Parse(typeof(EntityType), lTypeString);
         }
         GeocodeCapital    = TambonHelper.GetAttributeOptionalInt(iNode, "capitalgeocode", 0);
         GeocodeCapitalOld = TambonHelper.GetAttributeOptionalInt(iNode, "oldcapitalgeocode", 0);
         CapitalName       = TambonHelper.GetAttributeOptionalString(iNode, "capitalname");
         CapitalNameOld    = TambonHelper.GetAttributeOptionalString(iNode, "oldcapitalname");
         CapitalEnglish    = TambonHelper.GetAttributeOptionalString(iNode, "capitalenglish");
         CapitalEnglishOld = TambonHelper.GetAttributeOptionalString(iNode, "oldcapitalenglish");
     }
 }
Exemplo n.º 15
0
        internal static PopulationDataEntry Load(XmlNode iNode)
        {
            PopulationDataEntry RetVal = null;

            if (iNode != null && iNode.Name.Equals("entity"))
            {
                RetVal            = new PopulationDataEntry();
                RetVal.Name       = TambonHelper.GetAttributeOptionalString(iNode, "name").Trim();
                RetVal.English    = TambonHelper.GetAttributeOptionalString(iNode, "english").Trim();
                RetVal.Total      = TambonHelper.GetAttributeOptionalInt(iNode, "total", 0);
                RetVal.Obsolete   = TambonHelper.GetAttributeOptionalBool(iNode, "obsolete", false);
                RetVal.Male       = TambonHelper.GetAttributeOptionalInt(iNode, "male", 0);
                RetVal.Female     = TambonHelper.GetAttributeOptionalInt(iNode, "female", 0);
                RetVal.Households = TambonHelper.GetAttributeOptionalInt(iNode, "households", 0);
                RetVal.Geocode    = TambonHelper.GetAttributeOptionalInt(iNode, "geocode", 0);
                RetVal.GeocodeOfCorrespondingTambon = TambonHelper.GetAttributeOptionalInt(iNode, "tambon", 0);
                RetVal.Comment = TambonHelper.GetAttributeOptionalString(iNode, "comment");
                string lNewGeocode = TambonHelper.GetAttributeOptionalString(iNode, "newgeocode");
                foreach (string lSubString in lNewGeocode.Split(new Char[] { ' ' }))
                {
                    if (!string.IsNullOrEmpty(lSubString))
                    {
                        RetVal.NewGeocode.Add(Convert.ToInt32(lSubString));
                    }
                }
                string s = TambonHelper.GetAttributeOptionalString(iNode, "type");
                if (!String.IsNullOrEmpty(s))
                {
                    RetVal.Type = (EntityType)Enum.Parse(typeof(EntityType), s);
                }
                string lGeocodeParent = TambonHelper.GetAttributeOptionalString(iNode, "parent");
                foreach (string lSubString in lGeocodeParent.Split(new Char[] { ' ' }))
                {
                    if (!string.IsNullOrEmpty(lSubString))
                    {
                        RetVal.GeocodeParent.Add(Convert.ToInt32(lSubString));
                    }
                }
                if (iNode.HasChildNodes)
                {
                    foreach (XmlNode lChildNode in iNode.ChildNodes)
                    {
                        if (lChildNode.Name == "office")
                        {
                            EntityOffice lOffice = EntityOffice.Load(lChildNode);
                            RetVal.Offices.Add(lOffice);
                        }
                        if (lChildNode.Name == "history")
                        {
                            RetVal.ParseHistory(lChildNode);
                        }
                        if (lChildNode.Name == "entity")
                        {
                            RetVal.SubEntities.Add(PopulationDataEntry.Load(lChildNode));
                        }
                        if (lChildNode.Name == "constituencies")
                        {
                            RetVal.ConstituencyList.ReadFromXml(lChildNode);
                        }
                    }
                }
            }
            return(RetVal);
        }