コード例 #1
0
        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;
            }
        }
コード例 #2
0
ファイル: TasksTree.cs プロジェクト: RabbWhite/ExtNet
        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;
            }
        }
コード例 #3
0
 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);
     }
 }
コード例 #4
0
ファイル: TasksTree.cs プロジェクト: pgodwin/Ext.net
        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;
            }
        }
コード例 #5
0
 protected void RemoteMove(object sender, RemoteMoveEventArgs e)
 {
     e.Accept = true;
 }
コード例 #6
0
ファイル: TasksTree.cs プロジェクト: extnet/Ext.NET.Examples
        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;
            }
        }