private void cboFormatFilm_SelectedIndexChanged(object sender, EventArgs e) { if (cboFormatFilm.SelectedIndex != -1) { lvLichChieu.Items.Clear(); FormatMovie format = cboFormatFilm.SelectedItem as FormatMovie; LoadListShowTimeByFilm(format.ID); } }
private void cboFormatID_Showtime_SelectedIndexChanged(object sender, EventArgs e) { if (cboFormatID_Showtime.SelectedIndex != -1) { FormatMovie formatMovieSelecting = (FormatMovie)cboFormatID_Showtime.SelectedItem; txtMovieName_Showtime.Text = formatMovieSelecting.MovieName; txtScreenTypeName_Showtime.Text = formatMovieSelecting.ScreenTypeName; cboCinemaID_Showtime.DataSource = null; ScreenType screenType = ScreenTypeDAO.GetScreenTypeByName(formatMovieSelecting.ScreenTypeName); cboCinemaID_Showtime.DataSource = CinemaDAO.GetCinemaByScreenTypeID(screenType.ID); cboCinemaID_Showtime.DisplayMember = "Name"; } }
public static List <FormatMovie> GetFormatMovie() { List <FormatMovie> formatMovieList = new List <FormatMovie>(); DataTable data = DataProvider.ExecuteQuery("SELECT DD.id, P.TenPhim, MH.TenMH " + "FROM dbo.DinhDangPhim DD, dbo.Phim P, dbo.LoaiManHinh MH " + "WHERE DD.idPhim = P.id AND DD.idLoaiManHinh = MH.id"); foreach (DataRow item in data.Rows) { FormatMovie formatMovie = new FormatMovie(item); formatMovieList.Add(formatMovie); } return(formatMovieList); }
public static List <FormatMovie> GetListFormatMovieByMovie(string movieID) { List <FormatMovie> listFormat = new List <FormatMovie>(); string query = "select d.id, p.TenPhim, m.TenMH " + "from Phim p, DinhDangPhim d, LoaiManHinh m " + "where p.id = d.idPhim and d.idLoaiManHinh = m.id " + "and p.id = '" + movieID + "'"; DataTable data = DataProvider.ExecuteQuery(query); foreach (DataRow row in data.Rows) { FormatMovie format = new FormatMovie(row); listFormat.Add(format); } return(listFormat); }
private void txtShowtimeID_TextChanged(object sender, EventArgs e) { #region Change selected index of ComboBox FormatMovie string movieName = (string)dtgvShowtime.SelectedCells[0].OwningRow.Cells["Tên phim"].Value; string screenTypeName = (string)dtgvShowtime.SelectedCells[0].OwningRow.Cells["Màn hình"].Value; FormatMovie formatMovieSelecting = FormatMovieDAO.GetFormatMovieByName(movieName, screenTypeName); if (formatMovieSelecting == null) { return; } int indexFormatMovie = -1; for (int i = 0; i < cboFormatID_Showtime.Items.Count; i++) { FormatMovie item = cboFormatID_Showtime.Items[i] as FormatMovie; if (item.ID == formatMovieSelecting.ID) { indexFormatMovie = i; break; } } cboFormatID_Showtime.SelectedIndex = indexFormatMovie; #endregion #region Change selected index of ComboBox Cinema string cinemaID = (string)dtgvShowtime.SelectedCells[0].OwningRow.Cells["Mã phòng"].Value; Cinema cinemaSelecting = CinemaDAO.GetCinemaByID(cinemaID); //This is the Cinema that we're currently selecting in dtgv if (cinemaSelecting == null) { return; } int indexCinema = -1; int iCinema = 0; foreach (Cinema item in cboCinemaID_Showtime.Items) { if (item.ID == cinemaSelecting.ID) { indexCinema = iCinema; break; } iCinema++; } cboCinemaID_Showtime.SelectedIndex = indexCinema; #endregion toolTipCinema.SetToolTip(cboCinemaID_Showtime, "Danh sách phòng chiếu hỗ trợ loại màn hình trên"); }