コード例 #1
0
        /// <summary>
        /// Gets the event info collection.
        /// </summary>
        /// <param name="dtStart">The dt start.</param>
        /// <param name="dtEnd">The dt end.</param>
        /// <returns></returns>
        public EventInfoCollections GetEventInfoCollection(DateTime dtStart,
                                                           DateTime dtEnd)
        {
            EventInfoCollections retVal = new EventInfoCollections();

            if (_calendarId == -1)
            {
                throw new NullReferenceException("calendarId");
            }

            CalendarEventLink[] eventLinks = CalendarEventLink.List(new FilterElement("CalendarId",
                                                                                      FilterElementType.Equal, _calendarId));

            foreach (CalendarEventLink eventLink in eventLinks)
            {
                try
                {
                    CalendarEvent calEvent = new CalendarEvent(eventLink.EventId);

                    if ((calEvent.DtStart >= dtStart) && (calEvent.DtEnd <= dtEnd))
                    {
                        CalendarEventInfo eventInfo = new CalendarEventInfo(this, calEvent);
                        eventInfo.SetEventId(EventProviderHelper.MakeEventId(GetEventType(),
                                                                             (ulong)(int)eventLink.PrimaryKeyId.Value));
                        retVal.Add(eventInfo);
                    }
                }
                catch (ObjectNotFoundException)
                {
                    throw;
                }
            }

            return(retVal);
        }
コード例 #2
0
ファイル: Calendar.cs プロジェクト: alex765022/IBN
        /// <summary>
        /// Gets the event info.
        /// </summary>
        /// <param name="dtStart">The dtStart.</param>
        /// <param name="dtEnd">The dtEnd.</param>
        /// <returns></returns>
        public EventInfoCollections GetEventList(DateTime dtStart, DateTime dtEnd)
        {
            CheckProviderInitialize();
            EventInfoCollections retVal =
                _providers.GetEventInfoCollection(dtStart, dtEnd);

            return(retVal);
        }
コード例 #3
0
ファイル: Calendar.cs プロジェクト: alex765022/IBN
        /// <summary>
        /// Called after a delete operation.
        /// </summary>
        protected override void  OnDeleting()
        {
            EventInfoCollections events = GetEventList(DateTime.MinValue, DateTime.MaxValue);

            DeleteEvent(events);

            base.OnDeleting();
        }
コード例 #4
0
ファイル: Calendar.cs プロジェクト: 0anion0/IBN
 /// <summary>
 /// Removes the event.
 /// </summary>
 /// <param name="eventInfoList">The event info list.</param>
 public void DeleteEvent(EventInfoCollections eventInfoList)
 {
     CheckProviderInitialize();
     if (eventInfoList != null)
     {
         foreach (CalendarEventInfo eventInfo in eventInfoList)
         {
             _providers.DeleteEvent(eventInfo.EventId);
         }
     }
 }
コード例 #5
0
ファイル: Calendar.cs プロジェクト: 0anion0/IBN
        /// <summary>
        /// Adds the event.
        /// </summary>
        /// <param name="eventInfoCollection">The event info collection.</param>
        /// <returns></returns>
        public EventInfoCollections AddEvent(EventInfoCollections eventInfoCollection)
        {
            EventInfoCollections retVal = new EventInfoCollections();

            foreach(CalendarEventInfo eventInfo in eventInfoCollection)
            {
              retVal.Add( AddEvent(eventInfo.EventId) );
            }

            return retVal;
        }
コード例 #6
0
ファイル: Calendar.cs プロジェクト: alex765022/IBN
        /// <summary>
        /// Adds the event.
        /// </summary>
        /// <param name="eventInfoCollection">The event info collection.</param>
        /// <returns></returns>
        public EventInfoCollections AddEvent(EventInfoCollections eventInfoCollection)
        {
            EventInfoCollections retVal = new EventInfoCollections();

            foreach (CalendarEventInfo eventInfo in eventInfoCollection)
            {
                retVal.Add(AddEvent(eventInfo.EventId));
            }

            return(retVal);
        }
コード例 #7
0
ファイル: Calendar.cs プロジェクト: alex765022/IBN
 /// <summary>
 /// Removes the event.
 /// </summary>
 /// <param name="eventInfoList">The event info list.</param>
 public void DeleteEvent(EventInfoCollections eventInfoList)
 {
     CheckProviderInitialize();
     if (eventInfoList != null)
     {
         foreach (CalendarEventInfo eventInfo in eventInfoList)
         {
             _providers.DeleteEvent(eventInfo.EventId);
         }
     }
 }
コード例 #8
0
        /// <summary>
        /// Gets the event info collection.
        /// </summary>
        /// <param name="dtStart">The dt start.</param>
        /// <param name="dtEnd">The dt end.</param>
        /// <returns></returns>
        public EventInfoCollections GetEventInfoCollection(DateTime dtStart,
                                                           DateTime dtEnd)
        {
            EventInfoCollections retVal = new EventInfoCollections();

            foreach (IEventProvider provider in _eventProviders)
            {
                retVal.AddRange(provider.GetEventInfoCollection(dtStart, dtEnd));
            }

            return(retVal);
        }
コード例 #9
0
        /// <summary>
        /// Gets the event info collection.
        /// </summary>
        /// <param name="dtStart">The dt start.</param>
        /// <param name="dtEnd">The dt end.</param>
        /// <returns></returns>
        public EventInfoCollections GetEventInfoCollection(DateTime dtStart,
                                                           DateTime dtEnd)
        {
            EventInfoCollections retVal = new EventInfoCollections();

            if (_calendarId == -1)
            {
                throw new NullReferenceException("calendarId");
            }

            //querying non virtual events
            if (dtStart == DateTime.MinValue && dtEnd == DateTime.MaxValue)
            {
                return(retVal);
            }

            CalendarEvent[] calEvents = CalendarEvent.List(new FilterElement("PrimaryCalendarId",
                                                                             FilterElementType.Equal, _calendarId));

            foreach (CalendarEvent calEvent in calEvents)
            {
                CalendarEventRecurrence[] eventRecurrs = CalendarEventRecurrence.List(new FilterElement("EventId",
                                                                                                        FilterElementType.Equal, calEvent.PrimaryKeyId.Value));

                List <DateTime> eventRecurrResult = new List <DateTime>();

                foreach (CalendarEventRecurrence eventRecurr in eventRecurrs)
                {
                    List <DateTime> recurrList = GetRecurrence(eventRecurr.Rrule,
                                                               eventRecurr.Exrule,
                                                               eventRecurr.Exdate,
                                                               calEvent.DtStart, dtEnd);

                    //skip recurrence equals beginning owner calendar event
                    recurrList.Remove(calEvent.DtStart);

                    eventRecurrResult = (JoinList(eventRecurrResult, recurrList, false));
                }

                //Begin create virtual events
                foreach (DateTime eventDate in eventRecurrResult)
                {
                    retVal.Add(MakeEventInfo(eventDate, calEvent));
                }
            }

            return(retVal);
        }
コード例 #10
0
        /// <summary>
        /// Gets the event info collection.
        /// </summary>
        /// <param name="dtStart">The dt start.</param>
        /// <param name="dtEnd">The dt end.</param>
        /// <returns></returns>
        public EventInfoCollections GetEventInfoCollection(DateTime dtStart, DateTime dtEnd)
        {
            EventInfoCollections retVal = new EventInfoCollections();

            if (_calendar == null)
            {
                throw new NullReferenceException("calendar");
            }

            CalendarEvent[] calEvents = CalendarEvent.List(new FilterElement("PrimaryCalendarId",
                                                                             FilterElementType.Equal, _calendar.PrimaryKeyId.Value));
            foreach (CalendarEvent calEvent in calEvents)
            {
                if ((calEvent.DtStart >= dtStart) && (calEvent.DtEnd <= dtEnd))
                {
                    CalendarEventInfo eventInfo = new CalendarEventInfo(this, calEvent);
                    eventInfo.SetEventId(EventProviderHelper.MakeEventId(GetEventType(),
                                                                         (ulong)(int)calEvent.PrimaryKeyId.Value));
                    retVal.Add(eventInfo);
                }
            }

            return(retVal);
        }
コード例 #11
0
ファイル: EventProviderLink.cs プロジェクト: 0anion0/IBN
        /// <summary>
        /// Gets the event info collection.
        /// </summary>
        /// <param name="dtStart">The dt start.</param>
        /// <param name="dtEnd">The dt end.</param>
        /// <returns></returns>
        public EventInfoCollections GetEventInfoCollection(DateTime dtStart, 
                                                           DateTime dtEnd)
        {
            EventInfoCollections retVal = new EventInfoCollections();

            if (_calendarId == -1)
                throw new NullReferenceException("calendarId");

            CalendarEventLink[] eventLinks = CalendarEventLink.List(new FilterElement("CalendarId",
                                                          FilterElementType.Equal, _calendarId));

            foreach (CalendarEventLink eventLink in eventLinks)
            {
                try
                {
                    CalendarEvent calEvent = new CalendarEvent(eventLink.EventId);

                    if ((calEvent.DtStart >= dtStart) && (calEvent.DtEnd <= dtEnd))
                    {
                        CalendarEventInfo eventInfo = new CalendarEventInfo(this, calEvent);
                        eventInfo.SetEventId(EventProviderHelper.MakeEventId(GetEventType(),
                                                                             (ulong)(int)eventLink.PrimaryKeyId.Value));
                        retVal.Add(eventInfo);
                    }
                }
                catch(ObjectNotFoundException)
                {
                    throw;
                }

            }

            return retVal;
        }
コード例 #12
0
ファイル: EventProviderMediator.cs プロジェクト: 0anion0/IBN
        /// <summary>
        /// Gets the event info collection.
        /// </summary>
        /// <param name="dtStart">The dt start.</param>
        /// <param name="dtEnd">The dt end.</param>
        /// <returns></returns>
        public EventInfoCollections GetEventInfoCollection(DateTime dtStart,
                                                           DateTime dtEnd)
        {
            EventInfoCollections retVal = new EventInfoCollections();

            foreach (IEventProvider provider in _eventProviders)
            {
                retVal.AddRange(provider.GetEventInfoCollection(dtStart, dtEnd));
            }

            return retVal;
        }
コード例 #13
0
ファイル: Calendar.cs プロジェクト: alex765022/IBN
        /// <summary>
        /// Removes the event.
        /// </summary>
        /// <param name="dtStart">The dtStart.</param>
        /// <param name="dtEnd">The dtEnd.</param>
        public void DeleteEvent(DateTime dtStart, DateTime dtEnd)
        {
            EventInfoCollections eventInfos = GetEventList(dtStart, dtEnd);

            DeleteEvent(eventInfos);
        }
コード例 #14
0
ファイル: EventProviderPrimary.cs プロジェクト: 0anion0/IBN
        /// <summary>
        /// Gets the event info collection.
        /// </summary>
        /// <param name="dtStart">The dt start.</param>
        /// <param name="dtEnd">The dt end.</param>
        /// <returns></returns>
        public EventInfoCollections GetEventInfoCollection(DateTime dtStart, DateTime dtEnd)
        {
            EventInfoCollections retVal = new EventInfoCollections();

            if (_calendar == null)
                throw new NullReferenceException("calendar");

            CalendarEvent[] calEvents = CalendarEvent.List(new FilterElement("PrimaryCalendarId",
                                                                 FilterElementType.Equal, _calendar.PrimaryKeyId.Value));
            foreach(CalendarEvent calEvent in calEvents)
            {
                if ((calEvent.DtStart >= dtStart) && (calEvent.DtEnd <= dtEnd))
                {
                    CalendarEventInfo eventInfo = new CalendarEventInfo(this, calEvent);
                    eventInfo.SetEventId(EventProviderHelper.MakeEventId(GetEventType(),
                                                                        (ulong)(int)calEvent.PrimaryKeyId.Value));
                    retVal.Add(eventInfo);
                }
            }

            return retVal;
        }
コード例 #15
0
        /// <summary>
        /// Gets the event info collection.
        /// </summary>
        /// <param name="dtStart">The dt start.</param>
        /// <param name="dtEnd">The dt end.</param>
        /// <returns></returns>
        public EventInfoCollections GetEventInfoCollection(DateTime dtStart, 
                                                           DateTime dtEnd)
        {
            EventInfoCollections retVal = new EventInfoCollections();

            if (_calendarId == -1)
                throw new NullReferenceException("calendarId");

            //querying non virtual events
            if (dtStart == DateTime.MinValue && dtEnd == DateTime.MaxValue)
                return retVal;

            CalendarEvent[] calEvents = CalendarEvent.List(new FilterElement("PrimaryCalendarId",
                                                     FilterElementType.Equal, _calendarId));

            foreach(CalendarEvent calEvent in calEvents)
            {
                CalendarEventRecurrence[] eventRecurrs = CalendarEventRecurrence.List(new FilterElement("EventId",
                                                                 FilterElementType.Equal, calEvent.PrimaryKeyId.Value));

                List<DateTime> eventRecurrResult = new List<DateTime>();

                foreach(CalendarEventRecurrence eventRecurr in eventRecurrs)
                {

                    List<DateTime> recurrList = GetRecurrence(eventRecurr.Rrule,
                                                              eventRecurr.Exrule,
                                                              eventRecurr.Exdate,
                                                              calEvent.DtStart, dtEnd);

                    //skip recurrence equals beginning owner calendar event
                    recurrList.Remove(calEvent.DtStart);

                   eventRecurrResult = (JoinList(eventRecurrResult, recurrList, false));
                }

               //Begin create virtual events
                foreach(DateTime eventDate in eventRecurrResult)
                {
                    retVal.Add(MakeEventInfo(eventDate, calEvent));
                }
            }

            return retVal;
        }