Exemplo n.º 1
0
        //Switch to Sign Up
        private void btnSignUp_Click(object sender, EventArgs e)
        {
            this.Hide();
            frmSignUp nextForm = new frmSignUp();

            nextForm.Show();
            nextForm.Left = this.Left;
            nextForm.Top  = this.Top;
        }
Exemplo n.º 2
0
        private void btnConfirm_Click(object sender, EventArgs e)
        {
            DialogResult dialogResult = MessageBox.Show("Confirm this information?", "Confirm", MessageBoxButtons.YesNo, MessageBoxIcon.Question);

            if (txtEvent.Text == "")
            {
                MessageBox.Show("Please select an event!", "Select Event", MessageBoxButtons.OK, MessageBoxIcon.Error);

                return;
            }

            if (txtEmail.Text == "")
            {
                MessageBox.Show("One or more fields have been left empty! Please enter all required details.", "Empty Field(s)", MessageBoxButtons.OK, MessageBoxIcon.Error);

                return;
            }

            if (dialogResult == DialogResult.Yes)
            {
                if (Utilities.IsValid(txtEmail.Text))
                {
                    if (Customer.checkEmail(txtEmail.Text))
                    {
                        int tickets = Event.getTickets(Convert.ToInt32(txtEventID.Text));
                        if (tickets <= Convert.ToInt32(cboTickets.Text))
                        {
                            MessageBox.Show("Not enough tickets left. There is " + tickets + " tickets left.");
                            return;
                        }
                        else
                        {
                            Booking booking = new Booking();
                            booking.setBookingID(Convert.ToInt32(txtID.Text));
                            booking.setCustID(Customer.getCustIDFromEmail(Convert.ToString(txtEmail.Text)));
                            booking.setEventID(Convert.ToInt32(txtEventID.Text));
                            booking.setBookingDate(DateTime.Now.ToString("yyyy-MM-dd"));
                            booking.setNoTickets(Convert.ToInt32(cboTickets.Text));
                            booking.setBookingTotal(Convert.ToDouble(txtTotal.Text));
                            booking.AddBooking();

                            MessageBox.Show("All Done!");
                            grdEvents.DataSource = Event.getActiveEventsMini().Tables["aem"];
                            txtID.Text           = Convert.ToString(Booking.getNextID());
                        }
                    }
                    else
                    {
                        DialogResult dialogResult2 = MessageBox.Show("Email does not exist, sign up?", "Sign Up?", MessageBoxButtons.YesNo, MessageBoxIcon.Question);
                        if (dialogResult == DialogResult.Yes)
                        {
                            this.Hide();
                            frmSignUp nextForm = new frmSignUp();
                            nextForm.Show();
                            nextForm.Left = this.Left;
                            nextForm.Top  = this.Top;
                        }
                        else
                        {
                            return;
                        }
                    }
                }
                else
                {
                    MessageBox.Show("Email format not valid!");
                    return;
                }
            }
        }