Exemplo n.º 1
0
        public static void CreateEvent(string calendarName, string id, string title, DateTime date, int status, long ownerId)
        {
            int calID = CalendarId(calendarName);

            if (SimilarEventExists(calID, title, date))
            {
                // MLW TODO remove these
                SMap.GetLogger().Trace("An event already exists for " + calendarName + "; Name:" + title + "; ID=" + id + "; " + date.ToString());
                return;
            }
            else
            {
                SMap.GetLogger().Trace("Adding a new event for " + calendarName + "; Name:" + title + "; ID=" + id + "; " + date.ToString());
            }

            CalendarEvent.NameFromEventId(id);

            DnDSignUpEntities entities = new DnDSignUpEntities();

            Event e = new Event();
            e.EventId = id;
            e.Title = title;
            e.AllDay = true;
            e.CalendarId = calID;
            e.StartTime = date;
            e.EndTime = date;
            e.Status = status;
            e.OwnerId = ownerId;

            entities.Events.Add(e);
            entities.SaveChanges();
        }
Exemplo n.º 2
0
        public static void DeleteEvent(string calendarName, string id)
        {
            int currentCalendarId = CalendarId(calendarName);

            DnDSignUpEntities entities = new DnDSignUpEntities();

            Event e = entities.Events.Single(x => x.CalendarId == currentCalendarId && x.EventId == id);
            if (e != null)
            {
                entities.Events.Remove(e);
                entities.SaveChanges();
            }
        }
Exemplo n.º 3
0
        internal static void UpdateUsersFacebookInfo(FacebookInfo info)
        {
            DnDSignUpEntities entities = new DnDSignUpEntities();
            FacebookInfo fi = entities.FacebookInfoes.SingleOrDefault(u => u.FacebookId == info.FacebookId);

            if (fi != null)
                entities.FacebookInfoes.Remove(fi);

            entities.FacebookInfoes.Add(info);

            entities.SaveChanges();
        }
Exemplo n.º 4
0
        public static void UpdateEvent(string calendarName, CalendarEvent oEvent)
        {
            int currentCalendarId = CalendarId(calendarName);

            DnDSignUpEntities entities = new DnDSignUpEntities();

            // MLW TODO first name change
            Event e = entities.Events.Single(x => x.CalendarId == currentCalendarId && x.EventId == oEvent.ID);
            if (e != null)
            {
                e.EventId = oEvent.ID;
                e.Title = oEvent.Title;
                e.AllDay = oEvent.IsAllDay;
                e.CalendarId = currentCalendarId;
                e.StartTime = oEvent.StartDateTime;
                e.EndTime = oEvent.EndDateTime;
                e.Status = oEvent.Status;
                e.OwnerId = oEvent.OwnerId;

                DbEntityEntry entry = entities.Entry(e);
                entry.State = EntityState.Modified;
                entities.SaveChanges();
            }
        }