Esempio n. 1
0
        //----------

        private bool validateVolumeAndMass(out decimal volume, out int mass)
        {
            ValidationClass valid   = new ValidationClass();
            CorrectValue    correct = new CorrectValue();

            volume = 0;
            mass   = 0;
            if (valid.ValidateVolume(VolumeBox.Text))
            {
                volume = decimal.Parse(correct.CorrectVolume(VolumeBox.Text));
            }
            else
            {
                MessageBox.Show("Incorrect volume format");
                return(false);
            }
            if (valid.ValidateMass(MassBox.Text))
            {
                mass = int.Parse(MassBox.Text);
            }
            else
            {
                MessageBox.Show("Incorrect mass format");
                return(false);
            }
            return(true);
        }
        private void OrderButton_Click(object sender, EventArgs e)
        {
            ValidationClass validate = new ValidationClass();

            if (validate.ValidateVolume(textBox1.Text))
            {
                CorrectValue correct = new CorrectValue();
                parentForm.CustomVolumeValue = correct.CorrectVolume(textBox1.Text);
                Close();
            }
            else
            {
                MessageBox.Show("Wrong volume");
                textBox1.Clear();
            }
        }