public override SiteMapNode BuildSiteMap()
        {
            //lock (this)
            //{
            // Return immediately if this method has been called before

            if (HttpContext.Current.Session["_root_" + System.Web.HttpContext.Current.User.Identity.Name] != null)
            {
                _root = (SiteMapNode)(HttpContext.Current.Session["_root_" + System.Web.HttpContext.Current.User.Identity.Name]);
            }
            if ((_root != null))
            {
                return(_root);
            }
            try
            {
                this.Clear();
                Controller.AccomodationSVC AccSvc     = new Controller.AccomodationSVC();
                List <MDMSVC.DC_SiteMap>   objSiteMap = AccSvc.GetSiteMapByUserRole(System.Web.HttpContext.Current.User.Identity.Name);
                objSiteMap = (from s in objSiteMap orderby s.ID select s).ToList();
                if (objSiteMap != null)
                {
                    if (objSiteMap.Count > 0)
                    {
                        int iCounter = 1;
                        foreach (MDMSVC.DC_SiteMap SM in objSiteMap)
                        {
                            // Create the root SiteMapNode and add it to
                            // the site map
                            if (iCounter == 1)
                            {
                                _nodes.Clear();
                                _root = CreateSiteMapNode(SM);
                                AddNode(_root, null);
                            }
                            else
                            {
                                // Create another site map node and
                                // add it to the site map
                                SiteMapNode node = CreateSiteMapNode(SM);
                                AddNode(node, GetParentNode(SM));
                            }

                            iCounter++;
                        }
                    }
                }
            }
            catch
            {
                throw new ProviderException(_errmsg8);
            }

            // Return the root SiteMapNode
            HttpContext.Current.Session["_root_" + System.Web.HttpContext.Current.User.Identity.Name] = _root;
            return(_root);
            //}
        }
示例#2
0
        private List <MDMSVC.DC_SiteMap> GetData()
        {
            try
            {
                Controller.AccomodationSVC AccSvc = new Controller.AccomodationSVC();
                if (String.IsNullOrWhiteSpace(System.Web.HttpContext.Current.User.Identity.Name))
                {
                    Response.Redirect("/Account/Login", true);
                }

                Label LoggedInUser = (Label)LoginViewForSiteMap.FindControl("lblLoggedInUser");
                LoggedInUser.Text = System.Web.HttpContext.Current.User.Identity.Name;
                List <MDMSVC.DC_SiteMap> objSiteMap = AccSvc.GetSiteMapByUserRole(System.Web.HttpContext.Current.User.Identity.Name);
                objSiteMap = (from s in objSiteMap where s.ID != 1 orderby s.ID select s).ToList();
                return(objSiteMap);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }