Пример #1
0
 public int LogIn(string username, string password)
 {
     for (int x = 0; x < UserList.Count; x++)
     {
         if (username == UserList[x].Username.ToString() && password == UserList[x].Password.ToString())
         {
             SelectedUser = UserList[x];
             return(1);
         }
     }
     return(0);
 }
Пример #2
0
        public void AddUser()
        {
            var window = new Windows.AddUserWindow();

            window.Owner = Application.Current.MainWindow;
            window.WindowStartupLocation = WindowStartupLocation.CenterOwner;

            var newUser = new Classes.USER();

            window.DataContext = newUser;

            var result = window.ShowDialog();

            if (result == true)
            {
                _userList.Add(newUser);
            }
        }
Пример #3
0
        private void UpdateUsers()
        {
            SqlConnection  con  = Database.DatabaseLocator.GenerateConnection.GenerateNewConnection();
            SqlDataAdapter sda1 = new SqlDataAdapter("SELECT * From [USER]", con);
            DataTable      dt   = new DataTable();

            sda1.Fill(dt);
            ViewModels.ViewModelLocator.LogInWindowViewModel.UserList.Clear();
            for (int x = 0; x < dt.Rows.Count; x++)
            {
                Classes.USER newUser = new Classes.USER();

                newUser.ID       = Convert.ToInt16(dt.Rows[x]["ID"]);
                newUser.Username = dt.Rows[x]["Username"].ToString();
                newUser.Password = dt.Rows[x]["Password"].ToString();
                newUser.Level    = dt.Rows[x]["Level"].ToString();
                ViewModels.ViewModelLocator.LogInWindowViewModel.UserList.Add(newUser);
            }
            con.Close();
        }