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); }
public void SearchNewsNow() { RoyalGazetteList gazetteList = SearchNews(DateTime.Now); if (DateTime.Now.Month == 1) { // Check news from last year as well, in case something was added late gazetteList.AddRange(SearchNews(DateTime.Now.AddYears(-1))); } gazetteList.SortByPublicationDate(); OnProcessingFinished(new RoyalGazetteEventArgs(gazetteList)); }
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); }