Exemplo n.º 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);
        }
Exemplo 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)
 {
     CalendarEventLink[] eventLinks = CalendarEventLink.List(new FilterElement("EventId", FilterElementType.Equal,
                                                                               args.CalEvent.PrimaryKeyId.Value));
     foreach (CalendarEventLink eventLink in eventLinks)
     {
         eventLink.Delete();
     }
 }
Exemplo n.º 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;
                }
            }
        }
Exemplo n.º 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;
        }
Exemplo n.º 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);
        }
Exemplo n.º 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;

                }

            }
        }
Exemplo n.º 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);
        }
Exemplo n.º 8
0
 public static int GetTotalCount(params FilterElement[] filters)
 {
     return(MetaObject.GetTotalCount(CalendarEventLink.GetAssignedMetaClass(), filters));
 }
Exemplo n.º 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;
        }
Exemplo n.º 10
0
 public static CalendarEventLink[] List()
 {
     return(MetaObject.List <CalendarEventLink>(CalendarEventLink.GetAssignedMetaClass()));
 }
Exemplo n.º 11
0
 public CalendarEventLink(CustomTableRow row)
     : base(CalendarEventLink.GetAssignedMetaClass(), row)
 {
 }
Exemplo n.º 12
0
 public CalendarEventLink(CustomTableRow row, MetaObjectOptions options)
     : base(CalendarEventLink.GetAssignedMetaClass(), row, options)
 {
 }
Exemplo n.º 13
0
 public CalendarEventLink(int primaryKeyId)
     : base(CalendarEventLink.GetAssignedMetaClass(), primaryKeyId)
 {
 }
Exemplo n.º 14
0
 public CalendarEventLink(int primaryKeyId, MetaObjectOptions options)
     : base(CalendarEventLink.GetAssignedMetaClass(), primaryKeyId, options)
 {
 }
Exemplo n.º 15
0
 public CalendarEventLink(MetaObjectOptions options)
     : base(CalendarEventLink.GetAssignedMetaClass(), options)
 {
 }
Exemplo n.º 16
0
 public CalendarEventLink()
     : base(CalendarEventLink.GetAssignedMetaClass())
 {
 }
Exemplo n.º 17
0
 public static CalendarEventLink[] List(params Mediachase.Ibn.Data.FilterElement[] filters)
 {
     return(MetaObject.List <CalendarEventLink>(CalendarEventLink.GetAssignedMetaClass(), filters));
 }
Exemplo n.º 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));
 }
Exemplo n.º 19
0
 public static CalendarEventLink[] List(params Mediachase.Ibn.Data.SortingElement[] sorting)
 {
     return(MetaObject.List <CalendarEventLink>(CalendarEventLink.GetAssignedMetaClass(), sorting));
 }