private void ExitButton_Click(object sender, RoutedEventArgs e) { //REMEMBER: this is just for demonstration purposes. NavigationService.Navigate(DBInteraction.DisplayOrderedSeats(DateTime.Now, new DBInteraction.Cinema { Name = "test" })); //Environment.Exit(0); }
private void LoginButton_Click(object sender, RoutedEventArgs e) { string username = LoginTextBox.Text; string password = PasswordBox.Password; //WIP: anti-injection input tests string userRole = ""; try { userRole = DBInteraction.LoginCheck(username, password); } catch (Exception ex) { if (ex.Message == Properties.Resources.UserNotFoundQueryResponse) { MessageBox.Show($"Пользователь не найден. Проверьте логин и пароль.", "Ошибка"); Properties.Settings.Default.LoginTries += 1; if (Properties.Settings.Default.LoginTries >= Properties.Settings.Default.LoginBlockLimit) { Thread t = new Thread(new ThreadStart(BlockInputs)); t.Start(); return; } return; } else { MessageBox.Show($"Произошла ошибка при попытке входа в систему: {ex.Message}. Обратитесь к администратору и попробуйте позже.", "Ошибка"); return; } } userRole = userRole.ToLower(); switch (userRole) { case "client": ClientInterface clientInterface = new ClientInterface(); NavigationService.Navigate(clientInterface); break; case "manager": ManagerInterface managerInterface = new ManagerInterface(); NavigationService.Navigate(managerInterface); break; case "admin": AdminInterface adminInterface = new AdminInterface(); NavigationService.Navigate(adminInterface); break; default: MessageBox.Show("Произошла ошибка при попытке входа в систему: Ваша роль неизвестна системе.", "Ошибка"); break; } }