Esempio n. 1
0
        private void TimetableVisibility()
        {
            string currentRole = LoginAuth.displayRole();

            if (currentRole == "admin")
            //admin = Manager Role
            {
                eventsDataGrid.Visibility  = Visibility.Visible;
                accessDeniedlbl.Visibility = Visibility.Hidden;
            }
            if (currentRole == "user")
            //user = Labourer Role
            {
                eventsDataGrid.Visibility  = Visibility.Hidden;
                accessDeniedlbl.Visibility = Visibility.Visible;
            }
        }
        //Displaying buttons accordingly to user's role
        private void ButtonsVisibility()
        {
            //Getting the logged in user's role (admin or user)
            string currentRole = LoginAuth.displayRole();

            //admin = Manager Role
            if (currentRole == "admin")
            {
                //Display all buttons
                Button_Crops_Cultivation.Visibility = Visibility.Visible;
                Button_Fertiliser_Plan.Visibility   = Visibility.Visible;
                Button_Fertiliser_Stock.Visibility  = Visibility.Visible;
            }
            //user = Labourer Role
            if (currentRole == "user")
            {
                //Display only one button, "Fertiliser Plan"
                Button_Crops_Cultivation.Visibility = Visibility.Hidden;
                Button_Fertiliser_Plan.Visibility   = Visibility.Visible;
                Button_Fertiliser_Stock.Visibility  = Visibility.Hidden;
            }
        }