Exemplo n.º 1
0
 public static void ShowLoginedMenu(string Username)
 {
     if (PanelLogin != null)
     {
         PanelLogin.Visibility = Visibility.Visible;
     }
     if (ProfileButton != null)
     {
         ProfileButton.Visibility = Visibility.Visible;
         ProfileButton.Content    = Username;
     }
     if (AuthorizationButton != null && Config.Manager.CURRENT_USER != null)
     {
         if (FeatureAttributeService.isAuthorized(FeatureNameUtils.Authorization.MANAGEMENT, FeatureNameUtils.FeatureGroup.AUTHORIZATION))
         {
             AuthorizationButton.Visibility = Visibility.Visible;
         }
         else
         {
             AuthorizationButton.Visibility = Visibility.Collapsed;
         }
     }
 }
Exemplo n.º 2
0
        private void ListViewMenu_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            UserControl usc          = null;
            bool        isAuthorized = false;

            if (ListViewMenu.SelectedIndex == -1)
            {
                return;
            }
            switch (((ListViewItem)((ListView)sender).SelectedItem).Name)
            {
            case "Book":
                if (FeatureAttributeService.isAuthorized(typeof(BookManagementControl)))
                {
                    if (!isShowed(typeof(BookManagementControl)))
                    {
                        usc = new BookManagementControl();
                        GridMain.Children.Clear();
                        GridMain.Children.Add(usc);
                    }
                    isAuthorized = true;
                }
                break;

            case "Customer":
                if (FeatureAttributeService.isAuthorized(typeof(MemberManagement)))
                {
                    if (!isShowed(typeof(MemberManagement)))
                    {
                        usc = new MemberManagement();
                        GridMain.Children.Clear();
                        GridMain.Children.Add(usc);
                    }
                    isAuthorized = true;
                }
                break;

            case "Staff":
                if (FeatureAttributeService.isAuthorized(typeof(StaffManagement)))
                {
                    if (!isShowed(typeof(StaffManagement)))
                    {
                        usc = new StaffManagement();
                        GridMain.Children.Clear();
                        GridMain.Children.Add(usc);
                    }
                    isAuthorized = true;
                }
                break;

            case "Provider":
                if (FeatureAttributeService.isAuthorized(typeof(ProviderManagementControl)))
                {
                    if (!isShowed(typeof(ProviderManagementControl)))
                    {
                        usc = new ProviderManagementControl();
                        GridMain.Children.Clear();
                        GridMain.Children.Add(usc);
                    }
                    isAuthorized = true;
                }
                break;

            case "Publisher":
                if (FeatureAttributeService.isAuthorized(typeof(PublisherManagementControl)))
                {
                    if (!isShowed(typeof(PublisherManagementControl)))
                    {
                        usc = new PublisherManagementControl();
                        GridMain.Children.Clear();
                        GridMain.Children.Add(usc);
                    }
                    isAuthorized = true;
                }
                break;

            case "Category":
                if (FeatureAttributeService.isAuthorized(typeof(CategoryManagementControl)))
                {
                    if (!isShowed(typeof(CategoryManagementControl)))
                    {
                        usc = new CategoryManagementControl();
                        GridMain.Children.Clear();
                        GridMain.Children.Add(usc);
                    }
                    isAuthorized = true;
                }
                break;

            case "Author":
                if (FeatureAttributeService.isAuthorized(typeof(AuthorManagementControl)))
                {
                    if (!isShowed(typeof(AuthorManagementControl)))
                    {
                        usc = new AuthorManagementControl();
                        GridMain.Children.Clear();
                        GridMain.Children.Add(usc);
                    }
                    isAuthorized = true;
                }
                break;

            case "Transaction":
                if (FeatureAttributeService.isAuthorized(typeof(TransactionManagementControl)))
                {
                    if (!isShowed(typeof(TransactionManagementControl)))
                    {
                        usc = new TransactionManagementControl();
                        GridMain.Children.Clear();
                        GridMain.Children.Add(usc);
                    }
                    isAuthorized = true;
                }
                break;

            default:
                break;
            }
            if (!isAuthorized)
            {
                MessageBox.Show("You are not authorized for this feature!");
            }
            ListViewMenu.SelectedIndex = -1;
        }