Exemple #1
0
        //----------Cocher les menus d'un role--------------------------------
        private void cocherLesPrivilegeDunRole(String role)
        {
            List <String> listPrivilege = new List <string>();

            listPrivilege = gestionGroupePrivilegeBL.listerPrivilegeDunRole(role);

            String t, d;

            for (int j = 0; j < listPrivilege.Count; j++)
            {
                for (int i = 0; i < lbRole.Items.Count; i++)
                {
                    ListBoxItem item = lbRole.ItemContainerGenerator.ContainerFromIndex(i) as ListBoxItem;

                    if (item != null)
                    {
                        CheckBox myCheckBox = FindVisualChild <CheckBox>(item) as CheckBox;

                        t = deformaterNomMenuAffiche(myCheckBox.Content.ToString());
                        d = listPrivilege.ElementAt(j);

                        if (deformaterNomMenuAffiche(myCheckBox.Content.ToString()) == listPrivilege.ElementAt(j))
                        {
                            myCheckBox.IsChecked = true;
                        }
                        //if (myCheckBox.Content.ToString() == listPrivilege.ElementAt(j))
                        //{
                        //    myCheckBox.IsChecked = true;

                        //}
                    }
                }
            }
        }
        //--------obtenir la liste des sous menus------------------



        //-------------------------------------------------------------------------------

        private void Window_Loaded(object sender, RoutedEventArgs e)
        {
            desactiverTousLesMenus(menuTest);
            listPrivilege = gestionGroupePrivilegeBL.listerPrivilegeDunRole(role);
            activerLesMenus(menuTest, listPrivilege);
        }