예제 #1
0
        private void btnMonths_Click(object sender, EventArgs e)
        {
            StringBuilder value = new StringBuilder(boxText.Text);

            foreach (KeyValuePair <String, Byte> monthNameThai in TambonHelper.ThaiMonthNames)
            {
                DateTime month          = new DateTime(2000, monthNameThai.Value, 1);
                String   monthNameLocal = month.ToString("MMMM");
                value = value.Replace(monthNameThai.Key, monthNameLocal);
            }
            foreach (KeyValuePair <String, Byte> monthAbbreviation in TambonHelper.ThaiMonthAbbreviations)
            {
                DateTime month          = new DateTime(2000, monthAbbreviation.Value, 1);
                String   monthNameLocal = month.ToString("MMMM");
                value = value.Replace(monthAbbreviation.Key, monthNameLocal);
            }


            foreach (var subString in value.ToString().Split(new String[] { " ", Environment.NewLine, "\t" }, StringSplitOptions.None))
            {
                if (TambonHelper.IsNumeric(subString))
                {
                    Int64 number = Convert.ToInt64(subString);
                    if ((number > 2400) && (number < 2600))
                    {
                        number -= 543;
                        value.Replace(subString, number.ToString());
                    }
                }
            }

            boxText.Text = value.ToString();
        }
예제 #2
0
        internal List <PopulationDataEntry> InvalidGeocodeEntries()
        {
            List <PopulationDataEntry> lResult = new List <PopulationDataEntry>();

            foreach (PopulationDataEntry lEntry in SubEntities)
            {
                if (!TambonHelper.IsBaseGeocode(this.Geocode, lEntry.Geocode))
                {
                    lResult.Add(lEntry);
                }

                Int32 lCount = 0;
                foreach (PopulationDataEntry lCountEntry in SubEntities)
                {
                    if (lCountEntry.Geocode == lEntry.Geocode)
                    {
                        lCount++;
                    }
                }
                if (lCount > 1)
                {
                    lResult.Add(lEntry);
                }

                lResult.AddRange(lEntry.InvalidGeocodeEntries());
            }
            return(lResult);
        }
예제 #3
0
        public PopulationDataEntry FindByCode(Int32 code)
        {
            PopulationDataEntry retval = null;

            if (this.Geocode == code)
            {
                retval = this;
            }
            else
            {
                retval = SubEntities.FirstOrDefault(entry => (entry != null) && (entry.Geocode == code));
                if (retval == null)
                {
                    SubEntities.ForEach(delegate(PopulationDataEntry entity)
                    {
                        if ((retval == null) && (entity != null))
                        {
                            if (TambonHelper.IsBaseGeocode(entity.Geocode, code))
                            {
                                retval = entity.FindByCode(code);
                            }
                        }
                    });
                }
            }
            return(retval);
        }
예제 #4
0
        public Dictionary <String, EntityLeader> NewGovernorsList()
        {
            Dictionary <String, EntityLeader> RetVal        = new Dictionary <String, EntityLeader>();
            List <PopulationDataEntry>        lFoundEntries = new List <PopulationDataEntry>();

            foreach (PopulationDataEntry lEntry in mData)
            {
                lEntry.Geocode = TambonHelper.GetGeocode(lEntry.Name);
                PopulationData lData = TambonHelper.GetGeocodeList(lEntry.Geocode);
                lEntry.English = lData.Data.English;
                foreach (EntityOffice lOffice in lEntry.Offices)
                {
                    foreach (EntityLeader lLeader in lOffice.OfficialsList)
                    {
                        if (lLeader.Position == EntityLeaderType.Governor)
                        {
                            if (lData.Data.LeaderAlreadyInList(lLeader))
                            {
                                lFoundEntries.Add(lEntry);
                            }
                            else
                            {
                                RetVal.Add(lEntry.English, lLeader);
                            }
                        }
                    }
                }
            }
            foreach (PopulationDataEntry lEntry in lFoundEntries)
            {
                mData.Remove(lEntry);
            }
            return(RetVal);
        }
예제 #5
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);
         }
     }
 }
예제 #6
0
        public override bool IsAboutGeocode(Int32 iGeocode, Boolean iIncludeSubEntities)
        {
            Boolean retval = TambonHelper.IsSameGeocode(iGeocode, Geocode, iIncludeSubEntities);

            retval = retval | TambonHelper.IsSameGeocode(iGeocode, OldGeocode, iIncludeSubEntities);
            return(retval);
        }
예제 #7
0
 private void edit_MGRS_TextChanged(object sender, EventArgs e)
 {
     if (!_Changing)
     {
         String   value    = TambonHelper.ReplaceThaiNumerals(edt_MGRS.Text.ToUpper()).Trim();
         GeoPoint geoPoint = null;
         UtmPoint utmPoint = null;
         try
         {
             _Changing = true;
             if (!TambonHelper.IsNumeric(value.Substring(0, 2)))
             {
                 value = ZoneForThailandMgrs(value) + value;
             }
             utmPoint       = UtmPoint.ParseMgrsString(value);
             geoPoint       = new GeoPoint(utmPoint, (GeoDatum)cbx_datum.SelectedItem);
             geoPoint.Datum = GeoDatum.DatumWGS84();
         }
         catch
         {
             // invalid string
             utmPoint = null;
             geoPoint = null;
         }
         SetValues(geoPoint, utmPoint, sender);
         _Changing = false;
     }
 }
예제 #8
0
        private void ConstituencyForm_Load(Object sender, EventArgs e)
        {
            edtYear.Maximum = TambonHelper.PopulationStatisticMaxYear;
            edtYear.Minimum = TambonHelper.PopulationStatisticMinYear;
            edtYear.Value   = edtYear.Maximum;

            TambonHelper.LoadGeocodeList();

            cbxProvince.Items.Clear();
            foreach (PopulationDataEntry entry in TambonHelper.ProvinceGeocodes)
            {
                cbxProvince.Items.Add(entry);
                if (entry.Geocode == TambonHelper.PreferredProvinceGeocode)
                {
                    cbxProvince.SelectedItem = entry;
                }
            }

            cbxRegion.Items.Clear();
            foreach (String regionScheme in TambonHelper.RegionSchemes())
            {
                cbxRegion.Items.Add(regionScheme);
            }
            if (cbxRegion.Items.Count > 0)
            {
                cbxRegion.SelectedIndex = 0;
            }
        }
예제 #9
0
        private Stream DoDataDownload(Int32 page)
        {
            WebClient client = new WebClient();

            client.Encoding = Encoding.UTF8;
            if (page == 0)
            {
                client.Headers.Add("Referer", _searchPostUrl);
            }
            else
            {
                client.Headers.Add("Referer", _searchPageUrl);
            }
            if (!String.IsNullOrEmpty(_cookie))
            {
                client.Headers.Add("Cookie", _cookie);
            }
            client.Headers.Add("User-Agent", "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/66.0.3359.139 Safari/537.36");
            client.Headers.Add("Accept", "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8");
            client.Headers.Add("Accept-Language", "en-US;q=0.8,en;q=0.7");
            client.Headers.Add("Host", "www.ratchakitcha.soc.go.th");
            client.Headers.Add("Upgrade-Insecure-Requests", "1");

            // client.Headers.Add("Accept-Encoding", "gzip,deflate");
            client.Headers.Add("Accept-Charset", "UTF-8,*");
            System.IO.Stream receiveStream = client.OpenRead(_dataUrl);
            MemoryStream     memory        = new MemoryStream();

            TambonHelper.StreamCopy(receiveStream, memory);
            memory.Seek(0, 0);
            return(memory);
        }
예제 #10
0
        public Dictionary <PopulationDataEntry, PopulationDataEntry> DifferentMubanNames(PopulationDataEntry changwat)
        {
            var RetVal = new Dictionary <PopulationDataEntry, PopulationDataEntry>();

            PopulationData      geocodes        = TambonHelper.GetGeocodeList(changwat.Geocode);
            PopulationDataEntry currentChangwat = geocodes.Data;

            foreach (PopulationDataEntry currentAmphoe in currentChangwat.SubEntities)
            {
                foreach (PopulationDataEntry currentTambon in currentAmphoe.SubEntities)
                {
                    foreach (PopulationDataEntry currentMuban in currentTambon.SubEntities)
                    {
                        if (currentMuban.Type == EntityType.Muban)
                        {
                            PopulationDataEntry mubanDopa = changwat.FindByCode(currentMuban.Geocode);
                            if (mubanDopa != null)
                            {
                                if (!TambonHelper.IsSameMubanName(mubanDopa.Name, currentMuban.Name))
                                {
                                    RetVal.Add(currentMuban, mubanDopa);
                                }
                            }
                        }
                    }
                }
            }
            return(RetVal);
        }
예제 #11
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);
        }
예제 #12
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;
                    }
                }
            }
        }
예제 #13
0
        internal virtual void WriteToXMLNode(XmlElement iNode)
        {
            iNode.SetAttribute("type", Type.ToString());

            if (Location != null)
            {
                Location.ExportToXML(iNode);
            }
            if (Address != null)
            {
                Address.ExportToXML(iNode);
            }

            XmlDocument lXmlDocument = TambonHelper.XmlDocumentFromNode(iNode);

            foreach (Uri lUri in Websites)
            {
                var lNewElement = (XmlElement)lXmlDocument.CreateNode("element", "url", "");
                lNewElement.InnerText = lUri.ToString();
                iNode.AppendChild(lNewElement);
            }
            if (OfficialsList != null)
            {
                OfficialsList.ExportToXML(iNode);
            }
        }
예제 #14
0
        public List <PopulationDataEntry> ThesabanWithoutConstituencies()
        {
            List <PopulationDataEntry> lResult = new List <PopulationDataEntry>();

            PopulationData lGeocodes = TambonHelper.GetGeocodeList(mGeocode);

            lGeocodes.ReOrderThesaban();
            foreach (PopulationDataEntry lEntry in lGeocodes.Thesaban)
            {
                if (EntityTypeHelper.Thesaban.Contains(lEntry.Type) & (!lEntry.Obsolete))
                {
                    Boolean lSuccess = HasConstituencyAnnouncement(lEntry.Geocode, lEntry.Type);

                    if ((!lSuccess) & (lEntry.GeocodeOfCorrespondingTambon != 0))
                    {
                        lSuccess = HasConstituencyAnnouncement(lEntry.GeocodeOfCorrespondingTambon, lEntry.Type);
                    }
                    if (!lSuccess)
                    {
                        lResult.Add(lEntry);
                    }
                }
            }
            return(lResult);
        }
예제 #15
0
        private void btnDoConvert_Click(object sender, EventArgs e)
        {
            String value = boxText.Text;

            value        = TambonHelper.ReplaceThaiNumerals(value);
            boxText.Text = value;
        }
예제 #16
0
 public void RemoveAllKnownGeocodes()
 {
     foreach (var lEntry in TambonHelper.ProvinceGeocodes)
     {
         PopulationData lCurrentList = TambonHelper.GetGeocodeList(lEntry.Geocode);
         RemoveKnownGeocodes(lCurrentList.Data);
     }
 }
예제 #17
0
        public void ExportToXML(XmlNode iNode)
        {
            XmlDocument lXmlDocument = TambonHelper.XmlDocumentFromNode(iNode);
            var         lNewElement  = (XmlElement)lXmlDocument.CreateNode("element", "office", "");

            iNode.AppendChild(lNewElement);
            WriteToXMLNode(lNewElement);
        }
예제 #18
0
        internal void ExportToXML(XmlNode iNode)
        {
            XmlDocument lXmlDocument = TambonHelper.XmlDocumentFromNode(iNode);
            var         lNewElement  = (XmlElement)lXmlDocument.CreateNode("element", GetXmlLabel(), "");

            WriteToXmlElement(lNewElement);
            iNode.AppendChild(lNewElement);
        }
예제 #19
0
 protected void GetGeocodes()
 {
     if (_changwat != null)
     {
         PopulationData geocodes = TambonHelper.GetGeocodeList(_changwat.Geocode);
         _invalidGeocodes = geocodes.Data.InvalidGeocodeEntries();
         Data.GetCodes(geocodes.Data);
     }
 }
예제 #20
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);
     }
 }
예제 #21
0
        private void AppendNameInfo(StringBuilder iBuilder)
        {
            iBuilder.AppendLine("Name equal: " + SuffixFrequency(String.Empty).ToString() + " times");
            List <String> lStandardSuffices = new List <String>()
            {
                "เหนือ", "ใต้", "พัฒนา", "ใหม่", "ทอง", "น้อย", "ใน"
            };

            foreach (String lSuffix in lStandardSuffices)
            {
                iBuilder.AppendLine("Suffix " + lSuffix + ": " + SuffixFrequency(lSuffix).ToString() + " times");
            }
            iBuilder.AppendLine("Suffix with number:" + SuffixFrequencyNumbers().ToString() + " times");

            List <String> lStandardPrefixes = new List <String>()
            {
                "ใหม่"
            };

            foreach (String lPrefix in lStandardPrefixes)
            {
                iBuilder.AppendLine("Prefix " + lPrefix + ": " + PrefixFrequency(lPrefix).ToString() + " times");
            }

            iBuilder.AppendLine();

            iBuilder.Append("Other suffices: ");
            List <KeyValuePair <String, Int32> > lSortedSuffices = new List <KeyValuePair <String, Int32> >();

            foreach (KeyValuePair <String, Int32> lKeyValuePair in mNewNameSuffix)
            {
                String lName = TambonHelper.ReplaceThaiNumerals(lKeyValuePair.Key);
                if (lStandardSuffices.Contains(lName))
                {
                }
                else if (String.IsNullOrEmpty(lKeyValuePair.Key))
                {
                }
                else if (TambonHelper.IsNumeric(lName))
                {
                }
                else
                {
                    lSortedSuffices.Add(lKeyValuePair);
                }
            }
            lSortedSuffices.Sort(delegate(KeyValuePair <String, Int32> x, KeyValuePair <String, Int32> y)
            {
                return(y.Value.CompareTo(x.Value));
            });
            foreach (KeyValuePair <String, Int32> lKeyValuePair in lSortedSuffices)
            {
                iBuilder.Append(lKeyValuePair.Key + " (" + lKeyValuePair.Value.ToString() + ") ");
            }
            iBuilder.AppendLine();
        }
예제 #22
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);
        }
예제 #23
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");
     }
 }
예제 #24
0
파일: Form1.cs 프로젝트: zenwalk/tambon
        private void btn_PopulationAllProvinces_Click(object sender, EventArgs e)
        {
            Int32 year = Convert.ToInt32(edtYear.Value);
            PopulationDataEntry country = TambonHelper.GetCountryPopulationData(year);
            // CheckPopulationData(downloader);
            var dataForm = new PopulationByEntityTypeViewer();

            dataForm.Country = country;
            dataForm.Show();
        }
예제 #25
0
        private PopulationDataEntry FindCompare()
        {
            PopulationDataEntry result = null;

            if (chkCompare.Checked)
            {
                Int32 year = Convert.ToInt32(edtCompareYear.Value);
                result = TambonHelper.GetCountryPopulationData(year);
            }
            return(result);
        }
예제 #26
0
        public void ExportToXML(XmlNode iNode)
        {
            XmlDocument lXmlDocument = TambonHelper.XmlDocumentFromNode(iNode);
            var         lNode        = (XmlElement)lXmlDocument.CreateNode("element", "gazette", "");

            iNode.AppendChild(lNode);
            foreach (RoyalGazette lEntry in this)
            {
                lEntry.ExportToXML(lNode);
            }
        }
예제 #27
0
        public void ExportToXML(XmlNode iNode)
        {
            XmlDocument lXmlDocument = TambonHelper.XmlDocumentFromNode(iNode);
            var         lNode        = (XmlElement)lXmlDocument.CreateNode("element", "governors", "");

            iNode.AppendChild(lNode);
            foreach (PopulationDataEntry lEntry in mData)
            {
                lEntry.ExportToXML(lNode);
            }
        }
예제 #28
0
        public virtual Boolean IsAboutGeocode(Int32 iGeocode, Boolean iIncludeSubEntities)
        {
            Boolean retval = TambonHelper.IsSameGeocode(iGeocode, Geocode, iIncludeSubEntities);

            retval = retval | TambonHelper.IsSameGeocode(iGeocode, Owner, iIncludeSubEntities);
            retval = retval | TambonHelper.IsSameGeocode(iGeocode, TambonGeocode, iIncludeSubEntities);
            foreach (RoyalGazetteContent lContent in mSubEntries)
            {
                retval = retval | lContent.IsAboutGeocode(iGeocode, iIncludeSubEntities);
            }
            return(retval);
        }
 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);
         }
     }
 }
예제 #30
0
        private RoyalGazette ParseSingeItem(String value)
        {
            value = value.Replace("\t", "");
            RoyalGazette retval   = null;
            Int32        position = value.IndexOf(EntryURL);

            if (position >= 0)
            {
                retval   = new RoyalGazette();
                position = position + EntryURL.Length;
                Int32 position2 = value.IndexOf(EntryURLend);
                retval.URI   = value.Substring(position, position2 - position);
                value        = value.Substring(position2, value.Length - position2);
                position     = value.IndexOf(EntryTitle) + EntryTitle.Length;
                position2    = value.IndexOf(EntryTitleEnd);
                retval.Title = value.Substring(position, position2 - position).Trim();
                value        = value.Substring(position2, value.Length - position2);
                position     = value.IndexOf(EntryVolumeorPage) + EntryVolumeorPage.Length;
                position2    = value.IndexOf(ColumnEnd, position);
                String volume = value.Substring(position, position2 - position);
                retval.Volume = Convert.ToInt32(TambonHelper.ReplaceThaiNumerals(volume));
                value         = value.Substring(position2, value.Length - position2);
                position      = value.IndexOf(EntryIssue) + EntryIssue.Length;
                position2     = value.IndexOf(ColumnEnd, position);
                String Issue = TambonHelper.ReplaceThaiNumerals(value.Substring(position, position2 - position).Trim());
                value        = value.Substring(position2, value.Length - position2);
                retval.Issue = new RoyalGazetteIssue(Issue);
                position     = value.IndexOf(EntryDate) + EntryDate.Length;
                position2    = value.IndexOf(ColumnEnd, position);
                String Date = value.Substring(position, position2 - position);
                retval.Publication = TambonHelper.ParseThaiDate(Date);
                value     = value.Substring(position2, value.Length - position2);
                position  = value.IndexOf(EntryVolumeorPage) + EntryVolumeorPage.Length;
                position2 = value.IndexOf(ColumnEnd, position);
                String page = value.Substring(position, position2 - position);
                if (String.IsNullOrEmpty(page))
                {
                    retval.PageInfo.Page = 1;
                }
                else
                {
                    retval.PageInfo.Page = Convert.ToInt32(TambonHelper.ReplaceThaiNumerals(page));
                }

                if (retval.Title.Contains('[') && retval.Title.EndsWith("]"))
                {
                    var beginSubTitle = retval.Title.LastIndexOf('[');
                    retval.SubTitle = retval.Title.Substring(beginSubTitle + 1, retval.Title.Length - beginSubTitle - 2).Trim();
                    retval.Title    = retval.Title.Substring(0, beginSubTitle - 1).Trim();
                }
            }
            return(retval);
        }