Ejemplo n.º 1
0
        private void Enter_Click(object sender, RoutedEventArgs e)
        {
            if (alias.Text == "" || pass.Text == "")
            {
                MessageBox.Show("Fill in manditory fields");
            }

            else
            {
                var context       = new UserRegistrationDBEntities();
                var typedUsername = alias.Text.Trim();
                var typedPassword = pass.Text.Trim();
                var user          = context.tableUsers.FirstOrDefault(x => x.Username == typedUsername);

                SetPrincipleUser(user);
                if (user != null)
                {
                    if (typedPassword != user.Password)
                    {
                        MessageBox.Show("Incorrect Password");
                    }
                    else
                    {
                        SharedFunctions.GoHomeOnly(this);
                    }
                }
                else
                {
                    MessageBox.Show("Access Denied, incorrect credentials");
                }
            }
        }
Ejemplo n.º 2
0
 private void navLog_Click(object sender, RoutedEventArgs e)
 {
     //This would appear as sign out
     logged = Login.GetPrincipalUser();
     if (logged != null)
     {
         LogOut();
         SharedFunctions.GoHomeOnly(this);
     }
     else //this appears as signin
     {
         Login log = new Login();
         this.Hide();
         log.Show();
     }
 }
Ejemplo n.º 3
0
        public void AddValidateDetails()
        {
            var databaseContext = new UserRegistrationDBEntities();
            var user            = new tableUser()
            {
                FirstName = first.Text.Trim(),
                LastName  = last.Text.Trim(),
                Contact   = number.Text.Trim(),
                Address   = location.Text.Trim(),
                Username  = alias.Text.Trim(),
                Password  = pass.Text.Trim(),
                Email     = mail.Text.Trim()
            };

            databaseContext.tableUsers.Add(user);
            databaseContext.SaveChanges();
            MessageBox.Show("Registered successfully");
            registered = true;
            Login.SetPrincipleUser(user);
            SharedFunctions.Clear(this);
            SharedFunctions.GoHomeOnly(this);
        }
 private void homeFromReg_Click(object sender, RoutedEventArgs e)
 {
     SharedFunctions.GoHomeOnly(this);
 }
Ejemplo n.º 5
0
 private void welcomeIcon_Click(object sender, System.Windows.RoutedEventArgs e)
 {
     SharedFunctions.GoHomeOnly(this);
 }
Ejemplo n.º 6
0
 private void Cancel_Click(object sender, RoutedEventArgs e)
 {
     SharedFunctions.GoHomeOnly(this);
 }
Ejemplo n.º 7
0
 private void GoFromLog_Click(object sender, RoutedEventArgs e)
 {
     //Go home without attempting to login
     SharedFunctions.GoHomeOnly(this);
 }
Ejemplo n.º 8
0
 private void Welcome_Click(object sender, RoutedEventArgs e)
 {
     //Go home but stay logged in
     SharedFunctions.GoHomeOnly(this);
 }
Ejemplo n.º 9
0
 private void homeFromReg_Click(object sender, RoutedEventArgs e)
 {
     ChangeSearchStatus(false);
     SharedFunctions.GoHomeOnly(this);
 }