Exemple #1
0
        string SaveChannel(string id, string parentId, int index)
        {
            if (!CheckChannelPermission())
            {
                return("您没有操作权限。");
            }

            try
            {
                //更新子节点的父节点属性
                Channel c = new Channel();
                c = ChannelHelper.GetChannel(id, null);
                if (c.ParentID != parentId)
                {
                    if (CanMove(c, parentId))
                    {
                        string oldUrl  = c.FullUrl;
                        string oldPath = c.FullPath;
                        c.ParentID = parentId;
                        ChannelHelper.UpdateChannel(c);
                        //ChannelHelper.UpdateChannelUrlBatch(oldUrl, newUrl);
                        ChannelHelper.UpdateChannelUrlBatch2(oldUrl, c.FullUrl);
                        ChannelHelper.UpdateChannelPathBatch(c, oldPath);
                        TemplateMap.ReplaceChannelUrls(oldUrl, c.FullUrl);
                        TemplateMap.ResetInstance();
                    }
                    else
                    {
                        return("无法移动栏目,目标栏目下有标识为 " + c.ChannelName + " 的子栏目!");
                    }
                }
                if (c.Index != index)
                {
                    ResortChannelList(id, c.ParentID, index);
                }
                return("0");
            }
            catch (Exception ex)
            {
                return("无法保存数据!" + ex.Message);
            }
        }