/// <summary> /// </summary> /// <param name="Id"></param> /// <param name="flag">0:新增 1: 修改</param> /// <returns></returns> public ActionResult EditNotesSort(int Id = 0, int flag = 0) { var noteSort = new Sys_NotesSort(); if (Id != 0) { noteSort = _notesManager.GetNotesSort(Id); } if (flag == 1) //编辑 选中的接点 { if (noteSort != null) { if (noteSort.ParentID == 0) { ViewBag.ParentName = CurrentTenant.TenantName; } else { Sys_NotesSort temp = _notesManager.GetNotesSort(noteSort.ParentID); if (temp == null) { ViewBag.ParentName = CurrentTenant.TenantName; } else { ViewBag.ParentName = temp.SortName; } } } return(View(noteSort)); } var tempAdd = new Sys_NotesSort(); tempAdd.ParentID = Id; Sys_NotesSort tempParent = _notesManager.GetNotesSort(noteSort.Id); if (tempParent == null) { ViewBag.ParentName = NoteLanguage.AllCategories; } else { ViewBag.ParentName = tempParent.SortName; } return(View(tempAdd)); }
/// <summary> /// 递归获取子节点 /// </summary> /// <param name="dept"></param> /// <param name="all"></param> /// <returns></returns> private EasyuiTreeNode AddChild(Sys_NotesSort notsSort, IEnumerable <Sys_NotesSort> all) { var node = new EasyuiTreeNode { id = notsSort.Id.ToString(), text = notsSort.SortName }; IEnumerable <Sys_NotesSort> tmp = all.Where(p => p.ParentID == notsSort.Id); if (tmp.Count() > 0) { foreach (Sys_NotesSort item in tmp) { node.children.Add(AddChild(item, all)); } } return(node); }
public JsonResult submitEditNotesSort(int ParentID, string sortName, int Id, int type = 0) { try { var model = new Sys_NotesSort { Id = Id, SortName = sortName, Type = type, ParentID = ParentID, IsDelete = 0, TenantId = CurrentTenant.TenantId }; if (Id > 0) { _notesManager.UpdateNotesSort(model); } else { _notesManager.AddNotesSort(model); } return(Json(new { result = 1, content = RetechWing.LanguageResources.Common.SaveSuccess + RetechWing.LanguageResources.Common.ExclamationMark }, JsonRequestBehavior.AllowGet)); } catch { return(Json(new { result = 0, content = RetechWing.LanguageResources.Common.SaveFailed + RetechWing.LanguageResources.Common.ExclamationMark }, JsonRequestBehavior.AllowGet)); } }
/// <summary> /// 更新一条数据 /// </summary> public bool UpdateNotesSort(Sys_NotesSort model) { return(_dataAccess.UpdateEntity(model) > 0); }
/// <summary> /// 增加一条数据 /// </summary> public void AddNotesSort(Sys_NotesSort model) { _dataAccess.AddEntity(model); }