本文整理汇总了C#中ICriteria.ToXml方法的典型用法代码示例。如果您正苦于以下问题:C# ICriteria.ToXml方法的具体用法?C# ICriteria.ToXml怎么用?C# ICriteria.ToXml使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ICriteria
的用法示例。
在下文中一共展示了ICriteria.ToXml方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: GetReportPostData
private XElement GetReportPostData(string reportName, ICriteria criteria)
{
if (criteria != null)
{
XElement root = new XElement("Parameters");
root.Add(criteria.ToXml());
return root;
}
return null;
}
示例2: GetSelectPostData
private XElement GetSelectPostData(string tableName, ICriteria criteria, bool includeLookupCaptions, bool loadDeletedAndHiddenRecords, string[] orderby, string[] relatedTables, string[] fields, int top, int pageSize, int pageIndex)
{
XElement root = new XElement(tableName);
if (criteria != null)
{
root.Add(criteria.ToXml());
}
if (loadDeletedAndHiddenRecords)
{
root.Add(new XElement("_loadDeletedAndHiddenRecords", true));
}
if (includeLookupCaptions)
{
root.Add(new XElement("_includeLookupCaptions", true));
}
if (top > 0)
{
root.Add(new XElement("_top", top));
}
if (pageIndex > 0)
{
root.Add(new XElement("_pageIndex", pageIndex));
}
if (pageSize > 0)
{
root.Add(new XElement("_pageSize", pageSize));
}
if (relatedTables != null && relatedTables.Length > 0)
{
root.Add(new XElement("_relatedTables", string.Join(",", relatedTables)));
}
if (orderby != null && orderby.Length > 0)
{
root.Add(new XElement("_orderBy", string.Join(",", orderby)));
}
return root;
}
示例3: GetReport
/// <summary>
/// Returns the data from a report
/// </summary>
/// <param name="reportName">The name of the report to return or the ID of the report as a string</param>
/// <param name="criteria">The parameters with which to query the report if any</param>
/// <returns>An array of records from the database</returns>
public dynamic[] GetReport(string reportName, ICriteria criteria = null)
{
if (reportName == null) throw new ArgumentNullException("reportName");
XElement postXml = null;
if (criteria != null)
{
postXml = new XElement("Parameters");
postXml.Add(criteria.ToXml());
}
List<string> urlBits = new List<string> { "getreport", reportName };
XElement result;
HttpStatusCode status = PerformRequest(string.Join("/", urlBits), postXml, out result);
if (status == HttpStatusCode.OK)
{
//return result.Elements(reportName).Select(x => new ApiObject(x)).ToArray();
return result.Elements("Record").Select(x => new ApiObject(x)).ToArray();
}
return null;
}