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
} // end onCancel public void setupDialog() { // initially, all check boxes are not visible checkBox1.Visible = false; checkBox2.Visible = false; checkBox3.Visible = false; checkBox4.Visible = false; checkBox5.Visible = false; checkBox6.Visible = false; checkBox7.Visible = false; checkBox8.Visible = false; checkBox9.Visible = false; checkBox10.Visible = false; checkBox11.Visible = false; checkBox12.Visible = false; checkBox13.Visible = false; checkBox14.Visible = false; checkBox15.Visible = false; checkBox16.Visible = false; checkBox17.Visible = false; checkBox18.Visible = false; checkBox19.Visible = false; checkBox20.Visible = false; checkBox21.Visible = false; checkBox22.Visible = false; checkBox23.Visible = false; checkBox24.Visible = false; checkBox25.Visible = false; checkBox26.Visible = false; checkBox27.Visible = false; checkBox28.Visible = false; checkBox29.Visible = false; checkBox30.Visible = false; // reset checked status to all zero for (int k = 0; k < 30; k++) { checkStatus[k] = "0"; } // Add species code to checkbox text area and set check to true ArrayList justSpecies = bslyr.GetJustSpecies("Tree"); for (int k = 0; k < justSpecies.Count; k++) { loadCheckBox(k + 1, justSpecies[k].ToString()); } // end for k loop } // end setupDialog
public void setupDialog() { StringBuilder sb = new StringBuilder(); // Get just species from tree list CPbusinessLayer bslyr = new CPbusinessLayer(); bslyr.fileName = fileName; ArrayList justSpecies = bslyr.GetJustSpecies(); // if there are rows in the bioList, show the data in the dialog if (bioList.Count() > 0) { // Load values as needed foreach (Biomass bms in bioList) { // Is species from tree table already associated? Suppress from user species list if so. for (int k = 0; k < justSpecies.Count; k++) { if (justSpecies[k].ToString() != bms.userSpecies) { userSpecies.Items.Add(justSpecies[k].ToString()); } else { sb.Remove(0, sb.Length); sb.Append(bms.userSpecies); sb.Append(" -- "); sb.Append(bms.bioSpecies); associations.Items.Add(sb.ToString()); } // endif justSpecies // add the other fields } // end for k loop fractionLeftInWoods.Items.Add(bms.FLIW); damSmallTreesIncluded.Items.Add(bms.DSTincluded); } // end foreach loop } else if (bioList.Count() <= 0) { // Add just species for (int k = 0; k < justSpecies.Count; k++) { userSpecies.Items.Add(justSpecies[k].ToString()); } // end for k loop } // endif bioList has rows return; } // end setupDialog
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() { // are there any product 08 species to show in the grid? // changes made to Region 8 equations -- July 2017 -- slight changes to this code //ArrayList justSpecies = bslyr.GetProduct08Species(); ArrayList justSpecies = bslyr.GetJustSpecies("Tree"); if (justSpecies.Count == 0) { MessageBox.Show("There are no measured trees in this sale.", "INFORMATION", MessageBoxButtons.OK, MessageBoxIcon.Information); Close(); return(0); } // endif // Otherwise show default value and put species with default in the grid defaultDIB.Text = "6.0"; speciesDIB = new string[justSpecies.Count, 2]; // set number of rows to the species list count for (int k = 0; k < justSpecies.Count; k++) { speciesDIB[k, 0] = justSpecies[k].ToString(); speciesDIB[k, 1] = "6.0"; } // end for k loop // place just species in the list int nthRow = 0; speciesDIBlist.RowCount = justSpecies.Count; for (int k = 0; k < justSpecies.Count; k++) { speciesDIBlist.Rows[nthRow].Cells[0].Value = speciesDIB[k, 0]; speciesDIBlist.Rows[nthRow].Cells[1].Value = speciesDIB[k, 1]; nthRow++; } // end for loop on speciesDIB numRows = justSpecies.Count; return(1); } // 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
public void setupDialog() { // Get unique species list from trees ArrayList uniqueSpecies = bslyr.GetJustSpecies("Tree"); // any volume equations?? List <VolumeEquationDO> volList = bslyr.getVolumeEquations(); if (volList.Count <= 0) { // Initialize dibs as zero jstDIB.Clear(); for (int k = 0; k < uniqueSpecies.Count; k++) { JustDIBs jd = new JustDIBs(); jd.speciesDIB = uniqueSpecies[k].ToString(); jd.productDIB = "01"; jd.primaryDIB = 0.0F; jd.secondaryDIB = 0.0F; jstDIB.Add(jd); } // end for k loop } else if (volList.Count > 0) { // Initialize dibs from volume equations jstDIB.Clear(); for (int k = 0; k < uniqueSpecies.Count; k++) { JustDIBs jd = new JustDIBs(); string currentSpecies = uniqueSpecies[k].ToString(); int nthRow = volList.FindIndex( delegate(VolumeEquationDO v) { //return v.Species == currentSpecies && v.PrimaryProduct == "01"; return(v.Species == currentSpecies); }); if (nthRow >= 0) { jd.speciesDIB = currentSpecies; jd.productDIB = volList[nthRow].PrimaryProduct.ToString(); jd.primaryDIB = (float)volList[nthRow].TopDIBPrimary; jd.secondaryDIB = (float)volList[nthRow].TopDIBSecondary; jstDIB.Add(jd); } // endif nthRow } // end for k loop } // endif volumes // Now the list can be loaded into the data grid -- it is not bound int rowNum = 0; completedDIBs.RowCount = jstDIB.Count; completedDIBs.ColumnCount = 3; foreach (JustDIBs jd in jstDIB) { completedDIBs.Rows[rowNum].Cells[0].Value = jd.speciesDIB; completedDIBs.Rows[rowNum].Cells[1].Value = jd.primaryDIB; completedDIBs.Rows[rowNum].Cells[2].Value = jd.secondaryDIB; rowNum++; } // end foreach loop return; } // end setupDialog