private void login_Click(object sender, RoutedEventArgs e) { var res = rollingMachinesContext.GetUser(nikName.Text, password.Text); if (res.Count == 1) { BasicWindow basicWindow = new BasicWindow(res[0]); basicWindow.Show(); this.Close(); } else if (res.Count == 0) { error.Text = "Error in NikName or Password"; } else { MessageBox.Show("Error data"); } }
private void registration_Click(object sender, RoutedEventArgs e) { if (password1.Text != password2.Text) { error.Text = "Error Password not the Same"; } else { if ((String.IsNullOrEmpty(nikname.Text) || String.IsNullOrEmpty(firstname.Text) || String.IsNullOrEmpty(surname.Text) || String.IsNullOrEmpty(phone.Text) || String.IsNullOrEmpty(password1.Text))) { error.Text = "Error in empty cells cannot be"; } else { var help = rollingMachinesContext.GetUsers(nikname.Text); if (help.Count == 0) { User user = new User(); user.NikName = nikname.Text; user.FirstName = firstname.Text; user.SurName = surname.Text; user.Phone = phone.Text; user.Password = password1.Text; rollingMachinesContext.AddUser(user); BasicWindow basicWindow = new BasicWindow(user); basicWindow.Show(); this.Close(); } else { error.Text = "THIS NIKNAME NOT GOOD"; } } } }