Esempio n. 1
0
        private void onFinished(object sender, EventArgs e)
        {
            //  Remove all equations as they are rebuilt with either of these calls
            volList.Clear();
            Global.BL.SaveVolumeEquations(volList);
            if (taperEquations.Checked == true)
            {
                CreateEquations("900CLKE");
            }
            else if (oldEquations.Checked == true)
            {
                CreateEquations("900DVEE");
            }

            //  Save equations
            Global.BL.SaveVolumeEquations(volList);
            if (calcBiomass.Checked == true)
            {
                VolumeEquations ve = new VolumeEquations();
                ve.fileName = fileName;
                ve.updateBiomass(volList);
            }   //  endif calculate biomass
            Close();
            return;
        }   //  end onFinished
Esempio n. 2
0
        }   //  end onTopwoodClick

        private void onOK(object sender, EventArgs e)
        {
            //  open volume equation table and remove all before building and saving equations
            Global.BL.deleteVolumeEquations();
            volList.Clear();

            //  Need to build volume equation and store in table, so goes into VolumeEqList
            string currentForest   = "";
            string currentDistrict = "";
            string currGeoCode     = "";
            string currGrpCode     = "";

            foreach (SaleDO sd in Global.BL.getSale())
            {
                currentForest = sd.Forest;
                if (sd.District == null)
                {
                    currentDistrict = "";
                }
                else
                {
                    currentDistrict = sd.District;
                }
            }   //  end foreach

            //  Look up geo code and group code for this forest and district (if any)
            //  First look in defaults
            for (int k = 0; k < 12; k++)
            {
                if (currentForest == forestDefaultList[k, 0])
                {
                    currGeoCode = forestDefaultList[k, 1];
                    currGrpCode = forestDefaultList[k, 2];
                } //  endif
            }     //  end for k loop

            //  Check for an override on district
            for (int k = 0; k < 33; k++)
            {
                if (currentForest == forestDistrictList[k, 0] && currentDistrict == forestDistrictList[k, 1])
                {
                    currGeoCode = forestDistrictList[k, 2];
                    currGrpCode = forestDistrictList[k, 3];
                } //  endif
            }     //  end for k loop

            //  if geocode and group code are still blank, means forest or district are incorrect
            if (currGeoCode == "" || currGrpCode == "")
            {
                MessageBox.Show("Could not find Forest and/or District number.\nCannot complete equations.", "ERROR", MessageBoxButtons.OK, MessageBoxIcon.Error);
                Close();
                return;
            }   //  endif

            //  get unique species/product combinations
            string[,] speciesProduct = Global.BL.GetUniqueSpeciesProduct();
            for (int k = 0; k < speciesProduct.GetLength(0); k++)
            {
                //  need species and product
                string currentSpecies = speciesProduct[k, 0];
                string currentProduct = speciesProduct[k, 1];

                //  call build equation for this combination
                if (currentSpecies != null && currentProduct != null)
                {
                    //  change in volume library no longer has DVEE equations used for board for board foot volume
                    //  so commented out the call to build those equations
                    //  October 2015
                    //if (currentProduct == "01")
                    //  buildVolumeEquation(currGrpCode, currentSpecies, currentProduct);
                    //  Build Clark equations -- old or new -- July 2017
                    if (newClarkCheckBox.Checked == true)
                    {
                        buildNewClarkEquations(currGeoCode, currentSpecies, currentProduct);
                    }
                    else if (oldClarkCheckBox.Checked == true)
                    {
                        if (pulpwoodHeight >= 0)
                        {
                            buildClarkEquation(currGeoCode, currentSpecies, currentProduct, pulpwoodHeight);
                        }
                        else if (pulpwoodHeight < 0)
                        {
                            Close();
                            return;
                        } //  endif
                    }     //  endif
                }         //  endif no null
            }             //  end foreach

            //  Save equations in database
            Global.BL.SaveVolumeEquations(volList);

            if (calcBiomass.Checked == true)
            {
                VolumeEquations ve = new VolumeEquations();
                ve.fileName = fileName;
                ve.updateBiomass(volList);
            }   //  endif calculate biomass
            Close();
            return;
        }   //  end onOK