public void OpenCloseRoom(int locationId, string userId, bool isClosed) { var l = new Arena.Organization.Location(locationId); l.RoomClosed = isClosed; l.Save(userId); }
private IEnumerable <EventProfile> GetCurrentDayEvents(DateTime currentDate) { string key = GetCacheKey(calDates.VisibleDate); if (Cache[key] != null) { events = (List <EventProfile>)Cache[key]; cccevEvents = (List <EventProfileViewModel>)Cache[key + "cccevEvents"]; eventHash = (Dictionary <int, EventProfile>)Cache[key + "eventHash"]; } else { if (events == null) { LoadEvents(); } } var currentDayEvents = (from ce in cccevEvents where ce.OccurrenceStart.Date == currentDate.Date select ce).OrderBy(ce => ce.OccurrenceStart); foreach (EventProfileViewModel e in currentDayEvents) { EventProfile p = eventHash[e.ProfileID]; EventProfile newProfile = new EventProfile { ProfileID = p.ProfileID, Name = p.Name, Start = e.OccurrenceStart, ForiegnKey = e.OccurrenceID.ToString() }; if (p.LocationId != -1) { newProfile.Location = p.Location; } else { Arena.Organization.Location location = new Arena.Organization.Location { BuildingName = new Occurrence(e.OccurrenceID).Location }; newProfile.Location = location; } yield return(newProfile); } }
public void SetRoomCap(int locationId, int occurrenceId, int roomCap, bool includeLeaders) { /// save room cap var l = new Arena.Organization.Location(locationId); l.MaxPeople = roomCap; l.IncludeLeadersForMaxPeople = includeLeaders; l.Save("ArenaOz"); /// Check if we need to close/open the locations occurrences /// List <Occurrence> locationOccurences = new List <Occurrence>(); locationOccurences.AddRange(Occurrences.Where(x => x.LocationId == locationId)); foreach (Occurrence o in locationOccurences) { var occurrence = new Arena.Core.Occurrence(o.Id); var occtype = occurrence.OccurrenceType; if (occtype.UseRoomRatios) { if (occtype.MinLeaders != 0 || occtype.PeoplePerLeader != 0) { occurrence.PerformRoomRatioActions(Arena.Enums.CheckInAction.CheckIn, "ArenaOz"); } else { if (OccurrenceShouldBeClosed(roomCap, includeLeaders, occurrence.GetCurrentCount(Enums.OccurrenceAttendanceType.Person), occurrence.GetCurrentCount(Enums.OccurrenceAttendanceType.Leader))) { occurrence.OccurrenceClosed = true; } else { occurrence.OccurrenceClosed = false; } occurrence.Save("ArenaOz", false); } } } }