Пример #1
0
 private void UpdateForm()
 {
     Title           = titleTextBox.Text;
     Author          = authorTextBox.Text;
     Publisher       = publisherTextBox.Text;
     Year            = Convert.ToInt32(yearNumericUpDown.Value);
     Quality         = qualityTextBox.Text;
     Price           = Convert.ToSingle(priceNumericUpDown.Value);
     button1.Enabled = InputValidator.validateTitle(Title) &&
                       InputValidator.validateAuthor(Author) &&
                       InputValidator.validatePublisher(Publisher) &&
                       InputValidator.validateYear(Year) &&
                       InputValidator.validateQuality(Quality) &&
                       InputValidator.validatePrice(Price);
 }
Пример #2
0
        private void UpdateForm()
        {
            if (this.tabControl1.SelectedTab == this.yearTabPage)
            {
                PriceMinimum = this.lessRadioButton.Checked ? InputValidator.PriceMinimum : Convert.ToSingle(Math.Round(priceNumericUpDown.Value, 2));
                PriceMaximum = this.moreRadioButton.Checked ? InputValidator.PriceMaximum : Convert.ToSingle(Math.Round(priceNumericUpDown.Value, 2));
            }
            else if (this.tabControl1.SelectedTab == this.rangeTabPage)
            {
                PriceMinimum = Convert.ToSingle(Math.Round(fromNumericUpDown.Value, 2));
                PriceMaximum = Convert.ToSingle(Math.Round(toNumericUpDown.Value, 2));
            }

            this.button1.Enabled = InputValidator.validatePrice(PriceMinimum) &&
                                   InputValidator.validatePrice(PriceMaximum) &&
                                   (PriceMinimum <= PriceMaximum);
        }