void AutoCreateTicketsByShowTimes(ShowTimes showTimes) { int result = 0; Taudto cinema = TauDAO.GetCinemaByName(showTimes.CinemaName); int Row = cinema.Row; int Column = cinema.SeatInRow; for (int i = 0; i < Row; i++) { int temp = i + 65; char nameRow = (char)(temp); for (int j = 1; j <= Column; j++) { string seatName = nameRow.ToString() + j; result += TicketDAO.InsertTicketByShowTimes(showTimes.ID, seatName); } } if (result == Row * Column) { int ret = ShowTimesDAO.UpdateStatusShowTimes(showTimes.ID, 1); if (ret > 0) { MessageBox.Show("TẠO VÉ TỰ ĐỘNG THÀNH CÔNG!", "THÔNG BÁO"); } } else { MessageBox.Show("TẠO VÉ TỰ ĐỘNG THẤT BẠI!", "THÔNG BÁO"); } }
private void LoadDataCinema(string cinemaName) { Taudto cinema = TauDAO.GetCinemaByName(cinemaName); int Row = cinema.Row; int Column = cinema.SeatInRow; flpSeat.Size = new Size((SIZE + 20 + GAP) * Column, (SIZE + GAP) * Row); }
void UpdateCinema(string id, string name, string idMH, int seats, int status, int numberOfRows, int seatsPerRow) { if (TauDAO.UpdateCinema(id, name, idMH, seats, status, numberOfRows, seatsPerRow)) { MessageBox.Show("Sửa phòng thành công"); } else { MessageBox.Show("Sửa phòng thất bại"); } }
void DeleteCinema(string id) { if (TauDAO.DeleteCinema(id)) { MessageBox.Show("Xóa phòng thành công"); } else { MessageBox.Show("Xóa phòng thất bại"); } }
private void cboFormatID_Showtime_SelectedIndexChanged(object sender, EventArgs e) { if (cboFormatID_Showtime.SelectedIndex != -1) { FormatTaudto formatthienboatSelecting = (FormatTaudto)cboFormatID_Showtime.SelectedItem; txtthienboatName_Showtime.Text = formatthienboatSelecting.thienboatName; txtScreenTypeName_Showtime.Text = formatthienboatSelecting.ScreenTypeName; cboCinemaID_Showtime.DataSource = null; ScreenType screenType = ScreenTypeDAO.GetScreenTypeByName(formatthienboatSelecting.ScreenTypeName); cboCinemaID_Showtime.DataSource = TauDAO.GetCinemaByScreenTypeID(screenType.ID); cboCinemaID_Showtime.DisplayMember = "Name"; } }
private void txtShowtimeID_TextChanged(object sender, EventArgs e) { #region Change selected index of ComboBox Formatthienboat string thienboatName = (string)dtgvShowtime.SelectedCells[0].OwningRow.Cells["Tên Tau"].Value; string screenTypeName = (string)dtgvShowtime.SelectedCells[0].OwningRow.Cells["Màn hình"].Value; FormatTaudto formatthienboatSelecting = FormatTauDAO.GetFormatthienboatByName(thienboatName, screenTypeName); if (formatthienboatSelecting == null) { return; } int indexFormatthienboat = -1; for (int i = 0; i < cboFormatID_Showtime.Items.Count; i++) { FormatTaudto item = cboFormatID_Showtime.Items[i] as FormatTaudto; if (item.ID == formatthienboatSelecting.ID) { indexFormatthienboat = i; break; } } cboFormatID_Showtime.SelectedIndex = indexFormatthienboat; #endregion #region Change selected index of ComboBox Cinema string cinemaID = (string)dtgvShowtime.SelectedCells[0].OwningRow.Cells["Mã phòng"].Value; Taudto cinemaSelecting = TauDAO.GetCinemaByID(cinemaID); //This is the Cinema that we're currently selecting in dtgv if (cinemaSelecting == null) { return; } int indexCinema = -1; int iCinema = 0; foreach (Taudto 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 hỗ trợ loại phòng trên"); }
private void DeleteTicketsByShowTimes(ShowTimes showTimes) { Taudto cinema = TauDAO.GetCinemaByName(showTimes.CinemaName); int Row = cinema.Row; int Column = cinema.SeatInRow; int result = TicketDAO.DeleteTicketsByShowTimes(showTimes.ID); if (result == Row * Column) { int ret = ShowTimesDAO.UpdateStatusShowTimes(showTimes.ID, 0); if (ret > 0) { MessageBox.Show("XÓA TẤT CẢ CÁC VÉ CỦA LỊCH ID=" + showTimes.ID + " THÀNH CÔNG!", "THÔNG BÁO"); } } else { MessageBox.Show("XÓA TẤT CẢ CÁC VÉ CỦA LỊCH ID=" + showTimes.ID + " THẤT BẠI!", "THÔNG BÁO"); } }
void LoadCinemaList() { cinemaList.DataSource = TauDAO.GetListCinema(); }