Ejemplo n.º 1
0
 public void ShowDialog(Administration Administrator, string UserName)
 {
     this.Administrator = Administrator;
     this.UserName      = UserName;
     foreach (string Role in Roles.roles)
     {
         if (Administrator.GetRoles(UserName, Role))
         {
             spRoles.Children.Add(GetRadioButton(Roles.RoleNameToRussian(Role)));
         }
     }
     this.ShowDialog();
 }
Ejemplo n.º 2
0
        void FillRoleMatrix()
        {
            if (RolesGrid.RowDefinitions.Count != 0)
            {
                RolesGrid.RowDefinitions.RemoveRange(0, RolesGrid.RowDefinitions.Count);
            }
            if (RolesGrid.ColumnDefinitions.Count != 0)
            {
                RolesGrid.ColumnDefinitions.RemoveRange(0, RolesGrid.ColumnDefinitions.Count);
            }
            RolesGrid.Children.RemoveRange(0, RolesGrid.Children.Count);

            RolesGrid.RowDefinitions.Add(new RowDefinition()
            {
                Height = new GridLength(55)
            });
            for (int i = 0; i < Administrator.UsersNames.Count; i++)
            {
                RolesGrid.RowDefinitions.Add(new RowDefinition()
                {
                    Height = new GridLength(30)
                });
            }
            RolesGrid.ColumnDefinitions.Add(new ColumnDefinition()
            {
                Width = new GridLength(100)
            });
            for (int i = 0; i < Roles.roles.Count + 1; i++)
            {
                RolesGrid.ColumnDefinitions.Add(new ColumnDefinition()
                {
                    Width = new GridLength(85)
                });
            }
            for (int i = 0; i < Administrator.UsersNames.Count - 1; i++)
            {
                AddInfOnGrid(Administrator.UsersNames[i + 1], i + 1, 0, RolesGrid);
            }
            for (int i = 0; i < Roles.roles.Count; i++)
            {
                AddInfOnGrid(Roles.RoleNameToRussian(Roles.roles[i]), 0, i + 1, RolesGrid);
            }
            for (int i = 0; i < Administrator.UsersNames.Count - 1; i++)
            {
                for (int j = 0; j < Roles.roles.Count; j++)
                {
                    AddInfoOfRoleGrid(Administrator.GetRoles(i + 1, j), i + 1, j + 1);
                }
            }
        }