private void btnRegVenue_Click_1(object sender, EventArgs e) { //Validate data entered if (!txtStreet.Text.Equals("") || !txtTown.Text.Equals("") || !txtEmail.Text.Equals("") || !txtCapacity.Text.Equals("") || !txtContactNo.Text.Equals("") || !txtEmail.Text.Equals("") || !txtPassword.Text.Equals("")) { Venue myVenue = new Venue(); myVenue.setID(Convert.ToInt32(txtVenueID.Text)); myVenue.setName(txtVenueName.Text); myVenue.setStreet(txtStreet.Text); myVenue.setTown(txtTown.Text); myVenue.setCapacity(Convert.ToInt32(txtCapacity.Text)); myVenue.setContactNo(txtContactNo.Text); myVenue.setEmail(txtEmail.Text); myVenue.setPassword(txtPassword.Text); myVenue.setStatus('y'); if (!myVenue.isRegistered()) { //Ask user to confirm DialogResult confirmation = MessageBox.Show("The new Venue details you have entered are: \n" + myVenue.toString() + "\n\nWould you like to add this venue?,", "Confirmation", MessageBoxButtons.YesNo, MessageBoxIcon.Information); if (confirmation == DialogResult.Yes) { //Save data to Venues File myVenue.registerVenue(); //Display Confirmation Message MessageBox.Show("Venue Registered - You may now add events to the system", "Success", MessageBoxButtons.OK, MessageBoxIcon.Information); //Reset UI txtVenueName.Clear(); txtStreet.Clear(); txtTown.Clear(); txtCapacity.Clear(); txtContactNo.Clear(); txtEmail.Clear(); txtPassword.Clear(); txtVenueName.Focus(); txtVenueID.Text = Convert.ToString(Venue.getNextID()); } } else { MessageBox.Show("Venue Name already Exists", "Error!", MessageBoxButtons.OK, MessageBoxIcon.Error); txtVenueName.Focus(); return; } } else { MessageBox.Show("Information Missing", "Error!", MessageBoxButtons.OK, MessageBoxIcon.Error); txtStreet.Focus(); return; } }
private void btnUpdateVenue_Click(object sender, EventArgs e) { //Validate data entered if (!txtVenueName.Text.Equals("") && !txtStreet.Text.Equals("") && !txtTown.Text.Equals("") && !txtEmail.Text.Equals("") && !txtCapacity.Text.Equals("") && !txtContactNo.Text.Equals("") && !txtPassword.Text.Equals("")) { Venue myVenue = new Venue(); myVenue.setName(txtVenueName.Text); myVenue.setVenueDetails(); myVenue.setStreet(txtStreet.Text); myVenue.setTown(txtTown.Text); myVenue.setCapacity(Convert.ToInt32(txtCapacity.Text)); myVenue.setContactNo(txtContactNo.Text); myVenue.setEmail(txtEmail.Text); myVenue.setPassword(txtPassword.Text); if (!myVenue.isRegisteredWithID()) { //Ask user to confirm DialogResult confirmation = MessageBox.Show("The new Venue details you have entered are: \n" + myVenue.toString() + "\n\nWould you like to update this venue?,", "Confirmation", MessageBoxButtons.YesNo, MessageBoxIcon.Information); if (confirmation == DialogResult.Yes) { myVenue.updateVenue(); MessageBox.Show("Your venue details have been updated.", "Venue Updated!", MessageBoxButtons.OK, MessageBoxIcon.Information); //Reset UI //Reset Combo Box txtVenueName.Clear(); txtStreet.Clear(); txtTown.Clear(); txtCapacity.Clear(); txtContactNo.Clear(); txtEmail.Clear(); txtPassword.Clear(); cboVenueNames.SelectedIndex = -1; cboVenueNames.Focus(); pnlUpdateVenue.Visible = false; } } else { MessageBox.Show("Venue Name already exists", "Error!", MessageBoxButtons.OK, MessageBoxIcon.Error); txtVenueName.Clear(); txtVenueName.Focus(); return; } } else { MessageBox.Show("Information Missing", "Error!", MessageBoxButtons.OK, MessageBoxIcon.Error); txtStreet.Focus(); return; } }