예제 #1
0
        /// <summary>
        /// Method to load the list of users from the database.
        /// </summary>
        public void LoadUsers()
        {
            MessageBoxs.IsBusy = true;
            log.Warn(MessageBoxs.BusyContent = "Loading Users list. Please wait...");

            try
            {
                UserOptionsList op = new UserOptionsList
                {
                    Dependencies = { EnumEntitiesDependencies.UsersInAclGroups }
                };

                if (((DataGridAclGroupsLayout)(ControlView.FindName("UcDataGridAclGroupsServerName")))?.SelectedItem is AclGroupEntity a && a.PrimaryKey > 0)
                {
                    op.IncludeAclGroupKeys = new List <int>()
                    {
                        a.PrimaryKey
                    };
                }

                UserEntityCollection users = new UserEntityCollection(op, false);
                users.Load();
                Users.Items = users;

                log.Info(MessageBoxs.BusyContent = "Loading Users list. Done.");
            }
            catch (Exception e)
            {
                MessageBoxs.BusyContent = "Loading Users list. failed !";
                log.Fatal(MessageBoxs.BusyContent, e);
                MessageBoxs.Fatal(e, (string)MessageBoxs.BusyContent);
            }
            finally
            {
                log.Warn(MessageBoxs.BusyContent = "Loading Users list. Done.");
                MessageBoxs.IsBusy = false;
            }
        }