public HomeView(T_S_UTILISATEUR_UTI utilisateur) { InitializeComponent(); Model = new HomeViewModel(); this.DataContext = Model; HamburgerMenuItemCollection itemCollection = HamburgerMenuControl.ItemsSource as HamburgerMenuItemCollection; if (!utilisateur.UTI_ADMINISTRATEUR) { itemCollection.Remove(Utilisateurs); itemCollection.Remove(Domaines); itemCollection.Remove(Metiers); itemCollection.Remove(Contrats); itemCollection.Remove(Localisations); itemCollection.Remove(Status); } Model.Utilisateur = utilisateur; }
private void InitPriv() { HamburgerMenuItemCollection itemCollection = HamburgerMenuControl.ItemsSource as HamburgerMenuItemCollection; if (Convert.ToInt32(Application.Current.Resources["priv"]) == 1) { //Admin itemCollection.Remove(Transactions); itemCollection.Remove(Registers); itemCollection.Remove(Directory); itemCollection.Remove(Appointments); itemCollection.Remove(Search); } else if (Convert.ToInt32(Application.Current.Resources["priv"]) == 2) { //Secretary itemCollection.Remove(Transactions); itemCollection.Remove(Registers); itemCollection.Remove(Directory); itemCollection.Remove(Archives); itemCollection.Remove(Reports); itemCollection.Remove(Accounts); itemCollection.Remove(Priests); itemCollection.Remove(Timeslots); itemCollection.Remove(ControlPanel); itemCollection.Remove(AppointmentTypes); itemCollection.Remove(Search); } else if (Convert.ToInt32(Application.Current.Resources["priv"]) == 3) { //Cashier itemCollection.Remove(Appointments); itemCollection.Remove(Registers); itemCollection.Remove(Directory); itemCollection.Remove(Archives); itemCollection.Remove(Reports); itemCollection.Remove(Accounts); itemCollection.Remove(Priests); itemCollection.Remove(Timeslots); itemCollection.Remove(AppointmentTypes); itemCollection.Remove(Search); itemCollection.Remove(ControlPanel); } else if (Convert.ToInt32(Application.Current.Resources["priv"]) == 4) { //Registrar itemCollection.Remove(Appointments); itemCollection.Remove(Transactions); itemCollection.Remove(Archives); itemCollection.Remove(Reports); itemCollection.Remove(Accounts); itemCollection.Remove(Priests); itemCollection.Remove(Timeslots); itemCollection.Remove(AppointmentTypes); itemCollection.Remove(ControlPanel); } else if (Convert.ToInt32(Application.Current.Resources["priv"]).ToString().Contains("6")) { itemCollection.Remove(Appointments); itemCollection.Remove(Search); itemCollection.Remove(Transactions); itemCollection.Remove(Registers); itemCollection.Remove(Directory); itemCollection.Remove(Archives); itemCollection.Remove(Reports); itemCollection.Remove(Accounts); itemCollection.Remove(Priests); itemCollection.Remove(Timeslots); itemCollection.Remove(AppointmentTypes); itemCollection.Remove(ControlPanel); if (Convert.ToInt32(Application.Current.Resources["priv"]).ToString().Contains("2")) { //Secretary itemCollection.Add(Appointments); } if (Convert.ToInt32(Application.Current.Resources["priv"]).ToString().Contains("3")) { //Cashier itemCollection.Add(Transactions); } if (Convert.ToInt32(Application.Current.Resources["priv"]).ToString().Contains("4")) { //Registrar itemCollection.Add(Search); itemCollection.Add(Registers); itemCollection.Add(Directory); } } }