Getting abuse reports from the database

  Previous topic Next topic JavaScript is required for the print function Mail us feedback on this topic! Mail us feedback on this topic!  

The first code example on this page shows how you can get a single abuse report from the system database based on its ID.

 

[C#]

 

using CMS.SiteProvider;

 

...

 

        // Get abuse report as an info object by AbuseReportID

        AbuseReportInfo ari = AbuseReportInfoProvider.GetAbuseReportInfo(1);

 

The following code example shows how you can get a DataSet with multiple abuse reports. As you can see, two overrides of the GetAbuseReports method are used here. The first one gets the abuse reports based on the WHERE condition and ordered by the ORDER BY part of the SQL query. The second one does the same, while it also selects only the particular columns and retrieves only top N records (based on the order specified by the second parameter).

 

[C#]

 

using System.Data;

using CMS.SiteProvider;

 

...

 

        // Set the WHERE condition

        string where = "ReportStatus = 1";

        // Set the ORDER BY clause

        string orderBy = "ReportWhen DESC";

        // Set the colums to select

        string columns = "ReportID, ReportTitle, ReportURL, ReportComment, ReportStatus";

        // Set the number of rows to select

        int topN = 10;

 

        // Get a DataSet of abuse report info objects according to the given parameters

        DataSet ds = AbuseReportInfoProvider.GetAbuseReports(where, orderBy);

 

        DataSet ds2 = AbuseReportInfoProvider.GetAbuseReports(where, orderBy, columns, topN);

 

Page url: http://devnet.kentico.com/docs/5_5r2/devguide/index.html?api_getting_abuse_reports_from_the_database.htm