Esempio n. 1
0
 public OrderForm(OrderFormValuesValidator orderFormValuesValidator,
                  OrderConfigurationFormValuesValidator orderConfigurationFormValuesValidator,
                  OrderCalculator orderCalculator, OrderConverter orderConverter)
 {
     InitializeComponent();
     orderFormValues = new OrderFormValues
     {
         VehicleType = VehicleType.NONE
     };
     orderConfigurationFormValues = new OrderConfigurationFormValues();
     orderFormErrors = new OrderFormErrors();
     orderConfigurationFormErrors  = new OrderConfigurationFormErrors();
     this.OrderFormValuesValidator = orderFormValuesValidator;
     this.OrderConfigurationFormValuesValidator = orderConfigurationFormValuesValidator;
     this.OrderCalculator = orderCalculator;
     this.OrderConverter  = orderConverter;
 }
Esempio n. 2
0
        private bool IsFormValid()
        {
            OrderFormValuesValidator.ValidateOrderFormValues(orderFormValues, orderFormErrors);
            OrderConfigurationFormValuesValidator.ValidateOrderConfigurationFormValues(orderConfigurationFormValues,
                                                                                       orderConfigurationFormErrors);
            foreach (PropertyInfo property in orderFormErrors.GetType().GetProperties())
            {
                if (property.GetValue(orderFormErrors) != null)
                {
                    return(false);
                }
            }

            foreach (PropertyInfo property in orderConfigurationFormErrors.GetType().GetProperties())
            {
                if (property.GetValue(orderConfigurationFormErrors) != null)
                {
                    return(false);
                }
            }

            return(true);
        }