Example #1
0
        /// <summary>
        /// 绑定屏幕数据
        /// </summary>
        /// <param name="reloadTree">重新加部门载树</param>
        private void BindData(bool reloadTree)
        {
            // 加载树
            if (reloadTree)
            {
                this.LoadTree();
            }

            if (this.tvModule.SelectedNode == null && this.tvModule.Nodes.Count > 0)
            {
                if (this.CurrentEntityId.Length == 0)
                {
                    this.tvModule.SelectedNode = this.tvModule.Nodes[0];
                }
                else
                {
                    BasePageLogic.FindTreeNode(this.tvModule, this.CurrentEntityId);
                    if (BasePageLogic.TargetNode != null)
                    {
                        this.tvModule.SelectedNode = BasePageLogic.TargetNode;
                        // 展开当前选中节点的所有父节点
                        BasePageLogic.ExpandTreeNode(this.tvModule);
                    }
                }

                if (this.tvModule.SelectedNode != null)
                {
                    // 让选中的节点可视,并用展开方式
                    this.tvModule.SelectedNode.Expand();
                    this.tvModule.SelectedNode.EnsureVisible();
                }
            }
        }
Example #2
0
        /// <summary>
        /// 单个记录移动
        /// </summary>
        private void SingleMove()
        {
            if (String.IsNullOrEmpty(this.ParentEntityId))
            {
                return;
            }

            frmModuleSelect = new FrmModuleSelect(this.ParentEntityId)
            {
                AllowNull = true
            };
            frmModuleSelect.OnButtonConfirmClick += new FrmModuleSelect.ButtonConfirmEventHandler(this.CheckInputMove);
            if (frmModuleSelect.ShowDialog() != DialogResult.OK)
            {
                return;
            }

            // 设置鼠标繁忙状态,并保留原先的状态
            var holdCursor = this.Cursor;

            this.Cursor = Cursors.WaitCursor;
            // 调用事件
            moduleService.MoveTo(UserInfo, this.CurrentEntityId, frmModuleSelect.SelectedId);
            // 移动treeNode
            BasePageLogic.FindTreeNode(this.tvModule, frmModuleSelect.SelectedId);
            BasePageLogic.MoveTreeNode(this.tvModule, this.tvModule.SelectedNode, BasePageLogic.TargetNode);
            // 绑定dgvInfo
            this.GetModuleList();
            if (this.DTModuleList.Rows.Count > 0)
            {
                this.dgvInfo.FirstDisplayedScrollingRowIndex = this.DTModuleList.Rows.Count - 1;
            }
            // 设置鼠标默认状态,原来的光标状态
            this.Cursor = holdCursor;
        }
Example #3
0
 private void GetOrganizeList()
 {
     // 获取部门数据,这里是按权限范围进行获取
     this.DTOrganize = this.GetOrganizeScope(this.PermissionItemScopeCode, true);//organizationService.GetDT(this.UserInfo);
     if (!this.UserInfo.IsAdministrator)
     {
         BasePageLogic.CheckTreeParentId(this.DTOrganize, PiOrganizeTable.FieldId, PiOrganizeTable.FieldParentId);
     }
     this.LoadTree();
     if (this.tvOrganize.SelectedNode == null && this.tvOrganize.Nodes.Count > 0)
     {
         if (this.TargetOrganizeId.Length == 0)
         {
             this.tvOrganize.SelectedNode = this.tvOrganize.Nodes[0];
         }
         else
         {
             BasePageLogic.FindTreeNode(this.tvOrganize, this.TargetOrganizeId);
             if (BasePageLogic.TargetNode != null)
             {
                 this.tvOrganize.SelectedNode = BasePageLogic.TargetNode;
                 // 展开当前选中节点的所有父节点
                 BasePageLogic.ExpandTreeNode(this.tvOrganize);
             }
         }
         if (this.tvOrganize.SelectedNode != null)
         {
             // 让选中的节点可视,并用展开方式
             this.tvOrganize.SelectedNode.Expand();
             this.tvOrganize.SelectedNode.EnsureVisible();
         }
     }
 }
        /// <summary>
        /// 编辑组织机构
        /// </summary>
        private void EditGrid()
        {
            if (this.dgvList.RowCount == 0)
            {
                // 提高用户体验,如果dgvList没有数据则修改tvPermissiion 中的selectedNode
                this.LastControl = this.tvList;
                return;
            }
            string tmpId = BasePageLogic.GetDataGridViewEntityId(dgvList, QueryEngineTable.FieldId);
            if (string.IsNullOrEmpty(tmpId))
            {
                return;
            }
            var frmQueryEngineEdit = new FrmQueryEngineEdit(tmpId);
            if (frmQueryEngineEdit.ShowDialog(this) == DialogResult.OK)
            {
                BasePageLogic.FindTreeNode(this.tvList, tmpId);
                TreeNode selectNode = BasePageLogic.TargetNode;
                selectNode.Text = frmQueryEngineEdit.FullName;
                TreeNode oldParentNode = selectNode.Parent;

                BasePageLogic.FindTreeNode(this.tvList, frmQueryEngineEdit.ParentId);
                TreeNode parentNode = BasePageLogic.TargetNode;
                // 编辑节点
                BasePageLogic.EditTreeNode(this.tvList, selectNode, parentNode);
                // 绑定dgvList
                this.GetQueryEngineList();
                if (this.DTQueryEngineList.Rows.Count > 0)
                {
                    this.dgvList.FirstDisplayedScrollingRowIndex = this.DTQueryEngineList.Rows.Count - 1;
                }
            }
        }
        /// <summary>
        /// 批量移动
        /// </summary>
        private void BatchMove()
        {
            if (!BasePageLogic.CheckInputSelectAnyOne(this.dgvInfo, "colSelected"))
            {
                return;
            }
            var frmOrganizeSelect = new FrmOrganizeSelect(this.ParentEntityId, this.chkInnerOrganize.Checked);

            if (UserInfo.IsAdministrator)
            {
                frmOrganizeSelect.AllowNull = true;
            }
            else
            {
                frmOrganizeSelect.AllowNull           = false;
                frmOrganizeSelect.PermissionScopeCode = this.PermissionItemScopeCode;
            }
            frmOrganizeSelect.OnButtonConfirmClick += new BusinessLogic.CheckMoveEventHandler(CheckInputMove);
            if (frmOrganizeSelect.ShowDialog() != DialogResult.OK)
            {
                return;
            }
            // 设置鼠标繁忙状态,并保留原先的状态
            var holdCursor = this.Cursor;

            this.Cursor     = Cursors.WaitCursor;
            this.FormLoaded = false;
            RDIFrameworkService.Instance.OrganizeService.BatchMoveTo(UserInfo, this.GetSelecteIds(), frmOrganizeSelect.SelectedId);
            //if ((SystemInfo.ClientCache) && (this.chkRefresh.Checked))
            //{
            //    ClientCache.Instance.DTOrganize = null;
            //}
            this.ParentEntityId = frmOrganizeSelect.SelectedId;
            // 调用事件
            var tags = this.GetSelecteIds();

            RDIFrameworkService.Instance.OrganizeService.BatchMoveTo(UserInfo, tags, frmOrganizeSelect.SelectedId);
            // 移动treeNode
            BasePageLogic.FindTreeNode(this.tvOrganize, frmOrganizeSelect.SelectedId);
            var parentNode = BasePageLogic.TargetNode;

            if (tags.Length > 0)
            {
                foreach (string tmpTag in tags)
                {
                    BasePageLogic.FindTreeNode(this.tvOrganize, tmpTag);
                    BasePageLogic.MoveTreeNode(this.tvOrganize, BasePageLogic.TargetNode, parentNode);
                }
            }
            // 绑定grdOrganize
            this.GetOrganizeList();
            if (this.DTOrganizeList.Rows.Count > 0)
            {
                this.dgvInfo.FirstDisplayedScrollingRowIndex = this.DTOrganizeList.Rows.Count - 1;
            }
            this.FormLoaded = true;
            // 设置鼠标默认状态,原来的光标状态
            this.Cursor = holdCursor;
        }
        private void btnEdit_Click(object sender, EventArgs e)
        {
            if (this.LastControl == dgvInfo)
            {
                switch (this.dgvInfo.Rows.Count)
                {
                case 0:
                    this.LastControl = tvOrganize;
                    return;
                }

                //var frmEditOrganize = new FrmEditOrganize(this.EntityId);
                string tmpId = BasePageLogic.GetDataGridViewEntityId(dgvInfo, PiOrganizeTable.FieldId);
                if (string.IsNullOrEmpty(tmpId))
                {
                    return;
                }
                var frmEditOrganize = new FrmEditOrganize(tmpId);
                if (frmEditOrganize.ShowDialog(this) != DialogResult.OK)
                {
                    return;
                }
                BasePageLogic.FindTreeNode(this.tvOrganize, tmpId);
                var selectedNode = BasePageLogic.TargetNode;
                selectedNode.Text = frmEditOrganize.FullName;
                var oldParentNode = selectedNode.Parent;
                BasePageLogic.FindTreeNode(this.tvOrganize, frmEditOrganize.ParentId);
                var parentNode = BasePageLogic.TargetNode;

                BasePageLogic.EditTreeNode(this.tvOrganize, selectedNode, parentNode);

                this.GetOrganizeList();
                if (this.DTOrganizeList.Rows.Count > 0)
                {
                    this.dgvInfo.FirstDisplayedScrollingRowIndex = this.DTOrganizeList.Rows.Count - 1;
                }
            }
            else
            {
                if (tvOrganize.SelectedNode == null)
                {
                    return;
                }

                var frmEditOrganize = new FrmEditOrganize(this.ParentEntityId);
                if (frmEditOrganize.ShowDialog(this) == System.Windows.Forms.DialogResult.OK)
                {
                    this.tvOrganize.SelectedNode.Text = frmEditOrganize.FullName;
                    this.GetOrganizeList();
                    if (this.DTOrganizeList.Rows.Count <= 0)
                    {
                        return;
                    }
                    this.dgvInfo.FirstDisplayedScrollingRowIndex = this.DTOrganizeList.Rows.Count - 1;
                }
            }
        }
        /// <summary>
        /// 添加
        /// </summary>
        /// <returns>主键</returns>
        private string Add(bool root)
        {
            string returnValue = string.Empty;
            FrmQueryEngineAdd frmQueryEngineAdd;
            if (this.LastControl == this.tvList)
            {
                if (root || (this.ParentEntityId.Length == 0) || (this.tvList.SelectedNode == null))
                {
                    frmQueryEngineAdd = new FrmQueryEngineAdd();
                }
                else
                {
                    frmQueryEngineAdd = new FrmQueryEngineAdd(this.ParentEntityId, this.tvList.SelectedNode.Text);
                }
            }
            else
            {
                var dataRow = BasePageLogic.GetDataGridViewEntity(this.dgvList);
                if (root || dataRow == null)
                {
                    frmQueryEngineAdd = new FrmQueryEngineAdd();
                }
                else
                {
                    frmQueryEngineAdd = new FrmQueryEngineAdd(dataRow[QueryEngineTable.FieldId].ToString(), dataRow[QueryEngineTable.FieldFullName].ToString());
                }
            }
            frmQueryEngineAdd.Owner = this;
            if (frmQueryEngineAdd.ShowDialog() == DialogResult.OK)
            {
                returnValue = frmQueryEngineAdd.entity.Id.ToString();
                string fullName = frmQueryEngineAdd.FullName;
                string parentId = frmQueryEngineAdd.ParentId;
                // tvModule 中增加结点
                var newNode = new TreeNode
                {
                    Text = fullName,
                    Tag = RDIFrameworkService.Instance.QueryEngineService.GetQueryEngineDTByIds(UserInfo,new string[] {returnValue}).Rows[0]
                };
                ;

                TreeNode parentNode = null;
                if (!root && !string.IsNullOrEmpty(parentId))
                {
                    BasePageLogic.FindTreeNode(this.tvList, parentId);
                    parentNode = BasePageLogic.TargetNode;
                }
                BasePageLogic.AddTreeNode(this.tvList, newNode, parentNode);
                // 绑定grdModule
                this.GetQueryEngineList();
                // 使新增加的数据在grdModule中可见
                if (this.DTQueryEngineList.Rows.Count > 0)
                    this.dgvList.FirstDisplayedScrollingRowIndex = this.DTQueryEngineList.Rows.Count - 1;
            }
            return returnValue;
        }
Example #8
0
 /// <summary>
 /// 绑定屏幕数据
 /// </summary>
 /// <param name="reloadTree">重新加模块载树</param>
 private void BindData(bool reloadTree)
 {
     // 加载模块树的主键
     if (reloadTree)
     {
         // 加载模块树
         this.LoadTree();
         if (this.tvModule.SelectedNode == null)
         {
             if (this.tvModule.Nodes.Count > 0)
             {
                 if (this.parentEntityId.Length == 0)
                 {
                     this.tvModule.SelectedNode = this.tvModule.Nodes[0];
                 }
                 else
                 {
                     BasePageLogic.FindTreeNode(this.tvModule, this.parentEntityId);
                     if (BasePageLogic.TargetNode != null)
                     {
                         this.tvModule.SelectedNode = BasePageLogic.TargetNode;
                         // 展开当前选中节点的所有父节点
                         BasePageLogic.ExpandTreeNode(this.tvModule);
                     }
                 }
                 if (this.tvModule.SelectedNode != null)
                 {
                     // 让选中的节点可视,并用展开方式
                     this.tvModule.SelectedNode.Expand();
                     this.tvModule.SelectedNode.EnsureVisible();
                 }
             }
         }
     }
     if (this.ParentEntityId.Length > 0)
     {
         if (reloadTree)
         {
             this.GetModuleList();
         }
     }
     // 判断编辑权限
     if (!this.permissionEdit)
     {
         // 只读属性设置
         this.dgvInfo.Columns["colSelected"].ReadOnly    = !this.permissionEdit;
         this.dgvInfo.Columns["colFullName"].ReadOnly    = !this.permissionEdit;
         this.dgvInfo.Columns["colDescription"].ReadOnly = !this.permissionEdit;
         // 修改背景颜色
         //this.dgvInfo.Columns["colFullName"].DefaultCellStyle.BackColor = Color.White;
         //this.dgvInfo.Columns["colDescription"].DefaultCellStyle.BackColor = Color.White;
     }
     // 设置按钮状态
     this.SetControlState();
 }
        private void btnAdd_Click(object sender, EventArgs e)
        {
            string          returnValue  = string.Empty;
            FrmEditOrganize editOrgznize = null;

            if (this.LastControl == this.tvOrganize)
            {
                editOrgznize = this.ParentEntityId.Length == 0 || this.tvOrganize.SelectedNode == null
                    ? new FrmEditOrganize()
                    : new FrmEditOrganize(this.ParentEntityId, this.tvOrganize.SelectedNode.Text);
            }
            else
            {
                var dataRow = BasePageLogic.GetDataGridViewEntity(this.dgvInfo);
                editOrgznize = dataRow == null ? new FrmEditOrganize() : new FrmEditOrganize(dataRow[PiOrganizeTable.FieldId].ToString(), dataRow[PiOrganizeTable.FieldFullName].ToString());
            }

            if (editOrgznize.ShowDialog(this) != System.Windows.Forms.DialogResult.OK)
            {
                return;
            }
            returnValue = editOrgznize.EntityId;
            var fullName = editOrgznize.FullName;
            var parentId = editOrgznize.ParentId;
            // tvOrganize 中增加结点
            var newNode = new TreeNode();

            newNode.Text = fullName;
            newNode.Tag  = RDIFrameworkService.Instance.OrganizeService.GetDTByIds(UserInfo, new string[] { returnValue }).Rows[0];
            TreeNode parentNode = null;

            if (!string.IsNullOrEmpty(parentId))
            {
                BasePageLogic.FindTreeNode(this.tvOrganize, parentId);
                parentNode = BasePageLogic.TargetNode;
            }
            BasePageLogic.AddTreeNode(this.tvOrganize, newNode, parentNode);
            // 绑定数据
            this.GetOrganizeList();
            this.FormLoaded = false;
            this.BindData(true);
            this.FormLoaded = true;

            if (SystemInfo.ClientCache)
            {
                ClientCache.Instance.DTOrganize = null;
            }

            // 使新增加的数据可见
            if (this.DTOrganizeList.Rows.Count > 0)
            {
                this.dgvInfo.FirstDisplayedScrollingRowIndex = this.DTOrganizeList.Rows.Count - 1;
            }
        }
        /// <summary>
        /// 绑定屏幕数据
        /// </summary>
        /// <param name="reloadTree">重新加部门载树</param>
        private void BindData(bool reloadTree)
        {
            // 加载树
            if (reloadTree)
            {
                // 获取客户分类数据
                this.dtCustomerClass = customerClassService.GetDataTable(UserInfo);

                if (!this.UserInfo.IsAdministrator)
                {
                    BasePageLogic.CheckTreeParentId(this.dtCustomerClass, CustomerClassTable.FieldId, CustomerClassTable.FieldParentId);
                }
                this.LoadTree();
                if (this.tvCustomerClass.SelectedNode == null)
                {
                    if (this.tvCustomerClass.Nodes.Count > 0)
                    {
                        if (this.parentEntityId.Length == 0)
                        {
                            this.tvCustomerClass.SelectedNode = this.tvCustomerClass.Nodes[0];
                        }
                        else
                        {
                            BasePageLogic.FindTreeNode(this.tvCustomerClass, this.parentEntityId);
                            if (BasePageLogic.TargetNode != null)
                            {
                                this.tvCustomerClass.SelectedNode = BasePageLogic.TargetNode;
                                // 展开当前选中节点的所有父节点
                                BasePageLogic.ExpandTreeNode(this.tvCustomerClass);
                            }
                        }
                        if (this.tvCustomerClass.SelectedNode != null)
                        {
                            // 让选中的节点可视,并用展开方式
                            this.tvCustomerClass.SelectedNode.Expand();
                            this.tvCustomerClass.SelectedNode.EnsureVisible();
                        }
                    }
                }
            }

            if (this.ParentEntityId.Length > 0)
            {
                if (reloadTree)
                {
                    // 获得得到分类下的客户列表
                    this.GetCustomerList();
                }
            }
            // 设置按钮状态
            this.SetCustomerControlState();
        }
        /// <summary>
        /// 单个记录移动
        /// </summary>
        public void SingleMove()
        {
            if (String.IsNullOrEmpty(this.ParentEntityId))
            {
                return;
            }
            var frmOrganizeSelect = new FrmOrganizeSelect(this.ParentEntityId, this.chkInnerOrganize.Checked);

            if (UserInfo.IsAdministrator)
            {
                frmOrganizeSelect.AllowNull = true;
            }
            else
            {
                frmOrganizeSelect.AllowNull           = false;
                frmOrganizeSelect.PermissionScopeCode = this.PermissionItemScopeCode;
            }
            frmOrganizeSelect.OnButtonConfirmClick += new BusinessLogic.CheckMoveEventHandler(CheckInputMove);
            if (frmOrganizeSelect.ShowDialog() != DialogResult.OK)
            {
                return;
            }
            // 设置鼠标繁忙状态,并保留原先的状态
            var holdCursor = this.Cursor;

            this.Cursor     = Cursors.WaitCursor;
            this.FormLoaded = false;
            RDIFrameworkService.Instance.OrganizeService.MoveTo(UserInfo, this.CurrentEntityId, frmOrganizeSelect.SelectedId);
            if (!SystemInfo.ClientCache)
            {
                ClientCache.Instance.DTOrganize = null;
            }
            this.FormLoaded = false;
            //if ((SystemInfo.ClientCache) && (this.chkRefresh.Checked))
            //{
            //    ClientCache.Instance.DTOrganize = null;
            //}
            // 移动treeNode
            BasePageLogic.FindTreeNode(this.tvOrganize, frmOrganizeSelect.SelectedId);
            BasePageLogic.MoveTreeNode(this.tvOrganize, this.tvOrganize.SelectedNode, BasePageLogic.TargetNode);
            // 绑定grdOrganize
            this.GetOrganizeList();
            if (this.DTOrganizeList.Rows.Count > 0)
            {
                this.dgvInfo.FirstDisplayedScrollingRowIndex = this.DTOrganizeList.Rows.Count - 1;
            }
            this.FormLoaded = true;
            // 设置鼠标默认状态,原来的光标状态
            this.Cursor = holdCursor;
        }
        /// <summary>
        /// 检查删除选择项的有效性
        /// </summary>
        /// <returns>有效</returns>
        private bool CheckInputBatchDelete()
        {
            var returnValue = false;

            //重构后 V2.7
            foreach (DataRow dataRow in from DataGridViewRow dgvRow in dgvInfo.Rows let dataRow = (dgvRow.DataBoundItem as DataRowView).Row
                                                                                                  where (System.Boolean)(dgvRow.Cells["colSelected"].Value ?? false) select dataRow)
            {
                // 有记录被选中了
                returnValue = true;
                // 是否有子节点
                var id = dataRow[PiOrganizeTable.FieldId].ToString();
                BasePageLogic.FindTreeNode(this.tvOrganize, id);
                if (BasePageLogic.TargetNode != null && !BasePageLogic.NodeAllowDelete(BasePageLogic.TargetNode))
                {
                    MessageBoxHelper.ShowWarningMsg(string.Format(RDIFrameworkMessage.MSG0035, BasePageLogic.TargetNode.Text));
                    returnValue = false;
                    return(returnValue);
                }
            }
            //重构前的代码 V2.5版本
            //foreach (DataGridViewRow dgvRow in dgvInfo.Rows)
            //{
            //    DataRow dataRow = (dgvRow.DataBoundItem as DataRowView).Row;
            //    if ((System.Boolean)(dgvRow.Cells["colSelected"].Value ?? false))
            //    {
            //        // 有记录被选中了
            //        returnValue = true;
            //        // 是否有子节点
            //        string id = dataRow[PiOrganizeTable.FieldId].ToString();
            //        BasePageLogic.FindTreeNode(this.tvOrganize, id);
            //        if (BasePageLogic.TargetNode != null)
            //        {
            //            if (!BasePageLogic.NodeAllowDelete(BasePageLogic.TargetNode))
            //            {
            //                MessageBoxHelper.ShowWarningMsg(string.Format("{0} 有子节点不允许被删除!", BasePageLogic.TargetNode.Text));
            //                returnValue = false;
            //                return returnValue;
            //            }
            //        }
            //    }
            //}

            if (!returnValue)
            {
                MessageBoxHelper.ShowWarningMsg("无选择的数据!");
            }
            return(returnValue);
        }
Example #13
0
        /// <summary>
        /// 批量移动
        /// </summary>
        private void BatchMove()
        {
            if (!BasePageLogic.CheckInputSelectAnyOne(this.dgvInfo, "colSelected"))
            {
                return;
            }

            frmModuleSelect = new FrmModuleSelect(this.ParentEntityId)
            {
                AllowNull = true
            };
            frmModuleSelect.OnButtonConfirmClick += new FrmModuleSelect.ButtonConfirmEventHandler(CheckInputMove);
            if (frmModuleSelect.ShowDialog() != DialogResult.OK)
            {
                return;
            }

            // 设置鼠标繁忙状态,并保留原先的状态
            var holdCursor = this.Cursor;

            this.Cursor         = Cursors.WaitCursor;
            this.ParentEntityId = frmModuleSelect.SelectedId;
            // 调用事件
            var tags = this.GetSelecteIds();

            moduleService.BatchMoveTo(UserInfo, tags, frmModuleSelect.SelectedId);
            // 移动treeNode
            BasePageLogic.FindTreeNode(this.tvModule, frmModuleSelect.SelectedId);
            var parentNode = BasePageLogic.TargetNode;

            if (tags.Length > 0)
            {
                foreach (string tmpTag in tags)
                {
                    BasePageLogic.FindTreeNode(this.tvModule, tmpTag);
                    BasePageLogic.MoveTreeNode(this.tvModule, BasePageLogic.TargetNode, parentNode);
                }
            }
            // 绑定dgvInfo
            this.GetModuleList();
            if (this.DTModuleList.Rows.Count > 0)
            {
                this.dgvInfo.FirstDisplayedScrollingRowIndex = this.DTModuleList.Rows.Count - 1;
            }
            // 设置鼠标默认状态,原来的光标状态
            this.Cursor = holdCursor;
        }
        /// <summary>
        /// 绑定屏幕数据
        /// </summary>
        /// <param name="reloadTree">重新加部门载树</param>
        private void BindData(bool reloadTree)
        {
            // 加载树
            if (reloadTree)
            {
                // 获取部门数据,这里是按权限范围进行获取
                this.DTOrganize = this.GetOrganizeScope(this.PermissionItemScopeCode, this.chkInnerOrganize.Checked);//organizationService.GetDT(this.UserInfo);
                if (!this.UserInfo.IsAdministrator || this.chkInnerOrganize.Checked)
                {
                    BasePageLogic.CheckTreeParentId(this.DTOrganize, PiOrganizeTable.FieldId, PiOrganizeTable.FieldParentId);
                }
                this.LoadTree();
                if (this.tvOrganize.SelectedNode == null && this.tvOrganize.Nodes.Count > 0)
                {
                    if (this.parentEntityId.Length == 0)
                    {
                        this.tvOrganize.SelectedNode = this.tvOrganize.Nodes[0];
                    }
                    else
                    {
                        BasePageLogic.FindTreeNode(this.tvOrganize, this.parentEntityId);
                        if (BasePageLogic.TargetNode != null)
                        {
                            this.tvOrganize.SelectedNode = BasePageLogic.TargetNode;
                            // 展开当前选中节点的所有父节点
                            BasePageLogic.ExpandTreeNode(this.tvOrganize);
                        }
                    }
                    if (this.tvOrganize.SelectedNode != null)
                    {
                        // 让选中的节点可视,并用展开方式
                        this.tvOrganize.SelectedNode.Expand();
                        this.tvOrganize.SelectedNode.EnsureVisible();
                    }
                }
            }

            if (this.ParentEntityId.Length > 0 && reloadTree)
            {
                // 获得子部门列表
                this.GetOrganizeList();
            }
            // 设置按钮状态
            this.SetControlState();
        }
Example #15
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);
        }
Example #16
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);
        }
Example #17
0
 /// <summary>
 /// 绑定屏幕数据
 /// </summary>
 /// <param name="reloadTree">重新加模块载树</param>
 private void BindData(bool reloadTree)
 {
     // 加载模块树的主键
     if (reloadTree)
     {
         // 加载模块树
         this.LoadTree();
         if (this.tvItems.SelectedNode == null)
         {
             if (this.tvItems.Nodes.Count > 0)
             {
                 if (this.treeEntityId.Length == 0)
                 {
                     this.tvItems.SelectedNode = this.tvItems.Nodes[0];
                 }
                 else
                 {
                     BasePageLogic.FindTreeNode(this.tvItems, this.treeEntityId);
                     if (BasePageLogic.TargetNode != null)
                     {
                         this.tvItems.SelectedNode = BasePageLogic.TargetNode;
                         // 展开当前选中节点的所有父节点
                         BasePageLogic.ExpandTreeNode(this.tvItems);
                     }
                 }
                 if (this.tvItems.SelectedNode != null)
                 {
                     // 让选中的节点可视,并用展开方式
                     this.tvItems.SelectedNode.Expand();
                     this.tvItems.SelectedNode.EnsureVisible();
                 }
             }
         }
     }
     if (this.TreeEntityId.Length > 0)
     {
         if (reloadTree)
         {
             this.GetItemsDetailList();
         }
     }
     // 设置按钮状态
     this.SetControlState();
 }
Example #18
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);
        }
Example #19
0
        /// <summary>
        /// 加载树
        /// </summary>
        private void LoadTree()
        {
            // 开始更新控件,屏幕不刷新,提高效率。
            this.tvItems.BeginUpdate();
            this.tvItems.Nodes.Clear();
            var treeNode = new TreeNode();

            this.LoadTreeItems(treeNode);
            BasePageLogic.FindTreeNode(this.tvItems, this.OpenId);
            if (BasePageLogic.TargetNode != null)
            {
                this.tvItems.SelectedNode = BasePageLogic.TargetNode;
                BasePageLogic.ExpandTreeNode(this.tvItems);
                this.tvItems.SelectedNode.EnsureVisible();
                this.tvItems.SelectedNode.Expand();
            }
            // 更新控件,屏幕一次性刷新,提高效率。
            this.tvItems.EndUpdate();
        }
Example #20
0
 /// <summary>
 /// 绑定屏幕数据
 /// </summary>
 /// <param name="reloadTree">重新加部门载树</param>
 private void BindData(bool reloadTree)
 {
     // 加载树
     if (reloadTree)
     {
         this.LoadTree();
     }
     if (this.tvPermission.SelectedNode != null)
     {
         return;
     }
     if (this.tvPermission.Nodes.Count > 0)
     {
         if (this.CurrentEntityId.Length == 0)
         {
             this.tvPermission.SelectedNode = this.tvPermission.Nodes[0];
         }
         else
         {
             BasePageLogic.FindTreeNode(this.tvPermission, this.CurrentEntityId);
             if (BasePageLogic.TargetNode != null)
             {
                 this.tvPermission.SelectedNode = BasePageLogic.TargetNode;
                 // 展开当前选中节点的所有父节点
                 BasePageLogic.ExpandTreeNode(this.tvPermission);
             }
         }
         if (this.tvPermission.SelectedNode != null)
         {
             // 让选中的节点可视,并用展开方式
             this.tvPermission.SelectedNode.Expand();
             this.tvPermission.SelectedNode.EnsureVisible();
         }
     }
     if (this.tvPermission.SelectedNode != null)
     {
         // 让选中的节点可视,并用展开方式
         this.tvPermission.SelectedNode.Expand();
         this.tvPermission.SelectedNode.EnsureVisible();
         // 防止只有一个父节点的情况下,无法展开情况发生
         // this.GetPermissionList();
     }
 }
        /// <summary>
        /// 加载树形结构数据
        /// </summary>
        private void LoadTree()
        {
            // 开始更新控件,屏幕不刷新,提高效率。
            this.tvModuleList.BeginUpdate();
            this.tvModuleList.Nodes.Clear();
            TreeNode treeNode = new TreeNode();

            this.LoadTreeModule(treeNode);
            BasePageLogic.FindTreeNode(this.tvModuleList, this.OldEntityId);
            if (BasePageLogic.TargetNode != null)
            {
                this.tvModuleList.SelectedNode = BasePageLogic.TargetNode;
                BasePageLogic.ExpandTreeNode(this.tvModuleList);
                this.tvModuleList.SelectedNode.EnsureVisible();
                this.tvModuleList.SelectedNode.Expand();
            }
            // 更新控件,屏幕一次性刷新,提高效率。
            this.tvModuleList.EndUpdate();
        }
Example #22
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);
        }
Example #23
0
        /// <summary>
        /// 编辑模块
        /// </summary>
        private void EditGrid()
        {
            if (this.dgvInfo.RowCount == 0)
            {
                // 提高用户体验,如果grdPermission没有数据则修改tvPermissiion 中的selectedNode
                this.LastControl = this.tvModule;
                return;
            }
            //var frmModuleEdit = new FrmModuleEdit(this.EntityId);
            string tmpId = BasePageLogic.GetDataGridViewEntityId(dgvInfo, PiModuleTable.FieldId);

            if (string.IsNullOrEmpty(tmpId))
            {
                return;
            }
            var frmModuleEdit = new FrmModuleEdit(tmpId);

            if (frmModuleEdit.ShowDialog(this) != DialogResult.OK)
            {
                return;
            }

            BasePageLogic.FindTreeNode(this.tvModule, tmpId);
            var selectNode = BasePageLogic.TargetNode;

            selectNode.Text = frmModuleEdit.FullName;
            var oldParentNode = selectNode.Parent;

            BasePageLogic.FindTreeNode(this.tvModule, frmModuleEdit.ParentId);
            var parentNode = BasePageLogic.TargetNode;

            // 编辑节点
            BasePageLogic.EditTreeNode(this.tvModule, selectNode, parentNode);
            // 绑定dgvInfo
            this.GetModuleList();
            if (this.DTModuleList.Rows.Count > 0)
            {
                this.dgvInfo.FirstDisplayedScrollingRowIndex = this.DTModuleList.Rows.Count - 1;
            }
        }
        /// <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);
        }
Example #25
0
        /// <summary>
        /// 绑定屏幕数据
        /// </summary>
        /// <param name="reloadTree">重新加载树</param>
        private void BindData(bool reloadTree)
        {
            // 加载树的主键
            if (reloadTree)
            {
                this.LoadTree();
                if (this.tvList.SelectedNode == null && this.tvList.Nodes.Count > 0)
                {
                    if (this.parentEntityId.Length == 0)
                    {
                        this.tvList.SelectedNode = this.tvList.Nodes[0];
                    }
                    else
                    {
                        BasePageLogic.FindTreeNode(this.tvList, this.parentEntityId);
                        if (BasePageLogic.TargetNode != null)
                        {
                            this.tvList.SelectedNode = BasePageLogic.TargetNode;
                            // 展开当前选中节点的所有父节点
                            BasePageLogic.ExpandTreeNode(this.tvList);
                        }
                    }
                    if (this.tvList.SelectedNode != null)
                    {
                        // 让选中的节点可视,并用展开方式
                        this.tvList.SelectedNode.Expand();
                        this.tvList.SelectedNode.EnsureVisible();
                    }
                }
            }
            if (this.ParentEntityId.Length > 0 && reloadTree)
            {
                this.GetQueryEngineList();
            }

            this.SetControlState();
        }
Example #26
0
        /// <summary>
        /// 检查删除选择项的有效性
        /// </summary>
        /// <returns>有效</returns>
        private bool CheckInputBatchDelete()
        {
            var returnValue  = false;
            var moduleEntity = new PiModuleEntity();

            foreach (DataRow dataRow in from DataGridViewRow dgvRow
                     in dgvInfo.Rows let dataRow = (dgvRow.DataBoundItem as DataRowView).Row
                                                   where dataRow.RowState != DataRowState.Deleted
                                                   where (System.Boolean)(dgvRow.Cells["colSelected"].Value ?? false) select dataRow)
            {
                // 是否允许删除
                moduleEntity.GetFrom(dataRow);
                if (moduleEntity.AllowDelete == 0)
                {
                    returnValue = false;
                    MessageBoxHelper.ShowWarningMsg(RDIFrameworkMessage.Format(RDIFrameworkMessage.MSG0018, moduleEntity.FullName));
                    return(returnValue);
                }
                else
                {
                    returnValue = true;
                    // 是否有子节点
                    string id = dataRow[PiModuleTable.FieldId].ToString();
                    BasePageLogic.FindTreeNode(this.tvModule, id);
                    if (BasePageLogic.TargetNode != null)
                    {
                        if (!BasePageLogic.NodeAllowDelete(BasePageLogic.TargetNode))
                        {
                            MessageBoxHelper.ShowWarningMsg(RDIFrameworkMessage.Format(RDIFrameworkMessage.MSG0035, BasePageLogic.TargetNode.Text));
                            returnValue = false;
                        }
                    }
                    return(returnValue);
                }
            }

            //优化前代码
            //foreach (DataGridViewRow dgvRow in dgvInfo.Rows)
            //{
            //    DataRow dataRow = (dgvRow.DataBoundItem as DataRowView).Row;
            //    if (dataRow.RowState == DataRowState.Deleted)
            //    {
            //        continue;
            //    }
            //    if ((System.Boolean)(dgvRow.Cells["colSelected"].Value ?? false))
            //    {
            //        // 是否允许删除
            //        moduleEntity.GetFrom(dataRow);
            //        if (moduleEntity.AllowDelete == 0)
            //        {
            //            returnValue = false;
            //            MessageBoxHelper.ShowWarningMsg(RDIFrameworkMessage.Format(RDIFrameworkMessage.MSG0018, moduleEntity.FullName));
            //            return returnValue;
            //        }
            //        else
            //        {
            //            returnValue = true;
            //            // 是否有子节点
            //            string id = dataRow[PiModuleTable.FieldId].ToString();
            //            BasePageLogic.FindTreeNode(this.tvModule, id);
            //            if (BasePageLogic.TargetNode != null)
            //            {
            //                if (!BasePageLogic.NodeAllowDelete(BasePageLogic.TargetNode))
            //                {
            //                    MessageBoxHelper.ShowWarningMsg(RDIFrameworkMessage.Format(RDIFrameworkMessage.MSG0035, BasePageLogic.TargetNode.Text));
            //                    returnValue = false;
            //                }
            //            }
            //            return returnValue;
            //        }
            //    }
            //}
            if (!returnValue)
            {
                MessageBoxHelper.ShowWarningMsg(RDIFrameworkMessage.MSGC023);
            }
            return(returnValue);
        }
        /// <summary>
        /// 检查删除选择项的有效性
        /// </summary>
        /// <returns>有效</returns>
        private bool CheckInputBatchDelete()
        {
            bool returnValue = true;
            int selectedCount = 0;

            foreach (DataGridViewRow dgvRow in dgvList.Rows)
            {
                var dataRow = (dgvRow.DataBoundItem as DataRowView).Row;
                if ((System.Boolean)(dgvRow.Cells["colSelected"].Value ?? false))
                {
                    // break;
                    // 是否有子节点
                    string id = dataRow[QueryEngineTable.FieldId].ToString();
                    BasePageLogic.FindTreeNode(this.tvList, id);
                    if (BasePageLogic.TargetNode != null && !BasePageLogic.NodeAllowDelete(BasePageLogic.TargetNode))
                    {
                        MessageBox.Show(RDIFrameworkMessage.Format(RDIFrameworkMessage.MSG0035, BasePageLogic.TargetNode.Text),RDIFrameworkMessage.MSG0000, MessageBoxButtons.OK, MessageBoxIcon.Information);
                        return false;
                    }

                    var queryEnginentity = BaseEntity.Create<QueryEngineEntity>(dataRow);
                    if (queryEnginentity.AllowDelete.ToString().Equals("0"))
                    {
                        // 有不允许删除的数据
                        MessageBox.Show(RDIFrameworkMessage.Format(RDIFrameworkMessage.MSG0018, queryEnginentity.FullName), RDIFrameworkMessage.MSG0000, MessageBoxButtons.OK, MessageBoxIcon.Information);
                        returnValue = false;
                        break;
                    }

                    DataTable dtQueryEngineDefine =RDIFrameworkService.Instance.QueryEngineService.GetQueryEngineDefineDTByEngineId(this.UserInfo,queryEnginentity.Id);
                    if (dtQueryEngineDefine != null && dtQueryEngineDefine.Rows.Count > 0)
                    {
                        MessageBoxHelper.ShowWarningMsg(RDIFrameworkMessage.MSG0225); //当前节点定义的有查询引擎定义则也不能删除
                        returnValue = false;
                        break;
                        
                    }
                }
                if ((System.Boolean)(dgvRow.Cells["colSelected"].Value ?? false))
                {
                    // 有记录被选中了
                    returnValue = true;
                    // break;
                    // 是否有子节点
                    string id = dataRow[QueryEngineTable.FieldId].ToString();
                    BasePageLogic.FindTreeNode(this.tvList, id);
                    if (BasePageLogic.TargetNode != null && !BasePageLogic.NodeAllowDelete(BasePageLogic.TargetNode))
                    {
                        MessageBox.Show(
                            RDIFrameworkMessage.Format(RDIFrameworkMessage.MSG0035, BasePageLogic.TargetNode.Text),
                            RDIFrameworkMessage.MSG0000, MessageBoxButtons.OK, MessageBoxIcon.Information);
                        return false;
                    }

                    var queryEnginentity = BaseEntity.Create<QueryEngineEntity>(dataRow);
                    if (queryEnginentity.AllowDelete.ToString().Equals("0"))
                    {
                        // 有不允许删除的数据
                        MessageBox.Show(RDIFrameworkMessage.Format(RDIFrameworkMessage.MSG0018, queryEnginentity.FullName), RDIFrameworkMessage.MSG0000, MessageBoxButtons.OK, MessageBoxIcon.Information);
                        returnValue = false;
                        break;
                    }

                    selectedCount++;
                }
            }

            if (returnValue && selectedCount == 0)
            {
                returnValue = false;
                MessageBox.Show(RDIFrameworkMessage.MSGC023, RDIFrameworkMessage.MSG0000, MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
            return returnValue;
        }
Example #28
0
        /// <summary>
        /// 添加
        /// </summary>
        /// <returns>主键</returns>
        public string Add()
        {
            string        returnValue = string.Empty;
            FrmModuleEdit frmModuleEdit;

            if (this.LastControl == this.tvModule)
            {
                frmModuleEdit = new FrmModuleEdit {
                    ParentId = this.ParentEntityId
                };

                //if (this.ParentEntityId.Length == 0 || this.tvModule.SelectedNode == null)
                //{
                //    frmModuleEdit = new FrmModuleEdit();
                //}
                //else
                //{
                //    //frmModuleEdit = new FrmModuleEdit(this.ParentEntityId, this.tvModule.SelectedNode.Text);
                //    frmModuleEdit = new FrmModuleEdit(this.EntityId);
                //}
            }
            else
            {
                var dataRow = BasePageLogic.GetDataGridViewEntity(this.dgvInfo);
                frmModuleEdit          = new FrmModuleEdit();
                frmModuleEdit.ParentId = dataRow[PiModuleTable.FieldId].ToString();

                //if (dataRow == null)
                //{
                //    frmModuleEdit = new FrmModuleEdit();
                //}
                //else
                //{
                //    //frmModuleEdit = new FrmModuleEdit(dataRow[PiModuleTable.FieldId].ToString(), dataRow[PiModuleTable.FieldFullName].ToString());
                //    frmModuleEdit = new FrmModuleEdit(dataRow[PiModuleTable.FieldId].ToString());
                //}
            }

            if ((frmModuleEdit.ShowDialog(this) != DialogResult.OK) && !frmModuleEdit.Changed)
            {
                return(returnValue);
            }

            returnValue = frmModuleEdit.EntityId;
            string fullName = frmModuleEdit.FullName;
            string parentId = frmModuleEdit.ParentId;
            // tvModule 中增加结点
            var newNode = new TreeNode
            {
                Text = fullName,
                Tag  =
                    RDIFrameworkService.Instance.ModuleService.GetDTByIds(UserInfo, new string[] { returnValue }).Rows[0]
            };

            TreeNode parentNode = null;

            if (!string.IsNullOrEmpty(parentId))
            {
                BasePageLogic.FindTreeNode(this.tvModule, parentId);
                parentNode = BasePageLogic.TargetNode;
            }
            BasePageLogic.AddTreeNode(this.tvModule, newNode, parentNode);
            // 绑定dgvInfo
            this.GetModuleList();
            // 使新增加的数据在dgvInfo中可见
            if (this.DTModuleList.Rows.Count > 0)
            {
                this.dgvInfo.FirstDisplayedScrollingRowIndex = this.DTModuleList.Rows.Count - 1;
            }
            return(returnValue);
        }