예제 #1
0
    private string GetParameters(Uri sourcefile)
    {
        string parameters = "";
        string sourceRdl = System.IO.File.ReadAllText(sourcefile.LocalPath);
        fyiReporting.RDL.RDLParser parser = new fyiReporting.RDL.RDLParser(sourceRdl);
        parser.Parse();
        if (parser.Report.UserReportParameters.Count > 0)
        {
					
            int count = 0;
            foreach (fyiReporting.RDL.UserReportParameter rp in parser.Report.UserReportParameters)
            {
                parameters += "&" + rp.Name + "=";
            }
			
            fyiReporting.RdlGtkViewer.ParameterPrompt prompt = new fyiReporting.RdlGtkViewer.ParameterPrompt();
            prompt.Parameters = parameters;
            if (prompt.Run() == (int)Gtk.ResponseType.Ok)
            {
                parameters = prompt.Parameters;
            }
            prompt.Destroy();
			
        }	
		
        return parameters;
    }
예제 #2
0
        public static Report GetReport(Uri uri2Rdl)
        {
            //string cwd = System.Environment.CurrentDirectory;

            //var rdlView = new fyiReporting.RdlViewer.RdlViewer();
            //rdlView.SourceFile = new Uri(System.IO.Path.Combine(cwd,"Reports", "FunctionTest.rdl"));
            string filePath = uri2Rdl.LocalPath;
            // Now parse the file 
            string source = System.IO.File.ReadAllText(filePath);

            RDLParser rdlp;
            Report r;

            rdlp = new RDLParser(source);
            // RDLParser takes RDL XML and Parse compiles the report

            r = rdlp.Parse();
            if (r.ErrorMaxSeverity > 0)
            {

                foreach (string emsg in r.ErrorItems)
                {
                    //  Console.WriteLine(emsg);
                }

                int severity = r.ErrorMaxSeverity;
                r.ErrorReset();
                if (severity > 4)
                {
                    r = null; // don't return when severe errors
                }
            }

            return r;
        }
예제 #3
0
    private string GetParameters(Uri sourcefile)
    {
        string parameters = "";
        string sourceRdl  = System.IO.File.ReadAllText(sourcefile.LocalPath);

        fyiReporting.RDL.RDLParser parser = new fyiReporting.RDL.RDLParser(sourceRdl);
        parser.Parse();
        if (parser.Report.UserReportParameters.Count > 0)
        {
            int count = 0;
            foreach (fyiReporting.RDL.UserReportParameter rp in parser.Report.UserReportParameters)
            {
                parameters += "&" + rp.Name + "=";
            }

            fyiReporting.RdlGtkViewer.ParameterPrompt prompt = new fyiReporting.RdlGtkViewer.ParameterPrompt();
            prompt.Parameters = parameters;
            if (prompt.Run() == (int)Gtk.ResponseType.Ok)
            {
                parameters = prompt.Parameters;
            }
            prompt.Destroy();
        }

        return(parameters);
    }
예제 #4
0
        private ReportDefn GetReport(string folder)
        {
            string prog;
            string name;

            if (_ReportName[0] == Path.DirectorySeparatorChar ||
                _ReportName[0] == Path.AltDirectorySeparatorChar)
            {
                name = _ReportName;
            }
            else
            {
                name = folder + Path.DirectorySeparatorChar + _ReportName;
            }

            name = name + ".rdl";                               // TODO: shouldn't necessarily require this extension

            // Load and Compile the report
            RDLParser  rdlp;
            Report     r;
            ReportDefn rdefn = null;

            try
            {
                prog        = GetRdlSource(name);
                rdlp        = new RDLParser(prog);
                rdlp.Folder = folder;
                r           = rdlp.Parse(OwnerReport.GetObjectNumber());
                OwnerReport.SetObjectNumber(r.ReportDefinition.GetObjectNumber());
                if (r.ErrorMaxSeverity > 0)
                {
                    string err;
                    if (r.ErrorMaxSeverity > 4)
                    {
                        err = string.Format("Subreport {0} failed to compile with the following errors.", this._ReportName);
                    }
                    else
                    {
                        err = string.Format("Subreport {0} compiled with the following warnings.", this._ReportName);
                    }
                    OwnerReport.rl.LogError(r.ErrorMaxSeverity, err);
                    OwnerReport.rl.LogError(r.rl);                      // log all these errors
                    OwnerReport.rl.LogError(0, "End of Subreport errors");
                }
                // If we've loaded the report; we should tell it where it got loaded from
                if (r.ErrorMaxSeverity <= 4)
                {
                    rdefn = r.ReportDefinition;
                }
            }
            catch (Exception ex)
            {
                OwnerReport.rl.LogError(8, string.Format("Subreport {0} failed with exception. {1}", this._ReportName, ex.Message));
            }
            return(rdefn);
        }
예제 #5
0
        private Report GetReport(string reportSource)
        {
            // Now parse the file

            RDLParser rdlp;
            Report r;

            rdlp = new RDLParser(reportSource);
            rdlp.Folder = WorkingDirectory;
            // RDLParser takes RDL XML and Parse compiles the report

            r = rdlp.Parse();
            if (r.ErrorMaxSeverity > 0)
            {
                foreach (string emsg in r.ErrorItems)
                {
                    Console.WriteLine(emsg);
                }
                SetErrorMessages (r.ErrorItems);

                int severity = r.ErrorMaxSeverity;
                r.ErrorReset();
                if (severity > 4)
                {
                    errorsAction.Active = true;
                    return null; // don't return when severe errors
                }
            }
            return r;
        }
예제 #6
0
		private Report GetReport(string prog, string file)
		{
			// Now parse the file
			RDLParser rdlp;
			Report r;
			try
			{
				rdlp =  new RDLParser(prog);
				string folder = Path.GetDirectoryName(file);
				if (folder == "")
				{
					folder = Environment.CurrentDirectory;
				}
				rdlp.Folder = folder;

				r = rdlp.Parse();
				if (r.ErrorMaxSeverity > 4) 
				{
					MessageBox.Show(string.Format("Report {0} has errors and cannot be processed.", "Report"));
					r = null;			// don't return when severe errors
				}
			}
			catch(Exception e)
			{
				r = null;
				MessageBox.Show(e.Message, "Report load failed");
			}
			return r;
		}
예제 #7
0
		private ReportDefn GetReport(string folder)
		{
			string prog;
			string name;

			if (_ReportName[0] == Path.DirectorySeparatorChar ||
				_ReportName[0] == Path.AltDirectorySeparatorChar)
				name = _ReportName;
			else 
				name = Path.Combine (folder, _ReportName);

			if(!Path.HasExtension (name))
				name = Path.ChangeExtension (name, ".rdl");

			// Load and Compile the report
			RDLParser rdlp;
			Report r;
			ReportDefn rdefn=null;
			try
			{
				prog = GetRdlSource(name);
				rdlp =  new RDLParser(prog);
				rdlp.Folder = folder;
				if(OwnerReport.OverwriteInSubreport)
				{
					rdlp.OverwriteConnectionString = OwnerReport.OverwriteConnectionString;
					rdlp.OverwriteInSubreport = OwnerReport.OverwriteInSubreport;
				}

				r = rdlp.Parse(OwnerReport.GetObjectNumber());
				OwnerReport.SetObjectNumber(r.ReportDefinition.GetObjectNumber());
				if (r.ErrorMaxSeverity > 0) 
				{
					string err;
					if (r.ErrorMaxSeverity > 4)
						err = string.Format("Subreport {0} failed to compile with the following errors.", this._ReportName);
					else
						err = string.Format("Subreport {0} compiled with the following warnings.", this._ReportName);
					OwnerReport.rl.LogError(r.ErrorMaxSeverity, err);
					OwnerReport.rl.LogError(r.rl);	// log all these errors
					OwnerReport.rl.LogError(0, "End of Subreport errors");
				}
				// If we've loaded the report; we should tell it where it got loaded from
				if (r.ErrorMaxSeverity <= 4) 
				{	
					rdefn = r.ReportDefinition;
				}
			}
			catch (Exception ex)
			{
				OwnerReport.rl.LogError(8, string.Format("Subreport {0} failed with exception. {1}", this._ReportName, ex.Message));
			}
			return rdefn;
		}
예제 #8
0
        private Report GetReport(string prog, string file)
        {
            // Now parse the file
            RDLParser rdlp;
            Report r;
            try
            {
                rdlp =  new RDLParser(prog);
                string folder = Path.GetDirectoryName(file);
                if (folder == "")
                    folder = Environment.CurrentDirectory;
                rdlp.Folder = folder;
                rdlp.DataSourceReferencePassword = new NeedPassword(this.GetPassword);

                r = rdlp.Parse();
                if (r.ErrorMaxSeverity > 0)
                {
                    // have errors fill out the msgs
                    Console.WriteLine("{0} has the following errors:", file);
                    foreach (string emsg in r.ErrorItems)
                    {
                        Console.WriteLine(emsg);		// output message to console
                    }
                    int severity = r.ErrorMaxSeverity;
                    r.ErrorReset();
                    if (severity > 4)
                    {
                        r = null;			// don't return when severe errors
                        returnCode = 8;
                    }
                }
                // If we've loaded the report; we should tell it where it got loaded from
                if (r != null)
                {
                    r.Folder = folder;
                    r.Name = Path.GetFileNameWithoutExtension(file);
                    r.GetDataSourceReferencePassword = new RDL.NeedPassword(GetPassword);
                }
            }
            catch(Exception e)
            {
                r = null;
                Console.WriteLine(e.Message);
                returnCode = 8;
            }
            return r;
        }
예제 #9
0
		private Report ProcessReportCompile(string file, string prog, out string msgs)
		{
			// Now parse the file
			RDLParser rdlp;
			Report r;
			msgs = "";
			try
			{
				rdlp =  new RDLParser(prog);
				rdlp.Folder = Path.GetDirectoryName(file);
				rdlp.DataSourceReferencePassword = new NeedPassword(this.GetPassword);

				r = rdlp.Parse();
				if (r.ErrorMaxSeverity > 0) 
				{
					// have errors fill out the msgs 
					foreach (String emsg in r.ErrorItems)
					{
						if (_server.TraceLevel > 0)
							Console.WriteLine(emsg);		// output message to console
						msgs += (emsg + "<p>");
					}
					int severity = r.ErrorMaxSeverity;
					r.ErrorReset();
					if (severity > 4)
						r = null;			// don't return when severe errors
				}
				// If we've loaded the report; we should tell it where it got loaded from
				if (r != null)
				{
					r.Folder = Path.GetDirectoryName(file);
					r.Name = Path.GetFileNameWithoutExtension(file);
					r.GetDataSourceReferencePassword = new RDL.NeedPassword(GetPassword);
				}
			}
			catch (Exception ex)
			{
				msgs = string.Format("<H2>{0}</H2>", ex.Message);
				r = null;
			}


			return r;
		}
예제 #10
0
		private Report GetReport(string prog, string file)
		{
			// Now parse the file
			RDLParser rdlp;
			Report r;
			try
			{
                // Make sure RdlEngine is configed before we ever parse a program
                //   The config file must exist in the Bin directory.
                string searchDir = this.MapPathSecure(this.ReportFile.StartsWith("~") ? "~/Bin" : "/Bin") + Path.DirectorySeparatorChar;
                RdlEngineConfig.RdlEngineConfigInit(searchDir);

				rdlp =  new RDLParser(prog);
				string folder = Path.GetDirectoryName(file);
				if (folder == "")
					folder = Environment.CurrentDirectory;
				rdlp.Folder = folder;
				rdlp.DataSourceReferencePassword = new NeedPassword(this.GetPassword);

				r = rdlp.Parse();
				if (r.ErrorMaxSeverity > 0)
				{
					AddError(r.ErrorMaxSeverity, r.ErrorItems);
					if (r.ErrorMaxSeverity >= 8)
						r = null;
					r.ErrorReset();
				}

				// If we've loaded the report; we should tell it where it got loaded from
				if (r != null)
				{
					r.Folder = folder;
					r.Name = Path.GetFileNameWithoutExtension(file);
					r.GetDataSourceReferencePassword = new RDL.NeedPassword(GetPassword);
				}
			}
			catch(Exception e)
			{
				r = null;
				AddError(8, "Exception parsing report {0}.  {1}", file, e.Message);
			}
			return r;
		}
예제 #11
0
        // Obtain the Pages by running the report
        private Report GetReport()
        {
            string prog;

            // Obtain the source
            if (_loadFailed)
                prog = GetReportErrorMsg();
            else if (_SourceRdl != null)
                prog = _SourceRdl;
            else if (_SourceFileName != null)
                prog = GetRdlSource();
            else
                prog = GetReportEmptyMsg();

            // Compile the report
            // Now parse the file
            RDLParser rdlp;
            Report r;
            try
            {
                _errorMsgs = null;
                rdlp = new RDLParser(prog);
                rdlp.DataSourceReferencePassword = GetDataSourceReferencePassword;
                if (_SourceFileName != null)
                    rdlp.Folder = Path.GetDirectoryName(_SourceFileName.LocalPath);
                else
                    rdlp.Folder = this.Folder;

                r = rdlp.Parse();
                if (r.ErrorMaxSeverity > 0)
                {
                    _errorMsgs = r.ErrorItems;		// keep a copy of the errors

                    int severity = r.ErrorMaxSeverity;
                    r.ErrorReset();
                    if (severity > 4)
                    {
                        r = null;			// don't return when severe errors
                        _loadFailed = true;
                    }
                }
                // If we've loaded the report; we should tell it where it got loaded from
                if (r != null && !_loadFailed)
                {	// Don't care much if this fails; and don't want to null out report if it does
                    try
                    {
                        if (_SourceFileName != null)
                        {
                            r.Name = Path.GetFileNameWithoutExtension(_SourceFileName.LocalPath);
                            r.Folder = Path.GetDirectoryName(_SourceFileName.LocalPath);
                        }
                        else
                        {
                            r.Folder = this.Folder;
                            r.Name = this.ReportName;
                        }
                    }
                    catch { }
                }
            }
            catch (Exception ex)
            {
                _loadFailed = true;
                _errorMsgs = new List<string>();		// create new error list
                _errorMsgs.Add(ex.Message);			// put the message in it
                _errorMsgs.Add(ex.StackTrace);		//   and the stack trace
                r = null;
            }

            if (r != null)
            {
                _PageWidth = r.PageWidthPoints;
                _PageHeight = r.PageHeightPoints;
                _ReportDescription = r.Description;
                _ReportAuthor = r.Author;
                r.SubreportDataRetrieval += new EventHandler<SubreportDataRetrievalEventArgs>(r_SubreportDataRetrieval);
                ParametersBuild(r);
            }
            else
            {
                _PageWidth = 0;
                _PageHeight = 0;
                _ReportDescription = null;
                _ReportAuthor = null;
                _ReportName = null;
            }
            return r;
        }
예제 #12
0
        private Report GetReport(string reportSource)
        {
            // Now parse the file

            RDLParser rdlp;
            Report r;

            rdlp =  new RDLParser(reportSource);
            // RDLParser takes RDL XML and Parse compiles the report

            r = rdlp.Parse();
            if (r.ErrorMaxSeverity > 0)
            {

                foreach (string emsg in r.ErrorItems)
                {
                      Console.WriteLine(emsg);
                }

                int severity = r.ErrorMaxSeverity;
                r.ErrorReset();
                if (severity > 4)
                {
                      r = null; // don't return when severe errors
                }
            }

            return r;
        }
예제 #13
0
        private Report GetReport(string prog, string file)
        {
            // Now parse the file
            RDLParser rdlp;
            Report r;
            try
            {
                rdlp =  new RDLParser(prog);
                string folder = Path.GetDirectoryName(file);
                if (folder == "")
                    folder = Environment.CurrentDirectory;
                rdlp.Folder = folder;

                r = rdlp.Parse();
                if (r.ErrorMaxSeverity > 4)
                {
                    MessageBox.Show(Strings.DrillParametersDialog_ShowC_ReportHasErrors);
                    r = null;			// don't return when severe errors
                }
            }
            catch(Exception e)
            {
                r = null;
                MessageBox.Show(e.Message, Strings.SubreportCtl_Show_ReportLoadFailed);
            }
            return r;
        }
예제 #14
0
        private Report GetReportFromFile(ReportInfo reportInfo)
        {
            RDLParser rdlp;
            Report r;
            string source = System.IO.File.ReadAllText(reportInfo.GetPath());

            rdlp = new RDLParser(source);
            rdlp.Folder = System.IO.Path.GetDirectoryName (reportInfo.GetPath());
            rdlp.OverwriteConnectionString = reportInfo.ConnectionString;
            rdlp.OverwriteInSubreport = true;

            r = rdlp.Parse();

            return r;
        }