Exemplo n.º 1
0
 public VMUserAdd(List <GroupsModel> Groups, List <RolesModel> Roles, List <GroupRolesModel> GroupRoles, List <CodesModel> SystemConstants)
 {
     SuggestedGroupsSource.ReFill(Groups);
     UserTypeSource.ReFill(SystemConstants.Where(x => x.CMasterId == SystemValues.MasterSystemConstants.UserType));
     CommunicationCodeSource.ReFill(SystemConstants.Where(x => x.CMasterId == SystemValues.MasterSystemConstants.CommunicationType));
     this.GroupRoles = GroupRoles;
     this.Roles      = Roles;
 }
Exemplo n.º 2
0
        public VMUserEdit(UsersModel user, PersonsModel person, List <PersonsCommunicationModel> PersonCommunications, List <GroupsModel> Groups, List <RolesModel> Roles, List <GroupRolesModel> GroupRoles, List <UserGroupModel> UserGroups, List <CodesModel> SystemConstants)
        {
            Person           = person;
            SelectedUserType = SystemConstants.Where(x => x.CId == person.PeType && x.CId == SystemValues.MasterSystemConstants.UserType).FirstOrDefault();
            UserState        = user.UIsActive.ToBool();
            UserTypeSource.ReFill(SystemConstants.Where(x => x.CMasterId == SystemValues.MasterSystemConstants.UserType));
            CommunicationCodeSource.ReFill(SystemConstants.Where(x => x.CMasterId == SystemValues.MasterSystemConstants.CommunicationType));
            this.GroupRoles = GroupRoles;
            this.Roles      = Roles;

            AddedGroupsSource.ReFill(Groups.Where(x => UserGroups.Where(y => y.GroupId == x.GId && y.UserId == person.PeId).Count() > 0));
            SuggestedGroupsSource.ReFill(Groups.Where(x => !AddedGroupsSource.Contains(x)));
            foreach (var item in PersonCommunications.Where(x => x.CoPeIdFk == person.PeId))
            {
                CommunicationSource.Add((item, SystemConstants));
            }

            PresentUser(user);
            PresentPerson(person);
        }