예제 #1
0
        /// <summary>
        /// Loads the list of users from the Users table in the database.
        /// </summary>
        private void LoadUsers()
        {
            try
            {
                m_UserList.Clear();
                m_UserList.Load();

                m_CancelEvents.ComboBoxValueChanged = true;
                cbUsers.Items.Clear();

                foreach (User user in m_UserList)
                {
                    cbUsers.Items.Add(user.UserName);
                }//next user

                m_CancelEvents.ComboBoxValueChanged = false;


                if (m_UserList.Count > 0)
                {
                    cbUsers.SelectedIndex = 0;
                    LoadTodoList();
                }//end if
            }
            catch (Exception err)
            {
                ErrorHandler.ShowErrorMessage(err, "Error in LoadUsers function of frmMain form.");
            }
        }
예제 #2
0
        /*
         * This function is lauched as a thread function when the user is connected to the server.
         * This function is used to receive the broadcast message from the server. And accroding
         * to the type message received, it will display the message in the correct place.
         */
        public void Receive_Message()
        {
            while (true)
            {
                string   message       = remoteService.ServerBroadcastMessage();
                string[] message_split = message.Split('|');
                string   type          = message_split[0];
                if (type == "userlist")
                {
                    this.Dispatcher.Invoke(() =>
                    {
                        UserList.Clear();
                        for (int i = 1; i < message_split.Count() - 1; i++)
                        {
                            UserList.Add(message_split[i]);
                        }
                        DataContext = this;
                    });
                }
                if (type == "message")
                {
                    this.Dispatcher.Invoke(() =>
                    {
                        string publisher = message_split[1];
                        string content   = message_split[2];
                        MessageList.Add(publisher + " : " + content);
                        DataContext = this;
                    });
                }

                Thread.Sleep(100);
            }
        }
예제 #3
0
        private void Refresh(bool rmodule, bool rmenu, bool rmenudtl, bool rrole, bool ruser)
        {
            if (rmodule)
            {
                ModuleList.Clear();
                ModuleList.AddRange(PubMaster.Mod.RoleSql.QueryWcsModuleList());
            }

            if (rmenu)
            {
                MenuList.Clear();
                MenuList.AddRange(PubMaster.Mod.RoleSql.QueryWcsMenuList());
            }

            if (rmenudtl)
            {
                MenuDtlList.Clear();
                MenuDtlList.AddRange(PubMaster.Mod.RoleSql.QueryWcsMenuDtlList());
            }

            if (rrole)
            {
                RoleList.Clear();
                RoleList.AddRange(PubMaster.Mod.RoleSql.QueryWcsRoleList());
            }

            if (ruser)
            {
                UserList.Clear();
                UserList.AddRange(PubMaster.Mod.RoleSql.QueryWcsUserList());
            }
        }
예제 #4
0
        public void PopulateuserList()
        {
            UserList.Clear();
            var MyList = new List <string>();

            try
            {
                DirectoryEntry root = new DirectoryEntry("WinNT:");
                foreach (DirectoryEntry c1 in root.Children)
                {
                    if (c1.Name == "WORKGROUP")
                    {
                        foreach (DirectoryEntry c2 in c1.Children)
                        {
                            if (c2.Name.ToString() != "Schema")
                            {
                                MyList.Add(c2.Name.ToString());
                            }
                        }
                    }
                }
                var MyUsers = MyList.ToArray();
                var items   = UserList.Items;
                i = 0;
                foreach (var value in MyUsers)
                {
                    items.Add(value);
                    UserList.Items[i].ImageIndex = 0;
                    DoGetHostAddresses(value.ToString());
                    i++;
                }
            }catch (Exception) {}
        }
        void loadOperation_Completed(object sender, EventArgs e)
        {
            UserList.Clear();
            LoadOperation loadOperation = sender as LoadOperation;

            foreach (ProductManager.Web.Model.user user in loadOperation.Entities)
            {
                if (user.user_name == "admin")
                {
                    continue;
                }
                UserEntity userEntity = new UserEntity();
                userEntity.User = user;
                userEntity.Update();
                DepartmentEntity departmentEntity;
                if (DepartmentDictionary.TryGetValue(userEntity.UserDepartmentID, out departmentEntity))
                {
                    userEntity.UserDepartment = departmentEntity.DepartmentName;
                    UserList.Add(userEntity);
                }
            }

            PagedCollectionView lPagedCollectionView = new PagedCollectionView(UserList);

            lPagedCollectionView.GroupDescriptions.Add(new PropertyGroupDescription("UserDepartment"));
            UserDataView = lPagedCollectionView;
            UserDataView.Refresh();
            UpdateChanged("UserList");
            IsBusy = false;
            finishLoaded();
        }
예제 #6
0
        public async Task ExecuteLoadItemsCommand()
        {
            if (IsBusy)
            {
                return;
            }

            IsBusy = true;

            try
            {
                UserList.Clear();
                var items = await DataStore.GetUsersAsync();

                foreach (var item in items)
                {
                    UserList.Add(item);
                }
            }
            catch (Exception ex)
            {
                Debug.WriteLine(ex);
            }
            finally
            {
                IsBusy = false;
            }
        }
        public async Task ExecuteUserSearch(string searchQuery)
        {
            UserList.Clear();
            SearchStatusText = string.Format(AppResources.HomePage_SearchInProgressString, searchQuery);
            ClickableText    = string.Empty;
            IsLoaderRunning  = true;
            try
            {
                User searchedUser = await _repoHostClient.GetUserInfoByUserName(searchQuery);

                if (searchedUser == null)
                {
                    SearchStatusText = string.Format(AppResources.HomePage_ResultNotFoundString, searchQuery);
                    ClickableText    = AppResources.Sample_User;
                }
                else
                {
                    SearchStatusText = string.Empty;
                    UserList.Add(_mapper.MapUserDTOToUserViewModel(searchedUser));
                }
            }
            finally
            {
                IsLoaderRunning = false;
            }
        }
예제 #8
0
        void loadOperation_Completed(LoadOperation <ProductManager.Web.Model.user> sender)
        {
            UserList.Clear();
            //LoadOperation loadOperation = sender as LoadOperation;
            this.userSource.Source = sender.Entities;
            foreach (ProductManager.Web.Model.user user in sender.Entities)
            {
                if (user.user_name == "admin")
                {
                    continue;
                }
                UserEntity userEntity = new UserEntity();
                userEntity.User = user;
                userEntity.UserNameDictionary = UserEntityDictionary;
                userEntity.Update();
                UserList.Add(userEntity);
                DepartmentEntity departmentEntity;
                if (DepartmentDictionary.TryGetValue(userEntity.UserDepartmentID, out departmentEntity))
                {
                    userEntity.UserDepartment = departmentEntity.DepartmentName;
                }
            }

            if (sender.TotalEntityCount != -1)
            {
                this.userView.SetTotalItemCount(sender.TotalEntityCount);
            }

            UpdateChanged("UserList");
            UpdateChanged("CollectionView");
            IsBusy = false;
        }
예제 #9
0
 public bool SaveUser(string passBox1, string passBox2)
 {
     if (ValidateUser() && ValidatePass(passBox1, passBox2) && SelectedUser.ID == 0)
     {
         context.AddUser(SelectedUser.Name, SelectedUser.Password);
         IsEnabled = false;
         UserList.Clear();
         LoadUserList();
         return(true);
     }
     else if (ValidateUser() && SelectedUser.ID != 0)
     {
         if (string.IsNullOrEmpty(passBox1) && string.IsNullOrEmpty(passBox2))
         {
             context.UpdateUserName(SelectedUser.ID, SelectedUser.Name);
         }
         else
         {
             if (ValidatePass(passBox1, passBox2))
             {
                 context.UpdateUserName(SelectedUser.ID, SelectedUser.Name);
                 context.UpdatePassword(SelectedUser.ID, SelectedUser.Password);
             }
         }
         IsEnabled = false;
         return(true);
     }
     return(false);
 }
예제 #10
0
        void loadOperation_Completed(object sender, EventArgs e)
        {
            UserList.Clear();
            LoadOperation loadOperation = sender as LoadOperation;

            foreach (DocumentManager.Web.Model.user user in loadOperation.Entities)
            {
                if (user.user_name == "admin")
                {
                    continue;
                }
                UserEntity userEntity = new UserEntity();
                userEntity.User = user;
                userEntity.Update();
                UserList.Add(userEntity);
            }

            PagedCollectionView lPagedCollectionView = new PagedCollectionView(UserList);

            UserDataView = lPagedCollectionView;
            UserDataView.Refresh();
            UpdateChanged("UserList");
            IsBusy = false;
            //finishLoaded();
        }
        }                                                   //角色删除
        #endregion

        #region 获取数据
        private void GetAllUsers()
        {
            UserList.Clear();
            _userService.GetAllUsers().ToList().ForEach(x =>
            {
                UserList.Add(x);
            });
        }
        public async void LoadUsers()
        {
            if (HasLoadFromDBRun == 0)
            {
                UserList.Clear();
                UserList = await UserPersistency.LoadUsers();

                HasLoadFromDBRun++;
            }
        }
        /// <summary>
        /// Обновляет список пользователей
        /// </summary>
        private void UpdateObservableList()
        {
            UserList.Clear();

            using (var dataBase = new UserService())
            {
                foreach (var item in _mapperUserContract.GetMapList(dataBase.GetAllUsers()))
                {
                    UserList.Add(item);
                }
            }
        }
예제 #14
0
        public void DisplayUsers()
        {
            if (UserList.Count > 0)
            {
                UserList.Clear();
            }
            RandomUsers StoredUsers = GetUsers(false);

            foreach (Result element in StoredUsers.Results)
            {
                UserList.Add(element);
            }
        }
예제 #15
0
        private void sortByUserId()
        {
            List <USER> sortedList = UserList.OrderBy(x => x.ID.ToString() == Convert.ToString(SearchByUserId)).ToList();

            sortedList.Reverse();
            UserList.Clear();
            foreach (var sortedItem in sortedList)
            {
                UserList.Add(sortedItem);
            }
            SelectedUser = UserList.First();
            OnPropertyChanged("UserList");
        }
        public void BuildUserList()
        {
            var userList = (from users in db.RULES
                            where users.Active == "Y"
                            orderby users.STATUS
                            select users).ToList();

            UserList.Clear();
            foreach (var userName in userList)
            {
                _UserList.Add(userName);
            }
        }
예제 #17
0
        private void sortByName()
        {
            List <USER> sortedList = UserList.OrderBy(x => x.NAME.ToUpper().Contains(SortByName.ToUpper())).ToList();

            sortedList.Reverse();
            UserList.Clear();
            foreach (var sortedItem in sortedList)
            {
                UserList.Add(sortedItem);
            }
            SelectedUser = UserList.First();
            OnPropertyChanged("UserList");
        }
예제 #18
0
        /// <summary>
        /// Loads the data from an XML file.
        /// </summary>
        public void LoadData()
        {
            if (!System.IO.File.Exists(File))
            {
                throw new FileNotFoundException();
            }
            XmlReader reader = null;

            try
            {
                reader = XmlReader.Create(System.IO.File.OpenRead(File));
                // Read until we reach the MentalisProxy element
                while (reader.Read() && reader.Name.ToLower() != "mentalisproxy")
                {
                }
                // Read until we reach the MentalisProxy element again (the end tag)
                while (reader.Read() && reader.Name.ToLower() != "mentalisproxy")
                {
                    if (!reader.IsEmptyElement)
                    {
                        switch (reader.Name.ToLower())
                        {
                        case "settings":
                            Settings.Clear();
                            LoadSettings(reader);
                            break;

                        case "users":
                            UserList.Clear();
                            LoadUsers(reader);
                            break;

                        case "listeners":
                            LoadListeners(reader);
                            break;
                        }
                    }
                }
            }
            catch
            {
                throw new XmlException("Malformed XML initialisation file.", null);
            }
            finally
            {
                if (reader != null)
                {
                    reader.Dispose();
                }
            }
        }
예제 #19
0
 void InitData()
 {
     UserList.Clear();
     Model.Users.UsersLocalGroup.ForEach(u =>
     {
         UserList.Add(u);
     });
     Model.Users.UsersMembersDomainGroup.ForEach(u =>
     {
         UserList.Add(u);
     });
     OnPropertyChanged("UserList");
     User = $"{Model.Users.CurrentUser.Domain}/{Model.Users.CurrentUser.Name}";
 }
예제 #20
0
        private void HostSilentCloseConnection()
        {
            var tmpUserList = new List <User>(UserList);

            foreach (var user in tmpUserList)
            {
                if (!user.IsHost)
                {
                    user.Listen = false;
                    user.Dispose();
                }
            }
            UserList.Clear();
        }
예제 #21
0
파일: ViewModel.cs 프로젝트: Hunv/beRemote
        public void Dispose()
        {
            CmdLoaded.Loaded     -= CmdLoaded_Loaded;
            CmdStart.StartImport -= CmdStart_StartImport;
            CmdImport.Import     -= CmdImport_Import;

            CmdLoaded = null;
            CmdStart  = null;
            CmdImport = null;
            if (UserList != null)
            {
                UserList.Clear();
            }
        }
예제 #22
0
        private void HostSendAllDisconnect()
        {
            var tmpUserList = new List <User>(UserList);

            foreach (var user in tmpUserList)
            {
                if (!user.IsHost)
                {
                    user.Listen = false;
                    user.SendDisconnect();
                    user.Dispose();
                }
            }
            UserList.Clear();
        }
예제 #23
0
        public static void RefreshList()
        {
            UserList.Clear();
            DataTable dt = Database.GetAllData("Users");

            foreach (DataRow dataRow in dt.Rows)
            {
                UserList.Add(new User(
                                 dataRow["Email"].ToString(),
                                 dataRow["Password"].ToString(),
                                 dataRow["Name"].ToString(),
                                 dataRow["Surname"].ToString(),
                                 dataRow["Image"].ToString()));
            }
        }
예제 #24
0
        private void Refresh()
        {
            if (SelectedRole == null)
            {
                if (UserList == null)
                {
                    return;
                }
                UserList.Clear();
                return;
            }
            var menuDataService = AppEx.Container.GetInstance <IRole2UserService>();

            menuDataService.GetUserListByRole(SelectedRole.Id); //所有的 还是有权限
        }
예제 #25
0
        private void GetAllUsers()
        {
            IEnumerable <string> users = History.Select(m => m.Sender);

            users = users.Union(History.Select(m => m.Recipient));
            users = users.Where(u => u != _logicClient.Login);

            DispatchService.Invoke(() =>
            {
                UserList.Clear();
                foreach (string user in users)
                {
                    UserList.Add(new User {
                        Login = user
                    });
                }
            });
        }
예제 #26
0
        public async Task GetUsers()
        {
            try {
                ProgressBarVal = "0";
                List <UsersResponseModel> Users = await dashboardRepo.GetUsers();

                UserList.Clear();
                foreach (var u in Users)
                {
                    UserList.Add(u);
                }
                ProgressBarVal = "100";
            }
            catch (Exception e) {
                ProgressBarVal = "100";
                Toast.ProvideToast().ShowError("Can't load users");
            }
        }
 private void loadOperation_Completed(LoadOperation <DocumentManager.Web.Model.user> sender)
 {
     UserList.Clear();
     this.userSource.Source = sender.Entities;
     foreach (DocumentManager.Web.Model.user user in sender.Entities)
     {
         if (user.user_name == "admin")
         {
             continue;
         }
         UserEntity userEntity = new UserEntity();
         userEntity.User = user;
         userEntity.Update();
         UserList.Add(userEntity);
     }
     UpdateChanged("UserList");
     IsBusy = false;
 }
예제 #28
0
        //TODO: usar scripts
        static void RulesApendRol(Rol pRol, FwkAuthorizationRuleList pRulesList)
        {
            RolList  rollistAux  = new RolList();
            UserList userListAux = new UserList();;

            foreach (FwkAuthorizationRule rule in pRulesList)
            {
                rollistAux.Clear();
                userListAux.Clear();

                Fwk.Security.FwkMembership.BuildRolesAndUsers_FromRuleExpression(rule.Expression, out rollistAux, out userListAux);

                ///Agregar el rol a la regla
                rollistAux.Add(pRol);

                rule.Expression = Fwk.Security.FwkMembership.BuildRuleExpression(rollistAux, userListAux);
            }
        }
예제 #29
0
        public async void GetPage()
        {
            Owner.Status = "フォローユーザーを取得中";
            var list = await FollowInstance.GetFollowedUserAsync(CurrentPage);

            if (list == null)
            {
                return;
            }

            UserList.Clear();

            foreach (var entry in list)
            {
                UserList.Add(new FollowUserEntryViewModel(entry));
            }
            IsActive     = false;
            Owner.Status = "";
        }
예제 #30
0
        //TODO: usar scripts
        static void RulesRemoveRol(Rol pRol, FwkAuthorizationRuleList pRulesList)
        {
            RolList  rollistAux  = new RolList();
            UserList userListAux = new UserList();

            foreach (FwkAuthorizationRule rule in pRulesList)
            {
                rollistAux.Clear();
                userListAux.Clear();

                Fwk.Security.FwkMembership.BuildRolesAndUsers_FromRuleExpression(rule.Expression, out rollistAux, out userListAux);

                ///Agregar el rol a la regla
                if (rollistAux.Any <Rol>(r => r.RolName.Equals(pRol.RolName)))
                {
                    rollistAux.Remove(rollistAux.First <Rol>(r => r.RolName.Equals(pRol.RolName)));
                    rule.Expression = Fwk.Security.FwkMembership.BuildRuleExpression(rollistAux, userListAux);
                }
            }
        }
예제 #31
0
        //TODO: usar scripts
        static void RulesRemoveRol(Rol pRol, FwkAuthorizationRuleList pRulesList)
        {
            RolList rollistAux = new RolList();
            UserList userListAux = new UserList();
            foreach (FwkAuthorizationRule rule in pRulesList)
            {
                rollistAux.Clear();
                userListAux.Clear();

                Fwk.Security.FwkMembership.BuildRolesAndUsers_FromRuleExpression(rule.Expression, out rollistAux, out userListAux);

                ///Agregar el rol a la regla
                if (rollistAux.Any<Rol>(r => r.RolName.Equals(pRol.RolName)))
                {
                    rollistAux.Remove(rollistAux.First<Rol>(r => r.RolName.Equals(pRol.RolName)));
                    rule.Expression = Fwk.Security.FwkMembership.BuildRuleExpression(rollistAux, userListAux);
                }
            }
        }
예제 #32
0
        //TODO: usar scripts
        static void RulesApendRol(Rol pRol, FwkAuthorizationRuleList pRulesList)
        {
            RolList rollistAux = new RolList();
            UserList userListAux = new UserList(); ;
            foreach (FwkAuthorizationRule rule in pRulesList)
            {
                rollistAux.Clear();
                userListAux.Clear();

                Fwk.Security.FwkMembership.BuildRolesAndUsers_FromRuleExpression(rule.Expression, out rollistAux, out userListAux);

                ///Agregar el rol a la regla
                rollistAux.Add(pRol);

                rule.Expression = Fwk.Security.FwkMembership.BuildRuleExpression(rollistAux, userListAux);
            }
        }