Beispiel #1
0
        public async Task <IActionResult> Index(int?page, int?typesFilterApplied, int?categoryFilterApplied, int?locationFilteredApplied, int?priceFilteredApplied)
        {
            var itemsOnPage = 12;

            var catalog = await _service.GetEventItemsAsync(page ?? 0, itemsOnPage, typesFilterApplied, categoryFilterApplied, locationFilteredApplied, priceFilteredApplied);

            var vm = new EventIndexViewModel
            {
                EventItems     = catalog.Data,
                PaginationInfo = new PaginationInfo
                {
                    ActualPage   = page ?? 0,
                    ItemsPerPage = itemsOnPage,
                    TotalItems   = catalog.Count,
                    TotalPages   = (int)Math.Ceiling((decimal)catalog.Count / itemsOnPage)
                },
                Categories = await _service.GetCategoriesAsync(),
                Types      = await _service.GetTypesAsync(),
                Locations  = await _service.GetLocationsAsync(),
                Prices     = await _service.GetPricesAsync(),

                CategoryFilterApplied   = categoryFilterApplied ?? 0,
                TypesFilterApplied      = typesFilterApplied ?? 0,
                LocationFilteredApplied = locationFilteredApplied ?? 0,
                PriceFilteredApplied    = priceFilteredApplied ?? 0
            };

            return(View(vm));
        }
Beispiel #2
0
        public async Task <IActionResult> Index(int?CategoryFilterApplied, int?page)
        {
            int itemsPage = 10;
            var eventItem = await _eventSvc.GetEventAsync(page ?? 0, itemsPage, CategoryFilterApplied);

            if (eventItem == null)
            {
                _logger.LogDebug("the eventIten returned is null");
            }
            // _logger.LogDebug("the categoryId chose by user is" + eventItem.CategoryId);
            var v_model = new EventIndexViewModel()
            {
                EventItems = eventItem.Data,
                Categories = await _eventSvc.GetCategory(),
                // Prices = await _eventSvc.GetPrice(),
                CategoryFilterApplied = CategoryFilterApplied ?? 0,
                // PriceFilterApplied = PriceFilterApplied ?? 0,

                PaginationInfo = new PaginationInfo()
                {
                    ActualPage   = page ?? 0,
                    ItemsPerPage = itemsPage,
                    TotalItems   = eventItem.Count,
                    TotalPages   = (int)Math.Ceiling(((decimal)eventItem.Count / itemsPage))
                }
            };

            v_model.PaginationInfo.Next     = (v_model.PaginationInfo.ActualPage == v_model.PaginationInfo.TotalPages - 1) ? "is-disabled" : "";
            v_model.PaginationInfo.Previous = (v_model.PaginationInfo.ActualPage == 0) ? "is-disabled" : "";

            return(View(v_model));
        }
        public IActionResult Index()
        {
            ApplicationUser     user       = QueryController.GetCurrentUserAsync(_userManager, User);
            EventIndexViewModel indexModel = new EventIndexViewModel
            {
                CreatedEvents       = QueryController.GetUserEvents(_context, user),
                ParticipatingEvents = QueryController.GetUserParticipation(_context, user)
            };

            ViewData["Message"] = "Event Dashboard";
            return(View(indexModel));
        }
Beispiel #4
0
        private EventIndexViewModel getViewModelFrom(List <CMS.Core.Entity.Event> events)
        {
            EventIndexViewModel vm = new EventIndexViewModel();

            vm.event_details = new List <EventDetailModel>();
            foreach (var even in events)
            {
                var Events = _mapper.Map <EventDetailModel>(even);
                vm.event_details.Add(Events);
            }

            return(vm);
        }
Beispiel #5
0
        // GET: Events
        public ActionResult Index(int?id)
        {
            EventIndexViewModel indexViewModel = new EventIndexViewModel();

            indexViewModel.Events = db.Events
                                    .Include(e => e.Game)
                                    .Include(e => e.EventCompetitors);

            if (id != null)
            {
                // If the ID is not null (event is selected) then include the information
                // for event competitors
                indexViewModel.EventCompetitors = indexViewModel.Events
                                                  .Where(e => e.eventID == id).Single().EventCompetitors;
            }

            return(View(indexViewModel));
        }
Beispiel #6
0
        //We gonna get all these below info (Index parameters from the user)
        public async Task <IActionResult> Index(int?page, int?catagoriesFilterApplied, int?typesFilterApplied, int?
                                                addressesFilterApplied, int?organizersFilterApplied)

        {
            var itemsOnPage = 10;
            //?? means if there is no page number is guven the default page number will be 0
            var _event = await _service.GetEventItemsAsync(page ?? 0, itemsOnPage, catagoriesFilterApplied,
                                                           typesFilterApplied, addressesFilterApplied, organizersFilterApplied);

            if (null == _event)
            {
                var vm1 = new EventIndexViewModel
                {
                    CatagoriesFilterApplied = catagoriesFilterApplied ?? 0,
                    TypesFilterApplied      = typesFilterApplied ?? 0,
                    AddressesFilterApplied  = addressesFilterApplied ?? 0,
                    OrganizersFilterApplied = organizersFilterApplied ?? 0
                };
                return(View(vm1));
            }
            var vm = new EventIndexViewModel
            {
                EventItems     = _event.Data,
                Catagories     = await _service.GetEventCatagoriesAsync(),
                Types          = await _service.GetEventTypesAsync(),
                Addresses      = await _service.GetEventAddressesAsync(),
                Organizsers    = await _service.GetEventOrganizersAsync(),
                PaginationInfo = new PaginationInfo
                {
                    ActualPage   = page ?? 0,
                    ItemsPerPage = _event.PageSize,
                    TotalItems   = _event.Count,
                    TotalPages   = (int)Math.Ceiling((decimal)_event.Count / itemsOnPage)
                },
                CatagoriesFilterApplied = catagoriesFilterApplied ?? 0,
                TypesFilterApplied      = typesFilterApplied ?? 0,
                AddressesFilterApplied  = addressesFilterApplied ?? 0,
                OrganizersFilterApplied = organizersFilterApplied ?? 0
            };

            return(View(vm));
        }
Beispiel #7
0
        public async Task <IActionResult> Index(string sortOrder, string searchString, int?SelectedEventTypeId = null, int?SelectedEventSeriesId = null, int?SelectedUserId = null, int page = 1)
        {
            var result = await _mediator.Send(new GetEventListQuery { EventTypeId = SelectedEventTypeId, SearchString = searchString, CurrentPage = page });

            var eventTypes = await _mediator.Send(new GetEventTypeListQuery());

            EventIndexViewModel vm = new
                                     EventIndexViewModel(
                result.Events.ToList(),
                eventTypes.EventTypes.ToList(),
                sortOrder,
                searchString,
                result.Count,
                page,
                25,
                SelectedUserId,
                SelectedEventTypeId);

            return(View(vm));
        }
        public async Task <IActionResult> Index(int?page, int?typesFilterApplied, string location)
        {
            var itemsOnPage = 10;
            var events      = await _service.GetEventItemsAsync(page ?? 0, itemsOnPage, typesFilterApplied, location);

            var vm = new EventIndexViewModel
            {
                EventItems     = events.Data,
                PaginationInfo = new PaginationInfo
                {
                    ActualPage   = page ?? 0,
                    ItemsPerPage = itemsOnPage,
                    TotalItems   = events.Count,
                    TotalPages   = (int)Math.Ceiling((decimal)events.Count / itemsOnPage)
                },
                Types = await _service.GetTypesAsync()
            };

            return(View(vm));
        }
 private static void MapDatesEventIndexViewModel(EventIndexViewModel eivm, Event e)
 {
     if (string.IsNullOrWhiteSpace(e.StartDateTime.ToString()))
     {
         if (e.IsAllDayEvent)
         {
             eivm.StartDateTime = e.ActivityDate;
         }
         else
         {
             eivm.StartDateTime = e.ActivityDateTime;
         }
     }
     else
     {
         eivm.StartDateTime = e.StartDateTime;
     }
     //may need to be made more comprehensive, durationInMinutes
     eivm.EndDateTime = e.EndDateTime;
     eivm.CreatedDate = e.CreatedDate;
 }
Beispiel #10
0
        //whoid= fk for primary lead/contact
        //whocount= multiple contacts if enabled
        //whatID=fk associated with account/oppur/camp/cases/ or custom obj
        //whatcount= for mult activities if enabled
        //type = use to check for 'meeting'
        //subject = subject line of meeting...also use for check?
        //startdatetime = what it seems, unless activitydate/datetime is present
        //activitydatetime = may also be needed
        //activitydate = exists if isalldayevent is set to true
        //location = location of event
        //enddatetime / durationinminutes= one or the other used to calc end
        //description = event description
        //accountid= id of related account
        //
        public static IEnumerable <EventIndexViewModel> GetEventIndexViewModel(IEnumerable <Event> events)
        {
            List <EventIndexViewModel> eventIndexViewModels = new List <EventIndexViewModel>();

            foreach (Event e in events)
            {
                if (e.Subject.ToLower().Contains("meeting"))
                {
                    EventIndexViewModel eivm = new EventIndexViewModel();
                    eivm.Id          = e.Id;
                    eivm.Location    = e.Location;
                    eivm.WhoId       = e.WhoId;
                    eivm.OwnerId     = e.OwnerId;
                    eivm.Description = e.Description;
                    eivm.Subject     = e.Subject;
                    MapDatesEventIndexViewModel(eivm, e);
                    eventIndexViewModels.Add(eivm);
                }
            }
            return(eventIndexViewModels);
        }
        public async Task <IActionResult> Index(string sortOrder, string searchString, int SelectedEventTypeId = 0, int SelectedEventSeriesId = 0, int SelectedUserId = 0, int page = 1)
        {
            searchString = searchString.ToLowerRemoveSymbols();
            IEnumerable <Event> events = await _eventService.Events.GetEventsWithCreatorEventTypeAndSeriesAsnyc(searchString, SelectedEventTypeId, SelectedUserId, 0, page, PageSize);

            int totalItems = 0;

            if (!string.IsNullOrEmpty(searchString) || SelectedEventTypeId != 0 || SelectedEventSeriesId != 0 || SelectedUserId != 0)
            {
                Expression <Func <Event, bool> > predicate = (x => (string.IsNullOrEmpty(searchString) || x.Title.Contains(searchString)) && (SelectedEventTypeId == 0 || x.EventTypeId == SelectedEventTypeId) && (SelectedUserId == 0 || x.OwnerId == SelectedUserId) && (SelectedEventSeriesId == 0 || x.EventSeriesId == SelectedEventSeriesId));
                totalItems = _eventService.Events.CountByExpression(predicate);
            }
            else
            {
                totalItems = _eventService.Events.Count();
            }



            SelectList userSelect      = _eventService.Users.GetUserSelectList();
            SelectList eventTypeSelect = _eventService.EventTypes.GetEventTypeSelectList();

            EventIndexViewModel vm = new EventIndexViewModel(
                events,
                userSelect,
                eventTypeSelect,
                SelectedUserId,
                SelectedEventTypeId,
                sortOrder,
                searchString,
                totalItems,
                page,
                PageSize);

            ViewData["ActiveMenu"] = "Admin";
            ViewData["ActiveLink"] = "EventIndex";
            ViewData["Title"]      = "Event Index";
            return(View(vm));
        }
Beispiel #12
0
        public async Task <IActionResult> Index(int?page, int?categoryFilterApplied, int?typeFilterApplied,
                                                int?addressesFilterApplied)
        {
            var itemsOnPage = 10;

            var events = await _service.GetEventItemsAsync(page ?? 0, itemsOnPage, categoryFilterApplied, typeFilterApplied,
                                                           addressesFilterApplied);

            if (null == events)
            {
                var vm1 = new EventIndexViewModel
                {
                    CategoryFilterApplied  = categoryFilterApplied ?? 0,
                    TypeFilterApplied      = typeFilterApplied ?? 0,
                    AddressesFilterApplied = addressesFilterApplied ?? 0,
                };
                return(View(vm1));
            }
            var vm = new EventIndexViewModel
            {
                EventItems     = events.Data,
                Categories     = await _service.GetCategoriesAsync(),
                Types          = await _service.GetEventTypesAsync(),
                Addresses      = await _service.GetEventAddressesAsync(),
                PaginationInfo = new PaginationInfo
                {
                    ActualPage   = page ?? 0,
                    ItemsPerPage = events.PageSize,
                    TotalItems   = events.Count,
                    TotalPages   = (int)Math.Ceiling((decimal)events.Count / itemsOnPage)
                },
                CategoryFilterApplied  = categoryFilterApplied ?? 0,
                TypeFilterApplied      = typeFilterApplied ?? 0,
                AddressesFilterApplied = addressesFilterApplied ?? 0,
            };

            return(View(vm));
        }