public override bool CheckValidInput(string i_CurrentInput, int i_QuestionIndex) { bool isValidInput = false; switch (i_QuestionIndex) { case (int)Wheel.eRequiredWheelParams.ManufacturerName: isValidInput = !string.IsNullOrEmpty(i_CurrentInput); break; case (int)Wheel.eRequiredWheelParams.CurrentAirPressure: isValidInput = Wheel.CheckAirPressureValidation(i_CurrentInput, (float)Wheel.eMaxAirPressure.Motorcycle); break; case (int)eRequiredMotorcycleParams.LicenseType: isValidInput = Enum.TryParse(i_CurrentInput, true, out eLicenseType licenseType) && Enum.IsDefined(typeof(eLicenseType), licenseType); break; case (int)eRequiredMotorcycleParams.EngineCapacity: isValidInput = int.TryParse(i_CurrentInput, out int result) && result >= 0; break; } return(isValidInput); }
public override bool CheckValidInput(string i_CurrentInput, int i_QuestionIndex) { bool isValidInput = false; switch (i_QuestionIndex) { case (int)Wheel.eRequiredWheelParams.ManufacturerName: isValidInput = !string.IsNullOrEmpty(i_CurrentInput); break; case (int)Wheel.eRequiredWheelParams.CurrentAirPressure: isValidInput = Wheel.CheckAirPressureValidation(i_CurrentInput, (float)Wheel.eMaxAirPressure.Car); break; case (int)eRequiredCarParams.Color: isValidInput = Enum.TryParse(i_CurrentInput, true, out eColor carColor) && Enum.IsDefined(typeof(eColor), carColor); break; case (int)eRequiredCarParams.NumberOfDoors: bool isNumericInput = byte.TryParse(i_CurrentInput, out byte numericInput); if (isNumericInput) { isValidInput = numericInput >= k_MinNumberOfDoors && numericInput <= k_MaxNumberOfDoors; } break; } return(isValidInput); }
public override bool CheckValidInput(string i_CurrentInput, int i_QuestionIndex) { bool isValidInput = false; switch (i_QuestionIndex) { case (int)Wheel.eRequiredWheelParams.ManufacturerName: isValidInput = !string.IsNullOrEmpty(i_CurrentInput); break; case (int)Wheel.eRequiredWheelParams.CurrentAirPressure: isValidInput = Wheel.CheckAirPressureValidation(i_CurrentInput, (float)Wheel.eMaxAirPressure.Truck); break; case (int)eRequiredTruckParams.HazardousMaterials: bool isBoolean = char.TryParse(i_CurrentInput, out char choiceInputResult); if (isBoolean) { isValidInput = choiceInputResult == 'y' | choiceInputResult == 'Y' | choiceInputResult == 'n' | choiceInputResult == 'N'; } break; case (int)eRequiredTruckParams.CargoVolume: bool isNumeric = float.TryParse(i_CurrentInput, out float floatNumericInput); if (isNumeric) { isValidInput = floatNumericInput >= 0; } break; } return(isValidInput); }