ErrorReset() 공개 메소드

Clear all errors generated up to now.
public ErrorReset ( ) : void
리턴 void
예제 #1
0
        /// <summary>
        /// Save the file.  The extension determines the type of file to save.
        /// </summary>
        /// <param name="FileName">Name of the file to be saved to.</param>
        /// <param name="ext">Type of file to save.  Should be "pdf", "xml", "html", mht.</param>
        private void SaveAs(Report report, string FileName, string type)
        {
            string ext = type.ToLower();
            OneFileStreamGen sg=null;
            try
            {
                if (ext == "tifb")
                    FileName = FileName.Substring(0, FileName.Length - 1);      // get rid of the 'b'
                sg = new OneFileStreamGen(FileName, true);	// overwrite with this name
                switch(ext)
                {
                    case "pdf":
                        if (this._StampInfo == null)
                            report.RunRender(sg, OutputPresentationType.PDF);
                        else
                            SaveAsPdf(report, sg);
                        break;
                    case "xml":
                        report.RunRender(sg, OutputPresentationType.XML);
                        break;
                    case "mht":
                        report.RunRender(sg, OutputPresentationType.MHTML);
                        break;
                    case "html": case "htm":
                        report.RunRender(sg, OutputPresentationType.HTML);
                        break;
                    case "csv":
                        report.RunRender(sg, OutputPresentationType.CSV);
                        break;
                    case "xlsx":
                        report.RunRender(sg, OutputPresentationType.Excel);
                        break;
                    case "rtf":
                        report.RunRender(sg, OutputPresentationType.RTF);
                        break;
                    case "tif": case "tiff":
                        report.RunRender(sg, OutputPresentationType.TIF);
                        break;
                    case "tifb":
                        report.RunRender(sg, OutputPresentationType.TIFBW);
                        break;
                    default:
                        Console.WriteLine("Unsupported file extension '{0}'.  Must be 'pdf', 'xml', 'mht', 'csv', 'xslx', 'rtf', 'tif', 'tifb' or 'html'", type);
                        returnCode = 8;
                        break;
                }
            }
            catch(Exception e)
            {
                Console.WriteLine(e.Message);
                returnCode = 8;
            }
            finally
            {
                if (sg != null)
                {
                    sg.CloseMainStream();
                }
            }

            if (report.ErrorMaxSeverity > 0)
            {
                // have errors fill out the msgs
                Console.WriteLine("{0} has the following runtime errors:", FileName);
                foreach (string emsg in report.ErrorItems)
                {
                    Console.WriteLine(emsg);		// output message to console
                }
                report.ErrorReset();
            }

            return;
        }
예제 #2
0
		private void Generate(Report report)
		{
			try
			{
                _Pages =  report.BuildPages();
                // create array for XAML pages.   Actual XAML will be created on demand.
                _XamlPages = new string[_Pages.Count];
                for (int i = 0; i < _XamlPages.Length; i++)
                    _XamlPages[i] = null;
			}
			catch(Exception e)
			{
                AddError(8, string.Format("Exception generating report {0}", e.Message));
			}

			if (report.ErrorMaxSeverity > 0) 
			{
				AddError(report.ErrorMaxSeverity, report.ErrorItems);
				report.ErrorReset();
			}

			return;
		}
예제 #3
0
        private void Generate(Report report)
        {
            MemoryStreamGen sg=null;
            try
            {
                sg = new MemoryStreamGen("ShowFile.aspx?type=", null, this.RenderType);

                report.RunRender(sg, _RenderType, this.UniqueID);
                _CSS = "";
                _JavaScript = "";
                switch (_RenderType)
                {
                    case OutputPresentationType.ASPHTML:
                    case OutputPresentationType.HTML:
                        _CSS = report.CSS;//.Replace("position: relative;", "position: absolute;");
                        _JavaScript = report.JavaScript;
                        _Html = sg.GetText();
                        break;
                    case OutputPresentationType.XML:
                        _Xml = sg.GetText();
                        break;
                    case OutputPresentationType.CSV:
                        _Csv = sg.GetText();
                        break;
                    case OutputPresentationType.PDF:
                    {
                        MemoryStream ms = sg.MemoryList[0] as MemoryStream;
                        _Object = ms.ToArray();
                        break;
                    }
                }

                // Now save off the other streams in the session context for later use
                IList strms = sg.MemoryList;
                IList names = sg.MemoryNames;
                for (int i=1; i < sg.MemoryList.Count; i++)	// we skip the first one
                {
                    string n = names[i] as string;
                    MemoryStream ms = strms[i] as MemoryStream;
                    Context.Session[n] = ms.ToArray();
                }

            }
            catch(Exception e)
            {
                Console.WriteLine(e.Message);
            }
            finally
            {
                if (sg != null)
                {
                    sg.CloseMainStream();
                }
            }

            if (report.ErrorMaxSeverity > 0)
            {
                AddError(report.ErrorMaxSeverity, report.ErrorItems);
                report.ErrorReset();
            }

            return;
        }
예제 #4
0
        private Pages GetPages(Report report)
        {
            Pages pgs = null;

            ListDictionary ld = GetParameters();		// split parms into dictionary

            try
            {
                report.RunGetData(ld);

                pgs = report.BuildPages();

                if (report.ErrorMaxSeverity > 0)
                {
                    if (_errorMsgs == null)
                    {
                        _errorMsgs = report.ErrorItems;		// keep a copy of the errors
                    }
                    else
                    {
                        foreach (string err in report.ErrorItems)
                        {
                            _errorMsgs.Add(err);
                        }
                    }

                    report.ErrorReset();
                }

            }
            catch (Exception e)
            {
                string msg = e.Message;
            }

            return pgs;
        }
예제 #5
0
		/// <summary>
		/// Save the file.  The extension determines the type of file to save.
		/// </summary>
		/// <param name="FileName">Name of the file to be saved to.</param>
		/// <param name="ext">Type of file to save.  Should be "pdf", "xml", "html", mht.</param>
		private void SaveAs(Report report, string FileName, string type)
		{
			string ext = type.ToLower();
			OneFileStreamGen sg=null;
			try
			{
				bool isOldPdf = false;
				if (System.Environment.OSVersion.Platform == PlatformID.Unix && type=="pdf" ) {

                    if (System.IO.Directory.Exists("/usr/share/fonts/truetype/msttcorefonts")==false)
                    {
						isOldPdf = true;
                    }
                   
                }



                if (ext == "tifb")
                    FileName = FileName.Substring(0, FileName.Length - 1);      // get rid of the 'b'
				sg = new OneFileStreamGen(FileName, true);	// overwrite with this name
				switch(ext)
				{
					case "pdf":	
						if (this._StampInfo == null)
						{
							if (isOldPdf)
							{
								report.RunRender(sg, OutputPresentationType.PDFOldStyle);
							}
							else
							{
								report.RunRender(sg, OutputPresentationType.PDF);
							}
								
						}
						else
							SaveAsPdf(report, sg);
						break;
					case "xml": 
						report.RunRender(sg, OutputPresentationType.XML);
						break;																  
					case "mht": 
						report.RunRender(sg, OutputPresentationType.MHTML);
						break;																  
					case "html": case "htm":
						report.RunRender(sg, OutputPresentationType.HTML);
						break;
                    case "csv":
                        report.RunRender(sg, OutputPresentationType.CSV);
                        break;
                    case "xlsx":
                        report.RunRender(sg, OutputPresentationType.Excel);
                        break;
                    case "rtf":
                        report.RunRender(sg, OutputPresentationType.RTF);
                        break;
                    case "tif": case "tiff":
                        report.RunRender(sg, OutputPresentationType.TIF);
                        break;
                    case "tifb":
                        report.RunRender(sg, OutputPresentationType.TIFBW);
                        break;
					default:
						Console.WriteLine("Unsupported file extension '{0}'.  Must be 'pdf', 'xml', 'mht', 'csv', 'xslx', 'rtf', 'tif', 'tifb' or 'html'", type);
						returnCode = 8;
						break;
				}
			}
			catch(Exception e)
			{
				Console.WriteLine(e.Message);
				returnCode = 8;
			}
			finally
			{
				if (sg != null)
				{
					sg.CloseMainStream();
				}
			}

			if (report.ErrorMaxSeverity > 0) 
			{
				// have errors fill out the msgs 
				Console.WriteLine("{0} has the following runtime errors:", FileName);
				foreach (string emsg in report.ErrorItems)
				{
					Console.WriteLine(emsg);		// output message to console
				}
				report.ErrorReset();
			}

			return;
		}