Exemplo n.º 1
0
        public int setupDialog()
        {
            //  if there are value equations, show in grid
            //  if not, just initialize the grid
            valList = bslyr.getValueEquations();
            valueEquationDOBindingSource.DataSource = valList;
            valueEquationList.DataSource            = valueEquationDOBindingSource;

            //  need unique species and product
            List <TreeDefaultValueDO> tdvList = bslyr.GetUniqueSpeciesProductLiveDead();

            if (valList.Count == 0)
            {
                foreach (TreeDefaultValueDO tdv in tdvList)
                {
                    ValueEquationDO ved = new ValueEquationDO();
                    ved.Species        = tdv.Species;
                    ved.PrimaryProduct = tdv.PrimaryProduct;
                    valList.Add(ved);
                } //  end foreach loop
                valueEquationDOBindingSource.ResetBindings(false);
            }     //  endif list is empty

            //  Fill lists at bottom with unique species and primary products
            ArrayList justSpecies = bslyr.GetJustSpecies("Tree");

            for (int n = 0; n < justSpecies.Count; n++)
            {
                speciesList.Items.Add(justSpecies[n].ToString());
            }

            //  If there are no species/products in tree default values, it's wrong
            //  tell user to check the file design in CSM --  June 2013
            if (justSpecies.Count == 0)
            {
                MessageBox.Show("No species/product combinations found in Tree records.\nPlease enter tree records before continuing.", "ERROR", MessageBoxButtons.OK, MessageBoxIcon.Error);
                Close();
                return(-1);
            }   //  endif

            ArrayList justProducts = bslyr.GetJustPrimaryProduct();

            for (int n = 0; n < justProducts.Count; n++)
            {
                primaryProdList.Items.Add(justProducts[n].ToString());
            }

            regionNum.Enabled       = false;
            equationNumber.Enabled  = false;
            speciesList.Enabled     = false;
            primaryProdList.Enabled = false;
            return(1);
        }   //  end setupDialog
Exemplo n.º 2
0
        public void setupDialog()
        {
            //  if there are weight equations, show in grid
            //  if not, just initialize the grid
            CPbusinessLayer bslyr = new CPbusinessLayer();

            bslyr.fileName = fileName;
            wgtList        = bslyr.getWeightEquations();
            weightEquationDOBindingSource.DataSource = wgtList;
            weightEquationList.DataSource            = weightEquationDOBindingSource;
            //  need unique species, livedead and primary product from trees
            List <TreeDefaultValueDO> tList = bslyr.GetUniqueSpeciesProductLiveDead();

            if (wgtList.Count == 0)
            {
                //  Fill species, livedead and primary product with unique items from trees
                foreach (TreeDefaultValueDO tdo in tList)
                {
                    WeightEquationDO wedo = new WeightEquationDO();
                    wedo.Species        = tdo.Species;
                    wedo.LiveDead       = tdo.LiveDead;
                    wedo.PrimaryProduct = tdo.PrimaryProduct;
                    wgtList.Add(wedo);
                } //  end foreach loop
                weightEquationDOBindingSource.ResetBindings(false);
            }     //  endif wgtList is empty

            // Fill lists at bottom with unique species and primary products
            ArrayList justSpecies = bslyr.GetJustSpecies();

            for (int n = 0; n < justSpecies.Count; n++)
            {
                speciesList.Items.Add(justSpecies[n].ToString());
            }

            ArrayList justProduct = bslyr.GetJustPrimaryProduct();

            for (int n = 0; n < justProduct.Count; n++)
            {
                primaryProdList.Items.Add(justProduct[n].ToString());
            }

            speciesList.Enabled     = true;
            liveDeadList.Enabled    = true;
            primaryProdList.Enabled = true;
            return;
        }   //  end setupDialog
        public int setupDialog()
        {
            VolumeEqMethods Veq = new VolumeEqMethods();
            //  fill species list from tree table
            //  show message box if this is BLM
            string currRegion = bslyr.getRegion();

            if (currRegion == "7" || currRegion == "07")
            {
                MessageBox.Show("BLM Volume Equations cannot be entered here.", "INFORMATION", MessageBoxButtons.OK, MessageBoxIcon.Information);
                Close();
                return(-1);
            }   //  endif BLM

            //  if there are volume equations, show in grid
            //  if not, the grid is just initialized
            equationList = bslyr.getVolumeEquations();

            //  Check for missing common name and model name
            Veq.updateVolumeList(equationList, fileName, currRegion);

            string[,] speciesProduct;
            speciesProduct = bslyr.GetUniqueSpeciesProduct();
            //  pull species not used in the cruise from the equations list
            equationList = updateEquationList(speciesProduct);

            //  If there are no species/products in tree default values, it's wrong
            //  tell user to check the file design in CSM --  June 2013
            if (speciesProduct.Length == 0)
            {
                MessageBox.Show("No species/product combinations found in Tree records.\nPlease enter tree records before continuing.", "ERROR", MessageBoxButtons.OK, MessageBoxIcon.Error);
                Close();
                return(-1);
            }   //  endif

            //  if equation list is empty, just fill in unique species and primary product
            if (equationList.Count == 0)
            {
                for (int k = 0; k < speciesProduct.GetLength(0); k++)
                {
                    if (speciesProduct[k, 0] != "" && speciesProduct[k, 0] != null)
                    {
                        VolumeEquationDO ved = new VolumeEquationDO();
                        ved.Species        = speciesProduct[k, 0];
                        ved.PrimaryProduct = speciesProduct[k, 1];
                        equationList.Add(ved);
                    } //  endif end of list
                }     //  end for k loop
            }
            else
            {
                //  situation exists were a template file was made from an existing cruise and
                //  additional species/product combinations were placed in tree default value
                //  need to add those to the equationList so user can enter equation information
                //  June 2013
                for (int k = 0; k < speciesProduct.GetLength(0); k++)
                {
                    if (speciesProduct[k, 0] != "" && speciesProduct[k, 0] != null)
                    {
                        //  see if this combination is in the equationList
                        int nthRow = equationList.FindIndex(
                            delegate(VolumeEquationDO ved)
                        {
                            return(ved.Species == speciesProduct[k, 0] && ved.PrimaryProduct == speciesProduct[k, 1]);
                        });
                        if (nthRow == -1)
                        {
                            //  add the equation to the list so the user can enter equation information
                            VolumeEquationDO v = new VolumeEquationDO();
                            v.Species        = speciesProduct[k, 0];
                            v.PrimaryProduct = speciesProduct[k, 1];
                            equationList.Add(v);
                        } //  endif
                    }     //  endif
                }         //  end for k loop
            }             //  endif list is empty

            volumeEquationDOBindingSource.DataSource = equationList;
            volumeEquationList.DataSource            = volumeEquationDOBindingSource;

            //  also add species and product to combo boxes at bottom
            ArrayList justSpecies = bslyr.GetJustSpecies("TreeDefaultValue");

            for (int n = 0; n < justSpecies.Count; n++)
            {
                speciesList.Items.Add(justSpecies[n].ToString());
            }

            ArrayList justProduct = bslyr.GetJustPrimaryProduct();

            for (int n = 0; n < justProduct.Count; n++)
            {
                productList.Items.Add(justProduct[n].ToString());
            }

            volRegion.Enabled   = false;
            volForest.Enabled   = false;
            volEquation.Enabled = false;
            speciesList.Enabled = false;
            productList.Enabled = false;
            return(1);
        }   //  end setupDialog