Ejemplo n.º 1
0
 private void PopulateUsers()
 {
     AllUsers.Add(PurpleUser);
     AllUsers.Add(PeachUser);
     AllUsers.Add(AquaUser);
     AllUsers.Add(BlueUser);
     AllUsers.Add(PinkUser);
     AllUsers.Add(GreenUser);
 }
Ejemplo n.º 2
0
 private void CreateUser()
 {
     SelectedUser          = new User();
     SelectedUser.Username = NewUsername;
     AllUsers.Add(SelectedUser);
     SelectedUserNotSaved = true;
     usekeyfile           = false;
     // HostedServer.settingsrepo.AddUser(new User() { Username = NewUsername });
 }
        private async Task LoadUsers()
        {
            var usersReturned = await _userService.Get <List <Model.UserProfile> >(null);

            foreach (var item in usersReturned)
            {
                AllUsers.Add(item);
                QueryUsers.Add(item);
            }
        }
        private TestUser GenerateRandomUser()
        {
            var userName = "******" + UserCount++;
            var user     = new TestUser {
                Id = userName, Password = GenerateRandomPassword(userName), Groups = new HashSet <string>(), Permissions = new Permission()
            };

            AllUsers.Add(user);
            return(user);
        }
Ejemplo n.º 5
0
 /// <summary>
 /// Displays student by searched Id.
 /// </summary>
 /// <param name="id"></param>
 public void DisplayStudentById(int id)
 {
     AllUsers.Clear();
     foreach (Student p in AllStudents.ToList())
     {
         if (p.StudentId == id)
         {
             AllUsers.Add(p);
         }
     }
 }
Ejemplo n.º 6
0
 /// <summary>
 /// Displays employee by searched Id
 /// </summary>
 /// <param name="id"></param>
 public void DisplayEmployeeById(int id)
 {
     AllUsers.Clear();
     foreach (Employee e in AllEmployees.ToList())
     {
         if (e.EmployeeId == id)
         {
             AllUsers.Add(e);
         }
     }
 }
Ejemplo n.º 7
0
        public void AddUser()
        {
            User c = this.dm.CreateObject <User>();

            c.Id = GuidComb.Generate();
            dm.AddUser(c);

            UserViewModel vm = new UserViewModel(c);

            AllUsers.Add(vm);
            CurrentUser = vm;
        }
Ejemplo n.º 8
0
 /// <summary>
 /// We get all employees from DB and populates list to display them.
 /// </summary>
 public async void DisplayEmployees()
 {
     if (AllEmployees.Count == 0)
     {
         AllEmployees = await ApiHelper.Instance.GetAllEmployees();
     }
     foreach (Person p in AllEmployees)
     {
         if (!AllUsers.Contains(p))
         {
             AllUsers.Add(p);
         }
     }
 }
        public async Task LoadAsync()
        {
            AllUsers.Clear();
            var users = await _userRepository.GetAllAsync();

            foreach (var user in users)
            {
                if (user.UserName == "*****@*****.**")
                {
                    continue;
                }
                var modelWrapper = new UserWrapper(user);
                AllUsers.Add(modelWrapper);
            }
        }
Ejemplo n.º 10
0
 /// <summary>
 /// Initializes the state amd data of the view model instance.
 /// </summary>
 protected override void OnInitialize()
 {
     try
     {
         var userList = _userRepository.GetAllUsers();
         AllUsers.Add(string.Empty);//For any user
         if (null != userList && userList.Any())
         {
             var userNameList = userList.Select(u => u.Username);
             AllUsers.AddRange(userNameList);
             Username = string.Empty;//set the selected user to all.
         }
     }
     catch (Exception ex)
     {
         LogUtil.LogError("TransactionFilterViewModel", "OnInitialize", ex);
         _messagingService.ShowMessage(ErrorMessages.ERR_FAILED_TO_GET_USERS, DialogType.Error);
     }
 }
Ejemplo n.º 11
0
        /// <summary>
        /// Liest das AD aus und gibt eine Liste mit allen aktivien Usern zurück
        /// </summary>
        /// <returns></returns>
        private Task GetAllADUsers()
        {
            return(Task.Factory.StartNew(() =>
            {
                // create your domain context
                PrincipalContext ctx = new PrincipalContext(ContextType.Domain);
                // define a "query-by-example" principal - here, we search for a UserPrincipal
                UserPrincipal qbeUser = new UserPrincipal(ctx);

                // Erstellt den Eintrag der während des Ladens angezeigt wird
                UserPrincipal loading = new UserPrincipal(ctx)
                {
                    Name = "loading ..."
                };

                // Fügt den Lade User der Liste hinzu die angezeigt wird
                UsersFiltered = new ObservableCollection <UserPrincipal>
                {
                    loading
                };

                // create your principal searcher passing in the QBE principal
                PrincipalSearcher srch = new PrincipalSearcher(qbeUser);

                List <UserPrincipal> lst = new List <UserPrincipal>();
                // find all matches
                foreach (var found in srch.FindAll())
                {
                    if (found is UserPrincipal user)
                    {
                        if (user.Enabled.Value)
                        {
                            AllUsers.Add(user);
                        }
                    }
                }
                // Sortiert die Liste Aller User
                AllUsers.Sort((x, y) => x.Name.CompareTo(y.Name));

                // Kopiert zum Start alle User in die gefilterte Liste
                UsersFiltered = new ObservableCollection <UserPrincipal>(AllUsers);
            }));
        }
Ejemplo n.º 12
0
        private async void GetAllUsers()
        {
            try
            {
                var users = await remoteService.GetAllUser();

                AllUsers.Clear();
                foreach (var item in users)
                {
                    if (item.Id != Settings.KeySettings)
                    {
                        AllUsers.Add(item);
                    }
                }
            }
            catch
            {
            }
        }
Ejemplo n.º 13
0
        private void ClientRoomRefreshed(object sender, RoomEventArgs e)
        {
            Dispatcher.BeginInvoke(new Action <RoomEventArgs>(args =>
            {
                if (args.Room.Name == ServerModel.MainRoomName)
                {
                    AllUsers.Clear();

                    using (var client = ClientModel.Get())
                        foreach (string nick in args.Room.Users)
                        {
                            User user = args.Users.Single(u => u.Equals(nick));
                            AllUsers.Add(new UserViewModel(user, null)
                            {
                                IsClient = user.Equals(client.User)
                            });
                        }
                }
            }), e);
        }
 private async void OpenAndFilterNavigationView(OpenAndFilterNavigationViewEventArgs args)
 {
     if (String.IsNullOrEmpty(args.SelectedItem))
     {
         await LoadAsync();
     }
     else
     {
         var filteredUsers           = AllUsers.Where(u => u.FullName.ToLower().StartsWith(args.SelectedItem.ToLower()));
         List <UserWrapper> tempList = new List <UserWrapper>();
         foreach (var filteredUser in filteredUsers)
         {
             tempList.Add(filteredUser);
         }
         AllUsers.Clear();
         foreach (var item in tempList)
         {
             AllUsers.Add(item);
         }
     }
 }
Ejemplo n.º 15
0
        /// <summary>
        /// Get the User object for the current identity
        /// </summary>
        /// <param name="usr">The identity of the user</param>
        /// <returns>Populated User if it exists, otherwise null</returns>
        public static User CreateOrGetUser(IIdentity usr)
        {
            AllUsers items = new AllUsers();
            User     item  = null;

            try
            {
                item = items.Where(i => String.Equals(i.UserName, usr.Name, StringComparison.CurrentCultureIgnoreCase)).SingleOrDefault();
            }
            catch (InvalidOperationException ex)
            {
                throw new Exceptions.UIMessageException(string.Format("Corrupt Data: Multiple User records with User Name '{0}' found.", usr.Name), ex);
            }

            if (item == null)
            {
                item = new User {
                    UserId = Guid.NewGuid(), UserName = usr.Name, DisplayName = usr.Name, ShiftDefaultStartTime = System.Convert.ToDateTime(Constants.cstrConfigKeyStandardStartTime), ShiftDefaultEndTime = System.Convert.ToDateTime(Constants.cstrConfigKeyStandardEndTime)
                };
                items.Add(item);
                items.Save();
            }
            return(item);
        }
Ejemplo n.º 16
0
 public void CreatePerson(User user)
 {
     AllUsers.Add(user);
 }
Ejemplo n.º 17
0
 /// <summary>
 /// Used for user to change PIN and/or name.
 /// </summary>
 /// <param name="changedUser"></param>
 public void ChangeLoggedInUser(User changedUser)
 {
     AllUsers.Remove(LoggedInUser);
     AllUsers.Add(changedUser);
     LoggedInUser = changedUser;
 }
Ejemplo n.º 18
0
 public void AddNewUser(User newUser)
 {
     AllUsers.Add(newUser);
 }
Ejemplo n.º 19
0
 public void CreatePerson(string firstName, string lastName, List <User> friends, List <Group> groups)
 {
     AllUsers.Add(new User(firstName, lastName, friends, groups));
 }
Ejemplo n.º 20
0
 private Session()
 {
     AllUsers.Add(new RemoteUser {
         Id = User.Id, Username = User.Username
     });
 }
Ejemplo n.º 21
0
 public User()
 {
     Id = GenerateId.GenerateUserId(this);
     AllUsers.Add(this);
 }