本文整理汇总了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
}
示例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
}
示例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
}
示例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
}