protected override void Clear()
 {
     base.Clear();
     mDaysBetweenPublicationAndEffective = new FrequencyCounter();
     mDaysBetweenSignAndPublication = new FrequencyCounter();
     StrangeAnnouncements = new RoyalGazetteList();
 }
示例#2
0
 internal static void ShowGazetteNewsDialog(RoyalGazetteList iList)
 {
     var lNewGazetteEntries = iList.FilteredList(TambonHelper.GlobalGazetteList);
     if ( lNewGazetteEntries.Count != 0 )
     {
         ShowGazetteDialog(iList, true);
     }
 }
示例#3
0
 internal static void ShowGazetteDialog(RoyalGazetteList iList, Boolean iFiltered, String iTitle)
 {
     var lDataForm = new RoyalGazetteViewer();
     lDataForm.Filtered = iFiltered;
     lDataForm.Data = iList;
     if ( !String.IsNullOrEmpty(iTitle) )
     {
         lDataForm.Text = iTitle;
     }
     lDataForm.Show();
 }
        public RoyalGazetteList SearchString(DateTime beginDate, DateTime endDate, String searchKey)
        {
            RoyalGazetteList result = new RoyalGazetteList();
            Int32 volumeBegin = beginDate.Year - 2007 + 124;
            Int32 volumeEnd = endDate.Year - 2007 + 124;

            for ( Int32 volume = volumeBegin ; volume <= volumeEnd ; volume++ )
            {
                var list = GetListDescription(searchKey, volume, "");
                if ( list != null )
                {
                    result.AddRange(list);
                }
            }
            result.SortByPublicationDate();
            return result;
        }
        public RoyalGazetteList SearchNewsRangeAdministrative(DateTime beginDate, DateTime endDate, IEnumerable<EntityType> types, IEnumerable<EntityModification> modifications)
        {
            RoyalGazetteList result = new RoyalGazetteList();
            Int32 volumeBegin = beginDate.Year - 2007 + 124;
            Int32 volumeEnd = endDate.Year - 2007 + 124;

            for ( Int32 volume = volumeBegin ; volume <= volumeEnd ; volume++ )
            {
                foreach ( KeyValuePair<EntityModification, Dictionary<EntityType, String>> outerKeyValuePair in SearchKeys )
                {
                    if ( modifications.Contains(outerKeyValuePair.Key) )
                    {
                        foreach ( KeyValuePair<EntityType, String> keyValuePair in outerKeyValuePair.Value )
                        {
                            if ( types.Contains(keyValuePair.Key) )
                            {
                                var list = GetListDescription(keyValuePair.Value, volume, ModificationText(outerKeyValuePair.Key, keyValuePair.Key));
                                if ( list != null )
                                {
                                    result.AddRange(list);
                                }
                            }
                        }
                    }
                }
            }
            return result;
        }
        public RoyalGazetteList SearchNewsRange(DateTime beginDate, DateTime endDate)
        {
            RoyalGazetteList result = new RoyalGazetteList();
            var protecteAreaTypes = new List<ProtectedAreaTypes>();
            foreach ( ProtectedAreaTypes protectedArea in Enum.GetValues(typeof(ProtectedAreaTypes)) )
            {
                protecteAreaTypes.Add(protectedArea);
            }
            var protectedAreasList = SearchNewsProtectedAreas(beginDate, endDate, protecteAreaTypes);
            result.AddRange(protectedAreasList);

            var entityTypes = new List<EntityType>();
            foreach ( EntityType entityType in Enum.GetValues(typeof(EntityType)) )
            {
                if ( entityType != EntityType.Sukhaphiban )
                {
                    entityTypes.Add(entityType);
                }
            }
            var entityModifications = new List<EntityModification>();
            foreach ( EntityModification entityModification in Enum.GetValues(typeof(EntityModification)) )
            {
                entityModifications.Add(entityModification);
            }
            var administrativeEntitiesList = SearchNewsRangeAdministrative(beginDate, endDate, entityTypes, entityModifications);
            result.AddRange(administrativeEntitiesList);
            result.SortByPublicationDate();
            return result;
        }
        public RoyalGazetteList SearchNewsProtectedAreas(DateTime beginDate, DateTime endDate, IEnumerable<ProtectedAreaTypes> values)
        {
            RoyalGazetteList result = new RoyalGazetteList();
            Int32 volumeBegin = beginDate.Year - 2007 + 124;
            Int32 volumeEnd = endDate.Year - 2007 + 124;

            for ( Int32 volume = volumeBegin ; volume <= volumeEnd ; volume++ )
            {
                foreach ( KeyValuePair<EntityModification, Dictionary<ProtectedAreaTypes, String>> outerKeyValuePair in SearchKeysProtectedAreas )
                {
                    foreach ( KeyValuePair<ProtectedAreaTypes, String> keyValuePair in outerKeyValuePair.Value )
                    {
                        if ( values.Contains(keyValuePair.Key) )
                        {
                            var list = GetListDescription(keyValuePair.Value, volume, ModificationText(outerKeyValuePair.Key, keyValuePair.Key));
                            if ( list != null )
                            {
                                result.AddRange(list);
                            }
                        }
                    }
                }
            }
            result.SortByPublicationDate();
            return result;
        }
 public RoyalGazetteList SearchNews(DateTime date)
 {
     RoyalGazetteList result = new RoyalGazetteList();
     result.AddRange(SearchNewsRange(date, date));
     result.SortByPublicationDate();
     return result;
 }
示例#9
0
        private void FillDataTable(RoyalGazetteList iData)
        {
            RoyalGazetteList lData = iData;
            if ( filterToolStripMenuItem.Checked )
            {
                lData = lData.FilteredList(TambonHelper.GlobalGazetteList);
            }

            mTable.Rows.Clear();
            foreach ( RoyalGazette lEntry in lData )
            {
                DataRow lRow = mTable.NewRow();
                lRow["Description"] = lEntry.Description;
                lRow["Title"] = lEntry;
                lRow["Volume"] = lEntry.Volume;
                lRow["Issue"] = lEntry.Issue;
                lRow["Page"] = lEntry.PageInfo;
                lRow["Publication"] = lEntry.Publication;
                lRow["Signed"] = lEntry.Sign;
                lRow["Effective"] = lEntry.Effective;
                lRow["SignedBy"] = lEntry.SignedBy;
                lRow["SignedByAs"] = lEntry.SignedByPosition;
                lRow["Gazette"] = lEntry;
                mTable.Rows.Add(lRow);
            }
            grid.DataSource = mTable;
        }
 public StatisticsAnnouncementDates()
 {
     StartYear = 1883;
     EndYear = DateTime.Now.Year;
     StrangeAnnouncements = new RoyalGazetteList();
 }
示例#11
0
 private void openFileDialogXML_FileOk(Object sender, CancelEventArgs e)
 {
     this.Activate();
     String[] files = openFileDialogXML.FileNames;
     RoyalGazetteList currentGazetteList = new RoyalGazetteList();
     foreach ( String fileName in files )
     {
         RoyalGazetteList loadedGazetteList = RoyalGazetteList.Load(fileName);
         currentGazetteList.AddRange(loadedGazetteList);
     }
     ShowGazetteDialog(currentGazetteList);
 }
示例#12
0
 private void GazetteNewsReady(RoyalGazetteList data)
 {
     Invoke(new Action(() => RoyalGazetteViewer.ShowGazetteNewsDialog(data)));
 }
示例#13
0
 internal static void ShowGazetteDialog(RoyalGazetteList iList, Boolean iFiltered)
 {
     ShowGazetteDialog(iList, iFiltered, String.Empty);
 }
示例#14
0
 private void SetData(RoyalGazetteList value)
 {
     if ( value != null )
     {
         mData = value;
         FillDataTable(mData);
         grid.Columns[mTable.Columns.Count - 1].Visible = false;
     }
 }
        private RoyalGazetteList DoParse(TextReader reader)
        {
            RoyalGazetteList result = new RoyalGazetteList();
            String currentLine = String.Empty;
            int dataState = -1;
            StringBuilder entryData = new StringBuilder();
            try
            {
                while ( (currentLine = reader.ReadLine()) != null )
                {
                    if ( currentLine.Contains(PageStart) )
                    {
                        String temp = currentLine.Substring(currentLine.LastIndexOf(PageStart) + PageStart.Length, 3).Trim();
                        _numberOfPages = Convert.ToInt32(temp);
                    }
                    else if ( currentLine.StartsWith(EntryStart) )
                    {
                        if ( entryData.Length > 0 )
                        {
                            var current = ParseSingeItem(entryData.ToString());
                            if ( current != null )
                            {
                                result.Add(current);
                            }
                            entryData.Remove(0, entryData.Length);
                        }
                        dataState++;
                    }
                    else if ( dataState >= 0 )
                    {
                        entryData.Append(currentLine.Trim() + " ");
                    }
                }
                if ( entryData.Length > 0 )
                {
                    var current = ParseSingeItem(entryData.ToString());
                    if ( current != null )
                    {
                        result.Add(current);
                    }
                }
            }
            catch ( IOException )
            {
            }

            return result;
        }
 private RoyalGazetteList DoParseStream(Stream data)
 {
     var reader = new System.IO.StreamReader(data, TambonHelper.ThaiEncoding);
     RoyalGazetteList result = new RoyalGazetteList();
     result.AddRange(DoParse(reader));
     return result;
 }
示例#17
0
 private void ShowGazetteDialog(RoyalGazetteList data)
 {
     Invoke(new Action(() => RoyalGazetteViewer.ShowGazetteDialog(data, true)));
 }
 public RoyalGazetteList DoGetList(String searchKey, Int32 volume)
 {
     _searchKey = searchKey;
     _volume = volume;
     _cookie = String.Empty;
     RoyalGazetteList result = null;
     try
     {
         PerformRequest();
         result = new RoyalGazetteList();
         if ( _dataUrl != String.Empty )
         {
             Stream lData = DoDataDownload(0);
             result = DoParseStream(lData);
             for ( Int32 page = 2 ; page <= _numberOfPages ; page++ )
             {
                 PerformRequestPage(page);
                 Stream lDataPage = DoDataDownload(page);
                 result.AddRange(DoParseStream(lDataPage));
             }
         }
     }
     catch ( WebException )
     {
         result = null;
         // TODO
     }
     return result;
 }
示例#19
0
        private RoyalGazetteList CurrentSelection()
        {
            RoyalGazetteList retval = new RoyalGazetteList();
            foreach ( DataGridViewRow lRow in grid.SelectedRows )
            {
                DataRowView lRowView = lRow.DataBoundItem as DataRowView;
                // Debug.Assert(lRowView != null);

                DataRow lDataRow = lRowView.Row;
                // Debug.Assert(lDataRow != null);

                RoyalGazette lGazette = lDataRow["Title"] as RoyalGazette;
                if ( lGazette != null )
                {
                    retval.Add(lGazette);
                }
            }
            return retval;
        }