/// <summary> /// Validates the user input. /// </summary> /// <param name="uiTransactionData">The user input.</param> public static void ValidateUserInput(ref UserInterfaceTransactionData uiTransactionData) { // Check whether the title of the talk input by the user is valid, // otherwise add the error into the user input instance if (!Talk.IsValidTitle(uiTransactionData.TalkTitle)) { Fault newError = new Fault() { Message = "The title of the talk should not contain any numbers", Code = "userInput.TalkTitle" }; uiTransactionData.Faults.Add(newError); } // Check whether the length of the talk input by the user is valid, // otherwise add the error into the user input instance int result = 0; if (!Regex.IsMatch(uiTransactionData.LengthOfTalk, @"^\d+$") && !int.TryParse(uiTransactionData.LengthOfTalk, out result)) { Fault newError = new Fault() { Message = "The duration of the talk should be numbers only", Code = "userInput.LengthOfTalk" }; uiTransactionData.Faults.Add(newError); } }