当前位置: 首页>>代码示例>>C#>>正文


C# XmlDocumentExtender.CreateElement方法代码示例

本文整理汇总了C#中Discuz.Common.Xml.XmlDocumentExtender.CreateElement方法的典型用法代码示例。如果您正苦于以下问题:C# XmlDocumentExtender.CreateElement方法的具体用法?C# XmlDocumentExtender.CreateElement怎么用?C# XmlDocumentExtender.CreateElement使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Discuz.Common.Xml.XmlDocumentExtender的用法示例。


在下文中一共展示了XmlDocumentExtender.CreateElement方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: saveinfo_Click

        protected void saveinfo_Click(object sender, EventArgs e)
        {
			string configPath = Page.Server.MapPath("../xml/user_" + this.userid + ".config");
            XmlDocumentExtender doc = new XmlDocumentExtender();
            if (System.IO.File.Exists(configPath))
            {
                if (doc.SelectSingleNode("/UserConfig/ShowInfo") == null)
                {
                    XmlNode userconfig = doc.CreateElement("UserConfig");
                    doc.AppendChild(userconfig);
                    XmlNode showinfo = doc.CreateElement("ShowInfo");
                    showinfo.InnerText = showhelp.SelectedValue.ToString();
                    userconfig.AppendChild(showinfo);
                }
                else
                {
                    XmlNode showinfo = doc.SelectSingleNode("/UserConfig/ShowInfo");
                    showinfo.InnerText = showhelp.SelectedValue.ToString();
                }
            }
            else
            {
                XmlElement userconfig = doc.CreateElement("UserConfig");
                XmlElement showinfo = doc.CreateElement("ShowInfo");
                showinfo.InnerText = showhelp.SelectedValue.ToString();
                userconfig.AppendChild(showinfo);
                doc.AppendChild(userconfig);
            }
            doc.Save(configPath);
            this.RegisterStartupScript("PAGE", "window.location='likesetting.aspx'");
        }
开发者ID:ZeroneBit,项目名称:dnt3_src,代码行数:31,代码来源:likesetting.aspx.cs

示例2: saveinfo_Click

        protected void saveinfo_Click(object sender, EventArgs e)
        {
			string configPath = Page.Server.MapPath("../xml/user_" + this.userid + ".config");
            if (File.Exists(configPath))
                File.Delete(configPath);
            XmlDocumentExtender doc = new XmlDocumentExtender();
            XmlElement userconfig = doc.CreateElement("UserConfig");
            XmlElement showinfo = doc.CreateElement("ShowInfo");
            showinfo.InnerText = showhelp.SelectedValue.ToString();
            userconfig.AppendChild(showinfo);
            doc.AppendChild(userconfig);
            XmlElement showupgradenode = doc.CreateElement("ShowUpgrade");
            showupgradenode.InnerText = showupgrade.SelectedValue.ToString();
            userconfig.AppendChild(showupgradenode);
            doc.Save(configPath);
            this.RegisterStartupScript("PAGE", "window.location='likesetting.aspx'");
        }
开发者ID:ChalmerLin,项目名称:dnt_v3.6.711,代码行数:17,代码来源:likesetting.aspx.cs

示例3: NewMainMenu

        /// <summary>
        /// 增加主菜单
        /// </summary>
        /// <param name="title">主菜单标题</param>
        /// <param name="defaulturl">主菜单默认展开的页面</param>
        /// <returns>新主菜单项ID</returns>
        public static int NewMainMenu(string title, string defaulturl)
        {
            XmlDocumentExtender doc = new XmlDocumentExtender();
            doc.Load(configPath);
            XmlNodeList mainmenus = doc.SelectNodes("/dataset/toptabmenu");
            int newMenuId = mainmenus.Count + 1;
            XmlElement newMainMenuItem = doc.CreateElement("toptabmenu");
            XmlElement node = doc.CreateElement("id");
            node.InnerText = newMenuId.ToString();
            newMainMenuItem.AppendChild(node);

            node = doc.CreateElement("title");
            node.InnerText = title;
            newMainMenuItem.AppendChild(node);

            node = doc.CreateElement("mainmenulist");
            node.InnerText = "";
            newMainMenuItem.AppendChild(node);

            node = doc.CreateElement("mainmenuidlist");
            node.InnerText = "";
            newMainMenuItem.AppendChild(node);

            node = doc.CreateElement("defaulturl");
            node.InnerText = defaulturl;
            newMainMenuItem.AppendChild(node);

            node = doc.CreateElement("system");
            node.InnerText = "0";
            newMainMenuItem.AppendChild(node);

            doc.SelectSingleNode("/dataset").AppendChild(newMainMenuItem);
            doc.Save(configPath);
            return newMenuId;
        }
开发者ID:Vinna,项目名称:DeepInSummer,代码行数:41,代码来源:MenuManage.cs

示例4: addmenu_Click

        private void addmenu_Click(Object sender, EventArgs e)
        {
            #region 插入菜单

            if ((atext.Text.Trim() != "") && (ahref.Text.Trim() != ""))
            {
                XmlDocumentExtender doc = new XmlDocumentExtender();
                doc.Load(configPath);
                int lastmenuorder = 0;
                if (doc.SelectSingleNode("/menuset").ChildNodes.Count != 0)
                {
                   lastmenuorder = int.Parse(doc.SelectSingleNode("/menuset").LastChild["menuorder"].InnerText);
                }
                lastmenuorder++;
                XmlElement menunode = doc.CreateElement("menuitem");
                doc.AppendChildElementByNameValue(ref menunode, "menuorder", lastmenuorder.ToString());
                doc.AppendChildElementByNameValue(ref menunode, "text", atext.Text.Trim());
                doc.AppendChildElementByNameValue(ref menunode, "href", ahref.Text.Trim());
                doc.AppendChildElementByNameValue(ref menunode, "onclick", aonclick.Text.Trim(),true);
                doc.AppendChildElementByNameValue(ref menunode, "target", atarget.Text.Trim());

                doc.CreateNode("/menuset").AppendChild(menunode);
                doc.Save(configPath);
                CreateJsFile();
                try
                {
                    BindData();
                    ResetForm();
                    base.RegisterStartupScript("PAGE", "window.location.href='forum_mymenumanage.aspx';");
                    return;
                }
                catch
                {
                    base.RegisterStartupScript("", "<script>alert('无法更新XML文件');window.location.href='forum_mymenumanage.aspx';</script>");
                    return;
                }

            }
            else
            {
                base.RegisterStartupScript("", "<script>alert('链接文字和链接地址是必须输入的,如果无链接地址请输入\"#\".');window.location.href='forum_mymenumanage.aspx';</script>");
                return;
            }

            #endregion
        }
开发者ID:khaliyo,项目名称:DiscuzNT,代码行数:46,代码来源:forum_mymenumanage.aspx.cs

示例5: Page_Load

 protected void Page_Load(object sender, EventArgs e)
 {
     //加入快捷操作菜单
     resultmessage = "<img src='../images/existmenu.gif' style='vertical-align:middle'/> 已经收藏";
     string configPath = Page.Server.MapPath("xml/navmenu.config");
     string title = "";
     string menuparentid = "";
     string url = DNTRequest.GetString("url").ToLower();
     XmlDocumentExtender doc = new XmlDocumentExtender();
     doc.Load(configPath);
     //读到快捷操作菜单
     XmlNodeList shortcuts = doc.SelectNodes("/dataset/shortcut");
     foreach (XmlNode singleshortcut in shortcuts)
     {
         //如果当前链接在快捷菜单内,则返回
         if (singleshortcut.SelectSingleNode("link").InnerText == url.ToLower().Trim()) return;
     }
     XmlNodeList submains = doc.SelectNodes("/dataset/submain");
     XmlNodeInnerTextVisitor submainsvisitor = new XmlNodeInnerTextVisitor();
     
     foreach (XmlNode submain in submains)
     {
         submainsvisitor.SetNode(submain);
         if (submainsvisitor["link"].ToLower() == url)
         {
             title = submainsvisitor["menutitle"];
             menuparentid = submainsvisitor["menuparentid"];
         }
     }
     string[] parm = GetParm(doc,menuparentid);
     XmlElement shortcut = doc.CreateElement("shortcut");
     //将当前页面存入快捷操作菜单内
     doc.AppendChildElementByNameValue(ref shortcut, "link", url);
     doc.AppendChildElementByNameValue(ref shortcut, "menutitle", title);
     doc.AppendChildElementByNameValue(ref shortcut, "frameid", "main");
     doc.AppendChildElementByNameValue(ref shortcut, "custommenu", "true");
     doc.AppendChildElementByNameValue(ref shortcut, "showmenuid", parm[0]);
     doc.AppendChildElementByNameValue(ref shortcut, "toptabmenuid", parm[1]);
     doc.AppendChildElementByNameValue(ref shortcut, "mainmenulist", parm[2]);
     doc.SelectSingleNode("/dataset").AppendChild(shortcut);
     doc.Save(configPath);
     //managemainmenu.CreateMenu(Utils.GetMapPath("xml/navmenu.config"), Utils.GetMapPath("framepage") + "/navmenu.js");
     MenuManage.CreateMenuJson();
 }
开发者ID:ichari,项目名称:ichari,代码行数:44,代码来源:favoritefunction.ascx.cs

示例6: NewSubMenu

        /// <summary>
        /// 增加子菜单
        /// </summary>
        /// <param name="mainmenuid">主菜单ID</param>
        /// <param name="menutitle">子菜单标题</param>
        /// <returns>新建子菜单ID</returns>
        public static int NewSubMenu(int mainmenuid, string menutitle)
        {
            int newid = 1;
            int newmenuid = 100;
            XmlDocumentExtender doc = new XmlDocumentExtender();
            doc.Load(configPath);
            XmlNodeList submains = doc.SelectNodes("/dataset/mainmenu");
            newid += int.Parse(submains.Item(submains.Count - 1)["id"].InnerText);
            newmenuid += int.Parse(submains.Item(submains.Count - 1)["menuid"].InnerText);
            XmlElement mainmenu = doc.CreateElement("mainmenu");
            XmlElement node = doc.CreateElement("id");
            node.InnerText = newid.ToString();
            mainmenu.AppendChild(node);

            node = doc.CreateElement("menuid");
            node.InnerText = newmenuid.ToString();
            mainmenu.AppendChild(node);

            node = doc.CreateElement("menutitle");
            node.InnerText = menutitle;
            mainmenu.AppendChild(node);

            doc.SelectSingleNode("/dataset").AppendChild(mainmenu);

            XmlNodeList mainMenus = doc.SelectNodes("/dataset/toptabmenu");
            foreach (XmlNode menuItem in mainMenus) //查找主菜单信息
            {
                if (menuItem["id"].InnerText == mainmenuid.ToString())
                {
                    menuItem["mainmenulist"].InnerText += "," + newid;
                    menuItem["mainmenuidlist"].InnerText += "," + newmenuid;
                    menuItem["mainmenulist"].InnerText = menuItem["mainmenulist"].InnerText.TrimStart(',');
                    menuItem["mainmenuidlist"].InnerText = menuItem["mainmenuidlist"].InnerText.TrimStart(',');
                    break;
                }
            }
            doc.Save(configPath);
            return newmenuid;
        }
开发者ID:Vinna,项目名称:DeepInSummer,代码行数:45,代码来源:MenuManage.cs

示例7: savetopic_Click

 private void savetopic_Click(object sender, EventArgs e)
 {
     #region 绑定自动推荐相册修改
     //验证值是否正确
     if (!ValidateValue(focusphotodays.Text)) return;
     if (!ValidateValue(focusphotocount.Text)) return;
     if (!ValidateValue(focusalbumdays.Text)) return;
     if (!ValidateValue(focusalbumcount.Text)) return;
     if (!ValidateValue(weekhot.Text)) return;
     string strfocusphotoshowtype = focusphotoshowtype.SelectedIndex.ToString();
     string strfocusphotodays = focusphotodays.Text;
     string strfocusphotocount = focusphotocount.Text;
     string strfocusalbumshowtype = recommendalbumtype.SelectedIndex.ToString();
     string strfocusalbumdays = focusalbumdays.Text;
     string strfocusalbumcount = focusalbumcount.Text;
     string strweekhot = weekhot.Text;
     //保存信息
     XmlDocumentExtender doc = new XmlDocumentExtender();
     doc.Load(configPath);
     doc.RemoveNodeAndChildNode("/Aggregationinfo/Aggregationpage/Albumindex/Albumconfig");
     XmlNode albumconfig = doc.InitializeNode("/Aggregationinfo/Aggregationpage/Albumindex/Albumconfig");
     XmlElement node = doc.CreateElement("Focusphotoshowtype");
     node.InnerText = strfocusphotoshowtype;
     albumconfig.AppendChild(node);
     node = doc.CreateElement("Focusphotodays");
     node.InnerText = strfocusphotodays;
     albumconfig.AppendChild(node);
     node = doc.CreateElement("Focusphotocount");
     node.InnerText = strfocusphotocount;
     albumconfig.AppendChild(node);
     node = doc.CreateElement("Focusalbumshowtype");
     node.InnerText = strfocusalbumshowtype;
     albumconfig.AppendChild(node);
     node = doc.CreateElement("Focusalbumdays");
     node.InnerText = strfocusalbumdays;
     albumconfig.AppendChild(node);
     node = doc.CreateElement("Focusalbumcount");
     node.InnerText = strfocusalbumcount;
     albumconfig.AppendChild(node);
     node = doc.CreateElement("Weekhot");
     node.InnerText = strweekhot;
     albumconfig.AppendChild(node);
     doc.Save(configPath);
     AggregationFacade.BaseAggregation.ClearAllDataBind();
     Response.Redirect("aggregation_autoalbums.aspx");
     #endregion
 }
开发者ID:khaliyo,项目名称:DiscuzNT,代码行数:47,代码来源:autoalbums.aspx.cs

示例8: SaveTopicDisplay_Click

        /// <summary>
        /// 保存主题显示
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void SaveTopicDisplay_Click(object sender, EventArgs e)
        {
            #region 保存主题显示
            XmlDocumentExtender doc = new XmlDocumentExtender();
            doc.Load(configPath);
            //doc.RemoveNodeAndChildNode("/Aggregationinfo/Aggregationpage/Website/Forum/Bbs");
            doc.InitializeNode("/Aggregationinfo/Aggregationpage/Website/Forum");

            XmlElement BBS = doc.CreateElement("Bbs");
            doc.AppendChildElementByNameValue(ref BBS, "Topnumber", topnumber.Text, false);
            doc.AppendChildElementByNameValue(ref BBS, "Showtype", showtype.SelectedValue, false);
            doc.SelectSingleNode("/Aggregationinfo/Aggregationpage/Website/Forum").AppendChild(BBS);
            doc.Save(configPath);
            #endregion
        }
开发者ID:ichari,项目名称:ichari,代码行数:20,代码来源:aggregation_forumaggset.aspx.cs

示例9: savetopic_Click

 private void savetopic_Click(object sender, EventArgs e)
 {
     #region 保存相册
     string aid = DNTRequest.GetString("aid");
     string aidlist = Utils.ClearLastChar(recommendalbum.Value);
     string dataNode = "";
     string indexNode = "";
     string pagename = DNTRequest.GetString("pagename").ToLower();
     if (pagename == "albumindex")
     {
         dataNode = "/Aggregationinfo/Aggregationdata/Albumindexaggregationdata/Albumindex_albumlist";
         indexNode = "/Aggregationinfo/Aggregationpage/Albumindex/Albumindex_albumlist";
     }
     else if (pagename == "website")
     {
         dataNode = "/Aggregationinfo/Aggregationdata/Websiteaggregationdata/Website_albumlist";
         indexNode = "/Aggregationinfo/Aggregationpage/Website/Website_albumlist";
     }
     else
     {
         dataNode = "/Aggregationinfo/Aggregationdata/Spaceindexaggregationdata/Spaceindex_albumlist";
         indexNode = "/Aggregationinfo/Aggregationpage/Spaceindex/Spaceindex_albumlist";
     }
     if (aidlist == "")
     {
         XmlDocumentExtender doc = new XmlDocumentExtender();
         doc.Load(configPath);
         doc.RemoveNodeAndChildNode(dataNode);
         doc.RemoveNodeAndChildNode(indexNode);
         doc.Save(configPath);
         Response.Redirect("aggregation_commendalbums.aspx?pagename=" + DNTRequest.GetString("pagename"));
         return;
     }
     else
     {
         DataTable dt = DbProvider.GetInstance().GetAlbumLitByAlbumidList(aidlist);
         XmlDocumentExtender doc = new XmlDocumentExtender();
         doc.Load(configPath);
         XmlNode data_albumslistnode = doc.InitializeNode(dataNode);
         XmlNode index_albumslistnode = doc.InitializeNode(indexNode);
         foreach (DataRow dr in dt.Rows)
         {
             XmlElement album = doc.CreateElement("Album");
             doc.AppendChildElementByDataRow(ref album, dt.Columns, dr, "description");
             data_albumslistnode.AppendChild(album);
             if (("," + aid + ",").IndexOf("," + dr["albumid"].ToString() + ",") >= 0)
                 index_albumslistnode.AppendChild(album.Clone());
         }
         doc.Save(configPath);
         AggregationFacade.BaseAggregation.ClearAllDataBind();
         Response.Redirect("aggregation_commendalbums.aspx?pagename=" + DNTRequest.GetString("pagename"));
     }
     #endregion
 }
开发者ID:wenysky,项目名称:dnt31-lite,代码行数:54,代码来源:commendalbums.aspx.cs

示例10: AddNewRec_Click

        private void AddNewRec_Click(object sender, EventArgs e)
        {
            #region 添加附件分类
            if (typename.Text == "")
            {
                base.RegisterStartupScript("", "<script>alert('附件分类名称不能为空!');window.location.href='forum_attchemnttypes.aspx';</script>");
                return;
            }

            XmlDocumentExtender doc = new XmlDocumentExtender();
            doc.Load(AppDomain.CurrentDomain.BaseDirectory + "config/myattachment.config");
            if (DNTRequest.GetString("atttypeid") == "")   //增加附件分类
            {
                XmlNode attachtypes = doc.SelectSingleNode("/MyAttachmentsTypeConfigInfo/attachtypes");
                XmlElement attachtype = doc.CreateElement("AttachmentType");
                XmlElement node = doc.CreateElement("TypeId");
                int maxTypeid = GetMaxTypeid();
                node.InnerText = (++maxTypeid).ToString();
                attachtype.AppendChild(node);
                node = doc.CreateElement("TypeName");
                node.InnerText = typename.Text;
                attachtype.AppendChild(node);
                node = doc.CreateElement("ExtName");
                node.InnerText = GetAttTypeList();
                attachtype.AppendChild(node);
                attachtypes.AppendChild(attachtype);
            }
            else
            {
                XmlNodeList xnl = doc.SelectNodes("/MyAttachmentsTypeConfigInfo/attachtypes/AttachmentType");
                foreach (XmlNode xn in xnl)
                {
                    if (xn["TypeId"].InnerText == DNTRequest.GetString("atttypeid"))
                    {
                        xn["TypeName"].InnerText = typename.Text;
                        xn["ExtName"].InnerText = GetAttTypeList();
                    }
                }
            }
            doc.Save(AppDomain.CurrentDomain.BaseDirectory + "config/myattachment.config");
            UpdateAttchmentTypes();
            base.RegisterStartupScript("", "<script>window.location.href='forum_attchemnttypes.aspx';</script>");
            #endregion
        }
开发者ID:ichari,项目名称:ichari,代码行数:44,代码来源:forum_attchemnttypes.aspx.cs

示例11: addrota_Click

        private void addrota_Click(Object sender, EventArgs e)
        {
            #region 插入聚合页图版轮换广告

            if ((rotaimg.Text.Trim() != "") && (url.Text.Trim() != "") && (titlecontent.Text.Trim() != ""))
            {
                if((!Utils.IsURL(rotaimg.Text.Trim()) || (!Utils.IsURL(url.Text.Trim()))))
                {
                    base.RegisterStartupScript("", "<script>alert('图片路径或点击链接可能是非法URL');</script>");
                    BindData();
                    ResetForm();
                    return;
                }
               
                XmlDocumentExtender doc = new XmlDocumentExtender();
                doc.Load(configPath);
                int lastRotatepicid = 0;
				if (doc.SelectSingleNode(targetNode) != null)
				{
					if (doc.SelectSingleNode(targetNode).InnerText != "")
					{
						lastRotatepicid = int.Parse(doc.SelectSingleNode(targetNode).LastChild["rotatepicid"].InnerText);
					}
				}
                lastRotatepicid++;

                XmlElement rotatepicNode = doc.CreateElement(nodeName);
                doc.AppendChildElementByNameValue(ref rotatepicNode, "rotatepicid", lastRotatepicid.ToString());
                doc.AppendChildElementByNameValue(ref rotatepicNode, "pagetype", "1");
                doc.AppendChildElementByNameValue(ref rotatepicNode, "img", rotaimg.Text.Trim());
                doc.AppendChildElementByNameValue(ref rotatepicNode, "url", url.Text.Trim());
                doc.AppendChildElementByNameValue(ref rotatepicNode, "titlecontent", titlecontent.Text.Trim());

                doc.CreateNode(targetNode).AppendChild(rotatepicNode);
                doc.Save(configPath);
                AggregationFacade.BaseAggregation.ClearAllDataBind();
                AdminVistLogs.InsertLog(this.userid, this.username, this.usergroupid, this.grouptitle, this.ip, "添加聚合页图版轮换广告", "添加聚合页图版轮换广告,名称为: " + titlecontent.Text.Trim());

                try
                {
                    BindData();
                    Discuz.Cache.DNTCache.GetCacheService().RemoveObject("/Forum/ForumLinkList");
                    ResetForm();
					base.RegisterStartupScript("PAGE", "window.location.href='aggregation_rotatepic.aspx?pagename=" + DNTRequest.GetString("pagename") + "';");
                    return;
                }
                catch
                {
                    base.RegisterStartupScript("", "<script>alert('无法更新XML文件');window.location.href='aggregation_rotatepic.aspx?pagename=" + DNTRequest.GetString("pagename") + "';</script>");
                    return;
                }

            }
            else
            {
                base.RegisterStartupScript("", "<script>alert('图片或链接地址以及标题不能为空.');window.location.href='aggregation_rotatepic.aspx?pagename=" + DNTRequest.GetString("pagename") + "';</script>");
                return;
            }

            #endregion
        }
开发者ID:ChalmerLin,项目名称:dnt_v3.6.711,代码行数:61,代码来源:aggregation_rotatepic.aspx.cs

示例12: SaveRotatepic_Click

        private void SaveRotatepic_Click(object sender, EventArgs e)
        {
            #region 保存轮换图片修改
            int rowid = 0;
            bool error = false;

            XmlDocumentExtender doc = new XmlDocumentExtender();
            doc.Load(configPath);
            XmlNodeList __xmlnodelist = doc.SelectSingleNode(targetNode).ChildNodes;

            if ((__xmlnodelist != null) && (__xmlnodelist.Count > 0))
            {
                doc.InitializeNode(targetNode);
            }

            foreach (object o in DataGrid1.GetKeyIDArray())
            {
                #region 轮换图片
                string rotatepicid = DataGrid1.GetControlValue(rowid, "rotatepicid");
                //string name = ((TextBox)E.Item.FindControl("rotatepicid")).Text;
                string img = DataGrid1.GetControlValue(rowid, "img");
                string url = DataGrid1.GetControlValue(rowid, "url");
                string titlecontent = DataGrid1.GetControlValue(rowid, "titlecontent").Trim();
                if (!Utils.IsNumeric(rotatepicid) || !Utils.IsURL(img) || !Utils.IsURL(url) || titlecontent == "")
                {
                    //base.RegisterStartupScript("", "<script>alert('序号、图片路径或点击链接可能是非法URL或说明文字为空');window.location.href='aggregation_rotatepic.aspx?pagename=" + DNTRequest.GetString("pagename") + "';</script>");
                    //return;
                    error = true;
                    //continue;
                    break;//如果用continue,则导致正确的设置可以被保存,有错误的设置却被删除,即使被修改之前是正确的。会丢失数据
                }
                bool insert = false;
                XmlElement rotatepicNode = doc.CreateElement(nodeName);
                doc.AppendChildElementByNameValue(ref rotatepicNode, "rotatepicid", rotatepicid);
                doc.AppendChildElementByNameValue(ref rotatepicNode, "pagetype", "1");
                doc.AppendChildElementByNameValue(ref rotatepicNode, "img", img);
                doc.AppendChildElementByNameValue(ref rotatepicNode, "url", url);
                doc.AppendChildElementByNameValue(ref rotatepicNode, "titlecontent", titlecontent);

                foreach (XmlNode __node in __xmlnodelist)
                {
                    if (int.Parse(__node["rotatepicid"].InnerText) > int.Parse(rotatepicid))
                    {
                        doc.SelectSingleNode(targetNode).InsertBefore(rotatepicNode, __node);
                        insert = true;
                        break;
                    }
                }
                if (!insert)
                {
                    doc.SelectSingleNode(targetNode).AppendChild(rotatepicNode);
                }
                rowid++;
                #endregion
            }
            AggregationFacade.BaseAggregation.ClearAllDataBind();
            if(!error)
            {
                SiteUrls.SetInstance();
                AdminVistLogs.InsertLog(this.userid, this.username, this.usergroupid, this.grouptitle, this.ip, "聚合页面论坛广告编辑", "");
                doc.Save(configPath);

                base.RegisterStartupScript("PAGE", "window.location.href='aggregation_rotatepic.aspx?pagename=" + DNTRequest.GetString("pagename") + "';");
                return;
            }
            else
            {
                base.RegisterStartupScript("", "<script>alert('某行序号、图片路径或点击链接可能是非法URL或说明文字为空,不能进行更新.');window.location.href='aggregation_rotatepic.aspx?pagename=" + DNTRequest.GetString("pagename") + "';</script>");
                return;
            }
            #endregion
        }
开发者ID:ChalmerLin,项目名称:dnt_v3.6.711,代码行数:72,代码来源:aggregation_rotatepic.aspx.cs

示例13: SaveTopicDisplay_Click

        /// <summary>
        /// 保存主题显示
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void SaveTopicDisplay_Click(object sender, EventArgs e)
        {
            #region 保存主题显示
            //if (!Utils.IsNumeric(topnumber.Text))
            //{
            //    base.RegisterStartupScript("", "<script>alert('显示主题条数必须为数字!');</script>");
            //    return;
            //}
            //if (Convert.ToInt32(topnumber.Text) <= 0)
            //{
            //    base.RegisterStartupScript("", "<script>alert('显示主题条数至少是1条!');</script>");
            //    return;
            //}
            XmlDocumentExtender doc = new XmlDocumentExtender();
            doc.Load(configPath);
            doc.RemoveNodeAndChildNode("/Aggregationinfo/Aggregationpage/Website/Forum/Bbs");
            //doc.InitializeNode("/Aggregationinfo/Aggregationpage/Website/Forum");

            if (doc.SelectSingleNode("/Aggregationinfo/Aggregationpage/Website/Forum") == null)
                doc.InitializeNode("/Aggregationinfo/Aggregationpage/Website/Forum");

            XmlElement BBS = doc.CreateElement("Bbs");
            doc.AppendChildElementByNameValue(ref BBS, "Topnumber", topnumber.Text, false);
            doc.AppendChildElementByNameValue(ref BBS, "Showtype", showtype.SelectedValue, false);
            doc.SelectSingleNode("/Aggregationinfo/Aggregationpage/Website/Forum").AppendChild(BBS);
            doc.Save(configPath);
            AggregationConfig.ResetConfig();
            AggregationFacade.ForumAggregation.ClearAllDataBind();
            #endregion
        }
开发者ID:wenysky,项目名称:dnt31-lite,代码行数:35,代码来源:aggregation_forumaggset.aspx.cs

示例14: SaveTopic_Click

        private void SaveTopic_Click(object sender, EventArgs e)
        {
            #region 保存个人空间信息
            string sidlist = DNTRequest.GetString("spacestatus");
            if (sidlist == "")
            {
                XmlDocumentExtender doc = new XmlDocumentExtender();
                doc.Load(configPath);
                doc.RemoveNodeAndChildNode("/Aggregationinfo/Aggregationdata/" + pagename + "aggregationdata/" + pagename + "_spacelist");
                doc.RemoveNodeAndChildNode("/Aggregationinfo/Aggregationpage/" + pagename + "/" + pagename + "_spacelist");
                doc.Save(configPath);
                Response.Redirect("aggregation_spaceaggset.aspx");
                return;
            }
            else
            {
                DataTable dt = DbProvider.GetInstance().GetSpaceLitByTidlist(sidlist);

                XmlDocumentExtender doc = new XmlDocumentExtender();
                doc.Load(configPath);
                XmlNode data_spacelistnode = doc.InitializeNode("/Aggregationinfo/Aggregationdata/" + pagename + "aggregationdata/" + pagename + "_spacelist");
                XmlNode pagelistnode = doc.InitializeNode("/Aggregationinfo/Aggregationpage/" + pagename + "/" + pagename + "_spacelist");
                sidlist = DNTRequest.GetString("sid");
                foreach (DataRow dr in dt.Rows)
                {
                    XmlElement space = doc.CreateElement("Space");
                    doc.AppendChildElementByDataRow(ref space, dt.Columns, dr, "title,avatar,description");
                    doc.AppendChildElementByNameValue(ref space, "title", dr["spacetitle"].ToString().Trim());
                    doc.AppendChildElementByNameValue(ref space, "pic", dr["avatar"].ToString().Trim());
                    doc.AppendChildElementByNameValue(ref space, "description", Utils.RemoveHtml(dr["description"].ToString().Trim()), true);

                    string[] postinfo = DbProvider.GetInstance().GetSpaceLastPostInfo(int.Parse(dr["userid"].ToString()));
                    doc.AppendChildElementByNameValue(ref space, "postid", postinfo[0]);
                    doc.AppendChildElementByNameValue(ref space, "posttitle", postinfo[1]);

                    data_spacelistnode.AppendChild(space);
                    if (("," + sidlist + ",").IndexOf("," + dr["spaceid"].ToString() + ",") >= 0)
                    {
                        pagelistnode.AppendChild(space.Clone());
                   }
                }
                doc.Save(configPath);
                AggregationFacade.BaseAggregation.ClearAllDataBind();
                Response.Redirect("aggregation_spaceaggset.aspx?pagename=" + pagename);
            }
            #endregion
        }
开发者ID:ChalmerLin,项目名称:dnt_v3.6.711,代码行数:47,代码来源:spaceaggset.aspx.cs

示例15: NewMenuItem

        /// <summary>
        /// 新建菜单项
        /// </summary>
        /// <param name="menuparentid">父菜单ID</param>
        /// <param name="title">菜单标题</param>
        /// <param name="link">菜单链接</param>
        /// <returns>操作成功否</returns>
        public static bool NewMenuItem(int menuparentid, string title, string link)
        {
            XmlDocumentExtender doc = new XmlDocumentExtender();
            doc.Load(configPath);
            XmlNodeList submains = doc.SelectNodes("/dataset/submain");
            foreach (XmlNode sub in submains)
            {
                if (sub["link"].InnerText == link)
                {
                    return false;
                }
            }
            XmlElement submain = doc.CreateElement("submain");
            XmlElement node = doc.CreateElement("menuparentid");
            node.InnerText = menuparentid.ToString();
            submain.AppendChild(node);

            node = doc.CreateElement("menutitle");
            node.InnerText = title;
            submain.AppendChild(node);

            node = doc.CreateElement("link");
            node.InnerText = link;
            submain.AppendChild(node);

            node = doc.CreateElement("frameid");
            node.InnerText = "main";
            submain.AppendChild(node);

            doc.SelectSingleNode("/dataset").AppendChild(submain);
            doc.Save(configPath);
            return true;
        }
开发者ID:Vinna,项目名称:DeepInSummer,代码行数:40,代码来源:MenuManage.cs


注:本文中的Discuz.Common.Xml.XmlDocumentExtender.CreateElement方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。