Exemplo n.º 1
0
        private void tvOrganize_DragDrop(object sender, DragEventArgs e)
        {
            if (this.UserInfo.IsAdministrator != true)
            {
                return;
            }

            // 定义一个中间变量
            TreeNode treeNode;

            // 判断拖动的是否为TreeNode类型,不是的话不予处理
            if (e.Data.GetDataPresent("System.Windows.Forms.TreeNode", false))
            {
                // 定义一个位置点的变量,保存当前光标所处的坐标点
                Point point;
                // 拖放的目标节点
                TreeNode targetTreeNode;
                // 获取当前光标所处的坐标
                point = ((TreeView)sender).PointToClient(new Point(e.X, e.Y));
                // 根据坐标点取得处于坐标点位置的节点
                targetTreeNode = ((TreeView)sender).GetNodeAt(point);
                // 是公司节点或部门节点时才可以使用。
                if ((targetTreeNode.SelectedImageIndex <= 1) && (targetTreeNode.Parent != null))
                {
                    // 获取被拖动的节点
                    treeNode = (TreeNode)e.Data.GetData("System.Windows.Forms.TreeNode");
                    // 判断拖动的节点与目标节点是否是同一个,同一个不予处理
                    if (BasePageLogic.TreeNodeCanMoveTo(treeNode, targetTreeNode))
                    {
                        if (SystemInfo.ShowInformation)
                        {
                            // 是否移动模块
                            if (MessageBox.Show(RDIFrameworkMessage.Format(RDIFrameworkMessage.MSG0038, treeNode.Text, targetTreeNode.Text), RDIFrameworkMessage.MSG0000, MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.No)
                            {
                                return;
                            }
                        }
                        this.MoveUserTo(((PiUserEntity)treeNode.Tag).Id.ToString(), targetTreeNode);
                        // 往目标节点中加入被拖动节点的一份克隆
                        this.tvOrganize.SelectedNode = targetTreeNode;
                        //刷新拖入的节点用户
                        if (targetTreeNode != null)
                        {
                            if (targetTreeNode.Tag != null)
                            {
                                // 当前节点是用户节点
                                if (targetTreeNode.SelectedImageIndex <= 1)
                                {
                                    this.GetUserList(targetTreeNode);
                                }
                            }
                        }
                        // 将被拖动的节点移除
                        treeNode.Remove();
                    }
                }
            }
        }
Exemplo n.º 2
0
        /// <summary>
        /// 检查能否移动
        /// </summary>
        /// <returns>能否移动到目标位置</returns>
        private bool CheckInputMove()
        {
            var returnValue = true;

            // 单个移动检查
            BasePageLogic.FindTreeNode(this.tvModule, this.OpenId);
            TreeNode treeNode = BasePageLogic.TargetNode;

            BasePageLogic.FindTreeNode(this.tvModule, this.CurrentEntityId);
            TreeNode targetTreeNode = BasePageLogic.TargetNode;

            if (!BasePageLogic.TreeNodeCanMoveTo(treeNode, targetTreeNode))
            {
                MessageBoxHelper.ShowWarningMsg(RDIFrameworkMessage.Format(RDIFrameworkMessage.MSG0036, treeNode.Text, targetTreeNode.Text));
                returnValue = false;
            }
            return(returnValue);
        }
Exemplo n.º 3
0
        /// <summary>
        /// 检查能否移动
        /// </summary>
        /// <returns>能否移动到目标位置</returns>
        private bool CheckInputMove(string selectedId)
        {
            bool returnValue = true;

            // 单个移动检查
            BasePageLogic.FindTreeNode(this.tvOrganize, this.parentEntityId);
            var treeNode = BasePageLogic.TargetNode;

            BasePageLogic.FindTreeNode(this.tvOrganize, selectedId);
            var targetTreeNode = BasePageLogic.TargetNode;

            if (!BasePageLogic.TreeNodeCanMoveTo(treeNode, targetTreeNode))
            {
                MessageBoxHelper.ShowWarningMsg(RDIFrameworkMessage.Format(RDIFrameworkMessage.MSG0036, treeNode.Text, targetTreeNode.Text));
                returnValue = false;
            }
            return(returnValue);
        }
Exemplo n.º 4
0
        private void tvModule_DragDrop(object sender, DragEventArgs e)
        {
            // 定义一个中间变量
            TreeNode treeNode;

            //判断拖动的是否为TreeNode类型,不是的话不予处理
            if (!e.Data.GetDataPresent("System.Windows.Forms.TreeNode", false))
            {
                return;
            }
            //定义一个位置点的变量,保存当前光标所处的坐标点
            Point point;
            //拖放的目标节点
            TreeNode targetTreeNode;

            //获取当前光标所处的坐标
            point = ((TreeView)sender).PointToClient(new Point(e.X, e.Y));
            //根据坐标点取得处于坐标点位置的节点
            targetTreeNode = ((TreeView)sender).GetNodeAt(point);
            //获取被拖动的节点
            treeNode = (TreeNode)e.Data.GetData("System.Windows.Forms.TreeNode");
            //判断拖动的节点与目标节点是否是同一个,同一个不予处理
            if (!BasePageLogic.TreeNodeCanMoveTo(treeNode, targetTreeNode))
            {
                return;
            }

            if (SystemInfo.ShowInformation)
            {
                // 是否移动模块
                if (MessageBoxHelper.Show(RDIFrameworkMessage.Format(RDIFrameworkMessage.MSG0038, treeNode.Text, targetTreeNode.Text)) == System.Windows.Forms.DialogResult.No)
                {
                    return;
                }
            }

            moduleService.MoveTo(UserInfo, (treeNode.Tag as DataRow)[BusinessLogic.FieldId].ToString(), (targetTreeNode.Tag as DataRow)[BusinessLogic.FieldId].ToString());
            // 往目标节点中加入被拖动节点的一份克隆
            this.tvModule.SelectedNode = targetTreeNode;
            targetTreeNode.Nodes.Add((TreeNode)treeNode.Clone());
            // 将被拖动的节点移除
            treeNode.Remove();
        }
Exemplo n.º 5
0
        /// <summary>
        /// 检查能否移动
        /// </summary>
        /// <returns>能否移动到目标位置</returns>
        private bool CheckInputMove()
        {
            var returnValue = true;

            // 单个移动检查
            BasePageLogic.FindTreeNode(this.tvItems, this.OpenId);
            var treeNode = BasePageLogic.TargetNode;

            BasePageLogic.FindTreeNode(this.tvItems, this.CurrentEntityId);
            TreeNode targetTreeNode = BasePageLogic.TargetNode;

            if (BasePageLogic.TreeNodeCanMoveTo(treeNode, targetTreeNode))
            {
                return(returnValue);
            }
            MessageBox.Show(RDIFrameworkMessage.Format(RDIFrameworkMessage.MSG0036, treeNode.Text, targetTreeNode.Text), RDIFrameworkMessage.MSG0000, MessageBoxButtons.OK, MessageBoxIcon.Information);
            returnValue = false;
            return(returnValue);
        }
Exemplo n.º 6
0
        /// <summary>
        /// 检查能否移动
        /// </summary>
        /// <returns>能否移动到目标位置</returns>
        private bool CheckInputMove()
        {
            bool returnValue = true;

            // 单个移动检查
            if (this.LastControl == this.tvModule)
            {
                BasePageLogic.FindTreeNode(this.tvModule, this.parentEntityId);
                var treeNode = BasePageLogic.TargetNode;
                BasePageLogic.FindTreeNode(this.tvModule, frmModuleSelect.SelectedId);
                var targetTN = BasePageLogic.TargetNode;
                if (!BasePageLogic.TreeNodeCanMoveTo(treeNode, targetTN))
                {
                    MessageBoxHelper.ShowWarningMsg(RDIFrameworkMessage.Format(RDIFrameworkMessage.MSG0036, treeNode.Text, targetTN.Text));
                    returnValue = false;
                }
            }
            // 进行批量检查
            if (this.LastControl != this.dgvInfo)
            {
                return(returnValue);
            }

            BasePageLogic.FindTreeNode(this.tvModule, frmModuleSelect.SelectedId);
            var targetTreeNode = BasePageLogic.TargetNode;
            var SelecteIds     = this.GetSelecteIds();

            foreach (string temId in SelecteIds)
            {
                BasePageLogic.FindTreeNode(this.tvModule, temId);
                var treeNode = BasePageLogic.TargetNode;
                if (!BasePageLogic.TreeNodeCanMoveTo(treeNode, targetTreeNode))
                {
                    MessageBoxHelper.ShowWarningMsg(RDIFrameworkMessage.Format(RDIFrameworkMessage.MSG0036, treeNode.Text, targetTreeNode.Text));
                    returnValue = false;
                    break;
                }
            }
            return(returnValue);
        }
        /// <summary>
        /// 检查能否移动
        /// </summary>
        /// <returns>能否移动到目标位置</returns>
        private bool CheckInputMove(string selectedId)
        {
            var returnValue = true;

            // 单个移动检查
            if (this.LastControl == this.tvOrganize)
            {
                BasePageLogic.FindTreeNode(this.tvOrganize, this.parentEntityId);
                var treeNode = BasePageLogic.TargetNode;
                BasePageLogic.FindTreeNode(this.tvOrganize, selectedId);
                var targetTreeNode = BasePageLogic.TargetNode;
                if (treeNode != null && !BasePageLogic.TreeNodeCanMoveTo(treeNode, targetTreeNode))
                {
                    MessageBoxHelper.ShowWarningMsg(RDIFrameworkMessage.Format(RDIFrameworkMessage.MSG0036,
                                                                               treeNode.Text, targetTreeNode.Text));
                    returnValue = false;
                }
            }
            // 进行批量检查
            if (this.LastControl == this.dgvInfo)
            {
                BasePageLogic.FindTreeNode(this.tvOrganize, selectedId);
                TreeNode targetTreeNode = BasePageLogic.TargetNode;
                var      selecteIds     = this.GetSelecteIds();
                foreach (string tmpId in selecteIds)
                {
                    BasePageLogic.FindTreeNode(this.tvOrganize, tmpId);
                    TreeNode treeNode = BasePageLogic.TargetNode;
                    if (BasePageLogic.TreeNodeCanMoveTo(treeNode, targetTreeNode))
                    {
                        continue;
                    }
                    MessageBox.Show(RDIFrameworkMessage.Format(RDIFrameworkMessage.MSG0036, treeNode.Text, targetTreeNode.Text), RDIFrameworkMessage.MSG0000, MessageBoxButtons.OK, MessageBoxIcon.Information);
                    returnValue = false;
                    break;
                }
            }
            return(returnValue);
        }
        private void tvList_DragDrop(object sender, DragEventArgs e)
        {
            TreeNode treeNode;
            if (!e.Data.GetDataPresent("System.Windows.Forms.TreeNode", false)) return;
            Point point;
            TreeNode targetTreeNode;
            point = ((TreeView)sender).PointToClient(new Point(e.X, e.Y));
            targetTreeNode = ((TreeView)sender).GetNodeAt(point);
            treeNode = (TreeNode)e.Data.GetData("System.Windows.Forms.TreeNode");
            if (BasePageLogic.TreeNodeCanMoveTo(treeNode, targetTreeNode))
            {
                if (SystemInfo.ShowInformation &&
                    MessageBoxHelper.Show(RDIFrameworkMessage.Format(RDIFrameworkMessage.MSG0038, treeNode.Text,
                        targetTreeNode.Text)) == System.Windows.Forms.DialogResult.No)
                {
                    return;
                }

                RDIFrameworkService.Instance.QueryEngineService.MoveToQueryEngine(UserInfo, (treeNode.Tag as DataRow)[BusinessLogic.FieldId].ToString(), (targetTreeNode.Tag as DataRow)[BusinessLogic.FieldId].ToString());
                targetTreeNode.Nodes.Add((TreeNode)treeNode.Clone());
                treeNode.Remove();
            }
        }