Ejemplo n.º 1
0
        private void btnSubmit_Click(object sender, EventArgs e)
        {
            // show new style of view when submit is clicked
            textBoxId.Focus();
            btnShowCustomers.Show();
            lblMessage.Show();
            int id;

            if (int.TryParse(textBoxId.Text, out id))
            {
                string customer = currentCoord.getCustomerInfoById(id);
                if (currentCoord.customerExists(id))
                {
                    labelBookings.Text = "Bookings";
                    string[] customerFields = customer.Split(';');
                    labelNumberInfo.Text   = customerFields[0];
                    labelNameInfo.Text     = customerFields[1];
                    labelPhoneInfo.Text    = customerFields[2];
                    labelBookingsInfo.Text = customerFields[3];
                    lblMessage.Hide();
                }
                else
                {
                    clearCustomers();
                    labelBookings.Text = "";
                    lblMessage.Text    = customer;
                }
            }
            else
            {
                clearCustomers();
                lblMessage.Text = "Invalid input for ID search";
            }
            textBoxId.Text = "";
        }
        private void btnSubmit_Click(object sender, EventArgs e)
        {
            btnShowCustomers.Show();
            lblMessage.Show();
            clearCustomers();
            int id;

            if (int.TryParse(textBoxId.Text, out id))
            {
                if (currentCoord.customerExists(id))
                {
                    // change to customer view for deletion confirmation
                    string customer = currentCoord.getCustomerInfoById(id);
                    labelBookings.Text = "Bookings";
                    string[] customerFields = customer.Split(';');
                    labelNumberInfo.Text   = customerFields[0];
                    labelNameInfo.Text     = customerFields[1];
                    labelPhoneInfo.Text    = customerFields[2];
                    labelBookingsInfo.Text = customerFields[3];
                    lblMessage.Text        = "Are you sure you want to delete customer with ID " + id + "?";
                    btnConfirm.Show();
                    btnDeny.Show();
                    textBoxId.Hide();
                    labelCusId.Hide();
                    btnSubmit.Hide();
                }
                else
                {
                    lblMessage.Text = "Customer with ID " + id + " was not found..";
                }
            }
            else
            {
                lblMessage.Text = "Invalid input for ID search";
            }
        }