Example #1
0
        }   //  end onInsertEquation

        private void onFinished(object sender, EventArgs e)
        {
            //  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;
                //  make sure the equations have been entered
                foreach (ValueEquationDO ved in valList)
                {
                    if (ved.ValueEquationNumber == null || ved.ValueEquationNumber == "" ||
                        ved.ValueEquationNumber == " ")
                    {
                        nResult = MessageBox.Show("One or more equation numbers are blank.\nCannot continue without equation numbers.\nNo records saved.", "ERROR", MessageBoxButtons.OK, MessageBoxIcon.Error);
                        Close();
                        return;
                    } //  endif
                }     //  end foreach loop
                //  make sure coefficients are zero or a value but not null
                foreach (ValueEquationDO ved in valList)
                {
                    if (ved.Coefficient1 <= 0)
                    {
                        ved.Coefficient1 = 0;
                    }
                    if (ved.Coefficient2 <= 0)
                    {
                        ved.Coefficient2 = 0;
                    }
                    if (ved.Coefficient3 <= 0)
                    {
                        ved.Coefficient3 = 0;
                    }
                    if (ved.Coefficient4 <= 0)
                    {
                        ved.Coefficient4 = 0;
                    }
                    if (ved.Coefficient5 <= 0)
                    {
                        ved.Coefficient5 = 0;
                    }
                    if (ved.Coefficient6 <= 0)
                    {
                        ved.Coefficient6 = 0;
                    }
                }   //  end foreach loop
                bslyr.SaveValueEquations(valList);
                Cursor.Current = this.Cursor;
            }   //  endif

            if (bslyr.DAL_V3 != null)
            {
                bslyr.syncValueEquationToV3();
            }//end if

            Close();
            return;
        }   //  end onFinished