public bool CheckValidFields()
        {
            if (FieldValidation.IsValidDecimalNumericField(textBoxBudget.Text) == false)
            {
                MessageBox.Show("Invalid value typed for budget! Type another!");
                return(false);
            }
            if (FieldValidation.IsValidFloatNumericField(textBoxWallsHeight.Text) == false)
            {
                MessageBox.Show("Invalid value typed for walls height! Type another!");
                return(false);
            }
            if (FieldValidation.IsValidLongNumericField(textBoxTelephoneNumber.Text) == false)
            {
                MessageBox.Show("Invalid value typed for telephone number! Type another!");
                return(false);
            }
            if (FieldValidation.IsValidEmail(textBoxEmailAddress.Text) == false)
            {
                MessageBox.Show("Invalid value typed for email! Type another!");
                return(false);
            }

            return(true);
        }
Exemple #2
0
 private void btnOK_Click(object sender, RoutedEventArgs e)
 {
     if (textBoxName.Text.Length == 0 || textBoxInitialPrice.Text.Length == 0)
     {
         MessageBox.Show("Complete mandatory fields!");
         return;
     }
     if (FieldValidation.IsValidDecimalNumericField(textBoxInitialPrice.Text) == false)
     {
         MessageBox.Show("Invalid value typed for price! Type another!");
         return;
     }
     else
     {
         if (CheckObjectMaterials() == false)
         {
             MessageBox.Show("Some object materials do not exist! Please customize or import!");
             return;
         }
         importedObject.Name         = textBoxName.Text;
         importedObject.Description  = textBoxDescription.Text;
         importedObject.InitialPrice = Convert.ToDecimal(textBoxInitialPrice.Text);
         importedObject.SetInnerObjectMaterials(currentObjectMaterials);
         ClearAllFields();
         if (this.StatusUpdated != null)
         {
             this.StatusUpdated(this, new EventArgs());
         }
     }
 }
Exemple #3
0
        private void btnOK_Click(object sender, RoutedEventArgs e)
        {
            if (textBoxName.Text.Length == 0 || textBoxPrice.Text.Length == 0)
            {
                MessageBox.Show("Complete mandatory fields!");
                return;
            }

            if (FieldValidation.IsValidDecimalNumericField(textBoxPrice.Text) == false)
            {
                MessageBox.Show("Invalid value typed price! Type another!");
                return;
            }
            else
            {
                importedMaterial.Name        = textBoxName.Text;
                importedMaterial.Description = textBoxDescription.Text;
                importedMaterial.Price       = Convert.ToDecimal(textBoxPrice.Text);
                ClearAllFields();
                if (this.StatusUpdated != null)
                {
                    this.StatusUpdated(this, new EventArgs());
                }
            }
        }