public RdlReader(bool mono) { bMono = mono; GetStartupState(); BuildMenus(); InitializeComponent(); Application.AddMessageFilter(this); this.Closing += new System.ComponentModel.CancelEventHandler(this.RdlReader_Closing); _GetPassword = new NeedPassword(this.GetPassword); // open up the current files if any if (_CurrentFiles != null) { foreach (string file in _CurrentFiles) { MDIChild mc = new MDIChild(this.ClientRectangle.Width * 3 / 4, this.ClientRectangle.Height * 3 / 4); mc.MdiParent = this; mc.Viewer.GetDataSourceReferencePassword = _GetPassword; mc.SourceFile = file; mc.Text = file; mc.Show(); } _CurrentFiles = null; // don't need this any longer } }
public DesignerForm() { KeyPreview = true; GetStartupState(); //BuildMenus(); InitializeComponent(); Application.AddMessageFilter(this); this.MdiChildActivate += new EventHandler(RdlDesigner_MdiChildActivate); this.Closing += new System.ComponentModel.CancelEventHandler(this.RdlDesigner_Closing); _GetPassword = new NeedPassword(this.GetPassword); InitProperties(); InitToolbar(); InitStatusBar(); InitIpc(); // open up the current files if any if (_CurrentFiles != null) { foreach (string file in _CurrentFiles) { CreateMDIChild(file, null, false); } _CurrentFiles = null; // don't need this any longer } DesignTabChanged(this, new EventArgs()); }
static internal void SetUserContext(Report r, HttpContext context, NeedPassword np) { r.GetDataSourceReferencePassword = np; if (context == null) // may not always have a context { return; } HttpRequest req = context.Request; if (req != null && req.UserLanguages != null && req.UserLanguages.Length > 0) { string l = req.UserLanguages[0]; r.ClientLanguage = l; } if (context.User != null && context.User.Identity != null) { System.Security.Principal.IIdentity id = context.User.Identity; if (id.IsAuthenticated) { r.UserID = id.Name; } } return; }
override internal void Run(IPresent ip, Row row) { Report r = ip.Report(); base.Run(ip, row); // need to save the owner report and nest in this defintion ReportDefn saveReport = r.ReportDefinition; NeedPassword np = r.GetDataSourceReferencePassword; // get current password r.SetReportDefinition(_ReportDefn); r.Folder = _ReportDefn.ParseFolder; // folder needs to get set since the id of the report is used by the cache r.GetDataSourceReferencePassword = np; DataSourcesDefn saveDS = r.ParentConnections; if (this.MergeTransactions) { r.ParentConnections = saveReport.DataSourcesDefn; } else { r.ParentConnections = null; } r.SubreportDataRetrievalTriggerEvent(); if (_Parameters == null) { // When no parameters we only retrieve data once if (r.Cache.Get(this, "report") == null) { r.RunGetData(null); if (!r.IsSubreportDataRetrievalDefined) // if use has defined subreportdataretrieval they might { r.Cache.Add(this, "report", this); // set the data; so we don't cache } } } else { SetSubreportParameters(r, row); r.RunGetData(null); } ip.Subreport(this, row); r.SetReportDefinition(saveReport); // restore the current report r.ParentConnections = saveDS; // restore the data connnections }
Type _CodeType; // used for parsing of expressions; DONT USE AT RUNTIME // Constructor internal ReportDefn(XmlNode xNode, ReportLog replog, string folder, NeedPassword getpswd, int objcount) // report has no parents { rl = replog; // used for error reporting _ObjectCount = objcount; // starting number for objects in this report; 0 other than for subreports GetDataSourceReferencePassword = getpswd; _ParseFolder = folder; _Description = null; _Author = null; _AutoRefresh = -1; _DataSourcesDefn = null; _DataSetsDefn = null; _Body = null; _Width = null; _PageHeader = null; _PageFooter = null; _PageHeight = null; _PageWidth = null; _LeftMargin = null; _RightMargin = null; _TopMargin = null; _BottomMargin = null; _EmbeddedImages = null; _Language = null; _CodeModules = null; _Code = null; _Classes = null; _DataTransform = null; _DataSchema = null; _DataElementName = null; _DataElementStyle = DataElementStyleEnum.AttributeNormal; _LUReportItems = new Hashtable(); // to hold all the textBoxes _LUAggrScope = new ListDictionary(); // to hold all dataset, dataregion, grouping names _LUEmbeddedImages = new ListDictionary(); // probably not very many _LUDynamicNames = new Hashtable(); _DataCache = new List<ICacheData>(); // Run thru the attributes foreach(XmlAttribute xAttr in xNode.Attributes) { switch (xAttr.Name) { case "Name": _Name = new Name(xAttr.Value); break; } } // Loop thru all the child nodes foreach(XmlNode xNodeLoop in xNode.ChildNodes) { if (xNodeLoop.NodeType != XmlNodeType.Element) continue; switch (xNodeLoop.Name) { case "Description": _Description = xNodeLoop.InnerText; break; case "Author": _Author = xNodeLoop.InnerText; break; case "AutoRefresh": _AutoRefresh = XmlUtil.Integer(xNodeLoop.InnerText); break; case "DataSources": _DataSourcesDefn = new DataSourcesDefn(this, null, xNodeLoop); break; case "DataSets": _DataSetsDefn = new DataSetsDefn(this, null, xNodeLoop); break; case "Body": _Body = new Body(this, null, xNodeLoop); break; case "ReportParameters": _ReportParameters = new ReportParameters(this, null, xNodeLoop); break; case "Width": _Width = new RSize(this, xNodeLoop); break; case "PageHeader": _PageHeader = new PageHeader(this, null, xNodeLoop); break; case "PageFooter": _PageFooter = new PageFooter(this, null, xNodeLoop); break; case "PageHeight": _PageHeight = new RSize(this, xNodeLoop); break; case "PageWidth": _PageWidth = new RSize(this, xNodeLoop); break; case "LeftMargin": _LeftMargin = new RSize(this, xNodeLoop); break; case "RightMargin": _RightMargin = new RSize(this, xNodeLoop); break; case "TopMargin": _TopMargin = new RSize(this, xNodeLoop); break; case "BottomMargin": _BottomMargin = new RSize(this, xNodeLoop); break; case "EmbeddedImages": _EmbeddedImages = new EmbeddedImages(this, null, xNodeLoop); break; case "Language": _Language = new Expression(this, null, xNodeLoop, ExpressionType.String); break; case "Code": _Code = new Code(this, null, xNodeLoop); break; case "CodeModules": _CodeModules = new CodeModules(this, null, xNodeLoop); break; case "Classes": _Classes = new Classes(this, null, xNodeLoop); break; case "DataTransform": _DataTransform = xNodeLoop.InnerText; break; case "DataSchema": _DataSchema = xNodeLoop.InnerText; break; case "DataElementName": _DataElementName = xNodeLoop.InnerText; break; case "DataElementStyle": _DataElementStyle = fyiReporting.RDL.DataElementStyle.GetStyle(xNodeLoop.InnerText, this.rl); break; default: // don't know this element - log it this.rl.LogError(4, "Unknown Report element '" + xNodeLoop.Name + "' ignored."); break; } } if (_Body == null) rl.LogError(8, "Body not specified for report."); if (_Width == null) rl.LogError(4, "Width not specified for report. Assuming page width."); if (rl.MaxSeverity <= 4) // don't do final pass if already have serious errors { FinalPass(folder); // call final parser pass for expression resolution } // Cleanup any dangling resources if (_DataSourcesDefn != null) _DataSourcesDefn.CleanUp(null); }
Type _CodeType; // used for parsing of expressions; DONT USE AT RUNTIME // Constructor internal ReportDefn(XmlNode xNode, ReportLog replog, string folder, NeedPassword getpswd, int objcount) // report has no parents { rl = replog; // used for error reporting _ObjectCount = objcount; // starting number for objects in this report; 0 other than for subreports GetDataSourceReferencePassword = getpswd; _ParseFolder = folder; _Description = null; _Author = null; _AutoRefresh = -1; _DataSourcesDefn = null; _DataSetsDefn = null; _Body = null; _Width = null; _PageHeader = null; _PageFooter = null; _PageHeight = null; _PageWidth = null; _LeftMargin = null; _RightMargin = null; _TopMargin = null; _BottomMargin = null; _EmbeddedImages = null; _Language = null; _CodeModules = null; _Code = null; _Classes = null; _DataTransform = null; _DataSchema = null; _DataElementName = null; _DataElementStyle = DataElementStyleEnum.AttributeNormal; _LUReportItems = new Hashtable(); // to hold all the textBoxes _LUAggrScope = new ListDictionary(); // to hold all dataset, dataregion, grouping names _LUEmbeddedImages = new ListDictionary(); // probably not very many _LUDynamicNames = new Hashtable(); _DataCache = new List <ICacheData>(); // Run thru the attributes foreach (XmlAttribute xAttr in xNode.Attributes) { switch (xAttr.Name) { case "Name": _Name = new Name(xAttr.Value); break; } } // Loop thru all the child nodes foreach (XmlNode xNodeLoop in xNode.ChildNodes) { if (xNodeLoop.NodeType != XmlNodeType.Element) { continue; } switch (xNodeLoop.Name) { case "Description": _Description = xNodeLoop.InnerText; break; case "Author": _Author = xNodeLoop.InnerText; break; case "AutoRefresh": _AutoRefresh = XmlUtil.Integer(xNodeLoop.InnerText); break; case "DataSources": _DataSourcesDefn = new DataSourcesDefn(this, null, xNodeLoop); break; case "DataSets": _DataSetsDefn = new DataSetsDefn(this, null, xNodeLoop); break; case "Body": _Body = new Body(this, null, xNodeLoop); break; case "ReportParameters": _ReportParameters = new ReportParameters(this, null, xNodeLoop); break; case "Width": _Width = new RSize(this, xNodeLoop); break; case "PageHeader": _PageHeader = new PageHeader(this, null, xNodeLoop); break; case "PageFooter": _PageFooter = new PageFooter(this, null, xNodeLoop); break; case "PageHeight": _PageHeight = new RSize(this, xNodeLoop); break; case "PageWidth": _PageWidth = new RSize(this, xNodeLoop); break; case "LeftMargin": _LeftMargin = new RSize(this, xNodeLoop); break; case "RightMargin": _RightMargin = new RSize(this, xNodeLoop); break; case "TopMargin": _TopMargin = new RSize(this, xNodeLoop); break; case "BottomMargin": _BottomMargin = new RSize(this, xNodeLoop); break; case "EmbeddedImages": _EmbeddedImages = new EmbeddedImages(this, null, xNodeLoop); break; case "Language": _Language = new Expression(this, null, xNodeLoop, ExpressionType.String); break; case "Code": _Code = new Code(this, null, xNodeLoop); break; case "CodeModules": _CodeModules = new CodeModules(this, null, xNodeLoop); break; case "Classes": _Classes = new Classes(this, null, xNodeLoop); break; case "DataTransform": _DataTransform = xNodeLoop.InnerText; break; case "DataSchema": _DataSchema = xNodeLoop.InnerText; break; case "DataElementName": _DataElementName = xNodeLoop.InnerText; break; case "DataElementStyle": _DataElementStyle = fyiReporting.RDL.DataElementStyle.GetStyle(xNodeLoop.InnerText, this.rl); break; default: // don't know this element - log it this.rl.LogError(4, "Unknown Report element '" + xNodeLoop.Name + "' ignored."); break; } } if (_Body == null) { rl.LogError(8, "Body not specified for report."); } if (_Width == null) { rl.LogError(4, "Width not specified for report. Assuming page width."); } if (rl.MaxSeverity <= 4) // don't do final pass if already have serious errors { FinalPass(folder); // call final parser pass for expression resolution } // Cleanup any dangling resources if (_DataSourcesDefn != null) { _DataSourcesDefn.CleanUp(null); } }
override internal void RunPage(Pages pgs, Row row) { Report r = pgs.Report; if (IsHidden(r, row)) { return; } base.RunPage(pgs, row); // need to save the owner report and nest in this defintion ReportDefn saveReport = r.ReportDefinition; NeedPassword np = r.GetDataSourceReferencePassword; // get current password r.SetReportDefinition(_ReportDefn); r.Folder = _ReportDefn.ParseFolder; // folder needs to get set since the id of the report is used by the cache r.GetDataSourceReferencePassword = np; DataSourcesDefn saveDS = r.ParentConnections; if (this.MergeTransactions) { r.ParentConnections = saveReport.DataSourcesDefn; } else { r.ParentConnections = null; } r.SubreportDataRetrievalTriggerEvent(); bool bRows = true; if (_Parameters == null) { // When no parameters we only retrieve data once SubreportWorkClass wc = r.Cache.Get(this, "report") as SubreportWorkClass; if (wc == null) { // run report first time; bRows = r.RunGetData(null); if (!r.IsSubreportDataRetrievalDefined) // if use has defined subreportdataretrieval they might set data { r.Cache.Add(this, "report", new SubreportWorkClass(bRows)); // so we can't cache } } else { bRows = wc.bRows; } } else { SetSubreportParameters(r, row); // apply the parameters bRows = r.RunGetData(null); } SetPageLeft(r); // Set the Left attribute since this will be the margin for this report SetPagePositionBegin(pgs); float yOffset; if (bRows) // Only run subreport if have a row in some Dataset { // // Run the subreport -- this is the major effort in creating the display objects in the page // r.ReportDefinition.Body.RunPage(pgs); // create a the subreport items yOffset = pgs.CurrentPage.YOffset; } else { // Handle NoRows message string msg; if (this.NoRows != null) { msg = this.NoRows.EvaluateString(pgs.Report, null); } else { msg = null; } if (msg != null) { PageText pt = new PageText(msg); SetPagePositionAndStyle(pgs.Report, pt, null); if (pt.SI.BackgroundImage != null) { pt.SI.BackgroundImage.H = pt.H; // and in the background image } pgs.CurrentPage.AddObject(pt); yOffset = pt.Y + pt.H; } else { yOffset = pgs.CurrentPage.YOffset; } } r.SetReportDefinition(saveReport); // restore the current report r.ParentConnections = saveDS; // restore the data connnections SetPagePositionEnd(pgs, yOffset); }
internal static void SetUserContext(Report r, HttpContext context, NeedPassword np) { r.GetDataSourceReferencePassword = np; if (context == null) // may not always have a context return; HttpRequest req = context.Request; if (req != null && req.UserLanguages!= null && req.UserLanguages.Length > 0) { string l = req.UserLanguages[0]; r.ClientLanguage = l; } if (context.User != null && context.User.Identity != null) { System.Security.Principal.IIdentity id = context.User.Identity; if (id.IsAuthenticated) { r.UserID = id.Name; } } return; }
public RdlReader(bool mono) { bMono = mono; GetStartupState(); BuildMenus(); InitializeComponent(); Application.AddMessageFilter(this); this.Closing += new System.ComponentModel.CancelEventHandler(this.RdlReader_Closing); _GetPassword = new NeedPassword(this.GetPassword); // open up the current files if any if (_CurrentFiles != null) { foreach (string file in _CurrentFiles) { MDIChild mc = new MDIChild(this.ClientRectangle.Width*3/4, this.ClientRectangle.Height*3/4); mc.MdiParent = this; mc.Viewer.GetDataSourceReferencePassword = _GetPassword; mc.SourceFile = file; mc.Text = file; mc.Show(); } _CurrentFiles = null; // don't need this any longer } }
// Constructor internal ReportDefn(XmlNode xNode, ReportLog replog, string folder, NeedPassword getpswd, int objcount, CrossDelegate crossdel, string overwriteConnectionString, bool overwriteInSubreport, List <Param> sqlParams = null) // report has no parents { rl = replog; // used for error reporting _ObjectCount = objcount; // starting number for objects in this report; 0 other than for subreports GetDataSourceReferencePassword = getpswd; _ParseFolder = folder; _Description = null; _Author = null; _AutoRefresh = -1; _DataSourcesDefn = null; _DataSetsDefn = null; _Body = null; _Width = null; _PageHeader = null; _PageFooter = null; _PageHeight = null; _PageWidth = null; _LeftMargin = null; _RightMargin = null; _TopMargin = null; _BottomMargin = null; _EmbeddedImages = null; _Language = null; _CodeModules = null; _Code = null; _Classes = null; _DataTransform = null; _DataSchema = null; _DataElementName = null; _DataElementStyle = DataElementStyleEnum.AttributeNormal; _LUReportItems = new Hashtable(); // to hold all the textBoxes _LUAggrScope = new ListDictionary(); // to hold all dataset, dataregion, grouping names _LUEmbeddedImages = new ListDictionary(); // probably not very many _LUDynamicNames = new Hashtable(); _DataCache = new List <ICacheData>(); // EBN 30/03/2014 SubReportGetContent = crossdel; _OverwriteConnectionString = overwriteConnectionString; _OverwriteInSubreport = overwriteInSubreport; // Run thru the attributes foreach (XmlAttribute xAttr in xNode.Attributes) { switch (xAttr.Name) { case "Name": _Name = new Name(xAttr.Value); break; } } // Loop thru all the child nodes foreach (XmlNode xNodeLoop in xNode.ChildNodes) { if (xNodeLoop.NodeType != XmlNodeType.Element) { continue; } switch (xNodeLoop.Name) { case "Description": _Description = xNodeLoop.InnerText; break; case "Author": _Author = xNodeLoop.InnerText; break; case "AutoRefresh": _AutoRefresh = XmlUtil.Integer(xNodeLoop.InnerText); break; case "DataSources": _DataSourcesDefn = new DataSourcesDefn(this, null, xNodeLoop); break; case "DataSets": _DataSetsDefn = new DataSetsDefn(this, null, xNodeLoop); ParseSQLParams(sqlParams); break; case "Body": _Body = new Body(this, null, xNodeLoop); break; case "ReportParameters": _ReportParameters = new ReportParameters(this, null, xNodeLoop); break; case "Width": _Width = new RSize(this, xNodeLoop); break; case "PageHeader": _PageHeader = new PageHeader(this, null, xNodeLoop); break; case "PageFooter": _PageFooter = new PageFooter(this, null, xNodeLoop); break; case "PageHeight": _PageHeight = new RSize(this, xNodeLoop); break; case "PageWidth": _PageWidth = new RSize(this, xNodeLoop); break; case "LeftMargin": _LeftMargin = new RSize(this, xNodeLoop); break; case "RightMargin": _RightMargin = new RSize(this, xNodeLoop); break; case "TopMargin": _TopMargin = new RSize(this, xNodeLoop); break; case "BottomMargin": _BottomMargin = new RSize(this, xNodeLoop); break; case "EmbeddedImages": _EmbeddedImages = new EmbeddedImages(this, null, xNodeLoop); break; case "Language": _Language = new Expression(this, null, xNodeLoop, ExpressionType.String); break; case "Code": _Code = new Code(this, null, xNodeLoop); break; case "CodeModules": _CodeModules = new CodeModules(this, null, xNodeLoop); break; case "Classes": _Classes = new Classes(this, null, xNodeLoop); break; case "DataTransform": _DataTransform = xNodeLoop.InnerText; break; case "DataSchema": _DataSchema = xNodeLoop.InnerText; break; case "DataElementName": _DataElementName = xNodeLoop.InnerText; break; case "DataElementStyle": _DataElementStyle = fyiReporting.RDL.DataElementStyle.GetStyle(xNodeLoop.InnerText, this.rl); break; default: // don't know this element - log it this.rl.LogError(4, "Unknown Report element '" + xNodeLoop.Name + "' ignored."); break; } } //if (sqlParams != null && sqlParams.Count > 0) //{ // foreach (var item in sqlParams) // { // var a = ((System.Collections.Specialized.ListDictionary)_DataSetsDefn.Items).Values; // foreach (fyiReporting.RDL.DataSetDefn ibj in a) // { // if (ibj.Query.DataSourceName == item.Dataset) // { // var query = ibj.Query.CommandText.Source.Replace($"@{item.Key}", $"'{item.Value}'"); // ibj.Query.CommandText.SetSource(query); // //ibj.Query.CommandText.SetSource(ibj.Query.CommandText.Source.Replace($"@{item.Key}", $"'{item.Value}'")); // if (ibj.Query.QueryParameters == null) continue; // var queryItem = ibj.Query.QueryParameters.Items.FirstOrDefault(q => q.Name.ToString() == item.Key); // ibj.Query.QueryParameters.Items.Remove(queryItem); // } // } // } //} if (_Body == null) { rl.LogError(8, "Body not specified for report."); } if (_Width == null) { rl.LogError(4, "Width not specified for report. Assuming page width."); } if (rl.MaxSeverity <= 4) // don't do final pass if already have serious errors { FinalPass(folder); // call final parser pass for expression resolution } // Cleanup any dangling resources if (_DataSourcesDefn != null) { _DataSourcesDefn.CleanUp(null); } }