コード例 #1
0
        }       //  end WriteCountTrees

        private void WriteTreeCalcValues(string volType, StreamWriter strWriteOut, reportHeaders rh,
                                         IEnumerable <TreeCalculatedValuesDO> cvList, IEnumerable <TreeDO> tList, ref int pageNumb)
        {
            //  which heights to be used?
            int hgtOne = 0;
            int hgtTwo = 0;

            whichHeightFields(ref hgtOne, ref hgtTwo, tList);

            //  replace as needed header lines
            string[] headerToPrint = new string[10];
            if (volType == "CUFT" || volType == "BDFT")
            {
                headerToPrint    = updateHeightHeader(hgtOne, hgtTwo, "", rh.A05A07columns);
                headerToPrint[9] = headerToPrint[9].Replace("VVVV", volType);
            }
            else if (volType == "VALUE")
            {
                headerToPrint = updateHeightHeader(hgtOne, hgtTwo, "", rh.A06columns);
            }
            else if (volType == "BIOMASS")
            {
                headerToPrint = updateHeightHeader(hgtOne, hgtTwo, "", rh.A10columns);
            }

            //  print lines
            foreach (TreeDO tl in tList)
            {
                WriteReportHeading(strWriteOut, rh.reportTitles[0], rh.reportTitles[1], rh.reportTitles[2],
                                   headerToPrint, 19, ref pageNumb, "");
                if ((tl.CountOrMeasure == "M" && tl.ExpansionFactor > 0) ||
                    (tl.Stratum.Method == "FIXCNT"))
                {
                    switch (volType)
                    {
                    case "CUFT":
                        prtFields = TreeListMethods.buildPrintArray(tl, mainHeaderFields[3].ToString(), cvList,
                                                                    hgtOne, hgtTwo, volType);
                        break;

                    case "BDFT":
                        prtFields = TreeListMethods.buildPrintArray(tl, mainHeaderFields[3].ToString(), cvList,
                                                                    hgtOne, hgtTwo, volType);
                        break;

                    case "VALUE":
                        prtFields = TreeListMethods.buildPrintArray(tl, tcvList, hgtOne, hgtTwo, "value");
                        break;

                    case "BIOMASS":
                        prtFields = TreeListMethods.buildPrintArray(tl, tcvList, hgtOne, hgtTwo, "biomass");
                        break;
                    } //  switch on volType
                    printOneRecord(fieldLengths, prtFields, strWriteOut);
                }     //  endif count or measure tree
            }         //  end foreach loop
            return;
        }             //  end WriteTreeCalcValues
コード例 #2
0
        }                     //  end WritePlot

        private void WriteTree(StreamWriter strWriteOut, reportHeaders rh, ref int pageNumb, IEnumerable <TreeDO> tList)
        {
            if (currentReport == "A13")
            {
                //  output tree table information
                foreach (TreeDO tdo in tList)
                {
                    WriteReportHeading(strWriteOut, rh.reportTitles[0], "TREE TABLE INFORMATION",
                                       rh.reportTitles[2], rh.A13tree, 7, ref pageNumb, "");
                    prtFields = TreeListMethods.buildPrintArray(tdo);
                    printOneRecord(fieldLengths, prtFields, strWriteOut);
                }       //  end foreach loop
            }
            else if (currentReport == "A03")
            {
                //  Output records
                foreach (TreeDO tdo in tList)
                {
                    WriteReportHeading(strWriteOut, rh.reportTitles[0], rh.reportTitles[1], rh.reportTitles[2],
                                       completeHeader, 18, ref pageNumb, "");
                    TreeListMethods.buildPrintArray(tdo, fieldsToPrint, ref fieldLengths, ref prtFields);
                    printOneRecord(fieldLengths, prtFields, strWriteOut);
                    prtFields.Clear();
                    //  Write remarks after tree data
                    if (tdo.Remarks != "" && tdo.Remarks != null)
                    {
                        StringBuilder sb = new StringBuilder();
                        sb.Append("     REMARKS: ");
                        sb.Append(tdo.Remarks);
                        strWriteOut.WriteLine(sb.ToString());
                        numOlines++;
                    }
                } //  end foreach loop
            }     //  endif
            return;
        }         //  end WriteTree
コード例 #3
0
        public int TableEditChecks(IEnumerable <SaleDO> saleList, IEnumerable <StratumDO> strList,
                                   IEnumerable <CountTreeDO> cntList, IEnumerable <TreeDO> tList, IEnumerable <SampleGroupDO> sgList)
        {
            ErrorLogMethods.fileName = fileName;
            string currentRegion = Global.BL.getRegion();
            string isVLL         = "";

            //string isVLL = Global.BL.getVLL();

            //  edit checks for each table
            //  sale table
            //  empty or more than one record?
            errorValue = SaleMethods.MoreThanOne(saleList);
            if (errorValue == 0)
            {
                ErrorLogMethods.LoadError("Sale", "E", "25", errorValue, "NoName");           //  error 25 -- table cannot be empty
            }
            else if (errorValue > 1)
            {
                ErrorLogMethods.LoadError("Sale", "E", "28", errorValue, "SaleNumber");           //  error 28 -- more than one sale record not allowed
            }
            if (errorValue == 1)
            {
                //  and blank sale number
                errorValue = SaleMethods.BlankSaleNum(saleList);
                if (errorValue != -1)
                {
                    ErrorLogMethods.LoadError("Sale", "E", " 8Sale Number", errorValue, "SaleNumber");
                }
            }       //  endif
            //  end sale table edit checks

            // *******************************************************************
            //  stratum table
//                List<StratumDO> strList = Global.BL.getStratum();
            errorValue = StratumMethods.IsEmpty(strList);
            if (errorValue != 0)
            {
                ErrorLogMethods.LoadError("Stratum", "E", errorValue.ToString(), errorValue, "NoName");
            }
            else if (errorValue == 0)        //  means there are records to check
            {
                foreach (StratumDO sdo in strList)
                {
                    //  check for valid fixed plot size or BAF for each stratum
                    double BAForFPS = StratumMethods.CheckMethod(strList, sdo.Code);
                    if ((sdo.Method == "PNT" || sdo.Method == "P3P" || sdo.Method == "PCM" ||
                         sdo.Method == "PCMTRE" || sdo.Method == "3PPNT") && BAForFPS == 0)
                    {
                        ErrorLogMethods.LoadError("Stratum", "E", "22", (long)sdo.Stratum_CN, "BasalAreaFactor");
                    }
                    else if ((sdo.Method == "FIX" || sdo.Method == "F3P" || sdo.Method == "FIXCNT" ||
                              sdo.Method == "FCM") && BAForFPS == 0)
                    {
                        ErrorLogMethods.LoadError("Stratum", "E", "23", (long)sdo.Stratum_CN, "FixedPlotSize");
                    }

                    //  check for acres on area based methods
                    double currAcres = Utilities.AcresLookup((long)sdo.Stratum_CN, sdo.Code);
                    if ((sdo.Method == "PNT" || sdo.Method == "FIX" || sdo.Method == "P3P" ||
                         sdo.Method == "F3P" || sdo.Method == "PCM" || sdo.Method == "3PPNT" ||
                         sdo.Method == "FCM" || sdo.Method == "PCMTRE") && currAcres == 0)
                    {
                        ErrorLogMethods.LoadError("Stratum", "E", "24", (long)sdo.Stratum_CN, "NoName");
                    }
                    else if ((sdo.Method == "100" || sdo.Method == "3P" ||
                              sdo.Method == "S3P" || sdo.Method == "STR") && currAcres == 0)
                    {
                        ErrorLogMethods.LoadError("Stratum", "W", "Stratum has no acres", (long)sdo.Stratum_CN, "NoName");
                    }

                    //  August 2017 -- added check for valid yield component code
                    if (sdo.YieldComponent != "CL" && sdo.YieldComponent != "CD" &&
                        sdo.YieldComponent != "ND" && sdo.YieldComponent != "NL" &&
                        sdo.YieldComponent != "" && sdo.YieldComponent != " " &&
                        sdo.YieldComponent != null)
                    {
                        ErrorLogMethods.LoadError("Stratum", "W", "Yield Component has invalid code", (long)sdo.Stratum_CN, "YieldComponent");
                    }
                }   //  end foreach loop
            }       //  endif
            //  end stratum table edit checks

            //  ************************************************************************
            // cutting unit table
            //List<CuttingUnitDO> cuList = Global.BL.getCuttingUnits();
            errorValue = CuttingUnitMethods.IsEmpty(Global.BL.getCuttingUnits());
            if (errorValue != 0)
            {
                ErrorLogMethods.LoadError("Cutting Unit", "E", errorValue.ToString(), 0, "NoName");
            }
            //  end cutting unit edit checks

            //  **************************************************************************
            //  count table
            //List<CountTreeDO> cntList = Global.BL.getCountTrees();
            foreach (StratumDO sl in strList)
            {
                errorValue = CountTreeMethods.check3Pcounts(cntList, sl);
                if (errorValue != 0)
                {
                    ErrorLogMethods.LoadError("CountTree", "E", "Cannot tally by sample group for 3P strata.", (long)sl.Stratum_CN, "TreeDefaultValue");
                }
            }       //  end foreach on stratum

            //  **************************************************************************
            //  tree table
            //List<TreeDO> tList = Global.BL.getTrees();
            errorValue = TreeListMethods.IsEmpty(tList);
            if (errorValue != 0)
            {
                ErrorLogMethods.LoadError("Tree", "E", errorValue.ToString(), 0, "NoName");
            }
            else if (errorValue == 0)           //  means tree table has records
            {
                //  make sure single stratum is NOT FIXCNT which cannot have measured trees anyway.
                //if(strList.Count == 1 && strList[0].Method != "FIXCNT")
                //  doesn't matter if it's a single stratum or any stratum that's FIXCNT
                //  that method still has no measured trees so need to skip these checks.
                if (strList.First().Method != "FIXCNT")
                {
                    var tMeas = tList.Select(tree => tree.CountOrMeasure = "M");
                    //tList = Global.BL.JustMeasuredTrees();
                    //  March 2016 -- if the entire cruisde has no measured trees, that uis a critical erro
                    //  and should stop the program.  Since no report can be generated, a message box appears to warn the user
                    //  of the condition.
                    if (tMeas.Count() == 0)
                    {
                        MessageBox.Show("NO MEASURED TREES IN THIS CRUISE.\nCannot continue and cannot produce any reports.", "ERROR", MessageBoxButtons.OK, MessageBoxIcon.Stop);
                        return(-1);
                    }       //endif
                    //  general checks include  checking for secondary top DIB greater than primary
                    //  recoverable percent greater than seen defect primary
                    //  missing species, product or uom when tree count is greater than zero or DBH is greater than zero
                    //  and check for upper stem diameter greater than DBH
                    errorValue = TreeListMethods.GeneralChecks(tList, currentRegion);
                }   //  endif single stratum
            }       //  endif
            //  end tree table edit checks

            //  *************************************************************************
            //  log table
            List <LogDO> logList = Global.BL.getLogs().ToList();

            if (logList.Count > 0)
            {
                errorValue = LogMethods.CheckNumberLogs(logList);
                errorValue = LogMethods.CheckFBS(logList);
                if (isVLL == "true")
                {
                    errorValue = LogMethods.CheckVLL(logList);
                }
                errorValue = LogMethods.CheckDefect(logList);
                if (currentRegion != "05")
                {
                    errorValue = LogMethods.CheckLogGrade(logList);
                }
            }       //  endif records in log table to check
            //  end log table edit checks

            //  *************************************************************************
            //  volume equation table
            List <VolumeEquationDO> volList = Global.BL.getVolumeEquations().ToList();

            errorValue = VolumeEqMethods.IsEmpty(volList);
            //  pull region
            string currRegion = saleList.First().Region;

            //string currRegion =  Global.BL.getRegion();
            if (errorValue != 0)
            {
                ErrorLogMethods.LoadError("VolumeEquation", "E", errorValue.ToString(), 0, "NoName");
            }
            else if (errorValue == 0)        //  means the table is not empty and checks can proceed
            {
                //  Match unique species/product to volume equation   \
                errorValue = VolumeEqMethods.MatchSpeciesProduct(volList, tList);
                errorValue = VolumeEqMethods.GeneralEquationChecks(volList);
                //  if VLL, check equations for Behrs
                if (isVLL == "true")
                {
                    errorValue = VolumeEqMethods.FindBehrs(volList);
                }
            }       //  endif
            //  end volume equation edit checks

            //  *************************************************************************
            //  value equations
            // Check for valid equations
            IEnumerable <ValueEquationDO> valList = Global.BL.getValueEquations();

            if (valList.Any())          //  there are records to check
            {
                errorValue = ValueEqMethods.CheckEquations(valList, currentRegion);
            }
            //  end value equation edit checks

            //  *************************************************************************
            //  quality adjustment equations
            IEnumerable <QualityAdjEquationDO> qaeList = Global.BL.getQualAdjEquations();

            if (qaeList.Any())          //  there are records to check
            {
                errorValue = QualityAdjMethods.CheckEquations(qaeList);
            }
            //  end quality adjustment equation edit checks

            //  ************************************************************************
            //  June 2014 -- apparently the error log table is not meant to capture
            //  errors on the basis of an entire table.  Only on individual records.
            //  so if no reports have been selected, this check needs to move to
            //  the Output section when the user clicks GO.  If the reports list
            //  comes up empty then display a message box telling them to go back
            //  and enter reports.
            //  no reports selected

/*
 *              List<ReportsDO> selectedReports = Global.BL.GetSelectedReports();
 *              if (selectedReports.Count == 0)
 *              {
 *                  ErrorLogMethods.LoadError("Reports", "E", "26", 0,"NoName");
 *                  errorValue++;
 *              }   //  endif no reports
 */
            //  ************************************************************************
            //  sample group table
            //List<SampleGroupDO> sampGroups = Global.BL.getSampleGroups();
            errorValue = SampleGroupMethods.CheckAllUOMandCutLeave(strList, sgList, fileName);
            //  ************************************************************************
            errList = ErrorLogMethods.errList;
            if (errList.Count > 0)
            {
                Global.BL.SaveErrorMessages(errList);
            }   //  endif
            return(errorValue);
        }       //  end TableEditChecks
コード例 #4
0
        public void OutputListReports(StreamWriter strWriteOut, reportHeaders rh, ref int pageNumb)
        {
            //  Fill report title array
            string currentTitle = fillReportTitle(currentReport);

            //  create report title
            if (currentReport == "A05")
            {
                rh.createReportTitle(currentTitle, 3, 15, 45, "", "");
            }
            else if (currentReport == "A06")
            {
                rh.createReportTitle(currentTitle, 2, 25, 0, "", "");
            }
            else if (currentReport == "A07")
            {
                rh.createReportTitle(currentTitle, 3, 15, 45, "", "");
            }
            else if (currentReport == "A15")
            {
                rh.createReportTitle(currentTitle, 5, 0, 0, reportConstants.NSPO, "");
            }
            else
            {
                rh.createReportTitle(currentTitle, 1, 0, 0, "", "");
            }

            //  Which report?  Previous report number in parens
            numOlines = 0;
            switch (currentReport)
            {
            case "A01":                  //  Strata, Unit, and Payment unit Report
                //  stratum page
                numOlines = 0;
                //List<StratumDO> sList = Global.BL.getStratum();
                fieldLengths = new int[] { 5, 11, 7, 9, 8, 9, 6, 6, 27, 2, 4 };
                prtFields.Clear();
                WriteStratum(strWriteOut, rh, Global.BL.getStratum(), ref pageNumb);
                //  cutting unit page
                numOlines = 0;
                List <CuttingUnitDO> cList = Global.BL.getCuttingUnits().ToList();
                //  page 2 -- cutting units
                fieldLengths = new int[] { 5, 17, 8, 10, 28, 9, 3 };
                WriteUnit(1, strWriteOut, rh, cList, ref pageNumb);

                //  payment unit page
                numOlines    = 0;
                fieldLengths = new int[] { 5, 13, 9, 9, 4 };
                WriteUnit(2, strWriteOut, rh, cList, ref pageNumb);
                //  sample group page
                numOlines    = 0;
                fieldLengths = new int[] { 2, 10, 7, 7, 7, 7, 7, 25 };
                //List<SampleGroupDO> sgList = Global.BL.getSampleGroups();
                WriteSampleGroup(strWriteOut, rh, Global.BL.getSampleGroups(), ref pageNumb);
                break;

            case "A02":                  //  Listing of plot identification information (page three from old A1 report)List<PlotDO> pList = Global.BL.getPlots();
                //pList = Global.BL.getPlotsOrdered();
                fieldLengths = new int[] { 5, 9, 11, 10, 6, 9, 8, 7, 3 };
                prtFields.Clear();
                if (!Global.BL.getPlotsOrdered().Any())
                {
                    noDataForReport(strWriteOut, currentReport, " >>>> No data for report in Plot table");
                    return;
                }           //  endif no data
                WritePlot(strWriteOut, rh, ref pageNumb);
                break;

            case "A03":                  //  Listing of individual tree measurements and characteristics (A2)
                List <TreeDO> tList = Global.BL.getTreesSorted().ToList();
                //  what fields to print?
                fieldsToPrint = TreeListMethods.CheckForData(tList);
                //  Build column headings based on fields to print
                completeHeader = TreeListMethods.BuildColumnHeaders(rh.A03columns, fieldsToPrint);
                fieldLengths   = new int[fieldsToPrint.Count];
                prtFields.Clear();
                WriteTree(strWriteOut, rh, ref pageNumb, tList);

                break;

            case "A04":                  //  Listing of count table information (count page from A2 report)
                //List<CountTreeDO> ctList = Global.BL.getCountsOrdered();

                fieldLengths = new int[] { 3, 9, 10, 6, 13, 7, 8, 8, 11, 1 };
                prtFields.Clear();
                //  no data?
                if (!Global.BL.getCountsOrdered().Any())
                {
                    noDataForReport(strWriteOut, currentReport, " >>>> No data for report in Count table");
                    return;
                }           //  endif no data
                WriteCountTrees(strWriteOut, rh, Global.BL.getCountsOrdered(), ref pageNumb);
                break;

            case "A05":                  //  Listing of cubic foot volume   (A5)
                //tList = Global.BL.getTreesSorted();
                tcvList      = Global.BL.getTreeCalculatedValues().ToList();
                fieldLengths = new int[] { 1, 3, 4, 5, 5, 7, 6, 4, 4, 8, 9, 8, 9, 8, 8, 9, 9, 9, 8, 8 };
                prtFields.Clear();
                //  no data?
                summedValue = tcvList.Sum(cvdo => cvdo.GrossCUFTPP);
                if (summedValue == 0)
                {
                    noDataForReport(strWriteOut, currentReport, " >>>> No cubic foot volume for report");
                    return;
                }           //  endif no data for report
                WriteTreeCalcValues("CUFT", strWriteOut, rh, tcvList, Global.BL.getTreesSorted(), ref pageNumb);
                break;

            case "A07":                  //  Listing of board foot volume   (A7)
                //tList = Global.BL.getTreesSorted();
                tcvList      = Global.BL.getTreeCalculatedValues().ToList();
                fieldLengths = new int[] { 1, 3, 4, 5, 5, 7, 6, 4, 4, 8, 9, 8, 9, 8, 8, 9, 9, 9, 8, 8 };
                prtFields.Clear();
                //  no data?
                summedValue = tcvList.Sum(cvdo => cvdo.GrossBDFTPP);
                if (summedValue == 0)
                {
                    noDataForReport(strWriteOut, currentReport, " >>>> No board foot volume for report");
                    return;
                }           //  endif no data for report
                WriteTreeCalcValues("BDFT", strWriteOut, rh, tcvList, Global.BL.getTreesSorted(), ref pageNumb);
                break;

            case "A06":                  //  Listing of dollar value for each tree  (A6)
                //tList = Global.BL.getTrees();
                tcvList      = Global.BL.getTreeCalculatedValues().ToList();
                fieldLengths = new int[] { 1, 3, 4, 5, 5, 8, 6, 4, 6, 15, 15, 9, 9, 11, 15, 15 };
                prtFields.Clear();
                //  no data?
                summedValue = tcvList.Sum(tcvdo => tcvdo.ValuePP);
                if (summedValue == 0)
                {
                    noDataForReport(strWriteOut, currentReport, " >>>> No dollar value data for this report");
                    return;
                }           //  endif no data for report
                WriteTreeCalcValues("VALUE", strWriteOut, rh, tcvList, Global.BL.getTrees(), ref pageNumb);
                break;

            case "A08":                  //  Listing of log grade information   (A3)
                //List<LogDO> logList = Global.BL.getLogs();
                if (!Global.BL.getLogs().Any())
                {
                    noDataForReport(strWriteOut, currentReport, " >>>> No log data for this report");
                    return;
                }           //  endif logList empty

                //tList = Global.BL.getTreesSorted();
                fieldLengths = new int[] { 1, 3, 4, 5, 8, 5, 2, 4, 7, 5, 2, 4, 7, 5, 2, 4, 7, 5, 2, 4, 7, 5, 2, 4, 7 };
                prtFields.Clear();
                WriteLogList(strWriteOut, rh, Global.BL.getLogs(), Global.BL.getTreesSorted(), ref pageNumb);
                break;

            case "A09":                  //  Listing of log detail information for Fall, Buck and Scale  (A4)
                List <TreeDO> justFBS = Global.BL.getTrees().Where(tdo => tdo.IsFallBuckScale == 1).ToList();
                if (justFBS.Count == 0)
                {
                    noDataForReport(strWriteOut, currentReport, " >>>> No fall, buck and scale trees for this report.");
                    return;
                }           //  endif

                fieldLengths = new int[] { 1, 3, 4, 5, 6, 5, 6, 6, 5, 3, 10, 7, 10, 7, 5, 5 };
                prtFields.Clear();
                WriteFallBuckScale(strWriteOut, rh, justFBS, ref pageNumb, Global.BL.getLogStock());
                break;

            case "A10":                  //  Listing of calculated biomass weights by component (A9)
                //tList = Global.BL.getTrees();
                tcvList      = Global.BL.getTreeCalculatedValues().ToList();
                fieldLengths = new int[] { 1, 4, 5, 5, 5, 7, 6, 4, 5, 9, 10, 9, 9, 10, 9, 9, 9, 9, 9 };
                prtFields.Clear();
                //  Sum up mainsteam primary to determine if report can be printed
                summedValue = tcvList.Sum(tcvdo => tcvdo.BiomassMainStemPrimary);
                if (summedValue == 0)
                {
                    noDataForReport(strWriteOut, currentReport, " >>>> No biomass data for this report");
                    return;
                }           //  endif summedValue
                WriteTreeCalcValues("BIOMASS", strWriteOut, rh, tcvList, Global.BL.getTrees(), ref pageNumb);
                break;

            case "A13":                 //  Listing of geospatial information  (A14)
                //  This report prints two separate pages -- one for plot information and one for tree information
                //  plot information
                // = Global.BL.getPlots();
                fieldLengths = new int[] { 2, 5, 6, 4, 13, 11, 12, 1 };
                prtFields.Clear();
                WritePlot(strWriteOut, rh, ref pageNumb);

                //  tree information
                //tList = Global.BL.getTrees();
                fieldLengths = new int[10] {
                    2, 3, 3, 3, 4, 3, 3, 11, 11, 11
                };
                prtFields.Clear();
                //  reset headers
                rh.createReportTitle(currentTitle, 1, 0, 0, "", "");
                numOlines = 0;
                WriteTree(strWriteOut, rh, ref pageNumb, Global.BL.getTrees());
                break;

            case "A15":                 //  listing of merch rules
                fieldLengths = new int[] { 1, 13, 9, 10, 18, 18, 14, 13, 10, 3 };
                prtFields.Clear();
                numOlines = 0;
                WriteMerchRules(strWriteOut, rh, Global.BL.getVolumeEquations(), ref pageNumb);
                break;

            case "L1":                  //  Log listing
                fieldLengths = new int[] { 2, 3, 4, 5, 5, 7, 3, 4, 5, 7, 7, 9, 3, 4, 6, 7, 7, 8, 7, 7, 7, 3, 8 };
                prtFields.Clear();
                //  no data?
                if (!Global.BL.getLogStockSorted().Any())
                {
                    noDataForReport(strWriteOut, currentReport, " >>>> No log stock data for this report.");
                    return;
                }           //  endif no logs
                WriteLogStock(strWriteOut, rh, Global.BL.getLogStockSorted(), ref pageNumb);
                break;
            }   //  end switch on currentReport
            return;
        }       //  end OutputListReports
コード例 #5
0
        }   //  end LoadError

        //  Method checks here since not specific to one particular table
        public int CheckCruiseMethods(List <StratumDO> strList, List <TreeDO> tList)
        {
            TreeListMethods Tlm       = new TreeListMethods();
            int             errsFound = 0;

            //  pull trees by stratum for cruise method checks
            foreach (StratumDO str in strList)
            {
                List <TreeDO> treeList = Tlm.GetCurrentStratum(tList, str.Code);

                //  warn user if the stratum has no trees at all
                if (treeList.Count == 0)
                {
                    string warnMsg = "WARNING!  Stratum ";
                    warnMsg += str.Code;
                    warnMsg += " has no trees recorded.  Some reports may not be complete.\nContinue?";

                    DialogResult dr = MessageBox.Show(warnMsg, "WARNING", MessageBoxButtons.YesNo, MessageBoxIcon.Warning);
                    if (dr == DialogResult.No)
                    {
                        return(-1);
                    }
                }   //  endif no trees

                //  What needs to be checked?  By method
                switch (str.Method)
                {
                case "100":
                    //  Check for all measured trees in stratum
                    errsFound += CheckAllMeasured(treeList);
                    //  Check for tree count greater than 1
                    foreach (TreeDO tdo in treeList)
                    {
                        if (tdo.TreeCount > 1)
                        {
                            LoadError("Tree", "E", "10", (long)tdo.Tree_CN, "TreeCount");
                            errsFound++;
                        }   //  endif tree count greater than 1
                    }       //  end foreach loop
                    break;

                case "FIX":
                case "PNT":
                    //  Check for all measured trees in stratum
                    errsFound += CheckAllMeasured(treeList);
                    //  Check for no measured trees per sample group
                    errsFound += CheckForMeasuredTrees(treeList, (int)str.Stratum_CN, str.Method, bslyr);
                    break;

                case "3P":
                case "STR":
                case "S3P":
                    //  Check for measured trees with no DBH or height
                    errsFound += CheckForNoDBH(treeList);
                    //  Check 3P only for measured trees with no KPI
                    if (str.Method == "3P")
                    {
                        errsFound += CheckForNoKPI(treeList);
                    }
                    //  Check for sample group in CountTree with no measured tree
                    errsFound += CheckForMeasuredTrees(treeList, (int)str.Stratum_CN, str.Method, bslyr);
                    break;

                case "F3P":
                case "P3P":
                    //  Check for measured tree with no KPI
                    errsFound += CheckForNoKPI(treeList);
                    //  Check for measured trees with no DBH or height
                    errsFound += CheckForNoDBH(treeList);
                    //  Check for no measured trees when total tree count > 0
                    errsFound += CheckForMeasuredTrees(treeList, (int)str.Stratum_CN, str.Method, bslyr);
                    break;

                case "3PPNT":
                    foreach (TreeDO tdo in treeList)
                    {
                        // Check for blank product, uom and cut/leave on count trees
                        if (tdo.CountOrMeasure == "C" && tdo.SampleGroup.PrimaryProduct != "" &&
                            tdo.SampleGroup.UOM != "" && tdo.SampleGroup.CutLeave != "")
                        {
                            LoadError("Tree", "E", "16", (long)tdo.Tree_CN, "NoName");
                            errsFound++;
                        }       //  endif
                        //  Check for blank species, product, UOM and cut/leave on measured trees numbered zero
                        if (tdo.CountOrMeasure == "M" && tdo.TreeNumber == 0 &&
                            tdo.Species != "" && tdo.SampleGroup.PrimaryProduct != "" &&
                            tdo.SampleGroup.UOM != "" && tdo.SampleGroup.CutLeave != "")
                        {
                            LoadError("Tree", "E", "16", (long)tdo.Tree_CN, "NoName");
                            errsFound++;
                        }       //  endif
                        //  Check for count tree in a measured plot
                        //  Pull plot records first
                        List <TreeDO> justPlots = treeList.FindAll(
                            delegate(TreeDO jp)
                        {
                            return(jp.CountOrMeasure == "M" && jp.Plot.PlotNumber == 0);
                        });
                        foreach (TreeDO jpo in justPlots)
                        {
                            if (jpo.CountOrMeasure == "C" && jpo.TreeNumber != 0)
                            {
                                LoadError("Tree", "E", "15", (long)tdo.Tree_CN, "NoName");
                                errsFound++;
                            }   //  endif
                        }       //  end foreach loop on justPlots
                        //  Check for more than one sample group in the stratum
                        int nthRow = treeList.FindIndex(
                            delegate(TreeDO td)
                        {
                            return(tdo.SampleGroup.Code != treeList[0].SampleGroup.Code);
                        });
                        if (nthRow >= 0)
                        {
                            LoadError("Tree", "E", "17", (long)str.Stratum_CN, "NoName");
                            errsFound++;
                        }   //  endif nthRow
                    }       //  end foreach loop
                    //  Check for no measured tree when total tree count > 0
                    errsFound += CheckForMeasuredTrees(treeList, (int)str.Stratum_CN, str.Method, bslyr);
                    break;

                case "FIXCNT":
                    //  no measured trees allowed
                    int mthRow = treeList.FindIndex(
                        delegate(TreeDO tdo)
                    {
                        return(tdo.CountOrMeasure == "M");
                    });
                    if (mthRow >= 0)
                    {
                        LoadError("Tree", "E", "9", (long)treeList[mthRow].Tree_CN, "CountOrMeasure");
                        errsFound++;
                    }       //  endif nthRow
                    //  UOM must be 04
                    List <TreeDO> justUOM = treeList.FindAll(
                        delegate(TreeDO ju)
                    {
                        return(ju.SampleGroup.UOM != "04");
                    });
                    if (justUOM.Count > 0)
                    {
                        LoadError("SampleGroup", "E", "7", (long)str.Stratum_CN, "UOM");
                        errsFound++;
                    }       //  endif
                    break;

                case "PCM":
                case "FCM":
                    //  Check for no measured tree when total tree count > 0
                    errsFound += CheckForMeasuredTrees(treeList, (int)str.Stratum_CN, str.Method, bslyr);
                    break;
                } //  end switch on method
            }     //  end foreach loop on stratum
            return(errsFound);
        }         //  end CheckCruiseMethods