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


C# XmlDocumentExtender.AppendChildElementByDataRow方法代码示例

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


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

示例1: SaveTopic_Click

 private void SaveTopic_Click(object sender, EventArgs e)
 {
     #region 装载修改信息
     string pid = DNTRequest.GetString("pid");
     string pidlist = Utils.ClearLastChar(poststatus.Value);
     if (pidlist == "")
     {
         XmlDocumentExtender doc = new XmlDocumentExtender();
         doc.Load(configPath);
         doc.RemoveNodeAndChildNode("/Aggregationinfo/Aggregationdata/" + pagename + "aggregationdata/" + pagename + "_spacearticlelist");
         doc.RemoveNodeAndChildNode("/Aggregationinfo/Aggregationpage/" + pagename + "/" + pagename + "_spacearticlelist");
         doc.Save(configPath);
         Response.Redirect("aggregation_postaggset.aspx");
         return;
     }
     else
     {
         DataTable dt = DbProvider.GetInstance().GetSpacepostLitByTidlist(pidlist);
         XmlDocumentExtender doc = new XmlDocumentExtender();
         doc.Load(configPath);
         XmlNode data_spacearticlelistnode = doc.InitializeNode("/Aggregationinfo/Aggregationdata/" + pagename + "aggregationdata/" + pagename + "_spacearticlelist");
         XmlNode pagearticlelistnode = doc.InitializeNode("/Aggregationinfo/Aggregationpage/" + pagename + "/" + pagename + "_spacearticlelist");
         foreach (DataRow dr in dt.Rows)
         {
             XmlElement article = doc.CreateElement("Article");
             doc.AppendChildElementByDataRow(ref article, dt.Columns, dr);
             data_spacearticlelistnode.AppendChild(article);
             if (("," + pid + ",").IndexOf("," + dr["postid"].ToString() + ",") >= 0)
             {
                 pagearticlelistnode.AppendChild(article.Clone());
             }
         }
         doc.Save(configPath);
         AggregationFacade.BaseAggregation.ClearAllDataBind();
         Response.Redirect("aggregation_postaggset.aspx?pagename=" + pagename);
     }
     #endregion
 }
开发者ID:wenysky,项目名称:dnt31-lite,代码行数:38,代码来源:postaggset.aspx.cs

示例2: SaveTopic_Click

        /// <summary>
        /// 保存信息
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void SaveTopic_Click(object sender, EventArgs e)
        {
            #region 保存信息
            string tidlist = DNTRequest.GetString("forumtopicstatus");
            //当未选择主题时,则清除所有选择
            if (tidlist == "")
            {
                XmlDocumentExtender doc = new XmlDocumentExtender();
                doc.Load(configPath);
                doc.RemoveNodeAndChildNode("/Aggregationinfo/Aggregationdata/Websiteaggregationdata/Topiclist");
                doc.RemoveNodeAndChildNode("/Aggregationinfo/Aggregationpage/Website/Forum/Topiclist");
                doc.Save(configPath);
                Response.Redirect("aggregation_editforumaggset.aspx");
                return;
            }
            else
            {
                //得到所选择帖子信息
                DataTable dt = DatabaseProvider.GetInstance().GetTopicListByTidlist(tablelist.SelectedValue, tidlist);
            
                XmlDocumentExtender doc = new XmlDocumentExtender();
                doc.Load(configPath);
                //清除以前选择
                XmlNode topiclistnode = doc.InitializeNode("/Aggregationinfo/Aggregationdata/Websiteaggregationdata/Topiclist");
                XmlNode websitetopiclistnode = doc.InitializeNode("/Aggregationinfo/Aggregationpage/Website/Forum/Topiclist");

                tidlist = DNTRequest.GetString("tid");
                foreach (DataRow dr in dt.Rows)
                {
                    //创建Topic节点
                    XmlElement topic = doc.CreateElement("Topic");
                    doc.AppendChildElementByDataRow(ref topic, dt.Columns, dr, "tid,message");
                    doc.AppendChildElementByNameValue(ref topic, "topicid", dr["tid"].ToString());
                    string tempubbstr = UBB.ClearUBB(dr["message"].ToString());
                    if (tempubbstr.Length > 200)
                        tempubbstr = tempubbstr.Substring(0, 200) + "...";

                    doc.AppendChildElementByNameValue(ref topic, "shortdescription", tempubbstr, true);
                    doc.AppendChildElementByNameValue(ref topic, "fulldescription", UBB.ClearUBB(dr["message"].ToString()), true);
                    topiclistnode.AppendChild(topic);


                    if (("," + tidlist + ",").IndexOf("," + dr["tid"].ToString() + ",") >= 0)
                    {
                        websitetopiclistnode.AppendChild(topic.Clone());
                    }
                }                          
                doc.Save(configPath);
                AggregationFacade.BaseAggregation.ClearAllDataBind();
                Response.Redirect("aggregation_editforumaggset.aspx");
            }
            #endregion
        }
开发者ID:ichari,项目名称:ichari,代码行数:58,代码来源:aggregation_forumaggset.aspx.cs

示例3: 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

示例4: 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


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