Exemplo n.º 1
0
        private void FilterComboBoxOnSelectedIndexChanged(object sender, EventArgs e)
        {
            var title            = titlesComboBox.SelectedValue.ToString();
            var year             = yearsComboBox.SelectedValue.ToString();
            var director         = directorsComboBox.SelectedValue.ToString();
            var date             = datesComboBox.SelectedValue.ToString();
            var selectedSessions = sessions;

            if (!string.IsNullOrEmpty(title))
            {
                selectedSessions = selectedSessions.Where(s => s.Movie.Title == title).ToList();
            }

            if (!string.IsNullOrEmpty(year))
            {
                selectedSessions = selectedSessions.Where(s => s.Movie.Year == Convert.ToInt32(year)).ToList();
            }

            if (!string.IsNullOrEmpty(director))
            {
                selectedSessions = selectedSessions.Where(s => s.Movie.Director == director).ToList();
            }
            if (!string.IsNullOrEmpty(date))
            {
                selectedSessions = selectedSessions.Where(s => s.StartTime.Date == Convert.ToDateTime(date).Date)
                                   .ToList();
            }
            Controls.Remove(sessionList);
            sessionList = new SessionList(selectedSessions)
            {
                Size     = new Size(450, 500),
                Location = new Point(0, 0)
            };
            Controls.Add(sessionList);
        }
Exemplo n.º 2
0
        public SessionPage()
        {
            InitializeComponent();
            var dataHandler = new DataHandler();

            sessions = dataHandler.GetSessions();
            LoadHeaders(sessions);
            Size        = new Size(500, 1000);
            sessionList = new SessionList(sessions)
            {
                Size     = new Size(450, 500),
                Location = new Point(0, 0)
            };
            Controls.Add(sessionList);
        }