/// <summary> /// Check that report can process specified coluns and filters. /// </summary> /// <param name="columns">Columns which proposed for report.</param> /// <param name="filters">Filters which proposed for report.</param> /// <returns>Array with errors.</returns> public string[] Validate(IEnumerable <IReportColumn> columns, IEnumerable <IReportFilter> filters) { var errors = new List <string>(); /**************************** * 1. Validate ReportModel * ****************************/ if (!ReportColumns.Any()) { errors.Add("ReportModel do not contains any ReportColumns inside"); } if (DataSource == null) { errors.Add("DataSource for ReportModel not specified"); } /**************************** * 2. Validate Inputs * ****************************/ if (!columns.Any()) { errors.Add("Report must have at least one output column."); } foreach (var column in columns) { if (!ReportColumns.Contains(column)) { errors.Add("Unknow report column: " + column.Title); } } foreach (var filter in filters) { if (!ReportColumns.Contains(filter.ReportColumn)) { errors.Add("Unknow report filter, column: " + filter.ReportColumn.Title); } } return(errors.ToArray()); }