Example #1
0
        protected override void OnPreRender(EventArgs e)
        {
            base.OnInit(e);

            if (CurrentUser.IsSuperAdmin)// || CurrentUser.IsAdmin
            {
                this.Visible = true;
            }
            else
            {
                DataTable dt = CommandController.GetRoleForUserByPortalID(CurrentUser.UserID, ConvertUtility.ToInt32(AppEnv.PortalId()));

                if (dt.Rows.Count > 0)
                {
                    if (dt.Rows.Count > 1)
                    {
                        pmsRole  = ConvertUtility.ToBoolean(dt.Rows[0]["Role_Delete"]);
                        pmsRole1 = ConvertUtility.ToBoolean(dt.Rows[1]["Role_Delete"]);

                        if (!pmsRole && !pmsRole1)
                        {
                            this.Visible = false;
                        }
                        else
                        {
                            this.Visible = true;
                        }
                    }
                    else
                    {
                        pmsRole = ConvertUtility.ToBoolean(dt.Rows[0]["Role_Delete"]);
                        if (!pmsRole)
                        {
                            this.Visible = false;
                        }
                        else
                        {
                            this.Visible = true;
                        }
                    }
                }
                else
                {
                    this.Visible = false;
                }
            }
        }