Exemplo n.º 1
0
        private void cboSelectScreening_SelectedIndexChanged(object sender, EventArgs e)
        {
            grpScheduleScreening.Visible = true;

            //if resetting combo, ignore
            if (cboSelectScreening.SelectedIndex == -1)
            {
                return;
            }
            //find screen details
            updScreening = new Screening();
            updScreening.getScreening(Convert.ToInt32(cboSelectScreening.Text.Substring(12, 1)));

            if (updScreening.getScreenNo().Equals(0))
            {
                MessageBox.Show("No details found", "Error!", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }


            //display Screen details
            txtScreeningNumber.Text   = updScreening.getScreeningNo().ToString();
            dtpDateFrom.Value         = updScreening.getDateFrom();
            dtpDateTo.Value           = updScreening.getDateTo();
            cboTimes.SelectedIndex    = updScreening.getTime() - 1;
            txtseatsAvailable.Text    = updScreening.getSeatsAvailable().ToString();
            txtMaxSeats.Text          = updScreening.getMaxSeats().ToString();
            cboScreenNo.SelectedIndex = updScreening.getScreenNo() - 1;
            cboMovieId.SelectedIndex  = updScreening.getMovieId() - 1;
        }
Exemplo n.º 2
0
        private void btnScheduleScreening_Click(object sender, EventArgs e)
        {
            if (dtpDateTo.Value < dtpDateFrom.Value)
            {
                MessageBox.Show("Error! Date To must be later than or Equal to Date From");
                dtpDateTo.Focus();
                return;
            }

            string time     = cboTimes.Text.Substring(3, 5);
            string fromDate = dtpDateFrom.Value.ToShortDateString();
            string toDate   = dtpDateTo.Value.ToShortDateString();

            if (Screening.isTimeBooked(time, cboScreenNo.Text.Substring(8, 2), fromDate, toDate) == true)
            {
                MessageBox.Show("Error! This time for this screen is already booked!");
                return;
            }

            updScreening.setScreeningNumber(Convert.ToInt32(txtScreeningNumber.Text));
            updScreening.setDateFrom(Convert.ToDateTime(dtpDateFrom.Text));
            updScreening.setDateTo(Convert.ToDateTime(dtpDateTo.Text));
            updScreening.setTime(Convert.ToInt32(cboTimes.Text.Substring(0, 1)));
            updScreening.setSeatsAvailable(Convert.ToInt32(txtMaxSeats.Text));
            updScreening.setMaxSeats(Convert.ToInt32(txtMaxSeats.Text));
            updScreening.setScreenNo(Convert.ToInt32(cboScreenNo.Text.Substring(8, 2)));
            updScreening.setMovieId(Convert.ToInt32(cboMovieId.Text.Substring(0, 1)));
            updScreening.updScreen();

            MessageBox.Show("Movie " + txtScreeningNumber.Text + " Updated", "Confirmation", MessageBoxButtons.OK, MessageBoxIcon.Information);

            loadCombo();

            grpScheduleScreening.Visible = false;
        }
Exemplo n.º 3
0
        private void btnScheduleScreening_Click(object sender, EventArgs e)
        {
            if (dtpDateTo.Value < dtpDateFrom.Value)
            {
                MessageBox.Show("Date To must be later than Date From", "Error!", MessageBoxButtons.OK, MessageBoxIcon.Error);
                dtpDateTo.Focus();
                return;
            }

            if (cboScreenNo.SelectedIndex == -1)
            {
                MessageBox.Show("Please select an screen! ", "Error!", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }

            if (cboTimes.SelectedIndex == -1)
            {
                MessageBox.Show("Please select a Time! ", "Error!", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }

            if (cboMovieId.SelectedIndex == -1)
            {
                MessageBox.Show("Please select a movie! ", "Error!", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }

            string time     = cboTimes.Text.Substring(3, 5);
            string fromDate = dtpDateFrom.Value.ToShortDateString();
            string toDate   = dtpDateTo.Value.ToShortDateString();

            if (Screening.isTimeBooked(time, cboScreenNo.Text.Substring(8, 2), fromDate, toDate) == true)
            {
                MessageBox.Show("This time for this screen is already booked!", "Error!", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }

            myScreening = new Screening();
            myScreening.setScreeningNumber(Convert.ToInt32(txtScreeningNumber.Text));
            myScreening.setDateFrom(Convert.ToDateTime(dtpDateFrom.Text));
            myScreening.setDateTo(Convert.ToDateTime(dtpDateTo.Text));
            myScreening.setTime(Convert.ToInt32(cboTimes.Text.Substring(0, 1)));
            myScreening.setSeatsAvailable(Convert.ToInt32(txtMaxSeats.Text));
            myScreening.setMaxSeats(Convert.ToInt32(txtMaxSeats.Text));
            myScreening.setScreenNo(Convert.ToInt32(cboScreenNo.Text.Substring(8, 2)));
            myScreening.setMovieId(Convert.ToInt32(cboMovieId.Text.Substring(0, 1)));
            myScreening.regScreening();

            //Display Confirmation Message
            MessageBox.Show("Screening " + txtScreeningNumber.Text + " Updated", "Confirmation", MessageBoxButtons.OK, MessageBoxIcon.Information);

            txtScreeningNumber.Text = Screening.nextScreening_Number().ToString("00");
            dtpDateFrom.ResetText();
            dtpDateTo.ResetText();
            txtMaxSeats.ResetText();
            txtseatsAvailable.ResetText();
            loadComboScreen();
            loadComboMovie();
            loadComboTimes();
        }
Exemplo n.º 4
0
        public void loadComboTimes()
        {
            DataSet ds = new DataSet();

            ds = Screening.getTimes(cboSelectMovie.Text.Substring(0, 1), cboDate.SelectedText.ToString());

            for (int i = 0; i < ds.Tables["getTimes"].Rows.Count; i++)
            {
                cboTime.Items.Add(ds.Tables[0].Rows[i][0].ToString() + ' ' + ds.Tables[0].Rows[i][9].ToString());
            }

            cboSelectRate.SelectedIndex = -1;
        }
Exemplo n.º 5
0
        private void cboSelectMovie_SelectedIndexChanged_1(object sender, EventArgs e)
        {
            //find screen details
            updScreening = new Screening();
            updScreening.getScreeningTwo(Convert.ToInt32(cboSelectMovie.Text.Substring(0, 2)));

            dtpDateFrom.Value = updScreening.getDateFrom();
            dtpDateTo.Value   = updScreening.getDateTo();

            fromDate = dtpDateFrom.Value;
            toDate   = dtpDateTo.Value;

            loadComboDates();
        }
Exemplo n.º 6
0
        public void loadCombo()
        {
            DataSet ds = new DataSet();

            ds = Screening.getAllScreenings(ds);

            cboSelectScreening.Items.Clear();

            for (int i = 0; i < ds.Tables["gasc"].Rows.Count; i++)
            {
                cboSelectScreening.Items.Add("Screening".ToString() + "  " + ds.Tables[0].Rows[i][0].ToString().PadLeft(2, '0'));
            }

            cboSelectScreening.SelectedIndex = -1;
        }
Exemplo n.º 7
0
        private void frmScheduleScreening_Load(object sender, EventArgs e)
        {
            txtScreeningNumber.Text = Screening.nextScreening_Number().ToString("00");

            dtpDateFrom.MinDate = DateTime.Today;


            String theDate = dtpDateFrom.Value.ToShortDateString();

            dtpDateFrom.Format       = DateTimePickerFormat.Custom;
            dtpDateFrom.CustomFormat = "dd-MM-yy";

            String theDate2 = dtpDateTo.Value.ToShortDateString();

            dtpDateTo.Format       = DateTimePickerFormat.Custom;
            dtpDateTo.CustomFormat = "dd-MM-yy";

            loadComboTimes();

            loadComboScreen();

            loadComboMovie();
        }
Exemplo n.º 8
0
        private void cboSelectScreening_SelectedIndexChanged(object sender, EventArgs e)
        {
            grpScheduleScreening.Visible = false;
            if (Screening.isBooked(cboSelectScreening.Text.Substring(12, 1)) == true)
            {
                MessageBox.Show("Screening cannot be removed as it has been booked!");
                loadCombo();
                return;
            }

            grpScheduleScreening.Visible = true;

            //if resetting combo, ignore
            if (cboSelectScreening.SelectedIndex == -1)
            {
                return;
            }
            //find screen details
            myScreening = new Screening();
            myScreening.getScreening(Convert.ToInt32(cboSelectScreening.Text.Substring(12, 1)));

            if (myScreening.getScreenNo().Equals(0))
            {
                MessageBox.Show("No details found", "Error!", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }


            txtScreeningNumber.Text = myScreening.getScreeningNo().ToString();
            dtpDateFrom.Value       = myScreening.getDateFrom();
            dtpDateTo.Value         = myScreening.getDateTo();
            cboTimes.Text           = myScreening.getTime().ToString();
            txtseatsAvailable.Text  = myScreening.getSeatsAvailable().ToString();
            txtMaxSeats.Text        = myScreening.getMaxSeats().ToString();
            cboScreenNo.Text        = myScreening.getScreenNo().ToString();
            cboMovieId.Text         = myScreening.getMovieId().ToString();
        }