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 SelRole(DRelationship _param) { List <Role> lRoles = RoleRepository.SelRoles(new Role { }); if (_param.FromOID != null) { DRelationshipRepository.SelRelationship(new DRelationship { Type = CommonConstant.RELATIONSHIP_ROLE, FromOID = _param.FromOID }).ForEach(role => { lRoles.FindAll(innerRole => innerRole.OID == role.ToOID).ForEach(filterRole => { filterRole.IsChecked = true; }); }); } return(Json(lRoles)); }