private bool DataOk() { bool nameOk = InputValidations.ValidateIfEmpty(nameText, msgName); float heightSums = (float)(spinnerHeightAboveFloor.Value + spinnerHeight.Value); bool heightSumsOk = InputValidations.ValidateStrictMinor(heightSums, Constants.WALL_HEIGHT, msgHeight, "height plus elevation can't be higher than wall: " + Constants.WALL_HEIGHT + " m"); bool allOk = nameOk && heightSumsOk; return(allOk); }
private void createButton_Click(object sender, EventArgs e) { if (InputValidations.IsListItemSelected(usersList, listMsg, "You must choose a user first")) { bool validWidth = InputValidations.ValidateGreaterThanZero(widthField.Text, widthMsg, "width must be greater than zero") && InputValidations.ValidateStrictMinor(Convert.ToInt32(widthField.Text), 101, widthMsg, "width must be lower than 100"); bool validLength = InputValidations.ValidateGreaterThanZero(widthField.Text, lengthMsg, "length must be greater than zero") && InputValidations.ValidateStrictMinor(Convert.ToInt32(lengthField.Text), 101, lengthMsg, "length must be lower than 100"); bool validName = InputValidations.ValidateIfEmpty(nameText, nameMsg); if (validName && validWidth && validLength) { CreateAndEditBlueprint(); } } }
private void lengthField_Leave(object sender, EventArgs e) { InputValidations.ValidateGreaterThanZero(lengthField.Text, lengthMsg, "length must be greater than zero"); InputValidations.ValidateStrictMinor(Convert.ToInt32(lengthField.Text), 101, lengthMsg, "length must be lower than 100"); }