本文整理汇总了C#中ValidationType类的典型用法代码示例。如果您正苦于以下问题:C# ValidationType类的具体用法?C# ValidationType怎么用?C# ValidationType使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
ValidationType类属于命名空间,在下文中一共展示了ValidationType类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: ValidationResult
public ValidationResult(string message, string description, ValidationType validationType)
: this()
{
this.Message = message;
this.Description = description;
this.ValidationType = validationType;
}
示例2: ValidatorDescriptionAttribute
/// <summary>
/// Initializes a new instance of the <see cref="ValidatorDescriptionAttribute" /> class.
/// </summary>
/// <param name="tag">The validation tag.</param>
/// <param name="validationResultType">The validation result type.</param>
/// <param name="validationType">The validation type.</param>
public ValidatorDescriptionAttribute(string tag, ValidationResultType validationResultType = ValidationResultType.Error,
ValidationType validationType = ValidationType.Field)
{
Tag = tag;
ValidationResultType = validationResultType;
ValidationType = validationType;
}
示例3: Generate
public string Generate(int length, ValidationType validationType)
{
var passwordValidation = new PasswordValidationService();
var wordChar = GenerateChars(length, validationType);
var word = new String(wordChar);
var measuredPasswordStrength = passwordValidation.MeasurePasswordStrength(word);
if (validationType == ValidationType.Strong)
while (measuredPasswordStrength != 100)
{
wordChar = GenerateChars(length, validationType);
word = new String(wordChar);
measuredPasswordStrength = passwordValidation.MeasurePasswordStrength(word);
}
else if (validationType == ValidationType.Medium)
while (measuredPasswordStrength != 50)
{
wordChar = GenerateChars(length, validationType);
word = new String(wordChar);
measuredPasswordStrength = passwordValidation.MeasurePasswordStrength(word);
}
else if (validationType == ValidationType.Weak)
while (measuredPasswordStrength != 20)
{
wordChar = GenerateChars(length, validationType);
word = new String(wordChar);
measuredPasswordStrength = passwordValidation.MeasurePasswordStrength(word);
}
return word ;
}
示例4: ValidationRule
public ValidationRule(Func<bool> condition, string message,
ValidationType validationType = ValidationType.Required)
{
Condition = condition;
Message = message;
ValidationType = validationType;
}
示例5: Get
public IHttpActionResult Get(int length, ValidationType validationType)
{
var generatePasswordService = new PasswordGenerateService();
var password = generatePasswordService.Generate(length, validationType);
return Ok(password);
}
示例6: XmlValidatingReader
public XmlValidatingReader(String xmlFragment, XmlNodeType fragType,
XmlParserContext context)
{
reader = new XmlTextReader(xmlFragment, fragType, context);
entityHandling = EntityHandling.ExpandEntities;
validationType = ValidationType.Auto;
reader.Normalization = true;
}
示例7: addValidations
/// <summary>
/// Add the Stage validations
/// </summary>
/// <param name="validationType">The type of validation to perform.
/// Only the dialog should use the FromDialog type.</param>
public void addValidations(ValidationType validationType)
{
Int32 stageId;
if (!Int32.TryParse(getId(), out stageId)
|| stageId < 0 || stageId >= m_maxStages)
{
DataConfiguration.addValidation("The stage ID must be within 0 and " + (m_maxStages - 1).ToString());
}
else if (stageId != 0 && getDescription().Length == 0)
{
DataConfiguration.addValidation("The stage description must be specified (Stage: " + getId() + ")");
}
if (validationType.Equals(ValidationType.Complete))
{
if (!hasCompletions())
{
DataConfiguration.addValidation("Stage completions are mandatory (Stage: " + getId() + ")");
}
else
{
int actionCount;
int totalActionCount = 0;
foreach (Completion completion in getCompletions())
{
switch (completion.getCompletionType())
{
case CompletionType.Fight_Mob:
case CompletionType.Use_Skill_On_Mob_Type:
case CompletionType.Use_Skill_On_Object:
actionCount = completion.getCount();
if (actionCount == -1)
{
// If there is no count then it "counts" as one
actionCount = 1;
}
totalActionCount += actionCount;
break;
}
}
if (totalActionCount >= 32)
{
DataConfiguration.addValidation("There cannot be more than 32 actions in a stage (Stage: " + getId() + ")");
}
// Verify CompletionType interdependencies
/*if (Completion.contains(getCompletions(), CompletionType.Take_Item_To_Location)
&& !Completion.contains(getCompletions(), CompletionType.Nearest_Nav))
{
DataConfiguration.addValidation("The type '"
+ CompletionType.Take_Item_To_Location.ToString()
+ "' requires the '"
+ CompletionType.Nearest_Nav.ToString()
+ "' type (Stage: " + getId() + ").");
}*/
}
} // ValidationType.Complete
}
示例8: GetValidationErrorMessage
public static string GetValidationErrorMessage(ValidationType validType)
{
string errorMessage, dummy;
//Get Error Message
GetValidationDetails(validType, out dummy, out errorMessage);
return errorMessage;
}
示例9: AddValidationMessage
public static ValidationMessage AddValidationMessage(this Controller controller, string title, string message, ValidationType validationtType = ValidationType.Info)
{
Validator validator = controller.TempData["Validator"] as Validator;
validator = validator ?? new Validator();
var validationMessage = validator.AddValidationMessage(title, message, validationtType);
controller.TempData["Validator"] = validator;
return validationMessage;
}
示例10: GetSubmitScript
public string GetSubmitScript(string formId, RouteValueDictionary routeValues, string actionUrl, ValidationType validation = ValidationType.None)
{
if (routeValues == null) throw new ArgumentNullException("routeValues");
if (String.IsNullOrWhiteSpace(actionUrl)) throw new ArgumentNullException("actionUrl");
if (String.IsNullOrWhiteSpace(formId)) throw new ArgumentNullException("formId");
var scriptTemplate = "var param = [{1}]; setFormParams('{0}', param); submitForm(this, event, '{0}', '{2}', '{3}'); return false;";
return String.Format(scriptTemplate, formId, SafeConvert.ToJSArray(routeValues), actionUrl, validation);
}
示例11: GetValidationExpression
public static string GetValidationExpression(ValidationType validType)
{
string regularExpression, dummy;
//Get regular Expression
GetValidationDetails(validType, out regularExpression, out dummy);
return regularExpression;
}
示例12: XmlValidatingReader
public XmlValidatingReader (XmlReader reader)
{
sourceReader = reader;
xmlTextReader = reader as XmlTextReader;
if (xmlTextReader == null)
resolver = new XmlUrlResolver ();
entityHandling = EntityHandling.ExpandEntities;
validationType = ValidationType.Auto;
storedCharacters = new StringBuilder ();
}
示例13: AddValidationMessage
public ValidationMessage AddValidationMessage(string title, string message, ValidationType messageType)
{
var validation = new ValidationMessage()
{
Title = title,
Message = message,
MessageType = messageType
};
ValidationMessages.Add(validation);
return validation;
}
示例14: HeightLessThanTwo_ThrowsException
private static void HeightLessThanTwo_ThrowsException(ValidationType validationType)
{
ExceptionAssert.Throws(
() =>
{
// Arrange
BoardValidationError[] errors;
// Act
BoardValidator.Validate(5, 1, new[] { 1, 2, 3, 4, 0 }, validationType, out errors);
},
typeof(ArgumentException));
}
示例15: Validate
public static bool Validate(ValidationType type,string input)
{
string regex = string.Empty;
switch (type)
{
case ValidationType.Email:
regex = EmailPattern;
break;
default:
throw new Exception("没有找到验证类型!");
}
return Regex.IsMatch(input, regex);
}