Пример #1
0
        protected override void ProcessAnnouncement(RoyalGazette iEntry)
        {
            Int32 lCount           = 0;
            Int32 lProvinceGeocode = 0;

            foreach (RoyalGazetteContent lContent in iEntry.Content)
            {
                if (ContentFitting(lContent))
                {
                    lCount++;
                    ProcessContent(lContent);
                    lProvinceGeocode = lContent.Geocode;
                    while (lProvinceGeocode / 100 != 0)
                    {
                        lProvinceGeocode = lProvinceGeocode / 100;
                    }
                }
            }
            if (lCount > 0)
            {
                NumberOfAnnouncements++;
                mCreationsPerAnnouncement.IncrementForCount(lCount, lProvinceGeocode);
                if (iEntry.Effective.Year > 1)
                {
                    DateTime lDummy = new DateTime(2004, iEntry.Effective.Month, iEntry.Effective.Day);
                    Int32    lIndex = lDummy.DayOfYear;
                    if (!mEffectiveDayOfYear.ContainsKey(lIndex))
                    {
                        mEffectiveDayOfYear[lIndex] = 0;
                    }
                    mEffectiveDayOfYear[lIndex]++;
                }
            }
        }
Пример #2
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);
        }
Пример #3
0
        private void grid_CellDoubleClick(object sender, DataGridViewCellEventArgs e)
        {
            if (e.RowIndex >= 0)
            {
                DataGridView    lGrid = sender as DataGridView;
                DataGridViewRow lRow  = lGrid.Rows[e.RowIndex];

                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)
                {
                    lGazette.ShowPDF();
                }
            }
        }
Пример #4
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);
        }
Пример #5
0
        protected override void ProcessAnnouncement(RoyalGazette iEntry)
        {
            Int32   lWarningOffsetDays = 345;
            Boolean lProcessed         = false;

            if (iEntry.Publication.Year > 1)
            {
                if (iEntry.Effective.Year > 1)
                {
                    lProcessed = true;
                    TimeSpan iTime = iEntry.Publication.Subtract(iEntry.Effective);
                    mDaysBetweenPublicationAndEffective.IncrementForCount(iTime.Days, 0);
                    if (Math.Abs(iTime.Days) > lWarningOffsetDays)
                    {
                        StrangeAnnouncements.Add(iEntry);
                    }
                }
                if (iEntry.Sign.Year > 1)
                {
                    lProcessed = true;
                    TimeSpan iTime = iEntry.Publication.Subtract(iEntry.Sign);
                    mDaysBetweenSignAndPublication.IncrementForCount(iTime.Days, 0);
                    if ((iTime.Days < 0) | (iTime.Days > lWarningOffsetDays))
                    {
                        if (!StrangeAnnouncements.Contains(iEntry))
                        {
                            StrangeAnnouncements.Add(iEntry);
                        }
                    }
                }
                if (lProcessed)
                {
                    NumberOfAnnouncements++;
                }
            }
        }
Пример #6
0
 protected abstract void ProcessAnnouncement(RoyalGazette iEntry);
Пример #7
0
        protected virtual Boolean AnnouncementDateFitting(RoyalGazette iEntry)
        {
            Boolean retval = ((iEntry.Publication.Year <= EndYear) && (iEntry.Publication.Year >= StartYear));

            return(retval);
        }