本文整理汇总了C#中Link.CreateLinkXML方法的典型用法代码示例。如果您正苦于以下问题:C# Link.CreateLinkXML方法的具体用法?C# Link.CreateLinkXML怎么用?C# Link.CreateLinkXML使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Link
的用法示例。
在下文中一共展示了Link.CreateLinkXML方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: CreateLinksList
/// <summary>
/// Accesses DB and creates Links List.
/// Links created by users.
/// </summary>
/// <param name="userID">The user of the links to get</param>
/// <param name="siteID">Site of the links</param>
/// <param name="skip">number of links to skip</param>
/// <param name="show">number to show</param>
/// <param name="showPrivate">Indicates whether private links should be included.</param>
/// <returns>Whether created ok</returns>
public bool CreateLinksList(int userID, int siteID, int skip, int show, bool showPrivate)
{
// check object is not already initialised
if (userID <= 0 || show <= 0)
{
return false;
}
XmlElement list = AddElementTag(RootElement, "LINKS-LIST");
AddAttribute(list, "SKIP", skip);
AddAttribute(list, "SHOW", show);
using (IDnaDataReader dataReader = InputContext.CreateDnaDataReader("getmorelinks"))
{
dataReader.AddParameter("userid", userID);
dataReader.AddParameter("linkgroup", String.Empty);
dataReader.AddParameter("showprivate", showPrivate);
dataReader.AddParameter("siteid", InputContext.CurrentSite.SiteID);
// Get +1 so we know if there are more left
dataReader.AddParameter("skip", skip);
dataReader.AddParameter("show", show + 1);
dataReader.Execute();
if (dataReader.HasRows)
{
//1st Result set gets user details.
if (dataReader.Read())
{
User user = new User(InputContext);
user.AddUserXMLBlock(dataReader, userID, list);
dataReader.NextResult();
}
//Paged List of Links / Clippings / Bookmarks .
int count = 0;
Link link = new Link(InputContext);
while (dataReader.Read() && count < show)
{
//Delegate creation of XML to Link class.
link.CreateLinkXML(dataReader, list, true, false);
++count;
}
// Add More Attribute Indicating there are more rows.
if (dataReader.Read() && count > 0)
{
AddAttribute(list, "MORE", 1);
}
}
}
return true;
}