private void btnCusSubmit_Click(object sender, EventArgs e)
        {
            int cusId, eventId;

            lblCusMessage.Text   = "";
            lblEventMessage.Text = "";

            // will only work when both customer and event id are integers
            if (int.TryParse(textBoxCusId.Text, out cusId) && int.TryParse(textBoxEventId.Text, out eventId))
            {
                if (!currentCoord.customerExists(cusId))
                {
                    lblCusMessage.Text = "No customer with the ID " + cusId;
                }
                if (!currentCoord.eventExists(eventId))
                {
                    lblEventMessage.Text = "No event with the ID " + eventId;
                }
                // will only work if both customer and event exist, and if the event is not full or customer has not already registered
                if (currentCoord.customerExists(cusId) && currentCoord.eventExists(eventId) && !currentCoord.eventIsFull(eventId) && !currentCoord.customerRegisteredForEvent(eventId, cusId))
                {
                    Event    ev   = currentCoord.getEvent(eventId);
                    Customer cust = currentCoord.getCustomer(cusId);
                    currentCoord.addRegistration(ev, cust);
                    ev.addAttendee(cust);
                    cust.addBooking();
                    lblMessage.ForeColor = System.Drawing.Color.Black;
                    lblCusMessage.Text   = "RSVP Successfully added";
                    textBoxCusId.Text    = "";
                    textBoxEventId.Text  = "";
                }
                else if (currentCoord.customerExists(cusId) && currentCoord.eventExists(eventId))
                {
                    lblCusMessage.Text  = "RSVP was not added";
                    textBoxCusId.Text   = "";
                    textBoxEventId.Text = "";
                }
            }
            else
            {
                lblCusMessage.Text = "Please enter valid IDs in the fields";
            }
        }
Exemplo n.º 2
0
        private void btnSubmit_Click(object sender, EventArgs e)
        {
            // new style of view for events if submit is clicked
            btnShowEvents.Show();
            textBoxId.Focus();
            btnShowEvents.Text = "Show All Events";
            lblMessage.Show();
            int id;

            if (int.TryParse(textBoxId.Text, out id))
            {
                string events = currentCoord.getEventInfoById(id);
                if (currentCoord.eventExists(id))
                {
                    // will show new headers for event to display in depth details
                    labelEventTitle.Text   = "ID: " + id;
                    labelFirstColumn.Text  = "Event Name";
                    labelSecondColumn.Text = "Venue Name";
                    labelThirdColumn.Text  = "Date and Time";
                    string[] eventFields = events.Split(';');
                    labelRegistered.Show();
                    labelAvailable.Show();
                    textBoxId.Hide();
                    btnSubmit.Hide();
                    btnAttendingCus.Show();
                    lblMessage.Hide();
                    labelFirstColumnInfo.Text  = eventFields[1];
                    labelSecondColumnInfo.Text = eventFields[2];
                    labelThirdColumnInfo.Text  = eventFields[3];
                    labelRegisteredInfo.Text   = eventFields[4];
                    labelAvailablesInfo.Text   = eventFields[5];
                }
                else
                {
                    clearEvents();
                    lblMessage.Text = events;
                }
            }
            else
            {
                clearEvents();
                lblMessage.Text = "Invalid input for ID search";
            }
        }
Exemplo n.º 3
0
        private void btnSubmit_Click(object sender, EventArgs e)
        {
            btnShowEvents.Show();
            lblMessage.Show();
            clearEvents();
            int id;

            if (int.TryParse(textBoxId.Text, out id))
            {
                if (currentCoord.eventExists(id))
                {
                    // change to event view for deletion confirmation
                    string events = currentCoord.getEventInfoById(id);
                    labelBookings.Text = "Bookings";
                    labelDateTime.Text = "Date/Time";
                    string[] eventFields = events.Split(';');
                    labelNumberInfo.Text   = eventFields[0];
                    labelEventInfo.Text    = eventFields[1];
                    labelVenueInfo.Text    = eventFields[2];
                    labelDateTimeInfo.Text = eventFields[3];
                    labelBookingsInfo.Text = eventFields[4];
                    lblMessage.Text        = "Are you sure you want to delete the event with ID " + id + "?";
                    btnConfirm.Show();
                    btnDeny.Show();
                    textBoxId.Hide();
                    labelEventId.Hide();
                    btnSubmit.Hide();
                }
                else
                {
                    lblMessage.Text = "Event with ID " + id + " was not found..";
                }
            }
            else
            {
                lblMessage.Text = "Invalid input for ID search";
            }
        }