示例#1
0
    private static int UpdateChild(TagTree channel, TagTree oldChannel)
    {
        //int depthSpan = channel.Depth - oldChannel.Depth;
        TagTree value     = new TagTree();
        TagTree condition = new TagTree();

        condition.Path = "%~" + channel.ID + "~%";
        condition.AddAttach("Path", "like");

        value.RootID = channel.RootID;
        value.Depth  = channel.Depth - oldChannel.Depth;
        value.AddParameter("OldPath", oldChannel.Path + "" + channel.ID + "~");
        value.AddParameter("OldNamePath", oldChannel.NamePath + "" + oldChannel.Name + "~");
        value.Path     = channel.Path + "" + channel.ID + "~";
        value.NamePath = channel.NamePath + "" + channel.Name + "~";

        value.SetUpdate(" RootID=@RootID, Depth = Depth + @Depth, [Path]=REPLACE([Path], @OldPath, @Path) , [NamePath]=REPLACE([NamePath], @OldNamePath, @NamePath)");
        return(TableOperate <TagTree> .Update(value, condition));
    }