コード例 #1
0
        /// <summary>
        /// 方法说明:根据BusinessId删除模版或文件夹
        /// 作      者:jason.tang
        /// 完成时间:2013-07-24
        /// </summary>
        /// <param name="Id">业务ID</param>
        private void RemoveTreeNode(TreeNode currentNode)
        {
            if (currentNode == null)
            {
                return;
            }

            bool result = false;

            if (currentNode.ImageKey == "planning")
            {
                Guid planningId = new Guid(currentNode.Tag.ToString());
                result = ProcessPlanningBLL.DeletePlanningById(planningId);
                ProcessCardBLL.DeleteProcessVersion(planningId.ToString(), currentNode.Parent.Tag.ToString());
            }
            else
            {
                int  splitIndex = currentNode.Tag.ToString().IndexOf("@");
                Guid cardid     = new Guid(currentNode.Tag.ToString().Substring(0, splitIndex));
                Guid planningId = new Guid(currentNode.Parent.Tag.ToString());
                result = PlanningCardRelationBLL.DeleteRelationByCardId(cardid, planningId);
            }

            if (result)
            {
                if (currentNode.Parent != null && !string.IsNullOrEmpty(currentNode.Parent.ImageKey))
                {
                    tvProcessProcedure.SelectedNode     = currentNode.Parent;
                    tvProcessProcedure.SelectedImageKey = currentNode.Parent.ImageKey;
                }
                else
                {
                    tvProcessProcedure.SelectedNode = tvProcessProcedure.Nodes[0];
                    ///  如果选中的节点为空,默认为卡片
                    tvProcessProcedure.SelectedImageKey = tvProcessProcedure.Nodes[0].ImageKey;
                }

                //Remove treeview
                tvProcessProcedure.Nodes.Remove(currentNode);
                tvProcessProcedure.SelectedNode.Expand();
            }
        }