Ejemplo n.º 1
0
        /// <summary>
        /// Deletes the event.
        /// </summary>
        /// <remarks>Add except date in recurrence for this event</remarks>
        /// <param name="eventInfo"></param>
        public void DeleteEvent(ulong eventId)
        {
            if (EventProviderHelper.CheckEventBelong(GetEventType(), eventId))
            {
                DateTime      recurDate;
                CalendarEvent calEvent;

                ulong eventKey = EventProviderHelper.GetEventKey(eventId);

                if (DecryptId(eventKey, out recurDate, out calEvent))
                {
                    CalendarEventRecurrence[] eventRecurrs = CalendarEventRecurrence.List(new FilterElement("EventId",
                                                                                                            FilterElementType.Equal, calEvent.PrimaryKeyId.Value));

                    foreach (CalendarEventRecurrence eventRecurr in eventRecurrs)
                    {
                        // Add exception date
                        if (recurDate <= eventRecurr.DtEnd &&
                            recurDate >= eventRecurr.DtStart)
                        {
                            eventRecurr.Exdate = eventRecurr.Exdate + ";" + recurDate.ToString();
                            eventRecurr.Save();
                            break;
                        }
                    }
                }
            }
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Events the delete handler.
        /// </summary>
        /// <param name="sender">The sender.</param>
        /// <param name="args">The <see cref="Mediachase.Ibn.Calendar.CalendarEventArgs"/> instance containing the event data.</param>
        private void PrimaryEventDeleteHandler(object sender, CalendarEventArgs args)
        {
            CalendarEventRecurrence[] eventRecurrs =
                CalendarEventRecurrence.List(new FilterElement("EventId",
                                                               FilterElementType.Equal,
                                                               args.CalEvent.PrimaryKeyId.Value));

            foreach (CalendarEventRecurrence eventRecurr in eventRecurrs)
            {
                eventRecurr.Delete();
            }
        }
Ejemplo n.º 3
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);
        }
Ejemplo n.º 4
0
 public CalendarEventRecurrence(CustomTableRow row)
     : base(CalendarEventRecurrence.GetAssignedMetaClass(), row)
 {
 }
Ejemplo n.º 5
0
 public CalendarEventRecurrence(CustomTableRow row, MetaObjectOptions options)
     : base(CalendarEventRecurrence.GetAssignedMetaClass(), row, options)
 {
 }
Ejemplo n.º 6
0
 public CalendarEventRecurrence(int primaryKeyId)
     : base(CalendarEventRecurrence.GetAssignedMetaClass(), primaryKeyId)
 {
 }
Ejemplo n.º 7
0
 public CalendarEventRecurrence(int primaryKeyId, MetaObjectOptions options)
     : base(CalendarEventRecurrence.GetAssignedMetaClass(), primaryKeyId, options)
 {
 }
Ejemplo n.º 8
0
 public CalendarEventRecurrence()
     : base(CalendarEventRecurrence.GetAssignedMetaClass())
 {
 }
Ejemplo n.º 9
0
 public CalendarEventRecurrence(MetaObjectOptions options)
     : base(CalendarEventRecurrence.GetAssignedMetaClass(), options)
 {
 }
Ejemplo n.º 10
0
 public static int GetTotalCount(params FilterElement[] filters)
 {
     return(MetaObject.GetTotalCount(CalendarEventRecurrence.GetAssignedMetaClass(), filters));
 }
Ejemplo n.º 11
0
 public static CalendarEventRecurrence[] List(Mediachase.Ibn.Data.FilterElementCollection filters, Mediachase.Ibn.Data.SortingElementCollection sorting, int start, int count)
 {
     return(MetaObject.List <CalendarEventRecurrence>(CalendarEventRecurrence.GetAssignedMetaClass(), filters, sorting, start, count));
 }
Ejemplo n.º 12
0
 public static CalendarEventRecurrence[] List(params Mediachase.Ibn.Data.SortingElement[] sorting)
 {
     return(MetaObject.List <CalendarEventRecurrence>(CalendarEventRecurrence.GetAssignedMetaClass(), sorting));
 }
Ejemplo n.º 13
0
 public static CalendarEventRecurrence[] List(params Mediachase.Ibn.Data.FilterElement[] filters)
 {
     return(MetaObject.List <CalendarEventRecurrence>(CalendarEventRecurrence.GetAssignedMetaClass(), filters));
 }
Ejemplo n.º 14
0
 public static CalendarEventRecurrence[] List()
 {
     return(MetaObject.List <CalendarEventRecurrence>(CalendarEventRecurrence.GetAssignedMetaClass()));
 }