private void createmenuinside(DataTable dtMenuItem)
 {
     RadPanelItem newParentItem = new RadPanelItem();
     RadPanelItem newChildItem = new RadPanelItem();
     newParentItem.Text = dtMenuItem.Rows[0]["PROGRAM_TYPE_NAME"].ToString();
     newParentItem.Expanded = true;
     RadMenu myMenu = new RadMenu();
     myMenu.Width = Unit.Percentage(100);
     myMenu.Flow = ItemFlow.Vertical;
     myMenu.Skin = "Sitefinity";
     myMenu.EnableEmbeddedSkins =true;
     myMenu.DataTextField = "PROGRAM_SUB_NAME";
     myMenu.DataFieldID = "PROGRAM_SUB_ID";
     myMenu.DataFieldParentID = "PARENT_ID";
     myMenu.DataNavigateUrlField = "PROGRAM_NAME";
     myMenu.DataSource = dtMenuItem;
     myMenu.DataBind();
     newChildItem.Controls.Add(myMenu);
     newParentItem.Items.Add(newChildItem);
     RadPanelBar2.Items.Add(newParentItem);
     foreach (RadMenuItem myItems in myMenu.GetAllItems())
     {
         myItems.Width = Unit.Percentage(100);
     }
 }
Beispiel #2
0
        protected void roleCheck(RadMenu map)
        {
            String redirectUrl = "~/Pages/UnAuthorised.aspx";
            String currentUrl  = HttpContext.Current.Request.Url.AbsolutePath;

            MembershipUser member = Membership.GetUser();
            String         userId = member.ProviderUserKey.ToString().ToLower();

            IList <RadMenuItem> siteMapList = map.GetAllItems();

            List <String> roles = dc.userRoles.Where(c => c.userId.ToString().ToLower().Equals(userId)).Select(c => c.roleCode).ToList();

            if (!roles.Contains("CERT_USER") && !roles.Contains("CERT_VLUSER") && !roles.Contains("CERT_ACTMNG"))
            {
                var siteMapNode = siteMapList.Where(c => c.NavigateUrl.EndsWith("/Pages/DeliveryDetails.aspx")).FirstOrDefault();
                if (siteMapNode != null)
                {
                    siteMapNode.Remove();
                    if (currentUrl.Contains("DeliveryDetails.aspx"))
                    {
                        Response.Redirect(redirectUrl);
                    }
                }
            }

            if (!roles.Contains("CERT_ACTMNG"))
            {
                var siteMapNode = siteMapList.Where(c => c.NavigateUrl.EndsWith("/Pages/CustomerAccounts.aspx")).FirstOrDefault();
                if (siteMapNode != null)
                {
                    siteMapNode.Remove();
                    if (currentUrl.Contains("CustomerAccounts.aspx"))
                    {
                        Response.Redirect(redirectUrl);
                    }
                }
            }

            if (!roles.Contains("DOP_USER") && !roles.Contains("DOP_ADMIN"))
            {
                var siteMapNode = siteMapList.Where(c => c.NavigateUrl.EndsWith("/Pages/DOP/DOPDetails.aspx")).FirstOrDefault();
                if (siteMapNode != null)
                {
                    siteMapNode.Remove();
                    if (currentUrl.Contains("DOPDetails.aspx"))
                    {
                        Response.Redirect(redirectUrl);
                    }
                }
            }
        }
Beispiel #3
0
    /// <summary>
    /// Gets the RadMenuItem in the menu that has the specified module code
    /// </summary>
    /// <param name="radMenu"></param>
    /// <param name="moduleCode"></param>
    /// <returns></returns>
    private RadMenuItem FindItemByModuleCode(RadMenu mnuMain, string moduleCode)
    {
        //Get all items in the menu
        ArrayList menuItems = mnuMain.GetAllItems();

        //For each IndMenuItem
        foreach (IndMenuItem menuItem in menuItems)
        {
            if (menuItem.ModuleCode == moduleCode)
            {
                return(menuItem);
            }
        }
        return(null);
    }
Beispiel #4
0
        protected void roleCheck(RadMenu map)
        {
            String redirectUrl = "~/Pages/UnAuthorised.aspx";
              String currentUrl = HttpContext.Current.Request.Url.AbsolutePath;

              MembershipUser member = Membership.GetUser();
              String userId = member.ProviderUserKey.ToString().ToLower();

              IList<RadMenuItem> siteMapList = map.GetAllItems();

              List<String> roles = dc.userRoles.Where(c => c.userId.ToString().ToLower().Equals(userId)).Select(c => c.roleCode).ToList();

              if (!roles.Contains("CERT_USER") && !roles.Contains("CERT_VLUSER") && !roles.Contains("CERT_ACTMNG"))
              {
            var siteMapNode = siteMapList.Where(c => c.NavigateUrl.EndsWith("/Pages/DeliveryDetails.aspx")).FirstOrDefault();
            if (siteMapNode != null)
            {
              siteMapNode.Remove();
              if (currentUrl.Contains("DeliveryDetails.aspx"))
              {
            Response.Redirect(redirectUrl);
              }
            }
              }

              if (!roles.Contains("CERT_ACTMNG"))
              {
            var siteMapNode = siteMapList.Where(c => c.NavigateUrl.EndsWith("/Pages/CustomerAccounts.aspx")).FirstOrDefault();
            if (siteMapNode != null)
            {
              siteMapNode.Remove();
              if (currentUrl.Contains("CustomerAccounts.aspx"))
              {
            Response.Redirect(redirectUrl);
              }
            }
              }

              if (!roles.Contains("DOP_USER") && !roles.Contains("DOP_ADMIN"))
              {
            var siteMapNode = siteMapList.Where(c => c.NavigateUrl.EndsWith("/Pages/DOP/DOPDetails.aspx")).FirstOrDefault();
            if (siteMapNode != null)
            {
              siteMapNode.Remove();
              if (currentUrl.Contains("DOPDetails.aspx"))
              {
            Response.Redirect(redirectUrl);
              }
            }
              }
        }
Beispiel #5
0
        protected void RadMenuMain_DataBound(object sender, EventArgs e)
        {
            string  redirectUrl = "~/Pages/UnAuthorised.aspx";
            RadMenu map         = (RadMenu)sender;

            IList <RadMenuItem> siteMapList = map.GetAllItems();
            MembershipUser      member      = Membership.GetUser();

            string id = member.ProviderUserKey.ToString().ToLower();

            List <userRole> roles      = dc.userRoles.Where(c => c.userId.ToString().ToLower().Equals(id)).ToList();
            String          currentUrl = HttpContext.Current.Request.Url.AbsolutePath;



            Guid idUser = (Guid)member.ProviderUserKey;

            userSetting setting = dc.userSettings.Where(c => c.userId.Equals(idUser)).Select(c => c).SingleOrDefault();

            int businessPartnerId = dc.contactPersons.Where(c => c.userId.Equals(idUser)).Select(c => c.businessPartnerId).SingleOrDefault();

            if (setting == null)
            {
                var siteMapNode = siteMapList.Where(c => c.NavigateUrl.EndsWith("/Pages/UserAccounts.aspx")).FirstOrDefault();
                if (siteMapNode != null)
                {
                    siteMapNode.Remove();
                    if (currentUrl.Contains("UserAccounts.aspx"))
                    {
                        Response.Redirect(redirectUrl);
                    }
                }
            }
            else if (setting.siteAdmin == false)
            {
                var siteMapNode = siteMapList.Where(c => c.NavigateUrl.EndsWith("/Pages/UserAccounts.aspx")).FirstOrDefault();
                if (siteMapNode != null)
                {
                    siteMapNode.Remove();
                    if (currentUrl.Contains("UserAccounts.aspx"))
                    {
                        Response.Redirect(redirectUrl);
                    }
                }

                List <String> DeliveryDetailsRoles = new List <string>()
                {
                    "CERT_USER", "CERT_VLUSER", "CERT_ACTMNG"
                };
                if (!roles.Any(c => DeliveryDetailsRoles.Contains(c.roleCode)))
                {
                    siteMapNode = siteMapList.Where(c => c.NavigateUrl.EndsWith("/Pages/DeliveryDetails.aspx")).FirstOrDefault();
                    if (siteMapNode != null)
                    {
                        siteMapNode.Remove();
                        if (currentUrl.Contains("DeliveryDetails.aspx"))
                        {
                            Response.Redirect(redirectUrl);
                        }
                    }
                }
                roleCheck(map);
            }
            //CERT_ACTMNG
        }