private void LoadMenuTreeNode(bjf_articletype item, ProductCategoryTreeNode treeNode) { if (item == null) { return; } var currentNode = new ProductCategoryTreeNode(); currentNode.Id = item.id; currentNode.key = item.id.ToString(); currentNode.expanded = true; currentNode.folder = false; currentNode.title = item.title; currentNode.ParentId = item.parentid; if (item.parentid == 0) { currentNode.IsAddButtonForNextLevel = true; } currentNode.SortCode = item.id; treeNode.children.Add(currentNode); List <bjf_articletype> groupmentList = ArticleTypeManager.GetInstance().SelectList(m => m.isdelete == false && m.parentid == item.id); if (groupmentList.Count > 0) { foreach (var childItem in groupmentList) { this.LoadMenuTreeNode(childItem, currentNode); } } }
public ActionResult SubmitSave(bjf_articletype item) { try { if (item.id == 0) //表示添加 { item.createid = Convert.ToInt32(SessionHelper.GetSession("userid")); item.updateid = Convert.ToInt32(SessionHelper.GetSession("userid")); item.createtime = DateTime.Now; item.updatetime = DateTime.Now; ArticleTypeManager.GetInstance().Add(item); ArticleTypeManager.GetInstance().Save(); } if (item.id > 0) { var model = ArticleTypeManager.GetInstance().GetModel(item.id); model.updateid = Convert.ToInt32(SessionHelper.GetSession("userid")); model.updatetime = DateTime.Now; model.title = item.title; model.parentid = item.parentid; model.comment = item.comment; ArticleTypeManager.GetInstance().Update(model); ArticleTypeManager.GetInstance().Save(); } return(Json(new { state = 0, msg = "操作成功" })); } catch (Exception ex) { return(Json(new { state = 1, msg = ex.Message })); } }