Esempio n. 1
0
 public ArticleController(ArticleContentService _articleContentService, ArticleCommentService _articleCommentService, ArticleAttentionService _articleAttentionService, ArticleCollectService _articleCollectService, ArticleCategoryService _articleCategoryService)
 {
     this.articleContentService   = _articleContentService;
     this.articleCommentService   = _articleCommentService;
     this.articleAttentionService = _articleAttentionService;
     this.articleCollectService   = _articleCollectService;
     this.articleCategoryService  = _articleCategoryService;
 }
Esempio n. 2
0
        public List <ArticleCategoryInfo> GetAllArticleCategory()
        {
            IArticleCategoryService articleCategoryService = new ArticleCategoryService();
            var data  = articleCategoryService.GetAllArticleCategory().Where(s => s.Depth != 0).ToList();
            var group = ConfigHelper.ListConfig.GetListItems("ArticleCategoryType");

            data.ForEach((s) =>
                         { s.TypeName = group.FirstOrDefault(item => item.Value == s.CategoryType.ToString()).Text; });
            return(data);
        }
Esempio n. 3
0
 public ArticleController(
     ArticleService service,
     IMapper mapper,
     TranslateService translateService,
     ArticleCategoryService categoryService
     )
 {
     this.Service                 = service;
     this.Mapper                  = mapper;
     this.TranslateService        = translateService;
     this._articleCategoryService = categoryService;
 }
Esempio n. 4
0
 public ManualController(
     RegionService regionService,
     NewsCategoryService newsCategoryService,
     ArticleCategoryService articleCategoryService,
     CityService cityService,
     CultureService cultureService
     )
 {
     _cityService            = cityService;
     _regionService          = regionService;
     _articleCategoryService = articleCategoryService;
     _newsCategoryService    = newsCategoryService;
     _cultureService         = cultureService;
 }
Esempio n. 5
0
        public List <ComboTree> GetComboTreeArticleCategory(int id)
        {
            IArticleCategoryService articleCategoryService = new ArticleCategoryService();
            var data = articleCategoryService.GetAllArticleCategory();
            List <ComboTree> result = new List <ComboTree>();

            var root = data.Where(s => s.Depth == id);

            foreach (var articleCategoryInfo in root)
            {
                var comboTree = new ComboTree();
                comboTree.Id       = articleCategoryInfo.Id;
                comboTree.Text     = articleCategoryInfo.Name;
                comboTree.Children = GetComboTreeChildren2(comboTree, articleCategoryInfo, data);
                result.Add(comboTree);
            }
            return(result);
        }
Esempio n. 6
0
        public int DeleteArticleCategoryById(int id)
        {
            // 删除栏目的同时 删除栏目下属的文章
            IArticleCategoryService articleCategoryService = new ArticleCategoryService();

            var articleCategory = articleCategoryService.GetArticleCategoryById(id);

            if (articleCategory != null)
            {
                IArticleService articleService = new ArticleService();
                //WHERE Lft BETWEEN @MyLeft AND @MyRight;
                var all = articleCategoryService.GetAllArticleCategory().Where(s => s.Lft >= articleCategory.Lft && s.Lft <= articleCategory.Rgt);
                foreach (ArticleCategoryInfo articleCategoryInfo in all)
                {
                    articleService.DeleteByCategoryId(articleCategory.Id);
                }
            }

            return(articleCategoryService.Delete(id));
        }
Esempio n. 7
0
        public int UpdateArticleCategoryByCategoryId()
        {
            IArticleCategoryService articleCategoryService = new ArticleCategoryService();
            var model = new ArticleCategoryInfo();

            model.Id       = Convert.ToInt32(HttpContext.Current.Request.Params["ArticleCategoryId"]);
            model.Title    = HttpContext.Current.Request.Params["ArticleCategoryTitle"];
            model.Name     = HttpContext.Current.Request.Params["ArticleCategoryTitle"];
            model.UrlPath  = HttpContext.Current.Request.Params["UrlPath"];
            model.Keywords = HttpContext.Current.Request.Params["ArticleCategoryKeywords"];
            model.MetaDesc = HttpContext.Current.Request.Params["ArticleCategoryMetaDesc"];
            //var parentId = HttpContext.Current.Request.Params["ParentArticleCategory"] ?? "0";
            //model.ParentId = Convert.ToInt32(parentId);
            model.Description = HttpContext.Current.Request.Params["ArticleCategoryDesc"];
            //model.InUserId = 0;
            //model.InDate = DateTime.Now;
            model.EditDate   = DateTime.Now;
            model.EditUserId = 0;
            //model.DisplayOrder = OrderGenerator.NewOrder();
            //model.DataStatus = 1;
            return(articleCategoryService.Update(model));
        }
        /// <summary>
        /// 根据微用户所在行业给微账户添加默认模块
        /// </summary>
        public void addMouduleByRoleid(int roleid, int wid, IArticleCategoryRepository repository)
        {
            var acBll = new ArticleCategoryService(repository);
            //得到模型的实体类集合
            var idList = getModelList(" role_id=" + roleid + " order by sort_id asc");

            //循环给为账户添加行业模块
            for (int i = 0; i < idList.Count; i++)
            {
                var acModel = new ArticleCategoryInfo()
                {
                    title      = idList[i].mName,
                    call_index = "mubanpinyin",
                    wid        = wid,
                    link_url   = idList[i].url,
                    channel_id = 1,
                    sort_id    = MyCommFun.Obj2Int(idList[i].sort_id)
                };
                int resId   = acBll.Add(acModel);
                var upModel = acBll.GetModel(resId);
                upModel.class_list = "," + resId + ",";
                acBll.Update(upModel);
            }
        }
Esempio n. 9
0
 public ArticleCategoriesController(ArticleCategoryService articleCategoryService)
 {
     this.articleCategoryService = articleCategoryService;
 }