Exemple #1
0
        private void AddClick(object sender, RoutedEventArgs e)
        {
            UsersDataGrid.UnselectAll();

            string resultPath = string.Empty;

            using (var dialog = new FolderBrowserDialog())
            {
                DialogResult result = dialog.ShowDialog();

                if (result == System.Windows.Forms.DialogResult.OK)
                {
                    resultPath = dialog.SelectedPath;
                }
                else
                {
                    return;
                }
            }

            if (ListOfDirectories.FirstOrDefault(dir => dir.Path == resultPath) != null)
            {
                return;
            }

            int count = Directory.CreateDirectory(resultPath).GetFiles().Length;

            DirectoryObject directoryObject = new DirectoryObject(Rules.FirstOrDefault(rule => rule.AccessID == 0), resultPath, count);

            _allDirectories.Add(directoryObject);
            ListOfDirectories.Add(directoryObject);
        }
Exemple #2
0
        private void AddRoleClick(object sender, RoutedEventArgs e)
        {
            UsersDataGrid.UnselectAll();

            int id = Roles.Select(rule => rule.RoleID).Max() + 1;

            Roles.Add(new AccessRole(id, $"Новая роль {id}", "0,1", Rules));
        }
Exemple #3
0
        private void AddRuleClick(object sender, RoutedEventArgs e)
        {
            UsersDataGrid.UnselectAll();

            int id = Rules.Select(rule => rule.AccessID).Max() + 1;

            Rules.Add(new AccessRule(id, $"Новый уровень доступа {id}"));
        }
Exemple #4
0
        private void AddUserClick(object sender, RoutedEventArgs e)
        {
            UsersDataGrid.UnselectAll();

            int id = 0;

            if (Users.Any())
            {
                id = Users.Select(rule => rule.UserId).Max() + 1;
            }

            Users.Add(new MyUser(id, $"Новый пользователь {id}", "0", Roles));
        }
Exemple #5
0
 private void ClearFocusClick(object sender, RoutedEventArgs e)
 {
     UsersDataGrid.UnselectAll();
 }
Exemple #6
0
 private void RulesDataGrid_SelectionChanged(object sender, SelectionChangedEventArgs e)
 {
     UsersDataGrid.UnselectAll();
 }