public JsonResult InsDepartment(JqTreeModel _param) { int result = 0; try { DaoFactory.BeginTransaction(); DObject dobj = new DObject(); dobj.Type = CommonConstant.TYPE_DEPARTMENT; dobj.Name = _param.label; dobj.Description = _param.value; result = DObjectRepository.InsDObject(dobj); DRelationship dRel = new DRelationship(); dRel.Type = CommonConstant.RELATIONSHIP_DEPARTMENT; dRel.FromOID = _param.parentId; dRel.ToOID = result; DRelationshipRepository.InsDRelationshipNotOrd(dRel); DaoFactory.Commit(); } catch (Exception ex) { DaoFactory.Rollback(); return(Json(new ResultJsonModel { isError = true, resultMessage = ex.Message, resultDescription = ex.ToString() })); } return(Json(result)); }
public JsonResult DelDepartment(JqTreeModel _param) { int result = 0; try { DaoFactory.BeginTransaction(); DRelationship dRel = new DRelationship(); dRel.Type = CommonConstant.RELATIONSHIP_DEPARTMENT; dRel.FromOID = _param.parentId; dRel.ToOID = _param.id; result = DRelationshipRepository.DelDRelationship(dRel); DaoFactory.Commit(); } catch (Exception ex) { DaoFactory.Rollback(); return(Json(new ResultJsonModel { isError = true, resultMessage = ex.Message, resultDescription = ex.ToString() })); } return(Json(result)); }
public JsonResult UtpDepartment(JqTreeModel _param) { int result = 0; try { DaoFactory.BeginTransaction(); DObject dobj = new DObject(); dobj.Type = CommonConstant.TYPE_DEPARTMENT; dobj.OID = _param.id; dobj.Name = _param.label; dobj.Description = _param.value; result = DObjectRepository.UdtDObject(dobj); DaoFactory.Commit(); } catch (Exception ex) { DaoFactory.Rollback(); return(Json(new ResultJsonModel { isError = true, resultMessage = ex.Message, resultDescription = ex.ToString() })); } return(Json(result)); }
public ActionResult EditDepartment(JqTreeModel _param) { ViewBag.id = _param.id; if (_param.id != null) { DObject dobj = DObjectRepository.SelDObjects(new DObject { Type = CommonConstant.TYPE_DEPARTMENT, OID = _param.id }).First(); ViewBag.label = dobj.Name; ViewBag.value = dobj.Description; } else { ViewBag.label = ""; ViewBag.value = ""; } return(PartialView("Dialog/dlgEditDepartment")); }