protected override void ProcessAnnouncement(GazetteEntry entry)
 {
     Int32 warningOffsetDays = 345;
     Boolean processed = false;
     if ( entry.publication.Year > 1 )
     {
         if ( entry.effective.Year > 1 )
         {
             processed = true;
             TimeSpan timeBetweenPublicationAndEffective = entry.publication.Subtract(entry.effective);
             _daysBetweenPublicationAndEffective.IncrementForCount(timeBetweenPublicationAndEffective.Days, 0);
             if ( Math.Abs(timeBetweenPublicationAndEffective.Days) > warningOffsetDays )
             {
                 _strangeAnnouncements.Add(entry);
             }
         }
         if ( entry.sign.Year > 1 )
         {
             processed = true;
             TimeSpan timeBetweenSignAndPublication = entry.publication.Subtract(entry.sign);
             _daysBetweenSignAndPublication.IncrementForCount(timeBetweenSignAndPublication.Days, 0);
             if ( (timeBetweenSignAndPublication.Days < 0) | (timeBetweenSignAndPublication.Days > warningOffsetDays) )
             {
                 if ( !StrangeAnnouncements.Contains(entry) )
                 {
                     _strangeAnnouncements.Add(entry);
                 }
             }
         }
         if ( processed )
         {
             NumberOfAnnouncements++;
         }
     }
 }
예제 #2
0
        /// <summary>
        /// Adds the given gazette as a reference.
        /// </summary>
        /// <param name="gazette">Gazette entry to add.</param>
        public void AddGazetteReference(GazetteEntry gazette)
        {
            if (gazette == null)
            {
                throw new ArgumentNullException("gazette");
            }

            if (gazette.effectiveSpecified)
            {
                effective          = gazette.effective;
                effectiveSpecified = true;
            }
            if (gazette.effectiveafterSpecified)
            {
                effective          = gazette.publication + new TimeSpan(gazette.effectiveafter, 0, 0, 0);
                effectiveSpecified = true;
            }
            if (!effectiveSpecified)
            {
                // wild guess - using publication date as effective date
                effective          = gazette.publication;
                effectiveSpecified = true;
            }
            status = ChangeStatus.Gazette;
            Items.Add(new GazetteRelated(gazette)
            {
                relation = GazetteRelation.Unknown
            });
        }
예제 #3
0
        /// <summary>
        /// Adds the given gazette as a reference.
        /// </summary>
        /// <param name="gazette">Gazette entry to add.</param>
        public void AddGazetteReference(GazetteEntry gazette)
        {
            if ( gazette == null )
            {
                throw new ArgumentNullException("gazette");
            }

            if ( gazette.effectiveSpecified )
            {
                effective = gazette.effective;
                effectiveSpecified = true;
            }
            if ( gazette.effectiveafterSpecified )
            {
                effective = gazette.publication + new TimeSpan(gazette.effectiveafter, 0, 0, 0);
                effectiveSpecified = true;
            }
            if ( !effectiveSpecified )
            {
                // wild guess - using publication date as effective date
                effective = gazette.publication;
                effectiveSpecified = true;
            }
            status = ChangeStatus.Gazette;
            Items.Add(new GazetteRelated(gazette)
            {
                relation = GazetteRelation.Unknown
            });
        }
예제 #4
0
        protected override void ProcessAnnouncement(GazetteEntry entry)
        {
            Int32  count           = 0;
            UInt32 provinceGeocode = 0;

            foreach (var content in entry.Items)
            {
                var contentBase = content as GazetteOperationBase;
                if (ContentFitting(contentBase))
                {
                    count++;
                    ProcessContent(content as GazetteCreate);
                    provinceGeocode = contentBase.geocode;
                    while (provinceGeocode / 100 != 0)
                    {
                        provinceGeocode = provinceGeocode / 100;
                    }
                }
            }
            if (count > 0)
            {
                NumberOfAnnouncements++;
                _creationsPerAnnouncement.IncrementForCount(count, provinceGeocode);
                if (entry.effective.Year > 1)
                {
                    DateTime dummy = new DateTime(2004, entry.effective.Month, entry.effective.Day);
                    Int32    index = dummy.DayOfYear;
                    if (!_effectiveDayOfYear.ContainsKey(index))
                    {
                        _effectiveDayOfYear[index] = 0;
                    }
                    _effectiveDayOfYear[index]++;
                }
            }
        }
예제 #5
0
        /// <summary>
        /// Checks whether the <see cref="GazetteEntry.publication">publication date</see> of <paramref name="entry"/> fits into the time range given by <see cref="StartYear"/> and <see cref="EndYear"/>.
        /// </summary>
        /// <param name="entry">Announcement to check.</param>
        /// <returns><c>true</c> if announcement publication date is in the time range, <c>false</c> otherwise.</returns>
        /// <exception cref="ArgumentNullException"><paramref name="entry"/> is <c>null</c>.</exception>
        protected virtual Boolean AnnouncementDateFitting(GazetteEntry entry)
        {
            if (entry == null)
            {
                throw new ArgumentNullException("entry");
            }
            Boolean retval = ((entry.publication.Year <= EndYear) && (entry.publication.Year >= StartYear));

            return(retval);
        }
예제 #6
0
        /// <summary>
        /// Creates a new instance of <see cref="GazetteRelated"/> linking an Gazette entry.
        /// </summary>
        /// <param name="entry">Gazette entry to which the link should be made.</param>
        public GazetteRelated(GazetteEntry entry)
        {
            if (entry == null)
            {
                throw new ArgumentNullException("entry");
            }

            this.relationField = GazetteRelation.Mention;
            this.date          = entry.publication;
            this.dateSpecified = true;
            this.issue         = entry.issue;
            this.page          = entry.FirstPage;
            this.volume        = entry.volume;
        }
예제 #7
0
        private GazetteEntry ParseSingeItem(String value)
        {
            value = value.Replace("\t", "");
            GazetteEntry retval   = null;
            Int32        position = value.IndexOf(EntryURL);

            if (position >= 0)
            {
                retval   = new GazetteEntry();
                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.ToByte(ThaiNumeralHelper.ReplaceThaiNumerals(volume));
                value         = value.Substring(position2, value.Length - position2);
                position      = value.IndexOf(EntryIssue) + EntryIssue.Length;
                position2     = value.IndexOf(ColumnEnd, position);
                retval.issue  = ThaiNumeralHelper.ReplaceThaiNumerals(value.Substring(position, position2 - position).Trim());
                value         = value.Substring(position2, value.Length - position2);
                position      = value.IndexOf(EntryDate) + EntryDate.Length;
                position2     = value.IndexOf(ColumnEnd, position);
                string Date = value.Substring(position, position2 - position);
                retval.publication = ThaiDateHelper.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);
                retval.page = ThaiNumeralHelper.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);
        }
예제 #8
0
        protected override void ProcessAnnouncement(GazetteEntry entry)
        {
            Int32   warningOffsetDays = 345;
            Boolean processed         = false;

            if (entry.publication.Year > 1)
            {
                if (entry.effective.Year > 1)
                {
                    processed = true;
                    TimeSpan timeBetweenPublicationAndEffective = entry.publication.Subtract(entry.effective);
                    _daysBetweenPublicationAndEffective.IncrementForCount(timeBetweenPublicationAndEffective.Days, 0);
                    if (Math.Abs(timeBetweenPublicationAndEffective.Days) > warningOffsetDays)
                    {
                        _strangeAnnouncements.Add(entry);
                    }
                }
                if (entry.sign.Year > 1)
                {
                    processed = true;
                    TimeSpan timeBetweenSignAndPublication = entry.publication.Subtract(entry.sign);
                    _daysBetweenSignAndPublication.IncrementForCount(timeBetweenSignAndPublication.Days, 0);
                    if ((timeBetweenSignAndPublication.Days < 0) | (timeBetweenSignAndPublication.Days > warningOffsetDays))
                    {
                        if (!StrangeAnnouncements.Contains(entry))
                        {
                            _strangeAnnouncements.Add(entry);
                        }
                    }
                }
                if (processed)
                {
                    NumberOfAnnouncements++;
                }
            }
        }
예제 #9
0
 /// <summary>
 /// Calculates the actual detail statistics of the given <paramref name="entry"/>.
 /// </summary>
 /// <param name="entry">Announcement to be checked.</param>
 protected abstract void ProcessAnnouncement(GazetteEntry entry);
        private GazetteEntry ParseSingeItem(String value)
        {
            value = value.Replace("\t", "");
            GazetteEntry retval = null;
            Int32 position = value.IndexOf(EntryURL);
            if ( position >= 0 )
            {
                retval = new GazetteEntry();
                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.ToByte(ThaiNumeralHelper.ReplaceThaiNumerals(volume));
                value = value.Substring(position2, value.Length - position2);
                position = value.IndexOf(EntryIssue) + EntryIssue.Length;
                position2 = value.IndexOf(ColumnEnd, position);
                retval.issue = ThaiNumeralHelper.ReplaceThaiNumerals(value.Substring(position, position2 - position).Trim());
                value = value.Substring(position2, value.Length - position2);
                position = value.IndexOf(EntryDate) + EntryDate.Length;
                position2 = value.IndexOf(ColumnEnd, position);
                string Date = value.Substring(position, position2 - position);
                retval.publication = ThaiDateHelper.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);
                retval.page = ThaiNumeralHelper.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;
        }
예제 #11
0
        protected virtual Boolean AnnouncementDateFitting(GazetteEntry entry)
        {
            Boolean retval = ((entry.publication.Year <= EndYear) && (entry.publication.Year >= StartYear));

            return(retval);
        }