public Contracts.GenericListResult <Contracts.GenericReference> GetPersonEvents(int id) { EventProfileCollection eventProfileCollection = new EventProfileCollection(); eventProfileCollection.LoadMemberEventProfiles(Arena.Core.ArenaContext.Current.Organization.OrganizationID, id, false); //EventProfileCollection.RemoveInactiveProfiles(); Contracts.GenericListResult <Contracts.GenericReference> events = new Contracts.GenericListResult <Contracts.GenericReference>(); events.Items = new List <Contracts.GenericReference>(); Contracts.EventMapper eventMapper = new Contracts.EventMapper(); foreach (EventProfile eProfile in eventProfileCollection) { if (eProfile.DisplayAttendedOnly) { if (new Arena.DataLayer.Core.OccurrenceData().GetProfileAttendance(eProfile.ProfileID, id, Arena.Core.ArenaContext.Current.Organization.OrganizationID) > 0) { events.Items.Add(new Contracts.GenericReference(eProfile)); } } else { events.Items.Add(new Contracts.GenericReference(eProfile)); } } events.Max = events.Total = events.Items.Count; events.Start = 0; return(events); }
public static List <CccevEvent> LoadEventProfilesByTopicMonthAndParentID(this EventProfileCollection profiles, int parentProfileID, DateTime startDate, DateTime endDate, string topicAreas) { List <CccevEvent> events = new List <CccevEvent>(); SqlDataReader reader = new XEventProfileData().GetEventProfilesByTopicMonthAndParentID(parentProfileID, startDate, endDate, topicAreas); while (reader.Read()) { profiles.Add(new EventProfile((int)reader["profile_id"])); events.Add(new CccevEvent((int)reader["profile_id"], (int)reader["occurrence_id"], (DateTime)reader["start"])); } reader.Close(); return(events); }
private void AddChildEvents(int parentProfileID, DropDownList ddl) { ddl.Items.Clear(); EventProfileCollection events = new EventProfileCollection(); events.LoadProfileEventsByParentProfile(parentProfileID, CurrentOrganization.OrganizationID); foreach (EventProfile childEvent in events) { if (childEvent.Active && childEvent.Start >= DateTime.Today) { ddl.Items.Insert(0, new ListItem(childEvent.Name, childEvent.ProfileID.ToString())); } } }
private static IEnumerable <EventProfile> GetCalendarEvents(DateTime start, DateTime end, string topicIDs, int[] campusIDs) { var events = new EventProfileCollection(); var occurrenceEvents = events.LoadEventsByDateRangeTopicAndCampus(start, end, topicIDs, campusIDs); var calendarEvents = new List <EventProfile>(); var eventProfiles = events; foreach (var ev in eventProfiles) { var theEvent = ev; if (calendarEvents.Any(e => e.ProfileID == theEvent.ProfileID)) { continue; } // Needed to differentiate when to use the event profile's start/end date and when to use the start/end dates from the event's occurrences // based on needs defined by Central Communications Team if (theEvent.Start.Date == theEvent.End.Date) { var theEventsOccurrences = occurrenceEvents.Where(oe => oe.ProfileID == theEvent.ProfileID); calendarEvents.AddRange(theEventsOccurrences.Select( occurrence => new EventProfile { ProfileID = theEvent.ProfileID, Name = theEvent.Name, Summary = theEvent.Summary, Start = occurrence.OccurrenceStart, End = occurrence.OccurrenceStart, // Occurrence end dates not supported ExternalLink = theEvent.ExternalLink, Image = theEvent.Image, ForiegnKey = occurrence.OccurrenceID.ToString(), Campus = theEvent.Campus })); } else { var theEventsOccurrence = occurrenceEvents .Where(e => e.ProfileID == theEvent.ProfileID).OrderBy(e => e.OccurrenceStart); theEvent.ForiegnKey = theEventsOccurrence.First().OccurrenceID.ToString(); calendarEvents.Add(theEvent); } } return(calendarEvents); }
private void LoadEvents() { int month = calDates.VisibleDate.Month; int year = calDates.VisibleDate.Year; int dayCount = DateTime.DaysInMonth(year, month); DateTime monthStart = new DateTime(year, month, 1); DateTime monthEnd = new DateTime(year, month, dayCount); EventProfileCollection epc = new EventProfileCollection(); cccevEvents = epc.LoadEventProfilesByTopicMonthAndParentID(int.Parse(ParentEventProfileIDSetting), monthStart.AddDays(-8), monthEnd.AddDays(8), TopicAreasSetting); events = epc.OfType <EventProfile>().ToList(); foreach (EventProfile e in events) { if (!eventHash.ContainsKey(e.ProfileID)) { eventHash.Add(e.ProfileID, e); } } CacheEvents(); }
public static List <EventProfileViewModel> LoadEventsByDateRangeTopicAndCampus(this EventProfileCollection profiles, DateTime startDate, DateTime endDate, string topicAreas, int[] campusIDs) { List <EventProfileViewModel> events = new List <EventProfileViewModel>(); var data = new ProfileDataExtension(); var campuses = string.Join(",", Array.ConvertAll(campusIDs, Convert.ToString)); using (SqlDataReader reader = data.GetEventProfilesByDateRangeTopicsAndCampus(startDate, endDate, topicAreas, campuses)) { while (reader.Read()) { profiles.Add(new EventProfile(reader, false)); events.Add(new EventProfileViewModel((int)reader["profile_id"], (int)reader["occurrence_id"], (DateTime)reader["occurrence_start"])); } } return(events); }
public static List <EventProfileViewModel> LoadEventsByDateRangeTopicAndCampus(this EventProfileCollection profiles, DateTime startDate, DateTime endDate, string topicAreas, int campusID) { return(LoadEventsByDateRangeTopicAndCampus(profiles, startDate, endDate, topicAreas, new[] { campusID })); }
public static List <EventProfileViewModel> LoadEventProfilesByTopicMonthAndParentID(this EventProfileCollection profiles, int parentProfileID, DateTime startDate, DateTime endDate, string topicAreas, int campusID) { List <EventProfileViewModel> events = new List <EventProfileViewModel>(); SqlDataReader reader = new ProfileDataExtension().GetEventProfilesByTopicMonthAndParentID(parentProfileID, startDate, endDate, topicAreas, campusID); while (reader.Read()) { profiles.Add(new EventProfile(reader, false)); events.Add(new EventProfileViewModel((int)reader["profile_id"], (int)reader["occurrence_id"], (DateTime)reader["start"])); } reader.Close(); return(events); }
public static List <EventProfileViewModel> LoadEventProfilesByTopicMonthAndParentID(this EventProfileCollection profiles, int parentProfileID, DateTime startDate, DateTime endDate, string topicAreas) { return(LoadEventProfilesByTopicMonthAndParentID(profiles, parentProfileID, startDate, endDate, topicAreas, Constants.NULL_INT)); }