/// <summary> /// Unigrid event handler. /// </summary> /// <param name="actionName">Name of action</param> /// <param name="actionArgument">ID (value of Primary key) of corresponding data row</param> protected void UniGrid_OnAction(string actionName, object actionArgument) { // Edit report if (actionName == "edit") { if (!UseEditOnPostback) { URLHelper.Redirect(UrlResolver.ResolveUrl("AbuseReport_Edit.aspx?reportid=" + actionArgument)); } else { EditReportID = ValidationHelper.GetInteger(actionArgument, 0); } } // Delete report else if (actionName == "delete") { // Check permissions if (CheckPermissions("CMS.AbuseReport", "Manage")) { AbuseReportInfoProvider.DeleteAbuseReportInfo(ValidationHelper.GetInteger(actionArgument, 0)); } } // Solve report else if (actionName == "solve") { // Check permissions if (CheckPermissions("CMS.AbuseReport", "Manage")) { AbuseReportInfo ari = AbuseReportInfoProvider.GetAbuseReportInfo(ValidationHelper.GetInteger(actionArgument, 0)); if (ari != null) { ari.ReportStatus = AbuseReportStatusEnum.Solved; AbuseReportInfoProvider.SetAbuseReportInfo(ari); } } } // Reject report else if (actionName == "reject") { // Check permissions if (CheckPermissions("CMS.AbuseReport", "Manage")) { AbuseReportInfo ari = AbuseReportInfoProvider.GetAbuseReportInfo(ValidationHelper.GetInteger(actionArgument, 0)); if (ari != null) { ari.ReportStatus = AbuseReportStatusEnum.Rejected; AbuseReportInfoProvider.SetAbuseReportInfo(ari); } } } }
/// <summary> /// Deletes abuse report. Called when the "Delete report" button is pressed. /// Expects the CreateAbuseReport method to be run first. /// </summary> private bool DeleteAbuseReport() { string where = "ReportTitle LIKE N'MyNewReport%'"; // Get the report DataSet reports = AbuseReportInfoProvider.GetAbuseReports(where, null); if (!DataHelper.DataSourceIsEmpty(reports)) { // Create the object from DataRow AbuseReportInfo deleteReport = new AbuseReportInfo(reports.Tables[0].Rows[0]); // Delete the abuse report AbuseReportInfoProvider.DeleteAbuseReportInfo(deleteReport); return(true); } return(false); }