Ejemplo n.º 1
0
        private void btnSave_Click(object sender, RoutedEventArgs e)
        {
            usermodel = new UserViewModel();
            string name = txtName.Text;
            string surname = txtSurname.Text;
            int age = Convert.ToInt32(txtAge.Text);
            string idNumber = txtId.Text;
            string homeLanguage = txtHomeLan.Text;
            string contactNum = txtNum.Text;
            string  emailAddress = txtEmail.Text;
            string  username = txtUsernames.Text;
            string password = txtPassword.Text;

            try
            {
                usermodel.addUser(name,surname,age,idNumber,homeLanguage,contactNum,emailAddress,username,password);
            }
            catch(Exception exc)
            {
                MessageBox(exc.Message);
            }


            MessageBox("You are successful registered");

            
        }
 private void btnSubmit_Click(object sender, RoutedEventArgs e)
 {
     string username = txtUserName.Text;
     user = new UserViewModel();
     User userObject = user.getPassowrd(username);
     if (userObject != null)
     {
         lblPassword.Text = "Your Password Is " + userObject.PASSWORD;
         messageBox("Success!!! "+userObject.PASSWORD+" Will always be returned as long as you remember your username");
         txtUserName.Text = "";
     }else{
         messageBox("Sorry!!!Password for "+username+" cannot be found");
     }
    
 }
Ejemplo n.º 3
0
        private void Button_Click(object sender, RoutedEventArgs e)
        {
            string username = txtUsername.Text;

            string password = txtPassword.Password;
            user = new UserViewModel();
            var valid = user.getUser(username, password);
            if (valid != null)
            {
                this.Frame.Navigate(typeof(WelcomePage));
            }
            else
            {
                messageBox("Invalid Credentials Entered");
            }
        }
Ejemplo n.º 4
0
        public ObservableCollection<UserViewModel> GetUsers()
        {
            users = new ObservableCollection<UserViewModel>();

            using (var db = new SQLite.SQLiteConnection(app.dbPath))
            {
                var query = db.Table<User>();
                foreach (var _users in query)
                {
                    var user = new UserViewModel()
                    {
                       
                    };
                    users.Add(user);
                }
            }
            return users;
        }
Ejemplo n.º 5
0
        public ObservableCollection<UserViewModel> GetUsers()
        {
            users = new ObservableCollection<UserViewModel>();

            using (var db = new SQLite.SQLiteConnection(app.DBPath))
            {
                var query = db.Table<User>();
                foreach (var _users in query)
                {
                    var user = new UserViewModel()
                    {
                        USERNAME = _users.USER_EMAIL,
                        PASSWORD = _users.PASSWORD
                    };
                    users.Add(user);
                }
            }
            return users;
        }
Ejemplo n.º 6
0
        private void btnSubmit_Click(object sender, RoutedEventArgs e)
        {
            try { 
                string username = txtUserName.Text;
                user = new UserViewModel();
                if (user.verify(username) != null)
                {
                    user.removeUser(username);
                    messageBox("User has been removed");
                    this.Frame.Navigate(typeof(MainPage));
                }
                else {
                    messageBox("Error!!! ");
                }
            }
            catch
            {

                messageBox("Error!!! cannot find user");
            }
            txtUserName.Text = "";
        }
Ejemplo n.º 7
0
 private  void btnLogin_Click(object sender, RoutedEventArgs e)
 {
     string username = txtUsername2.Text;
     string pass = txtPassword2.Text;
     usermodel = new UserViewModel();
     user = usermodel.getUser(username,pass);
     try
     {
         if (user != null)
         {
             this.Frame.Navigate(typeof(Choice));
         }
         else { 
             MessageBox("Error, Invalid Login");
         }       
       
     }
     catch(Exception ex)
     {
         MessageBox(ex.Message+" or Error, Invalid Login");
     }
 }
Ejemplo n.º 8
0
 private void btnRegister_Click(object sender, RoutedEventArgs e)
 {
     user = new UserViewModel();
     string username = txtUserName.Text;
     
     string password = txtPassword.Text;
     string confirm = txtConfirm.Text;
     if (!username.Equals("") && !password.Equals(""))
     {
         if (password.Equals(confirm))
         {
             user.addUser(username, password);
             messageBox("account has been created");
         }
         else
         {
             messageBox("Passwords do not match");
         }
         txtPassword.Text = "";
         txtConfirm.Text = "";
     }
     else { messageBox("Sorry!!!!These fields cannot be left blank"); }
 }
Ejemplo n.º 9
0
        private void Commandhandler(IUICommand cmd)
        {
            HistoryViewModel myHistory = null;
            var lable = cmd.Label;
            myHistory = new HistoryViewModel();
            switch (lable)
            {
                case "Yes":

                     try 
                     { 
                        string username = txtUserName.Text;
                        user = new UserViewModel();
                        if (user.verify(username) != null)
                        {
                            user.removeUser(username);

                            this.Frame.Navigate(typeof(MainPage1));
                        }
                       else if(user.verify(username) == null)
                        { 
                            lblDeleted.Text = "Username not found";
                        }
        
                }
                catch
                {

                    //messageBox("Error!!! cannot find user");
                }
                txtUserName.Text = "";
                    break;
                case "No":
                    break;

            }
        }