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;
                }
            }
        }
Beispiel #2
0
        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 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;
            }
        }
Beispiel #5
0
        //------------------------------ CHECK IF VENUE IS FREE -------------------------------

        public Boolean isVenueFree()
        {
            Venue newVenue = new Venue();

            newVenue.setID(this.venueID);
            newVenue.setVenueDetails();


            //define sql query
            String strSQL = "SELECT COUNT(E.VENUEID) From Events E Join Venues V ON E.VenueID = V.VenueID" +
                            " WHERE EventDate = '" + this.date + "' AND E.VenueID = " + this.venueID + "AND E.EventID != " + this.id;

            //Declare an Oracle Connection
            OracleConnection conn = new OracleConnection(DBConnect.oradb);

            //Declare an oracle command to execute
            OracleCommand cmd = new OracleCommand(strSQL, conn);

            conn.Open();

            //Declare an oracle DataAdapter
            OracleDataAdapter da = new OracleDataAdapter(cmd);

            Boolean result = false;

            using (OracleDataReader reader = cmd.ExecuteReader())
            {
                while (reader.Read())
                {
                    int nxt = reader.GetInt32(0);

                    if (nxt == 0)
                    {
                        result = true;
                    }
                    else if (nxt >= 1)
                    {
                        result = false;
                    }
                }
            }

            conn.Close();

            return(result);
        }
        private void btnLogin_Click_1(object sender, EventArgs e)
        {
            //Validate Email & password combination
            if (!txtEmail.Text.Equals("") || !txtPassword.Text.Equals(""))
            {
                Customer cust = new Customer();
                cust.setEmail((txtEmail.Text).ToLower());
                cust.setPassword(txtPassword.Text);

                if (cust.isValidLogin())
                {
                    cust.setCustDetails();

                    pnlBook.Visible     = true;
                    txtBal.Text         = Convert.ToString(cust.getBal());
                    txtEmail.Enabled    = false;
                    txtPassword.Enabled = false;
                    grdEvents.Enabled   = false;
                    btnLogin.Visible    = false;

                    Event myEvent = new Event();

                    //gets the selected rows id
                    myEvent.setTitle(grdEvents.Rows[grdEvents.CurrentCell.RowIndex].Cells[0].Value.ToString());
                    myEvent.setEventDetails();

                    Venue venue = new Venue();
                    venue.setID(myEvent.getVenueId());
                    venue.setVenueDetails();

                    lblSelectedEvent.Text = myEvent.getTitle() + " at " + venue.getName();
                }
                else
                {
                    MessageBox.Show("Your Email or Password is incorrect", "Error!", MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
            }
            else
            {
                MessageBox.Show("Please enter a valid Email or Password", "Error!", MessageBoxButtons.OK, MessageBoxIcon.Error);
                txtEmail.Clear();
                txtPassword.Clear();
                txtEmail.Focus();
            }
        }
        private void grdEvents_CellClick(object sender, DataGridViewCellEventArgs e)
        {
            pnlLogin.Visible = true;

            Event myEvent = new Event();

            //gets the selected rows id
            myEvent.setTitle(grdEvents.Rows[grdEvents.CurrentCell.RowIndex].Cells[0].Value.ToString());
            myEvent.setEventDetails();

            Venue venue = new Venue();

            venue.setID(myEvent.getVenueId());
            venue.setVenueDetails();


            lblSelectedEvent.Text = myEvent.getTitle() + " at " + venue.getName();
        }
Beispiel #8
0
        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;
        }
Beispiel #12
0
        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);
            }
        }
Beispiel #13
0
        private void btnUpdateEvent_Click_1(object sender, EventArgs e)
        {
            //validate Data

            if (txtTitle.Text != "" && cboTypes.SelectedIndex != -1 && txtDate.Text != "" &&
                txtHour.Text != "" && txtMin.Text != "" && txtTickets.Text != "" && txtPrice.Text != "")
            {
                //if there are other events on same date with same venueID
                //Error- Clashing Events
                Event newEvent = new Event();
                newEvent.setTitle(cboEventTitles.Text);
                newEvent.setEventDetails();

                Venue eventVenue = new Venue();
                eventVenue.setID(newEvent.getVenueId());
                eventVenue.setVenueDetails();

                newEvent.setTickets(Convert.ToInt32(txtTickets.Text));

                //Tickets Available cannot be more than Capacity
                //Error - Capacity Exceeded
                if (newEvent.isVenueBigEnough())
                {
                    Type eventType = new Type();
                    eventType.setName(cboTypes.Text);
                    eventType.setTypeDetails();

                    newEvent.setType(eventType.getID());
                    newEvent.setDate(txtDate.Text);

                    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;

                        newEvent.setTime(time);
                        newEvent.setPrice(Convert.ToDouble(txtPrice.Text));


                        //check if event is on the same date in the same venue
                        if (newEvent.isVenueFree())
                        {
                            newEvent.setTitle(txtTitle.Text);
                            newEvent.setDesc(txtDescription.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 update the event?,",
                                                                        "Confirmation", MessageBoxButtons.YesNo, MessageBoxIcon.Information);

                            if (confirmation == DialogResult.Yes)
                            {
                                //if yes System save data to Events File
                                newEvent.updateEvent();

                                //Email Customers with Updates

                                MessageBox.Show("Event has been updated - Customers with existing tickets will be contacted and updated", "New Event!", MessageBoxButtons.OK, MessageBoxIcon.Information);

                                //Reset UI
                                cboEventTitles.SelectedIndex = -1;
                                pnlUpdateEvent.Visible       = false;
                                txtTitle.Clear();
                                txtDescription.Clear();
                                cboTypes.SelectedIndex = -1;
                                txtDate.Refresh();
                                txtHour.Clear();
                                txtMin.Clear();
                                txtTickets.Clear();
                                txtPrice.Clear();
                            }
                        }
                        else
                        {
                            MessageBox.Show("Your Venue already has an event scheduled for " + newEvent.getDate(), "Existing Event!", MessageBoxButtons.OK, MessageBoxIcon.Information);
                            txtDate.Focus();
                        }
                    }
                    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);
                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;
            }
        }