/// <summary>
        /// 查找子类别,并且将文章所属的类别前面的复选框选中
        /// </summary>
        /// <returns></returns>
        public ActionResult ShowChildClass()
        {
            int classId   = int.Parse(Request["classId"]);   //父类别编号
            int articelId = int.Parse(Request["articelId"]); //文章编号
                                                             //找出父类下的子类
            var childClassList = ArticelClassService.LoadEntities(a => a.ParentId == classId);
            //获取文章的类别。
            var articelInfo      = ArticelService.LoadEntities(a => a.ID == articelId).FirstOrDefault();
            var articelClassList = from a in articelInfo.ArticelClass
                                   select a.ID;
            List <ArticelClassModel> list = new List <ArticelClassModel>();

            foreach (var childClass in childClassList)
            {
                if (articelClassList.Contains(childClass.ID))
                {
                    ArticelClassModel articelClassModel = new ArticelClassModel();
                    articelClassModel.Checked = true;
                    articelClassModel.Id      = childClass.ID;
                    articelClassModel.Text    = childClass.ClassName;
                    list.Add(articelClassModel);
                }
                else
                {
                    ArticelClassModel articelClassModel = new ArticelClassModel();
                    articelClassModel.Id   = childClass.ID;
                    articelClassModel.Text = childClass.ClassName;
                    list.Add(articelClassModel);
                }
            }
            var temp = from a in list
                       select new { id = a.Id, text = a.Text, @checked = a.Checked };

            return(Json(temp, JsonRequestBehavior.AllowGet));
        }
        /// <summary>
        /// 获取根类别信息,填充Tree
        /// </summary>
        /// <returns></returns>
        public ActionResult GetArticelClass()
        {
            var articelClassList = ArticelClassService.LoadEntities(a => a.ParentId == 0);
            var temp             = from a in articelClassList
                                   select new { id = a.ID, text = a.ClassName };

            return(Json(temp, JsonRequestBehavior.AllowGet));
        }
        /// <summary>
        /// 加载新闻类别
        /// </summary>
        /// <returns></returns>
        private string LoadArticelClassList()
        {
            var           articelParentClassList = ArticelClassService.LoadEntities(a => a.ParentId == 0);
            StringBuilder sb = new StringBuilder();

            foreach (var articelParentClass in articelParentClassList)
            {
                sb.Append("<option value='" + articelParentClass.ID + "'>" + "--" + articelParentClass.ClassName + "</option>");
                var articelChildClassList = ArticelClassService.LoadEntities(a => a.ParentId == articelParentClass.ID);
                foreach (var childClass in articelChildClassList)
                {
                    sb.Append("<option value=" + childClass.ID + ">" + "----" + childClass.ClassName + "</option>");
                }
            }
            return(sb.ToString());
        }