Пример #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
 /// <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)
 {
     CalendarEventLink[] eventLinks = CalendarEventLink.List(new FilterElement("EventId", FilterElementType.Equal,
                                                                               args.CalEvent.PrimaryKeyId.Value));
     foreach (CalendarEventLink eventLink in eventLinks)
     {
         eventLink.Delete();
     }
 }
Пример #3
0
        /// <summary>
        /// Deletes the event.
        /// </summary>
        /// <param name="eventInfo"></param>
        public void DeleteEvent(ulong eventId)
        {
            if (EventProviderHelper.CheckEventBelong(GetEventType(), eventId))
            {
                if (_calendarId == -1)
                {
                    throw new NullReferenceException("calendarId");
                }

                try
                {
                    int linkKey = (int)EventProviderHelper.GetEventKey(eventId);

                    CalendarEventLink eventLink = new CalendarEventLink(linkKey);

                    eventLink.Delete();
                }
                catch (ObjectNotFoundException)
                {
                    throw;
                }
            }
        }
Пример #4
0
        /// <summary>
        /// Creates the event.
        /// </summary>
        /// <param name="eventInfo"></param>
        /// <returns></returns>
        public CalendarEventInfo CreateEvent(ulong eventId)
        {
            CalendarEventInfo retVal = null;

            //Is create link only
            if (eventId == 0)
                return retVal;

            if (_calendarId != 0)
            {
                 try
                {
                    int eventKey = (int)EventProviderHelper.GetEventKey(eventId);

                    CalendarEvent calEvent = new CalendarEvent(eventKey);

                    retVal = new CalendarEventInfo(this, calEvent);

                    CalendarEventLink eventLink = new CalendarEventLink();
                    eventLink.CalendarId = _calendarId;
                    eventLink.EventId = (int)EventProviderHelper.GetEventKey(eventId);
                    eventLink.Save();

                    //Set event key
                    retVal.SetEventId(EventProviderHelper.MakeEventId(GetEventType(),
                                                                      (ulong)(int)eventLink.PrimaryKeyId.Value));

                }
                catch(ObjectNotFoundException)
                {

                }

            }

               return retVal;
        }
Пример #5
0
        /// <summary>
        /// Creates the event.
        /// </summary>
        /// <param name="eventInfo"></param>
        /// <returns></returns>
        public CalendarEventInfo CreateEvent(ulong eventId)
        {
            CalendarEventInfo retVal = null;

            //Is create link only
            if (eventId == 0)
            {
                return(retVal);
            }

            if (_calendarId != 0)
            {
                try
                {
                    int eventKey = (int)EventProviderHelper.GetEventKey(eventId);

                    CalendarEvent calEvent = new CalendarEvent(eventKey);

                    retVal = new CalendarEventInfo(this, calEvent);

                    CalendarEventLink eventLink = new CalendarEventLink();
                    eventLink.CalendarId = _calendarId;
                    eventLink.EventId    = (int)EventProviderHelper.GetEventKey(eventId);
                    eventLink.Save();

                    //Set event key
                    retVal.SetEventId(EventProviderHelper.MakeEventId(GetEventType(),
                                                                      (ulong)(int)eventLink.PrimaryKeyId.Value));
                }
                catch (ObjectNotFoundException)
                {
                }
            }

            return(retVal);
        }
Пример #6
0
        /// <summary>
        /// Deletes the event.
        /// </summary>
        /// <param name="eventInfo"></param>
        public void DeleteEvent(ulong eventId)
        {
            if (EventProviderHelper.CheckEventBelong(GetEventType(), eventId))
            {
                if (_calendarId == -1)
                    throw new NullReferenceException("calendarId");

                try
                {
                    int linkKey = (int)EventProviderHelper.GetEventKey(eventId);

                    CalendarEventLink eventLink = new CalendarEventLink(linkKey);

                    eventLink.Delete();

                }
                catch(ObjectNotFoundException)
                {
                    throw;

                }

            }
        }
Пример #7
0
        /// <summary>
        /// Gets the event info.
        /// </summary>
        /// <param name="eventId">The event id.</param>
        /// <returns></returns>
        public CalendarEventInfo GetEventInfo(ulong eventId)
        {
            CalendarEventInfo retVal = null;

            if (EventProviderHelper.CheckEventBelong(GetEventType(), eventId))
            {
                try
                {
                    int linkKey = (int)EventProviderHelper.GetEventKey(eventId);

                    CalendarEventLink eventLink = new CalendarEventLink(linkKey);
                    CalendarEvent     calEvent  = new CalendarEvent(eventLink.EventId);

                    retVal = new CalendarEventInfo(this, calEvent);
                    retVal.SetEventId(eventId);
                }
                catch (ObjectNotFoundException)
                {
                    throw;
                }
            }

            return(retVal);
        }
Пример #8
0
 public static int GetTotalCount(params FilterElement[] filters)
 {
     return(MetaObject.GetTotalCount(CalendarEventLink.GetAssignedMetaClass(), filters));
 }
Пример #9
0
        /// <summary>
        /// Gets the event info.
        /// </summary>
        /// <param name="eventId">The event id.</param>
        /// <returns></returns>
        public CalendarEventInfo GetEventInfo(ulong eventId)
        {
            CalendarEventInfo retVal = null;

            if (EventProviderHelper.CheckEventBelong(GetEventType(), eventId))
            {
                try
                {
                    int linkKey = (int)EventProviderHelper.GetEventKey(eventId);

                    CalendarEventLink eventLink = new CalendarEventLink(linkKey);
                    CalendarEvent calEvent = new CalendarEvent(eventLink.EventId);

                    retVal = new CalendarEventInfo(this, calEvent);
                    retVal.SetEventId(eventId);

                }
                catch (ObjectNotFoundException)
                {
                    throw;

                }

            }

            return retVal;
        }
Пример #10
0
 public static CalendarEventLink[] List()
 {
     return(MetaObject.List <CalendarEventLink>(CalendarEventLink.GetAssignedMetaClass()));
 }
Пример #11
0
 public CalendarEventLink(CustomTableRow row)
     : base(CalendarEventLink.GetAssignedMetaClass(), row)
 {
 }
Пример #12
0
 public CalendarEventLink(CustomTableRow row, MetaObjectOptions options)
     : base(CalendarEventLink.GetAssignedMetaClass(), row, options)
 {
 }
Пример #13
0
 public CalendarEventLink(int primaryKeyId)
     : base(CalendarEventLink.GetAssignedMetaClass(), primaryKeyId)
 {
 }
Пример #14
0
 public CalendarEventLink(int primaryKeyId, MetaObjectOptions options)
     : base(CalendarEventLink.GetAssignedMetaClass(), primaryKeyId, options)
 {
 }
Пример #15
0
 public CalendarEventLink(MetaObjectOptions options)
     : base(CalendarEventLink.GetAssignedMetaClass(), options)
 {
 }
Пример #16
0
 public CalendarEventLink()
     : base(CalendarEventLink.GetAssignedMetaClass())
 {
 }
Пример #17
0
 public static CalendarEventLink[] List(params Mediachase.Ibn.Data.FilterElement[] filters)
 {
     return(MetaObject.List <CalendarEventLink>(CalendarEventLink.GetAssignedMetaClass(), filters));
 }
Пример #18
0
 public static CalendarEventLink[] List(Mediachase.Ibn.Data.FilterElementCollection filters, Mediachase.Ibn.Data.SortingElementCollection sorting, int start, int count)
 {
     return(MetaObject.List <CalendarEventLink>(CalendarEventLink.GetAssignedMetaClass(), filters, sorting, start, count));
 }
Пример #19
0
 public static CalendarEventLink[] List(params Mediachase.Ibn.Data.SortingElement[] sorting)
 {
     return(MetaObject.List <CalendarEventLink>(CalendarEventLink.GetAssignedMetaClass(), sorting));
 }