/// <summary>
    /// 添加栏目
    /// </summary>
    public static int Insert(ModeChannel channel)
    {
        if (channel.ParentID == 0)
        {
            channel.Depth    = 0;
            channel.ParentID = 0;
            channel.Path     = "0~";
            channel.NamePath = "所有栏目~";
            channel.AddInsert("RootID", "IDENT_CURRENT('ModeChannel')");
        }
        else
        {
            ModeChannel condition = new ModeChannel();
            condition.ID = channel.ParentID;
            ModeChannel pArentChannel = TableOperate <ModeChannel> .GetRowData(condition);

            string path     = Convert.ToString(pArentChannel.Path) + channel.ParentID + "~";
            string namePath = Convert.ToString(pArentChannel.NamePath) + Convert.ToString(pArentChannel.Name) + "~";
            channel.Depth    = pArentChannel.Depth + 1;
            channel.Path     = path;
            channel.RootID   = pArentChannel.RootID;
            channel.NamePath = namePath;
        }
        return(TableOperate <ModeChannel> .InsertReturnID(channel));
    }
    /// <summary>
    /// 修改栏目
    /// </summary>
    public static int Update(ModeChannel channel)
    {
        //修改信息

        ModeChannel condition = new ModeChannel();

        condition.ID = channel.ID;
        ModeChannel oldChannel = TableOperate <ModeChannel> .GetRowData(condition);


        if (channel.ParentID != oldChannel.ParentID)
        {
            if (channel.ParentID == 0)
            {
                channel.Depth    = 0;
                channel.ParentID = 0;
                channel.Path     = "0~";
                channel.NamePath = "所有栏目~";
                channel.AddInsert("RootID", "IDENT_CURRENT('Channel')");
            }
            else
            {
                condition    = new ModeChannel();
                condition.ID = channel.ParentID;
                ModeChannel pArentChannel = TableOperate <ModeChannel> .GetRowData(condition);

                string path     = Convert.ToString(pArentChannel.Path) + channel.ParentID + "~";
                string namePath = Convert.ToString(pArentChannel.NamePath) + Convert.ToString(pArentChannel.Name) + "~";
                channel.Depth    = pArentChannel.Depth + 1;
                channel.Path     = path;
                channel.RootID   = pArentChannel.RootID;
                channel.NamePath = namePath;
            }
        }
        else
        {
            channel.Depth    = oldChannel.Depth;
            channel.Path     = oldChannel.Path;
            channel.NamePath = oldChannel.NamePath;
            channel.RootID   = oldChannel.RootID;
        }
        //修改下面是有的子项的Depth, Path, RootID, NamePath
        UpdateChild(channel, oldChannel);

        return(TableOperate <ModeChannel> .Update(channel));
    }