/// <summary> /// This function returns the body value for the given message. /// </summary> /// <param name="eTypeOfError"></param> /// <returns></returns> public string GetMessageText(ETypeOfError eTypeOfError) { switch (eTypeOfError) { case ETypeOfError.NullOrWhiteSpaces: return($"The text cannot be empty or contain only white space."); case ETypeOfError.WrongDataFormat: return($"An incorrect value has been entered."); case ETypeOfError.WrongDateFormat: return($"An unsupported date format was provided (dd-mm-yyyy)."); default: return($"An unknown error has been encountered."); } }
/// <summary> /// This function displays an error message to the user. /// </summary> /// <param name="eTypeOfError"></param> public void PrintError(ETypeOfError eTypeOfError) { MessageBox.Show(GetMessageText(eTypeOfError), "Communication", MessageBoxButtons.OK); }