Exemplo n.º 1
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.º 2
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.º 3
0
 internal override void DoLoad(XmlNode iNode)
 {
     base.DoLoad(iNode);
     if (iNode != null && iNode.Name.Equals(XmlLabel))
     {
         OldGeocode = TambonHelper.GetAttributeOptionalInt(iNode, "oldgeocode", 0);
         OldParent  = TambonHelper.GetAttributeOptionalInt(iNode, "oldparent", 0);
     }
 }
Exemplo n.º 4
0
        internal static ConstituencyEntry Load(XmlNode iNode)
        {
            ConstituencyEntry RetVal = null;

            if (iNode != null && iNode.Name.Equals("constituency"))
            {
                RetVal               = new ConstituencyEntry();
                RetVal.Index         = TambonHelper.GetAttributeOptionalInt(iNode, "index", 0);
                RetVal.NumberOfSeats = TambonHelper.GetAttributeOptionalInt(iNode, "numberofseats", 1);

                if (iNode.HasChildNodes)
                {
                    foreach (XmlNode lChildNode in iNode.ChildNodes)
                    {
                        if (lChildNode.Name == "include")
                        {
                            PopulationDataEntry lEntity = new PopulationDataEntry();
                            lEntity.Geocode = TambonHelper.GetAttributeOptionalInt(lChildNode, "geocode", 0);
                            foreach (XmlNode lSubChildNode in lChildNode.ChildNodes)
                            {
                                if (lSubChildNode.Name == "exclude")
                                {
                                    PopulationDataEntry lExcludedEntity = new PopulationDataEntry();
                                    lExcludedEntity.Geocode = TambonHelper.GetAttributeOptionalInt(lSubChildNode, "geocode", 0);
                                    if (!RetVal.ExcludedAdministrativeEntities.ContainsKey(lEntity))
                                    {
                                        RetVal.ExcludedAdministrativeEntities[lEntity] = new List <PopulationDataEntry>();
                                    }
                                    RetVal.ExcludedAdministrativeEntities[lEntity].Add(lExcludedEntity);
                                }
                            }
                            RetVal.AdministrativeEntities.Add(lEntity);
                        }
                        if (lChildNode.Name == "includesub")
                        {
                            PopulationDataEntry lEntity = new PopulationDataEntry();
                            lEntity.Geocode = TambonHelper.GetAttributeOptionalInt(lChildNode, "geocode", 0);
                            foreach (XmlNode lSubChildNode in lChildNode.ChildNodes)
                            {
                                if (lSubChildNode.Name == "include")
                                {
                                    PopulationDataEntry lIncludedEntity = new PopulationDataEntry();
                                    lIncludedEntity.Geocode = TambonHelper.GetAttributeOptionalInt(lSubChildNode, "geocode", 0);
                                    if (!RetVal.SubIncludedAdministrativeEntities.ContainsKey(lEntity))
                                    {
                                        RetVal.SubIncludedAdministrativeEntities[lEntity] = new List <PopulationDataEntry>();
                                    }
                                    RetVal.SubIncludedAdministrativeEntities[lEntity].Add(lIncludedEntity);
                                }
                            }
                        }
                    }
                }
            }
            return(RetVal);
        }
Exemplo n.º 5
0
 internal override void DoLoad(XmlNode iNode)
 {
     base.DoLoad(iNode);
     if (iNode != null && iNode.Name.Equals(XmlLabel))
     {
         string s = TambonHelper.GetAttribute(iNode, "type");
         if (!String.IsNullOrEmpty(s))
         {
             Type = (EntityType)Enum.Parse(typeof(EntityType), s);
         }
         Parent = TambonHelper.GetAttributeOptionalInt(iNode, "parent", 0);
     }
 }
Exemplo n.º 6
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.º 7
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.º 8
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.º 9
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.º 10
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);
        }