Ejemplo n.º 1
0
        }     //  end onFinished

        private void updateBiomassList()
        {
            string          currentUserSpecies;
            string          currentBioSpecies;
            CPbusinessLayer bslyr = new CPbusinessLayer();

            bslyr.fileName = fileName;
            int    nLength = 0;
            int    nthPosition;
            string currentAssn = "";

            //  updates bioList before it is saved in the database
            //  remove all rows first
            bioList.Clear();

            //  rows must be added for all strata where this species is located
            for (int k = 0; k < associations.Items.Count; k++)
            {
                currentAssn = associations.Items[k].ToString();
                //  split out user and bio species
                nLength            = currentAssn.Length;
                nthPosition        = currentAssn.IndexOf("-");
                currentUserSpecies = currentAssn.Substring(0, nthPosition - 1);
                currentAssn        = currentAssn.Remove(0, nthPosition + 3);
                currentBioSpecies  = currentAssn;


                //  How many strata have the user species?
                //List<TreeDO> speciesList = bslyr.GetStratumForBiomassReport(currentUserSpecies);
                string[,] stratumSG = bslyr.GetStratumForBiomassReport(currentUserSpecies);
                for (int j = 0; j < stratumSG.GetLength(0); j++)
                {
                    //  setup fields to load into bioList
                    Biomass bms = new Biomass();
                    bms.userSpecies = currentUserSpecies;
                    bms.bioSpecies  = currentBioSpecies;
                    bms.FLIW        = fractionLeftInWoods.Items[k].ToString();
                    bms.DSTincluded = damSmallTreesIncluded.Items[k].ToString();

                    bms.userStratum = stratumSG[j, 0];
                    bms.userSG      = stratumSG[j, 1];

                    bioList.Add(bms);
                }

                /*foreach (TreeDO tree in speciesList)
                 * {
                 *  bms.userStratum = tree.Stratum.Code;
                 *  bms.userSG = tree.SampleGroup.Code;
                 *
                 *  bioList.Add(bms);
                 * }   //  end foreach loop
                 */
            }   //  end for k loop

            return;
        }   //  end updateBiomassList