Exemplo n.º 1
0
        private void tbEmailTicket_TextChanged(object sender, TextChangedEventArgs e)
        {
            string email    = tbEmailTicket.Text;
            int    ticketId = connection.GetTicketIdFromEmail(email);

            if (connection.IsRegistered(email))
            {
                if (connection.GetTicketIdFromEmail(email) != 0)
                {
                    lbRegisterStatus.Background  = Brushes.Red;
                    lbRegisterStatus.Content     = "Visitor has ticket";
                    ticketToggleSwitch.IsChecked = false;
                    ticketToggleSwitch.IsEnabled = false;

                    if (connection.IsCamper(ticketId))
                    {
                        campspotToggleSwitch.IsChecked = false;
                        campspotToggleSwitch.IsEnabled = false;
                        lbRegisterStatus.Content      += " and campspot";
                    }
                    else
                    {
                        campspotToggleSwitch.IsChecked = true;
                        campspotToggleSwitch.IsEnabled = true;
                    }
                }
                else
                {
                    lbRegisterStatus.Content     = "Buy ticket";
                    ticketToggleSwitch.IsChecked = true;
                    ticketToggleSwitch.IsEnabled = true;
                }

                if (email == "")
                {
                    lbRegisterStatus.Content = "Enter an email";
                }
            }
            else
            {
                campspotToggleSwitch.IsChecked = false;
                campspotToggleSwitch.IsEnabled = false;
                ticketToggleSwitch.IsChecked   = false;
                ticketToggleSwitch.IsEnabled   = false;
                btnBuyTicket.IsEnabled         = false;
                lbRegisterStatus.Content       = "Register first";
            }
        }