private void txtDate_ValueChanged(object sender, EventArgs e) { if (cboVenueName.SelectedIndex >= 0) { Venue checkVenue = new Venue(); //Assign rest of attributes to the venue object checkVenue.setName(cboVenueName.Text); checkVenue.setVenueDetails(); Event newEvent = new Event(); //Assign venueID and date to Event newEvent.setVenueID(checkVenue.getID()); newEvent.setDate(txtDate.Text); //check if event is on the same date in the same venue if (newEvent.isVenueFree()) { pnlEvDetails.Visible = true; } else { MessageBox.Show("Your Venue already has an event scheduled for " + newEvent.getDate(), "Existing Event!", MessageBoxButtons.OK, MessageBoxIcon.Information); pnlEvDetails.Visible = false; } } }
private void cboVenueNames_SelectedIndexChanged(object sender, EventArgs e) { cboYear.SelectedIndex = -1; cboMonth.SelectedIndex = -1; cboYear.Items.Clear(); pnlAnalysis.Visible = false; pnlMonth.Visible = false; pnlYear.Visible = false; btnAnalyseVenue.Visible = false; btnReset.Visible = false; if (cboVenueNames.SelectedIndex >= 0) { Venue ven = new Venue(); ven.setName(cboVenueNames.Text); ven.setVenueDetails(); List <String> years = ven.getYears(); if (years.Count > 0) { cboYear.Items.AddRange(years.ToArray()); pnlYear.Visible = true; } else { MessageBox.Show("There is no analysis available for " + cboVenueNames.Text, "Analysis Unavailable", MessageBoxButtons.OK, MessageBoxIcon.Error); cboVenueNames.SelectedIndex = -1; } } }
private void cboYear_SelectedIndexChanged(object sender, EventArgs e) { if (cboVenueNames.SelectedIndex >= 0) { Venue ven = new Venue(); ven.setName(cboVenueNames.Text); ven.setVenueDetails(); pnlMonth.Visible = true; btnAnalyseVenue.Visible = true; btnReset.Visible = true; } }
private void cboVenue_SelectedIndexChanged(object sender, EventArgs e) { if (cboVenue.SelectedIndex >= 0) { Venue newVen = new Venue(); newVen.setName(cboVenue.Text); newVen.setVenueDetails(); grdEvents.DataSource = Event.getAvailableEventsFiltered("VenueID", Convert.ToString(newVen.getID())).Tables["WS"]; cboType.SelectedIndex = -1; cboTown.SelectedIndex = -1; cboPrice.SelectedIndex = -1; } }
private void btnDelVenue_Click(object sender, EventArgs e) { //Validation string selected = cboVenueNames.Text; Venue selectedVenue = new Venue(); selectedVenue.setName(selected); selectedVenue.setVenueDetails(); //Check that Venue has no events beyond todays date if (!selectedVenue.checkIfUpcomingEvents()) { //if no upcoming events //Ask user to confirm DialogResult confirmation = MessageBox.Show("Are you sure you want to delete Venue?", "Confirmation", MessageBoxButtons.YesNo, MessageBoxIcon.Information); if (confirmation == DialogResult.Yes) { selectedVenue.deleteVenue(); //if yes set status of venue to "Unavailable" in the Venues File MessageBox.Show("Venue has been removed from the system", "Success", MessageBoxButtons.OK, MessageBoxIcon.Information); } } else { //Display error message MessageBox.Show("Please cancel upcoming events before deregistering from the system.", "Cancel Events", MessageBoxButtons.OK, MessageBoxIcon.Error); } txtVenueName.Clear(); txtStreet.Clear(); txtTown.Clear(); txtCapacity.Clear(); txtContactNo.Clear(); txtEmail.Clear(); pnlDeleteVenue.Visible = false; cboVenueNames.SelectedIndex = -1; cboVenueNames.Focus(); }
private void cboVenueNames_SelectedIndexChanged(object sender, EventArgs e) { pnlUpdateVenue.Visible = true; string selected = cboVenueNames.Text; Venue selectedVenue = new Venue(); selectedVenue.setName(selected); selectedVenue.setVenueDetails(); txtVenueName.Text = selectedVenue.getName(); txtStreet.Text = selectedVenue.getStreet(); txtTown.Text = selectedVenue.getTown(); txtCapacity.Text = Convert.ToString(selectedVenue.getCapacity()); txtContactNo.Text = selectedVenue.getContactNo(); txtEmail.Text = selectedVenue.getEmail(); txtPassword.Text = selectedVenue.getPassword(); }
private void btnEmailAnalysis_Click(object sender, EventArgs e) { string venue = cboVenueNames.Text; Venue ven = new Venue(); ven.setName(venue); ven.setVenueDetails(); //Retrieve venue email and send above Analysis results MessageBox.Show("Venue Analysis has been emailed to " + ven.getEmail(), "Analysis Emailed", MessageBoxButtons.OK, MessageBoxIcon.Information); //Reset UI txtEvents.Clear(); txtCancelledEvents.Clear(); txtTicketsSold.Clear(); txtRevenue.Clear(); txtSysFee.Clear(); txtRevFee.Clear(); cboVenueNames.Focus(); }
private void btnAnalyseVenue_Click(object sender, EventArgs e) { string venue = cboVenueNames.Text; Venue ven = new Venue(); ven.setName(venue); ven.setVenueDetails(); string condition; string year = cboYear.Text; if (cboMonth.SelectedIndex >= 0 && cboMonth.Text != "All") { string month = cboMonth.Text; condition = month.ToUpper() + "-" + year.Substring(2, 2); lblDate.Text = "Analysis for " + month + " " + year; } else { condition = year.Substring(2, 2); lblDate.Text = "Analysis for " + year; } List <String> analysis = ven.getAnalysis(condition); txtEvents.Text = analysis[0]; txtCancelledEvents.Text = analysis[1]; txtTicketsSold.Text = analysis[2]; txtRevenue.Text = analysis[3]; txtSysFee.Text = analysis[4]; txtRevFee.Text = analysis[5]; pnlAnalysis.Visible = true; }
private void btnAddEvent_Click_1(object sender, EventArgs e) { //validate Data if (cboVenueName.SelectedIndex != -1 && txtTitle.Text != "" && cboTypes.SelectedIndex != -1 && txtHour.Text != "" && txtMin.Text != "" && txtTickets.Text != "" && txtPrice.Text != "") { //Set venue details to get access to ID Venue eventVenue = new Venue(); eventVenue.setName(cboVenueName.Text); eventVenue.setVenueDetails(); //Set new event no tickets and venue id Event newEvent = new Event(); newEvent.setTickets(Convert.ToInt32(txtTickets.Text)); newEvent.setVenueID(eventVenue.getID()); //Check the venues capacity if (newEvent.isVenueBigEnough()) { //Access the Type ID through it's description Type eventType = new Type(); eventType.setName(cboTypes.Text); eventType.setTypeDetails(); //Correct the format of the time string time; int hour = Convert.ToInt32(txtHour.Text); int mins = Convert.ToInt32(txtMin.Text); if ((hour > 0 && hour < 13) && (mins >= 0 && mins < 60)) { //If pm add 12 hours to make 24 hr format if (cboAmPm.Text.Equals("pm") && hour < 12) { hour += 12; } time = hour + ":" + txtMin.Text; //get the new event details newEvent.setID(Convert.ToInt32(txtEventID.Text)); newEvent.setTitle(txtTitle.Text); newEvent.setDesc(txtDescription.Text); newEvent.setType(eventType.getID()); newEvent.setDate(txtDate.Text); newEvent.setTime(time); newEvent.setTickets(Convert.ToInt32(txtTickets.Text)); newEvent.setPrice(Convert.ToDouble(txtPrice.Text)); //Ask user to confirm DialogResult confirmation = MessageBox.Show("The new Event details you have entered are: \n" + newEvent.toString() + "\n\nWould you like to add this event?,", "Confirmation", MessageBoxButtons.YesNo, MessageBoxIcon.Information); if (confirmation == DialogResult.Yes) { //Add the new event to the events file newEvent.addEvent(); MessageBox.Show("Event has been added - Customers can now purchase Tickets", "New Event!", MessageBoxButtons.OK, MessageBoxIcon.Information); //Reset UI txtTitle.Clear(); txtDescription.Clear(); cboVenueName.SelectedIndex = -1; cboTypes.SelectedIndex = -1; txtTickets.Clear(); txtPrice.Clear(); txtHour.Clear(); txtMin.Clear(); cboVenueName.Focus(); txtDate.Value = DateTime.Now; txtEventID.Text = Convert.ToString(Event.getNextID()); pnlEvDetails.Visible = false; } } else { MessageBox.Show("Please Enter a valid time", "Invalid Time!", MessageBoxButtons.OK, MessageBoxIcon.Information); txtHour.Focus(); } } else { MessageBox.Show("For Health & Safety reasons you may NOT sell more tickets than the capacity of your Venue!", "Error!", MessageBoxButtons.OK, MessageBoxIcon.Error); txtTickets.Clear(); txtTickets.Focus(); } } else { MessageBox.Show("Information Missing", "Error!", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
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; } }