private void btnCosts_Click(object sender, RoutedEventArgs e) { UserCostsWindow UserCostsWindow = new UserCostsWindow(); UserCostsWindow.Show(); this.Hide(); }
private void Back_to_Costs(object sender, RoutedEventArgs e) { UserCostsWindow userCostsWindow = new UserCostsWindow(); userCostsWindow.Show(); Hide(); }
private void Button_Auth_Click(object sender, RoutedEventArgs e) { string login = textBoxLogin.Text.Trim(); string pass = passBox.Password.Trim(); if (login.Length < 5) { textBoxLogin.ToolTip = "Это поле заполнено некоректно"; textBoxLogin.BorderBrush = Brushes.DarkRed; } else if (pass.Length < 5) { passBox.ToolTip = "Это поле заполнено некоректно"; passBox.BorderBrush = Brushes.DarkRed; } else { textBoxLogin.ToolTip = null; textBoxLogin.Background = Brushes.Transparent; passBox.ToolTip = null; passBox.Background = Brushes.Transparent; User authUser = null; using (ApplicationContext db = new ApplicationContext()) { authUser = db.Users.Where(b => b.Login == login && b.Pass == pass).FirstOrDefault(); } if (authUser != null) { MessageBox.Show("Авторизация прошла успешно!"); UserCostsWindow userPageWindow = new UserCostsWindow(); userPageWindow.Show(); Hide(); } else { MessageBox.Show("Некоректный логин или пароль!"); } } }