public RecurringEvent PostSave(RecurringEvent nevent) { var ctrl = new DescriptionApiController(); if (nevent.Id > 0) { return(RecurringEventService.UpdateEvent(nevent)); } else { return(RecurringEventService.CreateEvent(nevent)); } }
public ActionResult GetEventDetails(int id, int calendar, int type = 0) { EventLocation l = null; EventDetailsModel evm = null; var ms = Services.MemberService; if (type == 0) { //Fetch Event var e = EventService.GetEvent(id); //If it has a location fetch it if (e.locationId != 0) { l = LocationService.GetLocation(e.locationId); } evm = new EventDetailsModel() { CalendarId = calendar, Title = e.title, LocationId = e.locationId, Location = l, Descriptions = e.descriptions }; if (null != e.start) { evm.StartDate = ((DateTime)e.start).ToString("F", CultureInfo.CurrentCulture); } if (null != e.end) { evm.EndDate = ((DateTime)e.end).ToString("F", CultureInfo.CurrentCulture); } if (e.Organisator != null && e.Organisator != 0) { var member = ms.GetById(e.Organisator); evm.Organisator = new Organisator() { Name = member.Name, Email = member.Email }; } } else if (type == 1) { var e = RecurringEventService.GetRecurringEvent(id); if (e.locationId != 0) { l = LocationService.GetLocation(e.locationId); } Schedule schedule = new Schedule(new ScheduleWidget.ScheduledEvents.Event() { Title = e.title, DaysOfWeekOptions = (DayOfWeekEnum)e.day, FrequencyTypeOptions = (FrequencyTypeEnum)e.frequency, MonthlyIntervalOptions = (MonthlyIntervalEnum)e.monthly_interval }); evm = new EventDetailsModel() { CalendarId = calendar, Title = e.title, LocationId = e.locationId, Location = l, Descriptions = e.descriptions }; if (null != e.start) { var start = ((DateTime)schedule.NextOccurrence(DateTime.Now)); evm.StartDate = new DateTime(start.Year, start.Month, start.Day, e.start.Hour, e.start.Minute, 0).ToString("F", CultureInfo.CurrentCulture); } if (null != e.end) { var end = ((DateTime)schedule.NextOccurrence(DateTime.Now)); evm.EndDate = new DateTime(end.Year, end.Month, end.Day, e.end.Hour, e.end.Minute, 0).ToString("F", CultureInfo.CurrentCulture); } if (e.Organisator != null && e.Organisator != 0) { var member = ms.GetById(e.Organisator); evm.Organisator = new Organisator() { Name = member.Name, Email = member.Email }; } } return(PartialView("EventDetails", evm)); }
protected override Umbraco.Web.Models.Trees.TreeNodeCollection GetTreeNodes(string id, System.Net.Http.Formatting.FormDataCollection queryStrings) { //check if we're rendering the root node's children if (id == global::Umbraco.Core.Constants.System.Root.ToInvariantString()) { var tree = new TreeNodeCollection(); tree.Add(CreateTreeNode("calendarTree", id, queryStrings, "Calendar", "icon-calendar-alt", true, FormDataCollectionExtensions.GetValue <string>(queryStrings, "application") + StringExtensions.EnsureStartsWith(this.TreeAlias, '/') + "/overviewCalendar/all")); tree.Add(CreateTreeNode("locationTree", id, queryStrings, "Locations", "icon-globe-alt", true, FormDataCollectionExtensions.GetValue <string>(queryStrings, "application") + StringExtensions.EnsureStartsWith(this.TreeAlias, '/') + "/overviewLocation/all")); if (Security.CurrentUser.UserType.Alias.ToLower() == "admin") { tree.Add(CreateTreeNode("security", id, queryStrings, "Security", "icon-combination-lock", true)); } return(tree); } if (id == "calendarTree") { var tree = new TreeNodeCollection(); List <ECalendar> calendar = new List <ECalendar>(); if (Security.CurrentUser.UserType.Alias.ToLower() == "admin") { calendar = CalendarService.GetAllCalendar().ToList(); } else { calendar = CalendarService.GetCalendarForUser(Security.GetUserId()).ToList(); } foreach (var cal in calendar) { tree.Add(CreateTreeNode("c-" + cal.Id.ToString(), id, queryStrings, cal.Calendarname, "icon-calendar", true, FormDataCollectionExtensions.GetValue <string>(queryStrings, "application") + StringExtensions.EnsureStartsWith(this.TreeAlias, '/') + "/editCalendar/" + cal.Id)); } return(tree); } if (id == "locationTree") { var tree = new TreeNodeCollection(); List <EventLocation> locations = new List <EventLocation>(); if (Security.CurrentUser.UserType.Alias.ToLower() == "admin") { locations = LocationService.GetAllLocations().ToList(); } else { locations = LocationService.GetLocationsForUser(Security.GetUserId()).ToList(); } foreach (var loc in locations) { tree.Add(CreateTreeNode("l-" + loc.Id.ToString(), id, queryStrings, loc.LocationName, "icon-map-loaction", false, FormDataCollectionExtensions.GetValue <string>(queryStrings, "application") + StringExtensions.EnsureStartsWith(this.TreeAlias, '/') + "/editLocation/" + loc.Id.ToString())); } return(tree); } if (id == "security") { var us = Services.UserService; var tree = new TreeNodeCollection(); var total = 0; var users = us.GetAll(0, 1000, out total); foreach (var user in users.Where(x => x.AllowedSections.Contains("eventCalendar"))) { //Only the superadmin should change the settings for superadmin if ((Security.CurrentUser.Id != 0 && user.Id != 0) || Security.CurrentUser.Id == 0) { tree.Add(CreateTreeNode("u-" + user.Id.ToString(), id, queryStrings, user.Name, "", false, FormDataCollectionExtensions.GetValue <string>(queryStrings, "application") + StringExtensions.EnsureStartsWith(this.TreeAlias, '/') + "/editUser/" + user.Id.ToString())); } } return(tree); } if (id.Contains("c-")) { List <Event> events = EventService.GetAllEvents().Where(x => x.calendarId.ToString() == id.Replace("c-", "")).ToList();//ctrl.GetAll().Where(x => x.calendarId.ToString() == id.Replace("c-","")).ToList(); var tree = new TreeNodeCollection(); foreach (var e in events) { tree.Add(CreateTreeNode("e-" + e.Id.ToString(), id, queryStrings, e.title, "icon-music", false, FormDataCollectionExtensions.GetValue <string>(queryStrings, "application") + StringExtensions.EnsureStartsWith(this.TreeAlias, '/') + "/editEvent/" + e.Id)); } List <RecurringEvent> revents = RecurringEventService.GetAllEvents().Where(x => x.calendarId.ToString() == id.Replace("c-", "")).ToList();//ctrl2.GetAll().Where(x => x.calendarId.ToString() == id.Replace("c-", "")).ToList(); foreach (var e in revents) { tree.Add(CreateTreeNode("re-" + e.Id.ToString(), id, queryStrings, e.title, "icon-axis-rotation", false, FormDataCollectionExtensions.GetValue <string>(queryStrings, "application") + StringExtensions.EnsureStartsWith(this.TreeAlias, '/') + "/editREvent/" + e.Id)); } return(tree); } //this tree doesn't suport rendering more than 1 level throw new NotSupportedException(); }
public IEnumerable <RecurringEvent> GetAll() { return(RecurringEventService.GetAllEvents()); }
public RecurringEvent GetById(int id) { return(RecurringEventService.GetRecurringEvent(id)); }
public int DeleteById(int id) { return(RecurringEventService.DeleteRecurringEvent(id)); }