void TasksTree_RemoteMove(object sender, RemoteMoveEventArgs e) { try { int nodeId = int.Parse(e.NodeID); int targetNodeId = int.Parse(e.TargetNodeID); SimpleTasksDataContext ctx = this.DBContext; Category category = (from tl in ctx.Categories where tl.ID == nodeId select tl).First(); Category parentlist = (from tl in ctx.Categories where tl.ID == targetNodeId select tl).First(); category.ParentCategory = parentlist; ctx.SubmitChanges(); e.Accept = true; } catch (Exception exception) { e.Accept = false; e.RefusalMessage = exception.Message; } }
void TasksTree_RemoteMove(object sender, RemoteMoveEventArgs e) { try { int nodeId = int.Parse(e.NodeID); int targetNodeId = int.Parse(e.TargetNodeID); var ctx = this.DBContext; if (ctx.IsListParent(targetNodeId, nodeId).Value) { e.Accept = false; e.RefusalMessage = "You can't move parent node into the child node"; } Category category = (from tl in ctx.Categories where tl.ID == nodeId select tl).First(); Category parentlist = (from tl in ctx.Categories where tl.ID == targetNodeId select tl).First(); category.ParentCategory = parentlist; ctx.SubmitChanges(); e.Accept = true; } catch (Exception exception) { e.Accept = false; e.RefusalMessage = exception.Message; } }
private void TreePanelEx_RemoteMove(object sender, RemoteMoveEventArgs e) { if (!EnableEdit) { return; } try { string[] source = e.Nodes.ToArray(); string targetNodeID = e.TargetNodeID; if (source.Contains <string>(targetNodeID)) { throw new ArgumentException("不能移动到自身"); } int target = Convert.ToInt32(targetNodeID); this._nodeHelper.ChangeParent(source, target); //int num2 = this._nodeHelper.GetItemLevel(target) + 1; foreach (string str2 in source) { NodeProxy nodeById = this.GetNodeById(str2); nodeById.Set("ParentId", target); // nodeById.Set("Level", num2); } e.Accept = true; } catch (ArgumentException exception) { this.ShowError(exception.Message, e); } catch (DbException exception2) { this.ShowError(exception2.Message, e); } }
protected void RemoteMove(object sender, RemoteMoveEventArgs e) { e.Accept = true; }