/// <summary>
 /// 从FrmQueryEngineAdd调用该方法添加节点
 /// </summary>
 /// <param name="newNode"></param>
 /// <param name="parentNode"></param>
 public void AddFromChild(TreeNode newNode, TreeNode parentNode)
 {
     BasePageLogic.AddTreeNode(tvList, newNode, parentNode);
     // 绑定grdModule
     this.GetQueryEngineList();
     // 使新增加的数据在grdModule中可见
     if (this.DTQueryEngineList.Rows.Count > 0)
         this.dgvList.FirstDisplayedScrollingRowIndex = this.DTQueryEngineList.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;
        }
Ejemplo n.º 3
0
        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;
            }
        }
Ejemplo n.º 4
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);
        }