本文整理汇总了C#中Route.CreateRouteXML方法的典型用法代码示例。如果您正苦于以下问题:C# Route.CreateRouteXML方法的具体用法?C# Route.CreateRouteXML怎么用?C# Route.CreateRouteXML使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Route
的用法示例。
在下文中一共展示了Route.CreateRouteXML方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: CreateRoutesList
/// <summary>
/// Accesses DB and creates Routes List.
/// Routes created by users.
/// </summary>
/// <param name="userID">The user of the routes to get</param>
/// <param name="siteID">Site of the routes</param>
/// <param name="skip">number of routes to skip</param>
/// <param name="show">number to show</param>
/// <param name="showPrivate">Indicates whether private routes should be included.</param>
/// <returns>Whether created ok</returns>
public bool CreateRoutesList(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, "ROUTES-LIST");
AddAttribute(list, "SKIP", skip);
AddAttribute(list, "SHOW", show);
using (IDnaDataReader dataReader = InputContext.CreateDnaDataReader("getmoreroutes"))
{
dataReader.AddParameter("userid", userID);
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 Routes.
int count = 0;
if (dataReader.HasRows)
{
while (dataReader.Read() && count < show)
{
Route route = new Route(InputContext);
//Delegate creation of XML to Route class.
route.CreateRouteXML(dataReader, false);
AddInside(list, route);
++count;
}
}
// Add More Attribute Indicating there are more rows.
if (dataReader.Read() && count > 0)
{
AddAttribute(list, "MORE", 1);
}
}
}
return true;
}
示例2: GenerateMangeRouteXml
/// <summary>
/// Generates the XML for the Route
/// </summary>
/// <param name="dataReader">The recordset of location data</param>
/// <param name="action">The action to apply to the route.</param>
private void GenerateMangeRouteXml(IDnaDataReader dataReader, string action)
{
XmlElement routePageXML = AddElementTag(RootElement, "ROUTEPAGE");
if (dataReader.HasRows)
{
if (dataReader.Read())
{
Route route = new Route(InputContext);
route.CreateRouteXML(dataReader, true);
AddInside(routePageXML, route);
}
}
}