Beispiel #1
0
        public ActionResult SitemapMenu(Guid id)
        {
            SiteMapMenu model = new SiteMapMenu();

            model = _cmsRepository.getSiteMapMenu(id);

            return(PartialView("SiteMapMenuGroup", model));
        }
        public ActionResult Index()
        {
            string url = HttpContext.Request.Url.AbsoluteUri;

            url = Regex.Replace(url, @"(\?|&)Token=.*", "", RegexOptions.IgnoreCase);
            ViewBag.UpdateUrl = string.Format("http://passport.wuxiapptec.sh.cn/MyInfoUpdate.aspx?BackURL={0}", url);
            ViewBag.Time      = DateTime.Now.ToString("yyyyMMddHHmmss");
            SiteMapMenu msn = _mss.GetMap();

            ViewBag.MapNodes = msn;
            return(View());
        }
Beispiel #3
0
 public ActionResult SaveSitemapMenu(SiteMapMenu model)
 {
     if (ModelState.IsValid)
     {
         var res = _cmsRepository.createOrUpdateSiteMapMenu(model);
         if (res)
         {
             return(PartialView("Modal/Success"));
         }
     }
     return(PartialView("Modal/Error"));
 }
Beispiel #4
0
        /*
         * public void ProcessRequest(HttpContext context)
         * {
         *  context.Response.ContentType = "text/plain";
         *  context.Response.Write("Hello World");
         * }
         */


        IEnumerable <SiteMapMenu> GetMenuList(SiteMapMenu menu)
        {
            foreach (var node in menu.Children)
            {
                yield return(new SiteMapMenu {
                    Url = node.Url
                });

                foreach (var childNode in GetMenuList(node))
                {
                    yield return(new SiteMapMenu {
                        Url = childNode.Url
                    });
                }
            }
        }
        /// <summary>
        /// Добавляем меню в карту сайта
        /// </summary>
        /// <param name="item">Элемент карты сайта</param>
        /// <returns></returns>
        public override bool createOrUpdateSiteMapMenu(SiteMapMenu item)
        {
            using (var db = new CMSdb(_context))
            {
                using (var tran = db.BeginTransaction())
                {
                    var query = db.content_sitemap_menuss.Where(w => w.id.Equals(item.Id));
                    if (!query.Any())
                    {
                        var sortMax = db.content_sitemap_menuss.Select(s => s.n_sort);

                        int max = sortMax.Any() ? sortMax.Max() + 1 : 1;

                        db.content_sitemap_menuss
                        .Value(v => v.c_title, item.Text)
                        .Value(v => v.n_sort, max)
                        .Insert();
                    }
                    else
                    {
                        db.content_sitemap_menuss
                        .Where(w => w.id.Equals(item.Id))
                        .Set(u => u.c_title, item.Text)
                        .Update();
                    }


                    var log = new LogModel()
                    {
                        Site     = _domain,
                        Section  = LogSection.SiteMap,
                        Action   = LogAction.update,
                        PageId   = item.Id,
                        PageName = item.Text,
                        UserId   = _currentUserId,
                        IP       = _ip,
                    };
                    insertLog(log);

                    tran.Commit();
                    return(true);
                }
            }
        }
Beispiel #6
0
 public abstract bool createOrUpdateSiteMapMenu(SiteMapMenu item);