public DelegationSettingsForUserViewModel(IDelegationRepository delegationRepository, IUserManagementRepository userManagementRepository, string username)
        {
            this.delegationRepository = delegationRepository;
            this.userManagementRepository = userManagementRepository;
            int totalCount;
            var allnames =
                userManagementRepository.GetUsers(0, 100, out totalCount)
                .Select(x => new SelectListItem
                {
                    Text = x
                }).ToList();
            allnames.Insert(0, new SelectListItem { Text = DelegationSettingsForUserInputModel.ChooseItem, Value = "" });
            this.AllUserNames = allnames;

            this.UserName = username;
            if (!IsNew)
            {
                var realmSettings =
                        this.delegationRepository
                            .GetDelegationSettingsForUser(this.UserName)
                            .ToArray();
                this.DelegationSettings = realmSettings;
            }
            else
            {
                this.DelegationSettings = new DelegationSetting[0];
            }
        }
Example #2
0
        public DelegationSettingsForUserViewModel(IDelegationRepository delegationRepository, IUserManagementRepository userManagementRepository, string username)
        {
            this.delegationRepository     = delegationRepository;
            this.userManagementRepository = userManagementRepository;
            int totalCount;
            var allnames =
                userManagementRepository.GetUsers(0, 100, out totalCount)
                .Select(x => new SelectListItem
            {
                Text = x
            }).ToList();

            allnames.Insert(0, new SelectListItem {
                Text = DelegationSettingsForUserInputModel.ChooseItem, Value = ""
            });
            this.AllUserNames = allnames;

            this.UserName = username;
            if (!IsNew)
            {
                var realmSettings =
                    this.delegationRepository
                    .GetDelegationSettingsForUser(this.UserName)
                    .ToArray();
                this.DelegationSettings = realmSettings;
            }
            else
            {
                this.DelegationSettings = new DelegationSetting[0];
            }
        }
Example #3
0
        public ClientCertificatesForUserViewModel(IClientCertificatesRepository clientCertificatesRepository, IUserManagementRepository userManagementRepository, string username)
        {
            this.clientCertificatesRepository = clientCertificatesRepository;
            this.userManagementRepository     = userManagementRepository;
            int totalCount;
            var allnames =
                userManagementRepository.GetUsers(0, 100, out totalCount)
                .Select(x => new SelectListItem
            {
                Text = x
            }).ToList();

            allnames.Insert(0, new SelectListItem {
                Text = Resources.ClientCertificatesForUserViewModel.ChooseItem, Value = ""
            });
            this.AllUserNames = allnames;

            this.UserName  = username;
            NewCertificate = new ClientCertificate {
                UserName = username
            };
            if (!IsNew)
            {
                var certs =
                    this.clientCertificatesRepository
                    .GetClientCertificatesForUser(this.UserName)
                    .ToArray();
                this.Certificates = certs;
            }
            else
            {
                this.Certificates = new ClientCertificate[0];
            }
        }
        public ClientCertificatesForUserViewModel(IClientCertificatesRepository clientCertificatesRepository, IUserManagementRepository userManagementRepository, string username)
        {
            this.clientCertificatesRepository = clientCertificatesRepository;
            this.userManagementRepository = userManagementRepository;
            int totalCount;
            var allnames =
                userManagementRepository.GetUsers(0, 100, out totalCount)
                .Select(x => new SelectListItem
                {
                    Text = x
                }).ToList();
            allnames.Insert(0, new SelectListItem { Text = Resources.ClientCertificatesForUserViewModel.ChooseItem, Value = "" });
            this.AllUserNames = allnames;

            this.UserName = username;
            NewCertificate = new ClientCertificate { UserName = username };
            if (!IsNew)
            {
                var certs =
                        this.clientCertificatesRepository
                        .GetClientCertificatesForUser(this.UserName)
                            .ToArray();
                this.Certificates = certs;
            }
            else
            {
                this.Certificates = new ClientCertificate[0];
            }
        }
        private void Init(int currentPage, string filter)
        {
            if (currentPage <= 0)
            {
                CurrentPage = 1;
            }
            else
            {
                CurrentPage = currentPage;
            }

            int rows      = 20;
            int pageIndex = (currentPage - 1);

            if (String.IsNullOrEmpty(filter))
            {
                int total;
                Users = UserManagementRepository.GetUsers(pageIndex, rows, out total);
                Total = total;
            }
            else
            {
                int total;
                Users = UserManagementRepository.GetUsers(filter, pageIndex, rows, out total);
                Total = total;
            }

            if (Total < rows)
            {
                Showing = Total;
            }
            else
            {
                Showing = rows;
            }
            UsersDeleteList = Users.Select(x => new UserDeleteModel {
                Username = x
            }).ToArray();
        }
Example #6
0
 public ActionResult <IEnumerable <UserResponse> > GetAllUsers()
 {
     return(Ok(_userManagementRepository.GetUsers()));
 }
 public IEnumerable <UserMeterDetail> GetAllUser()
 {
     return(_userManagementRepository.GetUsers());
 }