public WeixinResult ReadData(string json) { CorpDepartmentCollection result = new CorpDepartmentCollection(); result.ReadJson(json); return(result); }
private static CorpDepartment FindDept(string id, out CorpDepartmentCollection deptList) { deptList = WeDataUtil.GetCacheData <CorpDepartmentCollection>(WeCorpConst.CORP_DEPT_NAME); CorpDepartment result = deptList.Department[id]; TkDebug.AssertNotNull(result, string.Format(ObjectUtil.SysCulture, "数据有错误,无法找到Id为{0}的Department", id), null); return(result); }
public object MoveUpDown(string nodeId, TreeNodeMoveDirection direction) { CorpDepartmentCollection depts = GetDepartments(); var node = depts.Department[nodeId]; var list = depts.GetChildren(node.ParentId).ToArray(); int index = Array.IndexOf(list, node); CorpDepartment swapNode = null; switch (direction) { case TreeNodeMoveDirection.Up: if (index == 0) { break; } swapNode = list[index - 1]; break; case TreeNodeMoveDirection.Down: if (index == list.Length - 1) { break; } swapNode = list[index + 1]; break; } if (swapNode != null) { node.VerifyOrder(); swapNode.VerifyOrder(); int swap = node.Order; node.Order = swapNode.Order; swapNode.Order = swap; node.Update(); swapNode.Update(); WeDataUtil.SaveData(WeCorpConst.CORP_DEPT_NAME, depts); } return(new KeyData("Id", nodeId)); }