Пример #1
0
        /// <summary>
        /// Handles the Load event of the Page control.
        /// </summary>
        /// <param name="sender">The source of the event.</param>
        /// <param name="e">The <see cref="System.EventArgs"/> instance containing the event data.</param>
        protected void Page_Load(object sender, System.EventArgs e)
        {
            //if permissions are turned off, always provide permission
            bool permissionsEnabled = ProfileConfiguration.Instance.EnablePermissions;

            //If user is an admin, always provide permission
            bool isAdmin = SecurityManager.CheckPermission(new string[] { AppRoles.AdminRole }, false);

            //determine which section the control is being used for and then determine if permissions are present
            if (String.Compare(AppId, _CatalogSystemName, StringComparison.OrdinalIgnoreCase) == 0 && String.Compare(ViewId, _CurrentViewName, StringComparison.OrdinalIgnoreCase) == 0)
            {
                if (permissionsEnabled && !isAdmin && !ProfileContext.Current.CheckPermission("catalog:admin:meta:cls:mng:delete"))
                {
                    EditSaveControl.PermissionOverrideHideDeleteButton();
                }
            }
            else if (String.Compare(AppId, _ProfileSystemName, StringComparison.OrdinalIgnoreCase) == 0 && String.Compare(ViewId, _CurrentViewName, StringComparison.OrdinalIgnoreCase) == 0)
            {
                if (permissionsEnabled && !isAdmin && !ProfileContext.Current.CheckPermission("profile:admin:meta:cls:mng:delete"))
                {
                    EditSaveControl.PermissionOverrideHideDeleteButton();
                }
            }
            else if (String.Compare(AppId, _OrderSystemName, StringComparison.OrdinalIgnoreCase) == 0 && String.Compare(ViewId, _CurrentViewName, StringComparison.OrdinalIgnoreCase) == 0)
            {
                if (permissionsEnabled && !isAdmin && !ProfileContext.Current.CheckPermission("order:admin:meta:cls:mng:delete"))
                {
                    EditSaveControl.PermissionOverrideHideDeleteButton();
                }
            }

            ApplyLocalization();

            // bind top toolbar
            MetaToolbar1.ViewName  = this.AppId;
            MetaToolbar1.PlaceName = this.ViewId;
            MetaToolbar1.DataBind();

            tblMetaClass.Visible = false;
            if (!IsPostBack || String.Compare(Request.Form["__EVENTTARGET"], CommandManager.GetCurrent(this.Page).ID, false) == 0)
            {
                BindElement();
            }
        }
Пример #2
0
        /// <summary>
        /// Handles the Load event of the Page control.
        /// </summary>
        /// <param name="sender">The source of the event.</param>
        /// <param name="e">The <see cref="System.EventArgs"/> instance containing the event data.</param>
        protected void Page_Load(object sender, System.EventArgs e)
        {
            //if permissions are turned off, always provide permission
            bool permissionsEnabled = ProfileConfiguration.Instance.EnablePermissions;

            //If user is an admin, always provide permission
            bool isAdmin = SecurityManager.CheckPermission(new string[] { AppRoles.AdminRole }, false);

            //determine which section the control is being used for and then determine if permissions are present
            if (String.Compare(AppId, _CatalogSystemName, true) == 0)
            {
                if (permissionsEnabled && !isAdmin && !ProfileContext.Current.CheckPermission("catalog:admin:meta:fld:mng:delete"))
                {
                    EditSaveControl.PermissionOverrideHideDeleteButton();
                }
            }
            else if (String.Compare(AppId, _ProfileSystemName, true) == 0)
            {
                if (permissionsEnabled && !isAdmin && !ProfileContext.Current.CheckPermission("profile:admin:meta:fld:mng:delete"))
                {
                    EditSaveControl.PermissionOverrideHideDeleteButton();
                }
            }
            else if (String.Compare(AppId, _OrderSystemName, true) == 0)
            {
                if (permissionsEnabled && !isAdmin && !ProfileContext.Current.CheckPermission("order:admin:meta:fld:mng:delete"))
                {
                    EditSaveControl.PermissionOverrideHideDeleteButton();
                }
            }

            ApplyLocalization();
            if (!this.IsPostBack)
            {
                BindData();
                //DataBind();
            }
            //BindData();
            trError.Visible = false;
            InitUI();
        }