コード例 #1
0
 private void Register_Click(object sender, RoutedEventArgs e)
 {
     Scheme.Market market = new Scheme.Market();
     Scheme.User   user   = new Scheme.User()
     {
         FirstName = firstNameTextBox.Text,
         LastName  = firstNameTextBox.Text,
         Phone     = phoneTextBox.Text,
         Email     = emailTextBox.Text,
         Password  = passwordTextBox.Text,
         Address   = addressTextBox.Text,
         Card      = cardTextBox.Text
     };
     market.Users.Add(user);
     market.SaveChanges();
     Close();
 }
コード例 #2
0
 private void Login_Click(object sender, RoutedEventArgs e)
 {
     Scheme.Market market = new Scheme.Market();
     foreach (Scheme.User user in market.Users)
     {
         if (user.Phone.Equals(usernameTextBox.Text) || user.Email.Equals(usernameTextBox.Text) && user.Password.Equals(passwordTextBox.Text))
         {
             this.user = user;
             break;
         }
     }
     if (user == null)
     {
         MessageBox.Show("Incorrect phone, email or password", "Login failed", MessageBoxButton.OK);
     }
     else
     {
         loginResult = LoginResult.Success;
         Close();
     }
 }