private void Button_Click(object sender, RoutedEventArgs e) { if (TxtBoxRestaurante_Email.Text == "" || PswBoxRestaurante.Password.ToString().Equals("") || PswBoxConfirmRestaurante.Password.ToString().Equals("")) { MessageBox.Show("Please fill in all fields"); } else { if (emailIsValid(TxtBoxRestaurante_Email.Text) == 1) { MessageBox.Show("Please insert a valid email"); } else if (emailIsValid(TxtBoxRestaurante_Email.Text) == 2) { MessageBox.Show("That email is already taken, please insert another one"); } else if (passIsValid(PswBoxRestaurante.Password.ToString()) == 1) { MessageBox.Show("Please insert a password between 6 and 16 characters"); } else if (passIsValid(PswBoxRestaurante.Password.ToString()) == 2) { MessageBox.Show("Please insert at least one letter and one digit"); } else if (!PswBoxRestaurante.Password.Equals(PswBoxConfirmRestaurante.Password)) { MessageBox.Show("Passwords inserted dont match"); } else { restauranteFinal.emailRestaurante = TxtBoxRestaurante_Email.Text; restauranteFinal.passwordRestaurante = PswBoxRestaurante.Password.ToString(); CreateClasses.ListaRestaurantes.Add(restauranteFinal); HelloRestaurant helloRestaurant = new HelloRestaurant(restauranteFinal); this.NavigationService.Navigate(helloRestaurant); } } }
private void ButtonBack_Click(object sender, RoutedEventArgs e) { HelloRestaurant helloRestaurant = new HelloRestaurant(restaurante); this.NavigationService.Navigate(helloRestaurant); }
private void Button_Click_1(object sender, RoutedEventArgs e) { Boolean existeCaridade = false; Boolean existeRestaurante = false; UserCaridade caridade = new UserCaridade(); UserRestaurante restaurante = new UserRestaurante(); if (txtBox_EmailLogIn.Text == "" || txtBox_PswLogIn.Password.ToString().Equals("")) { MessageBox.Show("Please fill in all fields"); } else { foreach (UserCaridade c in CreateClasses.ListaCaridades) { if (c.emailCaridade == txtBox_EmailLogIn.Text) { existeCaridade = true; caridade = c; } } foreach (UserRestaurante r in CreateClasses.ListaRestaurantes) { if (r.emailRestaurante == txtBox_EmailLogIn.Text) { existeRestaurante = true; restaurante = r; } } if (existeCaridade) { if (!caridade.passwordCaridade.Equals(txtBox_PswLogIn.Password)) { MessageBox.Show("The password provided is incorrect"); } else { HelloCharity helloCharity = new HelloCharity(caridade); this.NavigationService.Navigate(helloCharity); } } else if (existeRestaurante) { if (!restaurante.passwordRestaurante.Equals(txtBox_PswLogIn.Password)) { MessageBox.Show("The password provided is incorrect"); } else { HelloRestaurant helloRestaurant = new HelloRestaurant(restaurante); this.NavigationService.Navigate(helloRestaurant); } } else { MessageBox.Show("Unknown username"); } } }