private ScreeningSearchRequest GetSearchRequest()
        {
            _request            = ApplyDefaultSearchValues(_request) as ScreeningSearchRequest;
            _request.PageIndex  = pgnReservations.PageIndex;
            _request.SearchTerm = txtMovieTitle.Text;
            _request.Hall       = txtHallName.Text;

            if (!_dateFilterCleared)
            {
                _request.Date = dtpScreeningDate.Value.ToUniversalTime();
            }
            else
            {
                _request.Date = null;
            }

            if (nmrNumberOfEntries.Value > 0)
            {
                _request.PageSize = (int)nmrNumberOfEntries.Value;
            }

            Enum.TryParse(cmbStatus.SelectedValue.ToString(), out TimingStatus timingStatus);
            _request.Status = timingStatus;

            return(_request);
        }
 private static ScreeningSearchRequest AddIncludes(ref ScreeningSearchRequest searchRequest)
 {
     searchRequest.Includes.Add("Movie");
     searchRequest.Includes.Add("Hall");
     searchRequest.Includes.Add("Pricing");
     return(searchRequest);
 }
示例#3
0
        public async Task <DashboardWidgetsDto> GetDashboardWidgetsDataAsync()
        {
            var userRoleIncludes = new List <string> {
                nameof(ApplicationUserRole.Role)
            };
            IEnumerable <ApplicationUserRole> userRoles = await _userRoleRepo.GetAsync(x => x.Role.Name.ToLower() == Roles.Customer.ToLower(), userRoleIncludes);

            int usersCount = userRoles.Count();

            var tickets = await _reservationRepo.GetAsync(x => x.CreatedAt.Year == DateTime.UtcNow.Year);

            ScreeningSearchRequest screeningSearchRequest = new ScreeningSearchRequest
            {
                Status    = TimingStatus.SCHEDULED,
                ReturnAll = true,
                PageSize  = int.MaxValue
            };

            var capacities = await GetScreeningCapacitiesAsync(screeningSearchRequest);

            DashboardWidgetsDto dashboardWidgetsDto = new DashboardWidgetsDto
            {
                TicketsSold         = tickets.Count(),
                CustomersCount      = usersCount,
                TicketsCanceled     = tickets.Count(x => x.IsCancelled),
                TotalSeatCapacities = capacities.Data.Sum(x => x.Capacity),
                TotalSeatsFree      = capacities.Data.Sum(x => x.Free),
                TotalSeatsOccupied  = capacities.Data.Sum(x => x.Occupied)
            };

            return(dashboardWidgetsDto);
        }
        private ScreeningSearchRequest GetSearchRequest()
        {
            ScreeningSearchRequest searchRequest = new ScreeningSearchRequest();

            searchRequest            = ApplyDefaultSearchValues(searchRequest) as ScreeningSearchRequest;
            searchRequest.PageIndex  = pagination.PageIndex;
            searchRequest.SearchTerm = txtSearchBar.Text;
            searchRequest.Hall       = txtHall.Text;

            if (!_dateFilterCleared)
            {
                searchRequest.Date = dtpScreeningDate.Value.ToUniversalTime();
            }
            else
            {
                searchRequest.Date = null;
            }

            Enum.TryParse(cmbStatus.SelectedValue.ToString(), out TimingStatus timingStatus);
            searchRequest.Status = timingStatus;

            AddIncludes(ref searchRequest);

            if (int.TryParse(txtPrice.Text, out int searchPrice))
            {
                searchRequest.Price = searchPrice;
            }

            return(searchRequest);
        }
示例#5
0
        public async Task Init()
        {
            ReviewScoreAverage = await _screeningsApi.GetMovieReviewScore(Movie.Id);

            ReviewScore = Convert.ToInt32(ReviewScoreAverage);
            UserId      = await _screeningsApi.GetCurrentUserId();

            CanVote = await _screeningsApi.UserCanVote(UserId, Movie.Id);

            ScreeningSearchRequest screeningSearchRequest = new ScreeningSearchRequest
            {
                MovieId    = Movie.Id,
                Status     = TimingStatus.SCHEDULED,
                Includes   = { nameof(ScreeningDto.Hall), nameof(ScreeningDto.Pricing), nameof(ScreeningDto.Movie) },
                SortColumn = nameof(ScreeningDto.DateAndTime),
                SortOrder  = SortOrder.ASC
            };

            PagedList <ScreeningDto> movieScreenings = await _screeningsApi.Get <PagedList <ScreeningDto> >(screeningSearchRequest);

            ScreeningsList.Clear();

            foreach (var screening in movieScreenings.Data)
            {
                screening.DateAndTime = screening.DateAndTime.ToLocalTime();
                ScreeningsList.Add(screening);
            }
        }
        private async void dgvScreeningCapacitiesList_ColumnHeaderMouseClick(object sender, DataGridViewCellMouseEventArgs e)
        {
            DataGridViewColumn clickedColumn = dgvScreeningCapacitiesList.Columns[e.ColumnIndex];

            ChangeSorting(clickedColumn.Name);

            _request            = GetSearchRequest();
            _request.SortColumn = CurrentSortPropertyName;
            _request.SortOrder  = CurrentSortOrder;

            await LoadScreeningCapacitiesData();
        }
示例#7
0
        private async Task <List <ScreeningDto> > GetScreeningsAsync(ScreeningSearchRequest searchRequest)
        {
            List <string> screeningIncludes = new List <string> {
                nameof(Screening.Hall), nameof(Screening.Movie)
            };

            searchRequest.Includes = screeningIncludes;

            List <ScreeningDto> screenings = await _screeningService.GetAsync(searchRequest);

            return(screenings);
        }
示例#8
0
        public async Task <IPagedList <ScreeningDto> > GetPagedAsync(ScreeningSearchRequest search)
        {
            var list = await _screeningRepo.GetPagedAsync(search, search.SearchTerm, search.MovieId, search.Hall, search.Price, search.Status, search.Date);

            var dtoList = PagedList <ScreeningDto> .Map <Screening>(_mapper, list);

            foreach (var screening in dtoList.Data)
            {
                screening.TimingStatus = GetTimingStatus(screening);
            }

            return(dtoList);
        }
        private async void FormReports_Load(object sender, EventArgs e)
        {
            _request        = ApplyDefaultSearchValues(_request) as ScreeningSearchRequest;
            _request.Status = TimingStatus.SCHEDULED;

            cmbStatus.DataSource   = Enum.GetValues(typeof(TimingStatus));
            cmbStatus.SelectedItem = TimingStatus.SCHEDULED;

            /* The handler is added code-first in order to prevent the SearchChanged method being triggered
             * in the value initialisation for status above.*/
            cmbStatus.SelectedIndexChanged += new EventHandler(SearchChanged);

            await LoadScreeningCapacitiesData();
        }
        private async Task LoadScreenings(ScreeningSearchRequest searchRequest)
        {
            var result = await _screeningsApi.Get <PagedList <ScreeningDto> >(searchRequest);

            foreach (var screening in result.Data)
            {
                screening.DateAndTime.ToLocalTime();
            }

            grdScreeningsList.AutoGenerateColumns = false;
            grdScreeningsList.DataSource          = result.Data;
            pagination.PageIndex  = result.PageIndex;
            pagination.TotalPages = result.TotalPages;
        }
        private async void FormScreeningList_Load(object sender, EventArgs e)
        {
            this.grdScreeningsList.DoubleBuffered(true);
            ScreeningSearchRequest searchRequest = new ScreeningSearchRequest();

            AddIncludes(ref searchRequest);

            searchRequest        = ApplyDefaultSearchValues(searchRequest) as ScreeningSearchRequest;
            searchRequest.Status = TimingStatus.SCHEDULED;

            cmbStatus.DataSource   = Enum.GetValues(typeof(TimingStatus));
            cmbStatus.SelectedItem = TimingStatus.SCHEDULED;

            /* The handler is added code-first in order to prevent the SearchChanged method being triggered
             * in the value initialisation for status above.*/
            cmbStatus.SelectedIndexChanged += new EventHandler(SearchChanged);

            await LoadScreenings(searchRequest);
        }
示例#12
0
        private async void FormDashboard_Load(object sender, EventArgs e)
        {
            LoadCharts();

            this.dgvScreenings.DoubleBuffered(true);
            ScreeningSearchRequest searchRequest = new ScreeningSearchRequest();

            searchRequest.Includes.Add("Movie");
            searchRequest.Includes.Add("Hall");
            searchRequest.Includes.Add("Pricing");

            searchRequest = ApplyDefaultSearchValues(searchRequest) as ScreeningSearchRequest;

            var screenings = await _screeningsApi.Get <PagedList <ScreeningDto> >(searchRequest);

            dgvScreenings.AutoGenerateColumns = false;
            dgvScreenings.DataSource          = screenings.Data;
            pgnScreenings.PageIndex           = screenings.PageIndex;
            pgnScreenings.TotalPages          = screenings.TotalPages;
        }
 private async void SearchChanged(object sender, EventArgs e)
 {
     _request = GetSearchRequest();
     await LoadScreeningCapacitiesData();
 }
        private async void SearchChanged(object sender, EventArgs e)
        {
            ScreeningSearchRequest searchRequest = GetSearchRequest();

            await LoadScreenings(searchRequest);
        }
示例#15
0
        public async Task <ActionResult <PagedList <ScreeningCapacityDto> > > GetYearlyUserSales([FromQuery] ScreeningSearchRequest searchRequest)
        {
            var result = await _reportService.GetScreeningCapacitiesAsync(searchRequest);

            return(Ok(result));
        }
示例#16
0
        public async Task <PagedList <ScreeningCapacityDto> > GetScreeningCapacitiesAsync(ScreeningSearchRequest searchRequest)
        {
            List <ScreeningDto> screenings = await GetScreeningsAsync(searchRequest);

            IEnumerable <int> screeningIds = screenings.Select(x => x.Id);

            List <string> seatReservationIncludes = new List <string> {
                nameof(SeatReservation.Reservation)
            };
            IEnumerable <SeatReservation> seatReservations = await _seatReservationRepo.GetAsync(x => screeningIds.Contains(x.Reservation.ScreeningId), seatReservationIncludes);

            List <ScreeningCapacityDto> screeningCapacities = GetScreeningCapacities(screenings, seatReservations);

            screeningCapacities = ApplySortingForScreeningCapacitiesReport(screeningCapacities, searchRequest);

            PagedList <ScreeningCapacityDto> pagedScreeningCapacities = PagedList <ScreeningCapacityDto> .Create(screeningCapacities, searchRequest.PageIndex, searchRequest.PageSize);

            return(pagedScreeningCapacities);
        }