private void checkLastLoginBtn_MouseLeftButtonUp(object sender, MouseButtonEventArgs e) { //show new screen with Last login Datetime as a line userMainScreen.Visibility = Visibility.Hidden; userMainScreenShadow.Visibility = Visibility.Hidden; actionPanelLabel.Content = "Last Login"; LastLoginScreen.Visibility = Visibility.Visible; LastLoginScreenShadow.Visibility = Visibility.Visible; btnBack.Visibility = Visibility.Visible; UserDAFactory me = new UserDAFactory(); lastLogin.Content = DateTime.Now; //lastLogin.Content = me.findMe(myName, myPassword); }
private void viewEventsBtn_MouseLeftButtonUp(object sender, MouseButtonEventArgs e) { //show available events in a list form, when clicked on an event show its details and a button to register //also display its cost userMainScreen.Visibility = Visibility.Hidden; userMainScreenShadow.Visibility = Visibility.Hidden; actionPanelLabel.Content = "View Events"; viewEventsScreen.Visibility = Visibility.Visible; viewEventsScreenShadow.Visibility = Visibility.Visible; btnBack.Visibility = Visibility.Visible; //update dataGrid, only display names and event duration UserDAFactory user = new UserDAFactory(); // dataGrid.ItemsSource = user.viewEvents(); eventList.ItemsSource = user.viewEvents(); }
public void checkOut() { UserDAFactory me = new UserDAFactory(); me.updateLastLogin(me.findMyObj(myName, myPassword)); }
public void checkIn() { UserDAFactory me = new UserDAFactory(); me.updateCurrentLogin(me.findMyObj(myName, myPassword)); }
//fab actions private void fab_MouseLeftButtonUp(object sender, MouseButtonEventArgs e) { if (currentFabTask.Equals(fabTasks.typeSelection)) { if (loginAdminRb.IsChecked == true || loginManagerRb.IsChecked == true || loginUserRb.IsChecked == true) { typeSelectionScreen.Visibility = Visibility.Hidden; typeSelectionScreenShadow.Visibility = Visibility.Hidden; credentialScreen.Visibility = Visibility.Visible; credentialScreenShadow.Visibility = Visibility.Visible; actionPanelLabel.Content = "Enter Credentials"; fnSetFabVisible(Visibility.Hidden); fnSetFabTask(fabTasks.logInCredentials); } } else if (currentFabTask.Equals(fabTasks.logInCredentials)) { if (loginName.Text != "Enter Name") { if (loginPassword.Text != "Enter Password") { fnSetFabVisible(Visibility.Visible); logInValidation(); } } } else if (currentFabTask.Equals(fabTasks.signUp)) { table_User user = new table_User(); user.user_name = name.Text; user.user_phone = long.Parse(cell.Text); user.user_email = email.Text; user.user_password = hiddenPassword; user.user_current_login = user.user_last_login = DateTime.Now; user.user_current_login = DateTime.Now; //user.f_event_id = null; UserDAFactory userFac = new UserDAFactory(); if (userFac.signUp(user)) { MessageBox.Show("Saved"); signUpScreen.Visibility = Visibility.Hidden; signUpScreenShadow.Visibility = Visibility.Hidden; name.Text = "Enter Name"; cell.Text = "Enter Cell"; password.Text = "Enter Password"; email.Text = "Enter Email"; welcomeScreen.Visibility = Visibility.Visible; welcomeScreenShadow.Visibility = Visibility.Visible; actionPanelLabel.Content = "Welcome"; btnMainBack.Visibility = Visibility.Hidden; fnSetFabVisible(Visibility.Hidden); } else { MessageBox.Show("Not Saved"); } fnSetFabTask(fabTasks.signUp); } }
private void logInValidation() { //check login if ((bool)loginAdminRb.IsChecked) { AdminDAFactory adminFac = new AdminDAFactory(); if (loginPassword.Text != "Enter Password" && loginPassword.Text != "Password Hidden") { hiddenPassword = loginPassword.Text; } if (adminFac.logIn(loginName.Text, hiddenPassword)) { Window loggedIn = new Admin(); loggedIn.WindowStartupLocation = WindowStartupLocation.CenterScreen; loggedIn.SourceInitialized += (s, a) => loggedIn.WindowState = WindowState.Normal; Admin.WhoAmI(loginName.Text, loginPassword.Text); loggedIn.Show(); this.Hide(); } else { MessageBox.Show("Admin does not exist with this name or password"); fnSetFabTask(fabTasks.logInCredentials); } } else if ((bool)loginManagerRb.IsChecked) { ManagerDAFactory managerFac = new ManagerDAFactory(); if (loginPassword.Text != "Enter Password" && loginPassword.Text != "Password Hidden") { hiddenPassword = loginPassword.Text; } if (managerFac.logIn(loginName.Text, hiddenPassword)) { Window loggedIn = new Manager(); loggedIn.WindowStartupLocation = WindowStartupLocation.CenterScreen; loggedIn.SourceInitialized += (s, a) => loggedIn.WindowState = WindowState.Normal; loggedIn.Show(); Manager.WhoAmI(loginName.Text, loginPassword.Text); this.Hide(); } else { MessageBox.Show("Manager does not exist with this name or password"); fnSetFabTask(fabTasks.logInCredentials); } } else if ((bool)loginUserRb.IsChecked) { UserDAFactory userFac = new UserDAFactory(); if (loginPassword.Text != "Enter Password" && loginPassword.Text != "Password Hidden") { hiddenPassword = loginPassword.Text; } if (userFac.logIn(loginName.Text, hiddenPassword)) { Window loggedIn = new User(); loggedIn.WindowStartupLocation = WindowStartupLocation.CenterScreen; loggedIn.SourceInitialized += (s, a) => loggedIn.WindowState = WindowState.Normal; loggedIn.Show(); User.WhoAmI(userFac.findMe(loginName.Text, loginPassword.Text)); this.Hide(); } else { MessageBox.Show("User does not exist with this name or password"); fnSetFabTask(fabTasks.logInCredentials); } } }