Beispiel #1
0
 private void prevPageBtn_Click(object sender, RoutedEventArgs e)
 {
     if (SQLiteDataAccess.LoadUsers().Count() != 0)
     {
         MenuWindow menuWindow = new MenuWindow();
         menuWindow.Show();
         this.Close();
     }
 }
Beispiel #2
0
        /*
         * Upon application startup, the Login window is intialized.
         * If there are no stored users in db, start add user form to add inital user.
         */
        public Login()
        {
            InitializeComponent();
            if (SQLiteDataAccess.LoadUsers().Count() == 0)
            {
                MessageBox.Show("Welcome new user!");

                AddUser addUser = new AddUser();
                addUser.Show();
                this.Close();
            }
        }
Beispiel #3
0
        /// <summary>
        /// Returns the index of an EasyPayUser based on username
        /// </summary>
        /// <param name="enteredUser">String username</param>
        /// <returns>int index of location on LoadUsers, otherwise -1 if nonexistent() list</returns>
        public static int indexOfUser(String enteredUser)
        {
            List <EasyPayUser> userList = SQLiteDataAccess.LoadUsers();

            foreach (EasyPayUser user in userList)
            {
                if (user.User_Name == enteredUser)
                {
                    return(userList.IndexOf(user));
                }
            }
            return(-1);
        }
Beispiel #4
0
        /// <summary>
        /// Checks for a match between password entered and pasword saved in database for a given user based on index of
        /// the EasyPayUser in the List returned.
        /// </summary>
        /// <param name="index">int index of EasyPayUser location in List</param>
        /// <param name="pw">String password entered in login screen</param>
        /// <returns>True if password mathches pw at given index</returns>
        public static Boolean validPassword(int index, String pw)
        {
            List <EasyPayUser> userList    = SQLiteDataAccess.LoadUsers();
            EasyPayUser        currentUser = userList.ElementAt(index);

            if (Encode_Decode.Decrypt(currentUser.Password) == pw)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }