Exemplo n.º 1
0
        /// <summary>
        /// 【视图】查看文章
        /// </summary>
        /// <returns></returns>
        public ViewResult Show(string NavID)
        {
            Navigation_S model = _NavigationFacade.Value.GetByID <Navigation_S>(NavID);

            model.VC_COLUMN_NAME = _NavigationFacade.Value.GetColumnNameByColumnId(model.N_COLUMN_ID);
            return(View(model));
        }
Exemplo n.º 2
0
        /// <summary>
        /// 根据key获得导航信息
        /// </summary>
        /// <returns></returns>
        public JsonResult _GetSingleNav(string key = "", int limits = 5)
        {
            if (string.IsNullOrEmpty(key))
            {
                return(Json(AjaxResult.Error("参数错误")));
            }
            try
            {
                Navigation_S ns = _NavigationFacade.Value.GetNavByKey(key);

                List <Article_S> list = _ArticleFacade.Value.GetTopArticleByColumnID("70010004", 5);

                var result = new
                {
                    obj  = ns,
                    data = list
                };


                return(Json(AjaxResult.Success(result)));
            }
            catch (Exception ex)
            {
                return(Json(AjaxResult.Error(ex.Message)));
            }
        }
Exemplo n.º 3
0
        /// <summary>
        /// 【视图】新增栏目
        /// </summary>
        /// <returns></returns>
        public ViewResult Add(string pid, string columnid)
        {
            ViewBag.FunType = DictionaryshipFactory.Instance.GetDictSelectList(DictParam.FunType);
            Navigation_S model = new Navigation_S();

            if (pid == "root")
            {
                model = new Navigation_S()
                {
                    N_SUPER_NAVIGATION_ID = "0", VC_SUPER_NAVIGATION_NAME = "", N_COLUMN_ID = columnid
                };
            }
            else
            {
                var column = _NavigationFacade.Value.GetColumnByKey(columnid);
                var perNav = _NavigationFacade.Value.GetByID <Navigation_S>(pid);
                model = new Navigation_S()
                {
                    N_SUPER_NAVIGATION_ID = pid, VC_SUPER_NAVIGATION_NAME = perNav.VC_NAVIGATION_NAME, N_COLUMN_ID = columnid
                };
            }
            ViewBag.ActionUrl = "_Add";
            ViewBag.OperType  = "Add";
            return(View(model));
        }
Exemplo n.º 4
0
        /// <summary>
        /// 【视图】栏目列表
        /// </summary>
        /// <returns></returns>
        public ViewResult List(string selfkey)
        {
            Navigation_S model = new Navigation_S();

            model.N_COLUMN_ID = selfkey;
            return(View(model));
        }
Exemplo n.º 5
0
        /// <summary>
        /// 【视图】编辑导航
        /// </summary>
        /// <returns></returns>
        public ViewResult Edit(string id)
        {
            Navigation_S model  = _NavigationFacade.Value.GetByID <Navigation_S>(id);
            var          perNav = _NavigationFacade.Value.GetByID <Navigation_S>(model.N_SUPER_NAVIGATION_ID);

            //model.VC_COLUMN_NAME = _NavigationFacade.Value.GetColumnNameByColumnId(model.N_COLUMN_ID);
            model.VC_SUPER_NAVIGATION_NAME = perNav.VC_NAVIGATION_NAME;
            ViewBag.ActionUrl = "_Edit";
            ViewBag.OperType  = "Edit";
            return(View("Add", model));
        }
Exemplo n.º 6
0
        /// <summary>
        /// 根据标识获得导航
        /// </summary>
        /// <returns></returns>
        public Navigation_S GetNavByKey(string key)
        {
            using (var factory = new BaseAccess())
            {
                NavigationEntity Column = factory.GetSingle <NavigationEntity>(Specification <NavigationEntity> .Create(c => c.N_NAV_CODE == key));

                if (Column != null)
                {
                    Navigation_S ss = new Navigation_S();

                    Column.Adapter <Navigation_S>(ss);

                    return(Column.Adapter <Navigation_S>(new Navigation_S()));
                }

                return(new Navigation_S());
            }
        }
Exemplo n.º 7
0
 /// <summary>
 /// 新增
 /// </summary>
 /// <param name="menu"></param>
 /// <returns></returns>
 public JsonResult _Add(Navigation_S nav)
 {
     try
     {
         nav.N_NAV_CODE = Regex.Replace(Pinyin.GetPinyin(nav.VC_NAVIGATION_NAME), @"\s", "");
         _NavigationFacade.Value.Add(nav);
         var model = (new
         {
             id = nav.ID,
             pId = nav.N_SUPER_NAVIGATION_ID == "0" ? "root" : nav.N_SUPER_NAVIGATION_ID,
             name = nav.VC_NAVIGATION_NAME,
             orderno = nav.N_ORDER_NO,
             columnid = nav.N_COLUMN_ID,
             title = nav.VC_NAVIGATION_NAME,
             navcode = nav.N_NAV_CODE
         });
         return(Json(AjaxResult.Success(model, "导航新增成功!")));
     }
     catch (Exception ex)
     {
         return(Json(AjaxResult.Error("导航新增失败!错误原因:" + ex.Message)));
     }
 }