} // end onInsertClick private void onFinished(object sender, EventArgs e) { // make sure volume equation is not blank for any species/product and make sure at least one volume flag is checked int noEquation = 0; int noVolume = 0; foreach (VolumeEquationDO ved in equationList) { if ((ved.VolumeEquationNumber == "" || ved.VolumeEquationNumber == null) && (ved.Species != "" || ved.Species == null)) { noEquation = 1; } if (ved.CalcBoard == 0 && ved.CalcCubic == 0 && ved.CalcCord == 0) { noVolume = 1; } if (noEquation == 1 || noVolume == 1) { break; } } // end foreach loop if (noEquation == 1) { MessageBox.Show("One or more records have no volume equation.\nPlease correct now.", "ERROR", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } // endif no equation if (noVolume == 1) { MessageBox.Show("One or more records have no volume selected.\nPlease correct now.", "ERROR", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } // endif no volume // Otherwise, make sure user wants to save all entries DialogResult nResult = MessageBox.Show("Do you want to save changes?", "CONFIRMATION", MessageBoxButtons.YesNo, MessageBoxIcon.Question); if (nResult == DialogResult.Yes) { Cursor.Current = Cursors.WaitCursor; bslyr.SaveVolumeEquations(equationList); Cursor.Current = this.Cursor; } // endif int sumBiomassFlag = (int)equationList.Sum(eq => eq.CalcBiomass); if (sumBiomassFlag > 0) { // Load biomass information if biomass flag was checked // But if it's an edited template then capture region and forest // before updating biomass. March 2017 if (templateFlag == 1) { TemplateRegionForest trf = new TemplateRegionForest(); trf.ShowDialog(); updateBiomass(equationList, trf.currentRegion, trf.currentForest); } else { updateBiomass(equationList); } } else if (sumBiomassFlag == 0) { // remove all biomass equations bslyr.ClearBiomassEquations(); } // endif if (bslyr.DAL_V3 != null) { //on finish sync biomass and volume eq. bslyr.syncVolumeEquationToV3(); bslyr.syncBiomassEquationToV3(); }//end if Close(); return; } // end onFinished