Exemplo n.º 1
0
        /// <summary>
        /// 单个记录删除
        /// </summary>
        /// <returns>影响行数</returns>
        private int SingleDelete()
        {
            var returnValue = 0;

            if (this.tvModule.SelectedNode == null)
            {
                return(returnValue);
            }
            // 设置鼠标繁忙状态,并保留原先的状态
            var holdCursor = this.Cursor;

            this.Cursor = Cursors.WaitCursor;
            if (!BasePageLogic.NodeAllowDelete(this.tvModule.SelectedNode))
            {
                MessageBoxHelper.ShowWarningMsg(RDIFrameworkMessage.Format(RDIFrameworkMessage.MSG0035, this.tvModule.SelectedNode.Text));
            }
            else
            {
                if (MessageBoxHelper.Show(RDIFrameworkMessage.MSG0015) == DialogResult.Yes)
                {
                    returnValue = moduleService.SetDeleted(UserInfo, new string[] { this.ParentEntityId });
                    // 有数据被删除了?
                    if (returnValue > 0)
                    {
                        string[] tags = { ((DataRow)this.tvModule.SelectedNode.Tag)[PiModuleTable.FieldId].ToString() };
                        BasePageLogic.BatchRemoveNode(this.tvModule, tags);
                        // 绑定dgvInfo
                        this.GetModuleList();
                    }
                }
            }
            // 设置鼠标默认状态,原来的光标状态
            this.Cursor = holdCursor;
            return(returnValue);
        }
Exemplo n.º 2
0
        private int DeleteItems()
        {
            var returnValue = 0;

            if (string.IsNullOrEmpty(this.TreeEntityId))
            {
                return(returnValue);
            }

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

            this.Cursor = Cursors.WaitCursor;
            if (!BasePageLogic.NodeAllowDelete(this.tvItems.SelectedNode))
            {
                MessageBoxHelper.ShowWarningMsg(RDIFrameworkMessage.Format(RDIFrameworkMessage.MSG0035, this.tvItems.SelectedNode.Text));
            }
            else
            {
                if (MessageBoxHelper.Show(RDIFrameworkMessage.MSG0015) == DialogResult.Yes)
                {
                    returnValue = RDIFrameworkService.Instance.ItemsService.SetDeleted(UserInfo, new string[] { this.TreeEntityId });
                    // 有数据被删除了?
                    if (returnValue > 0)
                    {
                        string[] tags = { ((DataRow)this.tvItems.SelectedNode.Tag)[CiItemsTable.FieldId].ToString() };
                        BasePageLogic.BatchRemoveNode(this.tvItems, tags);
                    }
                }
            }
            // 设置鼠标默认状态,原来的光标状态
            this.Cursor = holdCursor;
            return(returnValue);
        }
 /// <summary>
 /// 批量删除
 /// </summary>
 /// <returns>影响行数</returns>
 public override int BatchDelete()
 {
     int returnValue = 0;
     if (this.CheckInputBatchDelete() && MessageBoxHelper.Show(RDIFrameworkMessage.MSG0015) == DialogResult.Yes)
     {
         string[] tags = this.GetSelecteIds();
         // 逻辑删除
         returnValue = RDIFrameworkService.Instance.QueryEngineService.SetDeletedQueryEngine(UserInfo, tags);
         // 获取模块列表
         this.DTQueryEngine = RDIFrameworkService.Instance.QueryEngineService.GetQueryEngineDT(this.UserInfo);
         // 在tree删除相应的节点
         BasePageLogic.BatchRemoveNode(this.tvList, tags);
         // 绑定dgvInfo
         this.GetQueryEngineList();
     }
     return returnValue;
 }
        /// <summary>
        /// 单个记录删除
        /// </summary>
        /// <returns>影响行数</returns>
        public int SingleDelete()
        {
            int returnValue = 0;
            if (this.tvList.SelectedNode == null)
            {
                return returnValue;
            }
            
            if (!BasePageLogic.NodeAllowDelete(this.tvList.SelectedNode))
            {
                MessageBoxHelper.ShowWarningMsg(RDIFrameworkMessage.Format(RDIFrameworkMessage.MSG0035, this.tvList.SelectedNode.Text));
            }
            else
            {

                DataTable dtQueryEngineDefine = RDIFrameworkService.Instance.QueryEngineService.GetQueryEngineDefineDTByEngineId(this.UserInfo, this.ParentEntityId);
                if (dtQueryEngineDefine != null && dtQueryEngineDefine.Rows.Count > 0)
                {
                    MessageBoxHelper.ShowWarningMsg(RDIFrameworkMessage.MSG0225); //当前节点定义的有查询引擎定义则也不能删除
                    return returnValue;
                }

                if (MessageBoxHelper.Show(RDIFrameworkMessage.MSG0015) == DialogResult.Yes)
                {
                    // 逻辑上删除
                    returnValue = RDIFrameworkService.Instance.QueryEngineService.SetDeletedQueryEngine(UserInfo, new string[] { this.ParentEntityId });
                    // 有数据被删除了?
                    if (returnValue > 0)
                    {
                        string[] tags = { ((DataRow)this.tvList.SelectedNode.Tag)[PiPermissionTable.FieldId].ToString() };
                        BasePageLogic.BatchRemoveNode(this.tvList, tags);
                        // 绑定dgvInfo
                        this.GetQueryEngineList();
                    }
                }
            }
            return returnValue;
        }
Exemplo n.º 5
0
        /// <summary>
        /// 批量删除
        /// </summary>
        /// <returns>影响行数</returns>
        public override int BatchDelete()
        {
            var returnValue = 0;

            if (!this.CheckInputBatchDelete())
            {
                return(returnValue);
            }

            if (MessageBoxHelper.Show(RDIFrameworkMessage.MSG0015) == DialogResult.Yes)
            {
                // 删除选中的纪录
                // returnValue = RDIFrameworkService.Instance.ModuleService.BatchDelete(UserInfo, this.GetSelecteIds());
                var tags = this.GetSelecteIds();
                returnValue = moduleService.SetDeleted(UserInfo, tags);
                // 获取模块列表
                this.DTModule = moduleService.GetDT(UserInfo);
                // 在tree删除相应的节点
                BasePageLogic.BatchRemoveNode(this.tvModule, tags);
                // 绑定dgvInfo
                this.GetModuleList();
            }
            return(returnValue);
        }
        private void btnDelete_Click(object sender, EventArgs e)
        {
            if (this.LastControl == dgvInfo)
            {
                var returnValue = 0;
                if (this.CheckInputBatchDelete() &&
                    MessageBoxHelper.Show(RDIFrameworkMessage.MSG0015) == System.Windows.Forms.DialogResult.Yes)
                {
                    if (!SystemInfo.ClientCache)
                    {
                        ClientCache.Instance.DTOrganize = null;
                    }

                    this.FormLoaded = false;
                    // 绑定数据
                    var tags = BasePageLogic.GetSelecteIds(this.dgvInfo, PiOrganizeTable.FieldId, "colSelected", true);
                    returnValue = organizationService.SetDeleted(UserInfo, tags);
                    if (SystemInfo.ClientCache)
                    {
                        ClientCache.Instance.DTOrganize = null;
                    }
                    // 获取列表
                    this.DTOrganize = organizationService.GetDT(UserInfo);
                    // 在tree删除相应的节点
                    BasePageLogic.BatchRemoveNode(this.tvOrganize, tags);
                    // 绑定grdModule
                    this.GetOrganizeList();
                    this.FormLoaded = true;
                }
            }
            else
            {
                var returnValue = 0;
                if (this.tvOrganize.SelectedNode == null)
                {
                    returnValue = 0;
                    return;
                }
                // 设置鼠标繁忙状态,并保留原先的状态
                var holdCursor = this.Cursor;
                this.Cursor     = Cursors.WaitCursor;
                this.FormLoaded = false;
                try
                {
                    if (!BasePageLogic.NodeAllowDelete(this.tvOrganize.SelectedNode))
                    {
                        MessageBoxHelper.ShowWarningMsg(string.Format(RDIFrameworkMessage.MSG0035, BasePageLogic.TargetNode.Text));
                    }
                    else
                    {
                        if (MessageBoxHelper.Show(RDIFrameworkMessage.MSG0015) != System.Windows.Forms.DialogResult.Yes)
                        {
                            return;
                        }
                        returnValue = organizationService.SetDeleted(UserInfo, new String[] { this.ParentEntityId });
                        if (SystemInfo.ClientCache)
                        {
                            ClientCache.Instance.DTOrganize = null;
                        }
                        if (returnValue <= 0)
                        {
                            return;
                        }
                        string[] tags = { ((DataRow)this.tvOrganize.SelectedNode.Tag)[PiOrganizeTable.FieldId].ToString() };
                        BasePageLogic.BatchRemoveNode(this.tvOrganize, tags);
                        // 绑定grdOrganize
                        this.GetOrganizeList();
                    }
                }
                catch (Exception ex)
                {
                    this.ProcessException(ex);
                }
                finally
                {
                    // 设置鼠标默认状态,原来的光标状态
                    this.FormLoaded = true;
                    this.Cursor     = holdCursor;
                }
            }
        }