public static BMIValidationOutput ValidateInputText(string height, string weight) { decimal hResult, wResult; var output = new BMIValidationOutput() { Error = null }; if (!decimal.TryParse(height, out hResult)) { output.Error = AppResources.BMIHeightInvalidInputException; return(output); } if (!decimal.TryParse(weight, out wResult)) { output.Error = AppResources.BMIWeightInvalidInputException; return(output); } if (!hResult.Between(_minH, _maxH, true)) { output.Error = String.Format("{0} {1} {2} {3} cm", AppResources.BMIHeightInvalidRangeException, _minH, AppResources.AndConjuntion, _maxH); return(output); } if (!wResult.Between(_minW, _maxW, true)) { output.Error = String.Format("{0} {1} {2} {3} kg", AppResources.BMIWeightInvalidRangeException, _minW, AppResources.AndConjuntion, _maxW); return(output); } output.Height = hResult; output.Weight = wResult; return(output); }
public static BMIValidationOutput ValidateInputText(string height, string weight) { decimal hResult, wResult; var output = new BMIValidationOutput() { Error = null }; if (!decimal.TryParse(height, out hResult)) { output.Error = AppResources.BMIHeightInvalidInputException; return output; } if (!decimal.TryParse(weight, out wResult)) { output.Error = AppResources.BMIWeightInvalidInputException; return output; } if (!hResult.Between(_minH, _maxH, true)) { output.Error = String.Format("{0} {1} {2} {3} cm", AppResources.BMIHeightInvalidRangeException, _minH, AppResources.AndConjuntion, _maxH); return output; } if (!wResult.Between(_minW, _maxW, true)) { output.Error = String.Format("{0} {1} {2} {3} kg", AppResources.BMIWeightInvalidRangeException, _minW, AppResources.AndConjuntion, _maxW); return output; } output.Height = hResult; output.Weight = wResult; return output; }
public BMICalculator(BMIValidationOutput input, ICollection<BMILimit> BMILimitsList) : this(input.Height, input.Weight, BMILimitsList) { }
public BMICalculator(BMIValidationOutput input, ICollection <BMILimit> BMILimitsList) : this(input.Height, input.Weight, BMILimitsList) { }