Ejemplo n.º 1
0
        public static ListUser GetAllUsers()
        {
            ListUser users = new ListUser();

            MembershipUserCollection userCollection = Membership.GetAllUsers();

            foreach(MembershipUser x in userCollection)
                users.Add(new Subscription.User(x.UserName, x.Email, x.Comment, x.IsApproved));

            return users;
        }
Ejemplo n.º 2
0
        private async void LoadData()
        {
            try
            {
                ListUser.Clear();
                var result = await login.ListUser();

                foreach (var item in result)
                {
                    ListUser.Add(item);
                }
            }
            catch (Exception ex)
            {
            }
        }
        /// <summary>
        /// Initializes a new instance of the ManageMsolUserModel class.
        /// </summary>
        public ManageUsersViewModel()
        {
            IMsolCmdlet msolCmdlet = new GetUser()
            {
                All = true
            };

            PipelineReader <object> errors;
            ICollection <PSObject>  result;

            result = MsolCmdletWrapper.Instance.PipelineInvoke(msolCmdlet, out errors);

            if (result != null)
            {
                foreach (PSObject item in result)
                {
                    User user = TypeExtension.ToObject <User>(item.BaseObject);
                    ListUser.Add(user);
                }
            }
        }
Ejemplo n.º 4
0
        /// <summary>
        /// Method to load all the users.
        /// </summary>
        /// <param name="obj"></param>
        public async void LoadUsers(object obj)
        {
            try
            {
                CommonSettings.logger.LogInfo(typeof(string), string.Format(CultureInfo.InvariantCulture, Resources.loggerMsgStart, DateTime.Now.ToShortDateString(), DateTime.Now.ToShortTimeString(), MethodBase.GetCurrentMethod().Name));

                Count = 0;

                if (obj == null)
                {
                    CurrentPageIndex = 0;
                }
                if (CurrentPageIndex == 0)
                {
                    Application.Current.Properties["FindUserGridLastScrollOffset"] = 0;
                    Application.Current.Properties["FindUserGridCurrentPageIndex"] = 0;
                }

                WebPortalUserList objUserList = new WebPortalUserList();
                objUserList.CurrentPageIndex = CurrentPageIndex;
                objUserList.PageSize         = CurrentPageIndex > 0 ? _GridPageSizeOnScroll : _GridPageSize;;
                objUserList.DefaultPageSize  = _GridPageSize;

                var portalUsers = (await _serviceInstance.GetUsersAsync(objUserList)).Select(d => new WebPortalUserList
                {
                    userID         = d.userID,
                    username       = d.username,
                    password       = d.password,
                    firstname      = d.firstname,
                    lastname       = d.lastname,
                    lastLogin      = d.lastLogin,
                    email          = d.email,
                    phone          = d.phone,
                    isActive       = d.isActive,
                    TotalPageCount = d.TotalPageCount
                });;

                if (CurrentPageIndex == 0)
                {
                    ListUser = null;
                    ListUser = new ObservableCollection <WebPortalUserList>(portalUsers);
                }
                else
                {
                    if (ListUser != null && ListUser.Count > 0)
                    {
                        foreach (WebPortalUserList ud in new ObservableCollection <WebPortalUserList>(portalUsers))
                        {
                            ListUser.Add(ud);
                        }
                    }
                }

                Count = ListUser.ToList().Where(x => x.TotalPageCount > 0).FirstOrDefault().TotalPageCount;
            }
            catch (Exception ex)
            {
                CommonSettings.logger.LogError(this.GetType(), ex);
            }
            finally
            {
                CommonSettings.logger.LogInfo(typeof(string), string.Format(CultureInfo.InvariantCulture, Resources.loggerMsgEnd, DateTime.Now.ToShortDateString(), DateTime.Now.ToShortTimeString(), MethodBase.GetCurrentMethod().Name));
            }
        }