Beispiel #1
0
    private void SetUpDisplayInformation()
    {
        AdminHelper admin             = AdminHelper.LoadByUserName(Page.User.Identity.Name);
        bool        canViewProduct    = admin.CanViewPage(_productPage);
        bool        canViewCategory   = admin.CanViewPage(_categoryPage);
        bool        canViewDepartment = admin.CanViewPage(_departmentPage);

        if (!canViewProduct)
        {
            uxProductLiteral.Visible           = false;
            uxAllProductLink.Visible           = false;
            uxOutOfStockLiteral.Visible        = false;
            uxAllProductOnLowStockLink.Visible = false;
            uxProductInactiveLiteral.Visible   = false;
            uxAllProductInactiveLink.Visible   = false;
        }
        if (!canViewCategory)
        {
            uxCategoryLiteral.Visible = false;
            uxAllCategoryLink.Visible = false;
        }
        if (!canViewDepartment)
        {
            uxDepartmentLiteral.Visible = false;
            uxAllDepartmentLink.Visible = false;
        }
        if (!canViewProduct && !canViewCategory && !canViewDepartment)
        {
            uxNoPermissionLabel.Text = "You do not have permission to view this section";
        }
    }
Beispiel #2
0
    private void SetupDisplayBox()
    {
        AdminHelper admin = AdminHelper.LoadByUserName(Page.User.Identity.Name);

        if (!admin.CanViewPage(_orderPage))
        {
            Div1.Visible = false;
            Div3.Visible = false;
        }

        if (!admin.CanViewPage(_customerPage))
        {
            Div2.Visible = false;
        }

        if (!admin.CanViewPage(_productPage))
        {
            Div4.Visible = false;
        }
        if (!admin.CanViewPage(_categoryPage))
        {
            Div4.Visible = false;
        }
        if (!admin.CanViewPage(_departmentPage))
        {
            Div4.Visible = false;
        }
    }
Beispiel #3
0
    private void SetExportViewPermission()
    {
        AdminHelper admin = AdminHelper.LoadByUserName(Page.User.Identity.Name);

        if (!admin.CanViewPage(_exportCustomerPage))
        {
            uxTabContainer.Tabs[_exportCustomerTabIndex].Enabled = false;
        }
        if (!admin.CanViewPage(_exportOrderPage))
        {
            uxTabContainer.Tabs[_exportOrderTabIndex].Enabled = false;
        }
    }
Beispiel #4
0
    private void SetupDisplayBox()
    {
        AdminHelper admin = AdminHelper.LoadByUserName(Page.User.Identity.Name);

        if (!admin.CanViewPage(_orderPage))
        {
            uxTabContainerReport.Visible = false;
            uxTabLastestOrder.Visible    = false;
            uxTabBestSeller.Visible      = false;
        }

        if (!admin.CanViewPage(_customerPage))
        {
            uxTabNewCustomers.Visible = false;
        }
    }
Beispiel #5
0
        private void PrivateLoadMainControl()
        {
            AdminHelper admin = AdminHelper.LoadByUserName(_page.User.Identity.Name);

            if (!admin.CanViewPage(_page.LastControl))
            {
                AdminErrorMainControl.Header  = "AdminError";
                AdminErrorMainControl.Message =
                    String.Format("You do not have permission to access "{0}"", _page.LastControl);
                _page.LastControl       = "AdminError.ascx";
                _page.QueryString       = "";
                _page.IsControlPostback = false;
            }

            PlaceHolder myPanel = (PlaceHolder)_page.FindControl("uxContentPlaceHolder");

            myPanel.Controls.Clear();
            if (!String.IsNullOrEmpty(_page.LastControl))
            {
                UserControl uc = (UserControl)_page.LoadControl(
                    String.Format("MainControls/{0}", _page.LastControl));
                uc.ID = "dummyControlID";
                myPanel.Controls.Add(uc);
            }

            AddHistoryEntry(_page.LastControl, _page.QueryString);
        }
Beispiel #6
0
        protected bool IsAdminViewable(string pageUrl)
        {
            AdminHelper admin = AdminHelper.LoadByUserName(Page.User.Identity.Name);

            return(admin.CanViewPage(pageUrl));
        }