public void Clear()
 {
     Name     = null;
     Login    = null;
     Password = null;
     if (UserGroups != null)
     {
         UserGroups.Clear();
     }
     Enabled     = true;
     CreatedDate = null;
 }
Exemple #2
0
        private void Networking_GroupList(object sender, EventArgs e)
        {
            UserGroups.Clear();

            Group[] groups = (Group[])sender;

            if (groups != null)
            {
                foreach (Group group in groups)
                {
                    UserGroups.Add(group.name);
                }
            }
        }
Exemple #3
0
        public void Delete()
        {
            if (CanDeleted)
            {
                this.IsDeleted = true;
                UserGroups.Clear();

                /*
                 * foreach (var userGroup in UserGroups)
                 * {
                 *  UserGroups.Remove(userGroup);
                 * }
                 */
            }
        }
 private void ReloadUserGroups(List <UserGroup> userGroups)
 {
     UserGroups.Clear();
     foreach (var userGroup in userGroups)
     {
         UserGroups.Add(new UserGroupItemViewModel
         {
             GroupId    = userGroup.GroupId,
             GroupUsers = userGroup.GroupUsers,
             Logo       = userGroup.Logo,
             Name       = userGroup.Name,
             Owner      = userGroup.Owner,
             OwnerId    = userGroup.OwnerId,
         });
     }
 }
        /// <summary>
        /// Adds groups to this scenario based on the given user name
        /// </summary>
        /// <param name="entities">The entities.</param>
        /// <param name="userName">Name of the user.</param>
        /// <exception cref="System.ArgumentNullException">entities</exception>
        public void AddGroups(EnterpriseTestEntities entities, string userName)
        {
            if (entities == null)
            {
                throw new ArgumentNullException("entities");
            }

            var query =
                (
                    from g in entities.UserGroups
                    from u in g.Users
                    where u.UserName.Equals(userName, StringComparison.OrdinalIgnoreCase)
                    select g
                );

            UserGroups.Clear();
            foreach (var item in query)
            {
                UserGroups.Add(item);
            }
        }
Exemple #6
0
        public void GetUsersGroupsForSite_ValidDataInObject_ReturnsCorrectListOfGroups()
        {
            
            var cache = GetGroupsCache(_mocks);

            var creator = _mocks.DynamicMock<IDnaDataReaderCreator>();
            var diag = _mocks.DynamicMock<IDnaDiagnostics>();
            _mocks.ReplayAll();

            var obj = new UserGroups(creator, diag, cache, null, null);

            var groupsList = obj.GetUsersGroupsForSite(6, 1);
            Assert.IsNotNull(groupsList);

            obj.Clear();

            Assert.AreEqual(0, obj.InternalObjects.Keys.Count);

        }