示例#1
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);
            }
        }