Exemplo n.º 1
0
        }   //  end PrintErrorReport

        public string PrintFScruiserErrors(List <ErrorLogDO> eldList)
        {
            //  make output filename
            outFile = System.IO.Path.ChangeExtension(fileName, "out");
            string cruiseNumber = bslyr.getCruiseNumber();
            string currRegion   = bslyr.getRegion();

            //  write report
            using (StreamWriter strWriteOut = new StreamWriter(outFile))
            {
                //  need current date and time
                currentDate = DateTime.Now.ToString();

                //  and version numbers
                //currentVersion = "DRAFT.2018";
                currentVersion = "06.01.2021";
                DLLversion     = Utilities.CurrentDLLversion();

                //  Output banner page except for BLM
                if (currRegion != "07" && currRegion != "7" && currRegion != "BLM")
                {
                    BannerPage bp = new BannerPage();
                    bp.outputBannerPage(fileName, strWriteOut, currentDate, currentVersion, DLLversion, bslyr);
                }
                //  setup field lengths and write headers
                fieldLengths    = new int[] { 1, 18, 70, 43 };
                errorHeading[3] = errorHeading[3].Replace("XXXXX", eldList[0].Program);
                errorHeading[2] = "                                                              " + cruiseNumber;
                writeHeaders(strWriteOut);

                //  write error messages
                foreach (ErrorLogDO eld in eldList)
                {
                    prtFields.Add("");
                    prtFields.Add(eld.TableName);
                    if (eld.Message.Length > 70 && eld.Program == "CruiseProcessing")
                    {
                        prtFields.Add(eld.Message.Remove(70, eld.Message.Length - 69));
                    }
                    else
                    {
                        prtFields.Add(eld.Message);
                    }
                    //  add appriorate identifier for table
                    ident = Utilities.GetIdentifier(eld.TableName, eld.CN_Number, bslyr);
                    prtFields.Add(ident.ToString());
                    StringBuilder sb = buildPrintLine(fieldLengths, prtFields);
                    WriteCurrentError(strWriteOut, ref pageNumber, sb);
                    sb.Clear();
                    prtFields.Clear();
                }   //  end foreach loop

                //  output identification key
                OutputIdKey(strWriteOut);
                strWriteOut.Close();
            }   //  end using

            return(outFile);
        }   //  end PrintFScruiserErrors
Exemplo n.º 2
0
        public string PrintErrorReport(List <ErrorLogDO> errList)
        {
            //  fix filename for output
            outFile = System.IO.Path.ChangeExtension(fileName, "out");
            //  what's the current region?
            string currRegion = bslyr.getRegion();

            //  open output file and write report
            using (StreamWriter strWriteOut = new StreamWriter(outFile))
            {
                //  Get current date and time for run time
                currentDate = DateTime.Now.ToString();

                //  Set version numbers
                //currentVersion = "DRAFT.2018";
                currentVersion = "06.01.2021";
                DLLversion     = Utilities.CurrentDLLversion();

                //  Output banner page except for BLM
                if (currRegion != "07" && currRegion != "7" && currRegion != "BLM")
                {
                    BannerPage bp = new BannerPage();
                    bp.outputBannerPage(fileName, strWriteOut, currentDate, currentVersion, DLLversion, bslyr);
                }   //  endif

                //  output errors only -- warnings printed in regular output file
                fieldLengths = new int[] { 1, 18, 69, 43 };
                //  add program name to error heading
                errorHeading[3] = errorHeading[3].Replace("XXXXX", errList[0].Program);
                //  add cruise number to report title
                string cruiseNumber = bslyr.getCruiseNumber();
                errorHeading[2] = "                                                              " + cruiseNumber;
                writeHeaders(strWriteOut);

                //  write appropriate error messages
                foreach (ErrorLogDO eld in errList)
                {
                    prtFields.Add("");
                    prtFields.Add(eld.TableName);
                    switch (eld.TableName)
                    {
                    case "Sale":
                        SaleErrors(eld);
                        break;

                    case "Stratum":
                        StratumErrors(eld);
                        break;

                    case "Cutting Unit":
                        UnitErrors(eld);
                        break;

                    case "CountTree":
                        CountErrors(eld);
                        break;

                    case "Tree":
                        TreeErrors(eld);
                        break;

                    case "Log":
                        LogErrors(eld);
                        break;

                    case "VolumeEquation":
                        VolEqErrors(eld);
                        break;

                    case "ValueEquation":
                        ValEqErrors(eld);
                        break;

                    case "QualityAdjustment":
                        QAErrors(eld);
                        break;

                    case "Reports":
                        RptErrors(eld);
                        break;

                    case "SampleGroup":
                        SGErrors(eld);
                        break;
                    }   //  end switch
                    StringBuilder sb = buildPrintLine(fieldLengths, prtFields);
                    WriteCurrentError(strWriteOut, ref pageNumber, sb);
                    sb.Remove(0, sb.Length);
                    prtFields.Clear();
                }   //  end foreach loop
                //  output identification key
                OutputIdKey(strWriteOut);
                strWriteOut.Close();
            }   //  end using

            return(outFile);
        }   //  end PrintErrorReport