public ReportSource Resolve(string report, OperationOrigin operationOrigin, IDictionary <string, object> currentParameterValues) { // Converts the JSON data into a dynamic object and reads the reportName field ReportSourceModel reportSourceData = Newtonsoft.Json.JsonConvert.DeserializeObject <ReportSourceModel>(report); var reportName = reportSourceData.Name; try { // If the passed report name is not DataGridExample.trdx, return null so the fallback file resolver will try to resolve the report. if (!string.Equals(reportName, DATAGRID_EXAMPLE_REPORT, System.StringComparison.OrdinalIgnoreCase) && !string.Equals(reportName, SALES_EXAMPLE_REPORT, System.StringComparison.OrdinalIgnoreCase) && !string.Equals(reportName, PRESENTATION_EXAMPLE_REPORT, System.StringComparison.OrdinalIgnoreCase)) { return(null); } // Reads and deserialize the report file var gridReportPath = Path.Combine(this.reportPath, reportName); this.gridReportInstance = (Report) new Telerik.Reporting.XmlSerialization.ReportXmlSerializer().Deserialize(gridReportPath); // Set the JSON datasource if (string.Equals(reportName, DATAGRID_EXAMPLE_REPORT, System.StringComparison.OrdinalIgnoreCase)) { // This is only done for the DATAGRID_EXAMPLE_REPORT // The two other reports have the JSON data embedded this.BindData(Newtonsoft.Json.JsonConvert.SerializeObject(reportSourceData.Data)); } // Set the filters if (reportSourceData.Filters != null) { this.BindFilters(reportSourceData.Filters); } // Set the sorting if (reportSourceData.Sortings != null) { this.BindSorts(reportSourceData.Sortings); } // The grouping is applied by updating the parameter. By default, the parameter is "1". // The groupheader in the DATAGRID report will be hidden if the parameter is still "1". this.BindGroupByParameter(reportSourceData.Grouping); return(new InstanceReportSource() { ReportDocument = this.gridReportInstance, }); } catch (Newtonsoft.Json.JsonException jex) { Trace.TraceError("A problem occurred while deserializing the report source identifier: {0}.{1}Falling back to the next report resolver.", jex, Environment.NewLine); return(null); } }
public Telerik.Reporting.ReportSource Resolve(string reportId, OperationOrigin operationOrigin, IDictionary <string, object> currentParameterValues) { //soubor sestavy###login uživatele###j72id List <string> lis = BO.BAS.ConvertString2List(reportId, "###"); reportId = lis[0]; string strLogin = lis[1]; int intJ72ID = 0; if (lis.Count > 2) { intJ72ID = BO.BAS.InInt(lis[2]); } string reportXml = File.ReadAllText(_app.ReportFolder + "\\" + reportId); if (reportXml.Contains("1=1")) { var cu = new BO.RunningUser() { j03Login = strLogin }; BL.Factory f = new BL.Factory(cu, _app); if (intJ72ID > 0) { var recJ72 = f.j72TheGridTemplateBL.Load(intJ72ID); var mq = new BO.myQuery(recJ72.j72Entity); mq.lisJ73 = f.j72TheGridTemplateBL.GetList_j73(intJ72ID, recJ72.j72Entity.Substring(0, 3)); BL.DL.FinalSqlCommand fq = BL.DL.basQuery.ParseFinalSql("", mq, cu); //File.WriteAllText("c:\\temp\\hovado.txt", fq.SqlWhere); reportXml = reportXml.Replace("1=1", fq.SqlWhere).Replace("#query_alias#", recJ72.j72Name); } } return(new Telerik.Reporting.XmlReportSource { Xml = reportXml }); }
/// <summary> /// Converts the <see cref="sourceValue" /> parameter to the <see cref="destinationType" /> parameter using <see cref="formatProvider" /// /> and <see cref="ignoreCase" /> /// </summary> /// <param name="sourceValue">the <see cref="System.Object"/> to convert from</param> /// <param name="destinationType">the <see cref="System.Type" /> to convert to</param> /// <param name="formatProvider">not used by this TypeConverter.</param> /// <param name="ignoreCase">when set to <c>true</c>, will ignore the case when converting.</param> /// <returns> /// an instance of <see cref="OperationOrigin" />, or <c>null</c> if there is no suitable conversion. /// </returns> public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => OperationOrigin.CreateFrom(sourceValue);
public Telerik.Reporting.ReportSource Resolve(string reportId, OperationOrigin operationOrigin, IDictionary <string, object> currentParameterValues) { var reportGenerator = new ReportFileMaker(); return(reportGenerator.GetReportDocument()); }