void TryLogin() { string username = usernameTxt.Text; //string hash of plaintext password string password = UserAccount.stringToHashString(passwordBox.Password); var user = UICreatePage.GetUserFromUsernamePassword(username, password); if (user == null) { this.errorBlock.Text = "That username or password is invalid"; DefaultInputFields(); } else { //stores this current user //store ui window, with user menu page LoginService.getFirstInstance(user); UIWindow ui = LoginService.Instance.currentUIWindow; ui.Show(); //close all windows this.Close(); if (CreateNewAccountService.Instance != null) { CreateNewAccountService.Instance.Window.Close(); } } }
private void SignupBtn_Click(object sender, RoutedEventArgs e) { string username = UsernameTxt.Text; string password = passwordBox.Password; string confirmPassword = ConfirmPasswordBox.Password; var naV = new NewAccountValidation(username, password, confirmPassword); //validation passed if (naV.isNewAccountValid) { //stores username and hashed password CreateNewAccountService.Instance.username = username; CreateNewAccountService.Instance.password = UserAccount.stringToHashString(password); //show next window var ui = UICreatePage.GetAdminDetailsPage(); CreateNewAccountService.Instance.Window.Content = ui; } else { ErrorTxt.Text = naV.ErrorMessage; } /* * string errorMessage = ValidateInputs(username, password, confirmPassword); * * //Take action depending on validation from above * IsInputValid(errorMessage, username, password);*/ }
public static UIWindow GetUIWindow(dynamic user) { UIWindow pageHolder = new UIWindow(); var menuPage = UICreatePage.GetUserMenu(user); pageHolder.pageHolder.Content = menuPage; return(pageHolder); }
private void loginBtn_Click(object sender, RoutedEventArgs e) { //Get inputted details string username = usernameTxt.Text; string password = UserAccount.stringToHashString(passwordBox.Password); var aV = new AdminValidation(username, password); if (aV.isAccountAdmin) { //Allow admin to pick access levels var ui = UICreatePage.CreateNewSetAccessPage(); CreateNewAccountService.Instance.Window.Content = ui; } else { errorBlock.Text = aV.ErrorMessage; } /* * //Validate if details match existing admin account * using(var dbContext = new InventoryContext()) * { * AdminAccount admin = AdminAccountValidation.ValidateAdminAccount(username, password, dbContext); * * //Validation failed * if( admin == null) * { * errorBlock.Text = "Enter valid admin account details"; * * } * else * { * //Allow admin to pick access levels * var ui = UICreatePage.CreateNewSetAccessPage(); * CreateNewAccountService.Instance.Window.Content = ui; * } * }*/ }
private void MainMenuBtn_Click(object sender, RoutedEventArgs e) { LoginService.Instance.currentUIWindow.pageHolder.Content = UICreatePage.GetUserMenu(LoginService.Instance.currentUser); }
private CreateNewAccountService(CreateNewAccountWindow _Window) { Window = UICreatePage.GetNewAccountWindow(); }
private void lowStockBtn_Click(object sender, RoutedEventArgs e) { var ui = UICreatePage.GetNewLowStockPage(); LoginService.Instance.currentUIWindow.pageHolder.Content = ui; }
private void viewPastDelBtn_Click(object sender, RoutedEventArgs e) { var ui = UICreatePage.GetNewPastDeliveriesPage(); LoginService.Instance.currentUIWindow.pageHolder.Content = ui; }
private void analyticsBtn_Click(object sender, RoutedEventArgs e) { var ui = UICreatePage.GetAnalyticsPage(); LoginService.Instance.currentUIWindow.pageHolder.Content = ui; }
private void tillModeBtn_Click(object sender, RoutedEventArgs e) { TillModePage tillModePage = UICreatePage.GetTillModePage(); LoginService.Instance.currentUIWindow.pageHolder.Content = tillModePage; }
private void viewTransactionsBtn_Click(object sender, RoutedEventArgs e) { ViewTransactionsPage viewTransactions = UICreatePage.GetViewTransactionsPage(); LoginService.Instance.currentUIWindow.pageHolder.Content = viewTransactions; }
//Displaying pages on currently open UIWindow private void viewTblsBtn_Click(object sender, RoutedEventArgs e) { var viewTblsPage = UICreatePage.GetViewTblPage(); LoginService.Instance.currentUIWindow.pageHolder.Content = viewTblsPage; }
private LoginService(dynamic _currentUser) { this.currentUser = _currentUser; this.currentUIWindow = UICreatePage.GetUIWindow(this.currentUser); }