private void AddSchedule_Load(object sender, EventArgs e) { cmbMovie.DisplayMember = "title"; cmbMovie.ValueMember = "movieID"; cmbMovie.DataSource = sbus.GetAllMovies(); cmbHours.DisplayMember = "time"; cmbHours.ValueMember = "hourID"; cmbHours.DataSource = sbus.GetAllHours(); cmbRoom.DisplayMember = "name"; cmbRoom.ValueMember = "roomID"; cmbRoom.DataSource = sbus.GetAllRooms(); txtDate.Text = monthCalendar1.SelectionRange.Start.ToShortDateString(); }
private void UpdateSchedule_Load(object sender, EventArgs e) { try { cmbMovie.DisplayMember = "title"; cmbMovie.ValueMember = "movieID"; cmbMovie.DataSource = sbus.GetAllMovies(); cmbHours.DisplayMember = "time"; cmbHours.ValueMember = "hourID"; cmbHours.DataSource = sbus.GetAllHours(); cmbRoom.DisplayMember = "name"; cmbRoom.ValueMember = "roomID"; cmbRoom.DataSource = sbus.GetAllRooms(); int rowindex = parent.dgvSchedule.CurrentCell.RowIndex; roomDK = sbus.GetRoomID(parent.dgvSchedule.Rows[rowindex].Cells[0].Value.ToString()); hourDK = sbus.GetHourID(parent.dgvSchedule.Rows[rowindex].Cells[1].Value.ToString()); int movieID = sbus.GetMovieID(parent.dgvSchedule.Rows[rowindex].Cells[2].Value.ToString()); dateDK = parent.dgvSchedule.Rows[rowindex].Cells[3].Value.ToString(); string leftSeat = parent.dgvSchedule.Rows[rowindex].Cells[4].Value.ToString(); cmbRoom.SelectedValue = roomDK; cmbHours.SelectedValue = hourDK; cmbMovie.SelectedValue = movieID; txtDate.Text = dateDK; txtSeat.Text = leftSeat; DateTime example = Convert.ToDateTime(dateDK); monthCalendar1.SetDate(example); dateDK = monthCalendar1.SelectionRange.Start.ToShortDateString(); } catch (Exception ex) { MessageBox.Show(ex.Message); } }