コード例 #1
0
        protected void BrandIdDropdown_SelectedIndexChanged(object sender, EventArgs e)
        {
            CategoryDropDownList.RefreshFromBrand(BrandIdDropdown.SelectedId);

            UploadUserDropDownList.BrandId = BrandIdDropdown.SelectedId;
            UploadUserDropDownList.RefreshFromDataSource();
        }
コード例 #2
0
        protected void Page_Init(object sender, EventArgs e)
        {
            // Only super admins can bulk delete assets
            BulkDeleteButton1.Visible = BulkDeleteButton2.Visible = (CurrentUser.UserRole == UserRole.SuperAdministrator);

            // Wire up asset repeater events
            AssetList1.Delete      += new CommandEventHandler(DeleteLinkButton_OnCommand);
            AssetList1.SortChanged += new CommandEventHandler(SortListLinkButton_Command);

            // Add event handlers for brand dropdowns, as we need to change the upload user dropdown accordingly
            BrandIdDropdown.SelectedIndexChanged += new EventHandler(BrandIdDropdown_SelectedIndexChanged);

            if (!Page.IsPostBack)
            {
                // Only show brand selector to super-admins when there is more than one brand available
                BrandSelectorWrapper.Visible = (CurrentUser.UserRole == UserRole.SuperAdministrator && BrandCache.Instance.GetList().Count > 1);

                // Only show users who are at least upload users
                UploadUserDropDownList.MinimumUserRoleId = Convert.ToInt32(UserRole.UploadUser);

                switch (CurrentUser.UserRole)
                {
                case (UserRole.SuperAdministrator):

                    // Super admins can do everything.  No need to restrict the UI here
                    // The UploadUserDropDownList will show all upload users

                    break;

                case (UserRole.BrandAdministrator):

                    // Brand Administrators should only see upload users or above
                    // in their own Brand, so filter the UploadUserDropdown here.

                    UploadUserDropDownList.BrandId = CurrentUser.PrimaryBrandId;

                    break;

                case (UserRole.UploadUser):

                    // Neither the brand or upload user selectors are available
                    // to upload users, so we do not need to do anything here

                    break;
                }

                UploadUserDropDownList.RefreshFromDataSource();
            }
        }