Ejemplo n.º 1
0
        public ActionResult FilterChanged(EventListViewModel model)
        {
            FilterSession = model.Filter;

            // When filter is changeg, page index should be 0 because in other case first x Data pages would be skiped
            if (PagingSession != null)
                PagingSession.SelectedPageIndex = 0;

            return RedirectToAction("EventListView", "Event");
        }
Ejemplo n.º 2
0
        public ActionResult EventListView()
        {
            if (!RightManager.Instance.HasUserRight(false,
                RightEnum.EVENT___ACCESS_TO_PUBLIC,
                RightEnum.EVENT___ACCESS_TO_PRIVATE,
                RightEnum.EVENT___ACCESS_TO_CONFIDENTIAL))
                throw new Exception("Uživatel nemá přístup ke stránce přehled událostí");

            LinkCssFile("EventListView.css");

            ManageEventFilter();
            var dbFilter = new EventDbFilter()
            {
                IsFindNewer                = FilterSession.IsFindNewer,
                PilotTime                  = FilterSession.PilotTime,
                ActionName                 = FilterSession.EventName,
                AccessibilityId            = FilterSession.SelectedAccessibility,
                CreatorId                  = FilterSession.SelectedUser,
                EventTypeId                = FilterSession.SelectedEventType,
                UserAccessibilitiesByRight = RightManager.Instance.GetLoggedUserEventAccessibilityTypesByRights(),
                FileName                   = FilterSession.FileName
            };

            var dbEventDTO = Locator.GetDbEventManager().GetEventList(dbFilter, ManagePager());
            PagingSession.SetPaging(dbEventDTO.TotalRecords);

            var model = new EventListViewModel()
            {
                Events = dbEventDTO.Eventlist.Select(ModelConvertor.ConvertToEventModelNew).ToList(),
                Paging = PagingSession,
                Filter = FilterSession
            };

            // we need to show user if about forum items to each event.
            if (model.Events.Any())
                SetEventForumVisitedInfo(model.Events);

            return View(model);
        }