private void txtFormatID_TextChanged(object sender, EventArgs e) { string thienboatID = (string)dtgvFormat.SelectedCells[0].OwningRow.Cells["Mã Tau"].Value; Taudidto thienboatSelecting = TaudiDAO.GetthienboatByID(thienboatID); //This is the thienboat that we're currently selecting in dtgv if (thienboatSelecting == null) { return; } //cboFormat_thienboatID.SelectedItem = thienboatSelecting; int indexthienboat = -1; int ithienboat = 0; foreach (Taudidto item in cboFormat_thienboatID.Items) { if (item.Name == thienboatSelecting.Name) { indexthienboat = ithienboat; break; } ithienboat++; } cboFormat_thienboatID.SelectedIndex = indexthienboat; string screenName = (string)dtgvFormat.SelectedCells[0].OwningRow.Cells["Tên MH"].Value; ScreenType screenTypeSelecting = ScreenTypeDAO.GetScreenTypeByName(screenName); //This is the ScreenType that we're currently selecting in dtgv if (screenTypeSelecting == null) { return; } //cboFormat_ScreenID.SelectedItem = screenTypeSelecting; int indexScreen = -1; int iScreen = 0; foreach (ScreenType item in cboFormat_ScreenID.Items) { if (item.Name == screenTypeSelecting.Name) { indexScreen = iScreen; break; } iScreen++; } cboFormat_ScreenID.SelectedIndex = indexScreen; }
private void txtFormatID_TextChanged(object sender, EventArgs e) { string movieID = (string)dtgvFormat.SelectedCells[0].OwningRow.Cells["Mã phim"].Value; Movie movieSelecting = MovieDAO.GetMovieByID(movieID); //This is the Movie that we're currently selecting in dtgv if (movieSelecting == null) { return; } //cboFormat_MovieID.SelectedItem = movieSelecting; int indexMovie = -1; int iMovie = 0; foreach (Movie item in cboFormat_MovieID.Items) { if (item.Name == movieSelecting.Name) { indexMovie = iMovie; break; } iMovie++; } cboFormat_MovieID.SelectedIndex = indexMovie; string screenName = (string)dtgvFormat.SelectedCells[0].OwningRow.Cells["Tên MH"].Value; ScreenType screenTypeSelecting = ScreenTypeDAO.GetScreenTypeByName(screenName); //This is the ScreenType that we're currently selecting in dtgv if (screenTypeSelecting == null) { return; } //cboFormat_ScreenID.SelectedItem = screenTypeSelecting; int indexScreen = -1; int iScreen = 0; foreach (ScreenType item in cboFormat_ScreenID.Items) { if (item.Name == screenTypeSelecting.Name) { indexScreen = iScreen; break; } iScreen++; } cboFormat_ScreenID.SelectedIndex = indexScreen; }
void DeleteScreenType(string id) { if (ScreenTypeDAO.DeleteScreenType(id)) { MessageBox.Show("Xóa loại phòng thành công"); } else { MessageBox.Show("Xóa loại phòng thất bại"); } }
void UpdateScreenType(string id, string name) { if (ScreenTypeDAO.UpdateScreenType(id, name)) { MessageBox.Show("Sửa loại phòng thành công"); } else { MessageBox.Show("Sửa loại phòng thất bại"); } }
void InsertScreenType(string id, string name) { if (ScreenTypeDAO.InsertScreenType(id, name)) { MessageBox.Show("Thêm loại phòng thành công"); } else { MessageBox.Show("Thêm loại phòng thất bại"); } }
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"; } }
private void txtCinemaID_TextChanged(object sender, EventArgs e) //Use this to bind data between dtgv and cbo because cbo can't be applied DataBindings normally { string screenName = (string)dtgvCinema.SelectedCells[0].OwningRow.Cells["Tên màn hình"].Value; DTO.ScreenType screenType = ScreenTypeDAO.GetScreenTypeByName(screenName); //This is the ScreenType that we're currently selecting in dtgv cboCinemaScreenType.SelectedItem = screenType; int index = -1; int i = 0; foreach (ScreenType item in cboCinemaScreenType.Items) { if (item.Name == screenType.Name) { index = i; break; } i++; } cboCinemaScreenType.SelectedIndex = index; }
void LoadScreenTypeIntoComboBox(ComboBox cbo) { cbo.DataSource = ScreenTypeDAO.GetListScreenType(); cbo.DisplayMember = "Name"; cbo.ValueMember = "ID"; }
void LoadScreenTypeList() { screenTypeList.DataSource = ScreenTypeDAO.GetScreenType(); }
void LoadScreenIDIntoCombobox(ComboBox comboBox) { comboBox.DataSource = ScreenTypeDAO.GetListScreenType(); comboBox.DisplayMember = "ID"; comboBox.ValueMember = "ID"; }