void AutoCreateTicketsByShowTimes(ShowTimes showTimes) { int result = 0; Cinema cinema = CinemaDAO.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) { Cinema cinema = CinemaDAO.GetCinemaByName(cinemaName); int Row = cinema.Row; int Column = cinema.SeatInRow; flpSeat.Size = new Size((SIZE + 20 + GAP) * Column, (SIZE + GAP) * Row); }
private void listaDeCinemasToolStripMenuItem_Click(object sender, EventArgs e) { frmLista listaCinemas = new frmLista(); listaCinemas.Text = "Lista de Cinemas - CineManager"; listaCinemas.dgvLista.DataSource = CinemaDAO.Selecionar(); listaCinemas.Show(); }
void UpdateCinema(string id, string name, string idMH, int seats, int status, int numberOfRows, int seatsPerRow) { if (CinemaDAO.UpdateCinema(id, name, idMH, seats, status, numberOfRows, seatsPerRow)) { MessageBox.Show("Sửa phòng chiếu thành công"); } else { MessageBox.Show("Sửa phòng chiếu thất bại"); } }
void DeleteCinema(string id) { if (CinemaDAO.DeleteCinema(id)) { MessageBox.Show("Xóa phòng chiếu thành công"); } else { MessageBox.Show("Xóa phòng chiếu thất bại"); } }
private void btnCinema_Click(object sender, EventArgs e) { // Cria um frmLista em tempo de execução lista = new frmLista(); DataTable dtSalas = SalaDAO.Selecionar(); salas = new List <Sala>(); for (int i = 0; i < dtSalas.Rows.Count; i++) { Sala s = new Sala(); s.Id = dtSalas.Rows[i]["Id"].ToString(); s.IdCinema = dtSalas.Rows[i]["IdCinema"].ToString(); s.Capacidade = byte.Parse(dtSalas.Rows[i]["Capacidade"].ToString()); salas.Add(s); } // Preenche um DataTable com objetos Cinema vindos do banco de dados DataTable dtCinemas = CinemaDAO.Selecionar(); cinemas = new List <Cinema>(); // Preenche a lista de cinemas com o DataTable for (int i = 0; i < dtCinemas.Rows.Count; i++) { Cinema cine = new Cinema(); cine.Id = dtCinemas.Rows[i]["Id"].ToString(); cine.Nome = dtCinemas.Rows[i]["Nome"].ToString(); cine.Endereco = dtCinemas.Rows[i]["Endereco"].ToString(); cine.NSalas = int.Parse(dtCinemas.Rows[i]["NSalas"].ToString()); cine.Capacidade = int.Parse(dtCinemas.Rows[i]["Capacidade"].ToString()); cinemas.Add(cine); } // Preenche o DataGrid com a lista de cinemas lista.dgvLista.DataSource = cinemas; // Invoca o método CriaButton para criar um botão em tempo de execução // Point(int horizontal, int vertical) // Size(int largura, int altura) Button btnSelecionar = CriaButton("Selecionar", new Point(800, 473), new Size(100, 30)); // Delega o evento de click ao button criado dinamicamente btnSelecionar.Click += new EventHandler(btnSelecionar_Click); // Delega o evendo DoubleClick ao DataGrid lista.dgvLista.DoubleClick += new EventHandler(dgvLista_DoubleClick); // Adiciona o button ao form lista.Controls.Add(btnSelecionar); lista.Show(); }
public ActionResult InsertCinema(FormCollection formCollection) { CinemaDAO cDAO = new CinemaDAO(); string C_Name = formCollection["C_Name"]; string C_Address = formCollection["C_Address"]; string C_Phone = formCollection["C_Phone"]; string C_Email = formCollection["C_Email"]; string Description = formCollection["Description"]; cDAO.CreateCinema(C_Name, C_Address, C_Phone, C_Email, Description); return(View()); }
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 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"); }
private void btnSalvar_Click(object sender, EventArgs e) { try { Cinema cinema = new Cinema(); cinema.Id = tboId.Text.ToUpper(); cinema.Nome = tboNome.Text; cinema.Endereco = tboEndereco.Text; cinema.NSalas = int.Parse(cboNSalas.SelectedItem.ToString()); cinema.Capacidade = int.Parse(mtbCapacidade.Text); cinema.Foto = Photo.ConvertFileToByte(pbFoto); CinemaDAO.Inserir(cinema); } catch (Exception ex) { MessageBox.Show("Erro: " + ex.Message); } }
private void DeleteTicketsByShowTimes(ShowTimes showTimes) { Cinema cinema = CinemaDAO.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 CHIẾU 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 CHIẾU ID=" + showTimes.ID + " THẤT BẠI!", "THÔNG BÁO"); } }
private void frmNovaSala_Load(object sender, EventArgs e) { try { // Cria um DataTable e o preenche com cinemas vindos do banco de dados dtCinemas = new DataTable(); dtCinemas = CinemaDAO.Selecionar(); // Cria e preenche uma lista de cinemas com os cinemas do DataTable cinemas = new List <Cinema>(); for (int i = 0; i < dtCinemas.Rows.Count; i++) { Cinema c = new Cinema(); c.Id = dtCinemas.Rows[i]["Id"].ToString(); c.Nome = dtCinemas.Rows[i]["Nome"].ToString(); c.Endereco = dtCinemas.Rows[i]["Endereco"].ToString(); c.NSalas = int.Parse(dtCinemas.Rows[i]["NSalas"].ToString()); c.Capacidade = int.Parse(dtCinemas.Rows[i]["Capacidade"].ToString()); cinemas.Add(c); } // Preenche a comboBox com uma lista de cinemas vindos do banco de dados foreach (Cinema c in cinemas) { cboCinema.Items.Add(c.Nome); } // Lista suspensa e não editável e primeiro ítem da lista é selecionado (index 0) cboCinema.DropDownStyle = ComboBoxStyle.DropDownList; cboCinema.SelectedIndex = 0; } catch (Exception ex) { MessageBox.Show("Erro: " + ex.Message); } tboId.Focus(); }
void LoadCinemaList() { cinemaList.DataSource = CinemaDAO.GetListCinema(); }