Пример #1
0
 public async Task OnGetAsync(int?id)
 {
     if (id != null)
     {
         Room = await _roomService.GetFromId((int)id);
     }
 }
Пример #2
0
 public async Task OnGetAsync(int?id)
 {
     if (id != null)
     {
         Event = await _eventService.GetFromId((int)id);
     }
 }
Пример #3
0
        public async Task <IActionResult> OnGetAsync()
        {
            if (_sessionService.GetConferenceId(HttpContext.Session) == null)
            {
                _sessionService.SetConferenceId(HttpContext.Session, 1);
            }

            var userId = _sessionService.GetUserId(HttpContext.Session);
            var conId  = _sessionService.GetConferenceId(HttpContext.Session);

            if (conId != null)
            {
                Conference = await _conferenceService.GetFromId((int)conId);
            }
            if (userId != null)
            {
                User = await _userService.GetFromId((int)userId);
            }

            if (conId != null && userId != null)
            {
                int?bindingId = _ucBindingService.GetAll().Result.FindAll(binding => binding.UserId.Equals(userId)).Find(binding => binding.ConferenceId.Equals(conId))?.UserConferenceBindingId;
                if (bindingId != null)
                {
                    UserType = _ucBindingService.GetFromId((int)bindingId).Result.UserType;
                }
            }

            return(Page());
        }
Пример #4
0
 public async Task OnGetAsync(int?id)
 {
     if (id != null)
     {
         Floor = await _floorService.GetFromId((int)id);
     }
 }
        public async Task <IActionResult> OnGetAsync()
        {
            CurrentUserId = _sessionService.GetUserId(HttpContext.Session);


            if (CurrentUserId > 0)
            {
                CurrentUser = await _userService.GetFromId((int)_sessionService.GetUserId(HttpContext.Session));
            }


            return(Page());
        }
Пример #6
0
        public async Task <IActionResult> OnGetAsync()
        {
            if (_sessionService.GetUserId(HttpContext.Session) != null)
            {
                CurrentUser = await _userService.GetFromId((int)_sessionService.GetUserId(HttpContext.Session));
            }
            else
            {
                return(OnGetDeniedAsync());
            }

            if (_sessionService.GetConferenceId(HttpContext.Session) != null)
            {
                CurrentConference = await _conferenceService.GetFromId((int)_sessionService.GetConferenceId(HttpContext.Session));
            }
            else
            {
                return(RedirectToPage("/Index"));
            }

            UCBinding = _ucBindingService.GetAll().Result.FindAll(bind => bind.UserId.Equals(CurrentUser.UserId))
                        .Find(bind => bind.ConferenceId.Equals(CurrentConference.ConferenceId));

            if (UCBinding?.UserType != UserType.Admin && UCBinding?.UserType != UserType.SuperUser)
            {
                return(OnGetDeniedAsync());
            }

            Room   = new Room();
            Events = new List <Event>();
            Floors = await _floorService.GetAll();

            Features = await _featureService.GetAll();

            Rooms = await _roomService.GetAll();

            RoomFeatures = _roomFeatureService.GetAll().Result.FindAll(room => room.RoomId.Equals(Room.RoomId));

            //EventsInRoom = Room.RoomId != 0
            //    ? new List<Event>(Events.FindAll(e => e.RoomId.Equals(Room.RoomId)))
            //    : new List<Event>();

            SelectListFloors = new SelectList(Floors.FindAll(f => f.VenueId.Equals(tempVenueId)), nameof(Floor.FloorId),
                                              nameof(Floor.Name));
            SelectListFeatures = new SelectList(Features, nameof(Feature.FeatureId), nameof(Feature.Name), RoomFeatures);

            return(Page());
        }
        public async Task <IActionResult> OnGetAsync()
        {
            int?userId       = _sessionService.GetUserId(HttpContext.Session);
            int?conferenceId = _sessionService.GetConferenceId(HttpContext.Session);

            if (userId == null || conferenceId == null)
            {
                return(Unauthorized());
            }

            CurrentUser = await _userService.GetFromId((int)userId);

            CurrentConference = await _conferenceService.GetFromId((int)_sessionService.GetConferenceId(HttpContext.Session));

            CurrentBinding = _ucBindingService.GetAll().Result.FindAll(binding => binding.UserId.Equals(CurrentUser.UserId)).Find(binding => binding.ConferenceId.Equals(CurrentConference.ConferenceId));

            if (CurrentBinding?.UserType != UserType.Admin && CurrentBinding?.UserType != UserType.SuperUser)
            {
                return(Unauthorized());
            }

            Users = await _userService.GetAll();

            Conferences = await _conferenceService.GetAll();

            SelectListUsers       = new SelectList(Users, nameof(Models.User.UserId), nameof(Models.User.Email));
            SelectListConferences = new SelectList(Conferences, nameof(Conference.ConferenceId), nameof(Conference.Name));

            return(Page());
        }
Пример #8
0
        public async Task <IActionResult> OnGetAsync()
        {
            if (_sessionService.GetUserId(HttpContext.Session) != null && _sessionService.GetConferenceId(HttpContext.Session) != null)
            {
                CurrentUser = await _userService.GetFromId((int)_sessionService.GetUserId(HttpContext.Session));

                CurrentConference = await _conferenceService.GetFromId((int)_sessionService.GetConferenceId(HttpContext.Session));

                UCBinding = _ucBindingService.GetAll().Result.FindAll(bind => bind.UserId.Equals(CurrentUser.UserId))
                            .Find(bind => bind.ConferenceId.Equals(CurrentConference.ConferenceId));

                if (UCBinding?.UserType == UserType.Admin || UCBinding?.UserType == UserType.SuperUser)
                {
                    IsAdmin = true;
                }
            }

            Rooms = await _roomService.GetAll();

            Venues = await _venueService.GetAll();

            Floors = await _floorService.GetAll();

            return(Page());
        }
Пример #9
0
        public async Task <IActionResult> OnGetAsync()
        {
            if (Id == null)
            {
                return(Page());
            }
            speak = await SpeakerService.GetFromId(Id.GetValueOrDefault()) ?? new Speaker();

            return(Page());
        }
Пример #10
0
        public async Task <IActionResult> OnGetAsync(int?id)
        {
            if (id == null)
            {
                return(NotFound());
            }

            Venue = await _venueService.GetFromId((int)id);

            return(Page());
        }
Пример #11
0
        public async Task PageSetup(int id)
        {
            Event = await _eventService.GetFromId(id);

            Rooms = await _roomService.GetAll();

            Speakers = await _speakerService.GetAll();

            CurrentUserId     = _sessionService.GetUserId(HttpContext.Session);
            CurrentlyEnrolled = _enrollmentService.GetAll().Result.FindAll(enrollment => enrollment.EventId.Equals(id)).Count;
        }
Пример #12
0
        public IActionResult OnPostCreate(string imageName)
        {
            Room.VenueId = tempVenueId;
            Room.Image   = imageName;
            Room.Floor   = _floorService.GetFromId(Room.FloorId).Result.Name;
            Room.Events  = _eventService.GetAll().Result.FindAll(e => e.RoomId.Equals(Room.RoomId));
            foreach (int fId in SelectedFeatures)
            {
                Room.Features ??= new Dictionary <int, bool>();

                Feature f = _featureService.GetFromId(fId).Result;
                Room.Features.Add(f.FeatureId, true);
            }


            lock (_createRoomLock)
            {
                _roomService.Create(Room).Wait();

                if (Room.Features != null)
                {
                    if (Room.Features.Count != 0)
                    {
                        int maxId = 0;
                        maxId = _roomService.GetAll().Result.OrderByDescending(r => r.RoomId).First().RoomId;

                        foreach (int featureId in Room.Features.Keys)
                        {
                            RoomFeature rf = new RoomFeature
                            {
                                FeatureId = featureId, RoomId = maxId, IsAvailable = true
                            };

                            _roomFeatureService.Create(rf).Wait();
                        }
                    }
                }
            }

            return(RedirectToPage("/Admin/RoomTest/Index"));
        }
Пример #13
0
        public async Task OnGet()
        {
            CurrentUserId = _sessionService.GetUserId(HttpContext.Session);

            if (CurrentUserId != null)
            {
                CurrentUser = await _userService.GetFromId((int)CurrentUserId);

                UserBindings = _ucBindingService.GetAll().Result.FindAll(binding => binding.UserId.Equals(CurrentUserId));
                Conferences  = await _conferenceService.GetAll();
            }
        }
Пример #14
0
        public async Task <IActionResult> OnGetAsync(int?id)
        {
            if (id == null)
            {
                return(NotFound());
            }

            Conference = await _conferenceService.GetFromId((int)id);

            Venues = new SelectList(await _venueService.GetAll(), nameof(Venue.VenueId), nameof(Venue.Name));

            return(Page());
        }
        public async Task <IActionResult> OnGetAsync(int?id)
        {
            EventId = id;

            if (_sessionService.GetUserId(HttpContext.Session) != null)
            {
                CurrentUser = await _userService.GetFromId((int)_sessionService.GetUserId(HttpContext.Session));
            }
            else
            {
                return(OnGetDeniedAsync());
            }

            if (_sessionService.GetConferenceId(HttpContext.Session) != null)
            {
                CurrentConference = await _conferenceService.GetFromId((int)_sessionService.GetConferenceId(HttpContext.Session));
            }
            else
            {
                return(RedirectToPage("/Index"));
            }

            UCBinding = _ucBindingService.GetAll().Result
                        .FindAll(binding => binding.UserId.Equals(CurrentUser.UserId)).Find(binding =>
                                                                                            binding.ConferenceId.Equals(CurrentConference.ConferenceId));

            if (UCBinding?.UserType != UserType.Admin && UCBinding?.UserType != UserType.SuperUser)
            {
                return(OnGetDeniedAsync());
            }

            await PageSetup();

            if (EventId == null)
            {
                return(Page());
            }

            NewEvent = await _eventService.GetFromId((int)id);

            if (NewEvent != null)
            {
                Duration = (int)NewEvent.Duration?.TotalMinutes;
                return(Page());
            }

            return(Unauthorized());
        }
        public async Task OnGetAsync()
        {
            Events = await _eventService.GetAll();

            Rooms = await _roomService.GetAll();

            Enrollments = await _enrollmentService.GetAll();

            if (_sessionService.GetConferenceId(HttpContext.Session) != null)
            {
                CurrentConference = await _conferenceService.GetFromId((int)_sessionService.GetConferenceId(HttpContext.Session));
            }


            if (_sessionService.GetUserId(HttpContext.Session) != null)
            {
                CurrentUser = await _userService.GetFromId((int)_sessionService.GetUserId(HttpContext.Session));

                UCBinding = _ucBindingService.GetAll().Result
                            .FindAll(binding => binding.UserId.Equals(CurrentUser.UserId)).Find(binding =>
                                                                                                binding.ConferenceId.Equals(CurrentConference.ConferenceId));

                if (UCBinding?.UserType == UserType.Admin || UCBinding?.UserType == UserType.SuperUser)
                {
                    IsAdmin = true;
                }
                else
                {
                    IsAdmin = false;
                }
            }
            else
            {
                IsAdmin = false;
            }

            foreach (Event e in Events)
            {
                e.Enrollments = await _enrollmentService.GetFiltered(e.EventId, ModelTypes.Event);
            }
        }
Пример #17
0
        public async Task <bool> Initialize()
        {
            int?userId       = _sessionService.GetUserId(HttpContext.Session);
            int?conferenceId = _sessionService.GetConferenceId(HttpContext.Session);

            if (userId == null || conferenceId == null)
            {
                return(false);
            }

            CurrentUser = await _userService.GetFromId((int)userId);

            CurrentConference = await _conferenceService.GetFromId((int)conferenceId);

            CurrentBinding = _ucBindingService.GetAll().Result.FindAll(binding => binding.UserId.Equals(CurrentUser.UserId)).Find(binding => binding.ConferenceId.Equals(CurrentConference.ConferenceId));

            if (CurrentBinding?.UserType != UserType.Admin && CurrentBinding?.UserType != UserType.SuperUser)
            {
                return(false);
            }

            Users = await _userService.GetAll();

            SelectListUsers = new SelectList(Users, nameof(Models.User.UserId), nameof(Models.User.Email));

            Conferences = await _conferenceService.GetAll();

            Speakers = await _speakerService.GetAll();

            Venues = await _venueService.GetAll();

            Floors = await _floorService.GetAll();

            Features = await _featureService.GetAll();

            Themes = await _themeService.GetAll();

            CurrentVenue = Venues.Find(venue => venue.VenueId.Equals(CurrentConference.VenueId));
            return(true);
        }
 public async Task OnGetAsync(int tId, int eId)
 {
     EventTheme = await eventThemeService.GetFromId(tId, eId);
 }
Пример #19
0
 public async Task OnGetAsync(int rId)
 {
     NewRoom = await roomService.GetFromId(rId);
 }
 public async Task OnGetAsync(int fId)
 {
     Feature = await featureService.GetFromId(fId);
 }
Пример #21
0
 public async Task OnGetAsync(int eId)
 {
     NewEvent = await eventService.GetFromId(eId);
 }
Пример #22
0
        public async Task <IActionResult> OnGetEditAsync(int rId)
        {
            if (_sessionService.GetUserId(HttpContext.Session) != null)
            {
                CurrentUser = await _userService.GetFromId((int)_sessionService.GetUserId(HttpContext.Session));
            }
            else
            {
                return(OnGetDeniedAsync());
            }

            if (_sessionService.GetConferenceId(HttpContext.Session) != null)
            {
                CurrentConference = await _conferenceService.GetFromId((int)_sessionService.GetConferenceId(HttpContext.Session));
            }
            else
            {
                return(RedirectToPage("/Index"));
            }

            UCBinding = _ucBindingService.GetAll().Result.FindAll(bind => bind.UserId.Equals(CurrentUser.UserId))
                        .Find(bind => bind.ConferenceId.Equals(CurrentConference.ConferenceId));

            if (UCBinding?.UserType != UserType.Admin && UCBinding?.UserType != UserType.SuperUser)
            {
                return(OnGetDeniedAsync());
            }

            RoomId = rId;
            Room   = await _roomService.GetFromId(rId);

            Events = _eventService.GetAll().Result.FindAll(e => e.RoomId.Equals(rId));
            Floors = await _floorService.GetAll();

            Features = await _featureService.GetAll();

            Rooms = await _roomService.GetAll();

            RoomFeatures = _roomFeatureService.GetAll().Result.FindAll(room => room.RoomId.Equals(Room.RoomId));

            foreach (RoomFeature rf in RoomFeatures)
            {
                Room.Features.Add(rf.FeatureId, true);
            }


            EventsInRoom = Room.RoomId != 0
                ? new List <Event>(Events.FindAll(e => e.RoomId.Equals(Room.RoomId)))
                : new List <Event>();

            SelectListFloors   = new SelectList(Floors.FindAll(f => f.VenueId.Equals(tempVenueId)), nameof(Floor.FloorId), nameof(Floor.Name));
            SelectListFeatures = new SelectList(Features, nameof(Feature.FeatureId), nameof(Feature.Name), RoomFeatures);

            foreach (var item in SelectListFeatures)
            {
                foreach (var rf in RoomFeatures)
                {
                    if (item.Value == rf.FeatureId.ToString())
                    {
                        item.Selected = true;
                        break;
                    }
                }
            }
            IsEditing = true;
            return(Page());
        }
Пример #23
0
 public async Task OnGetAsync(int fId)
 {
     Floor = await floorService.GetFromId(fId);
 }
 public async Task OnGetAsync(int fId, int rId)
 {
     RoomFeature = await roomFeatureService.GetFromId(fId, rId);
 }