本文整理汇总了C#中ValidationType类的典型用法代码示例。如果您正苦于以下问题:C# ValidationType类的具体用法?C# ValidationType怎么用?C# ValidationType使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
ValidationType类属于命名空间,在下文中一共展示了ValidationType类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。
示例1: ValidationResult
public ValidationResult(string message, string description, ValidationType validationType)
: this()
{
this.Message = message;
this.Description = description;
this.ValidationType = validationType;
}
开发者ID:ezimaxtechnologies,项目名称:ASP.Net,代码行数:7,代码来源:ValidationResult.cs
示例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;
}
开发者ID:pars87,项目名称:Catel,代码行数:13,代码来源:ValidatorDescriptionAttribute.cs
示例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 ;
}
开发者ID:mmittmann,项目名称:ProjetoSeguranca,代码行数:32,代码来源:PasswordGenerateService.cs
示例4: ValidationRule
public ValidationRule(Func<bool> condition, string message,
ValidationType validationType = ValidationType.Required)
{
Condition = condition;
Message = message;
ValidationType = validationType;
}
开发者ID:CyrilvonLutzow,项目名称:Teleavtomatika_Form_Validation,代码行数:7,代码来源:ValidationRule.cs
示例5: Get
public IHttpActionResult Get(int length, ValidationType validationType)
{
var generatePasswordService = new PasswordGenerateService();
var password = generatePasswordService.Generate(length, validationType);
return Ok(password);
}
开发者ID:mmittmann,项目名称:ProjetoSeguranca,代码行数:8,代码来源:GenerateController.cs
示例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;
}
开发者ID:jjenki11,项目名称:blaze-chem-rendering,代码行数:8,代码来源:XmlValidatingReader.cs
示例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
}
开发者ID:RavenB,项目名称:Earth-and-Beyond-server,代码行数:63,代码来源:Stage.cs
示例8: GetValidationErrorMessage
public static string GetValidationErrorMessage(ValidationType validType)
{
string errorMessage, dummy;
//Get Error Message
GetValidationDetails(validType, out dummy, out errorMessage);
return errorMessage;
}
开发者ID:lucaslim,项目名称:NorthBay,代码行数:9,代码来源:ValidationHelper.cs
示例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;
}
开发者ID:ritterondotnet,项目名称:CustomValidation,代码行数:9,代码来源:ControllerExtensions.cs
示例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);
}
开发者ID:evkap,项目名称:DVS,代码行数:9,代码来源:JavaScriptHelper.cs
示例11: GetValidationExpression
public static string GetValidationExpression(ValidationType validType)
{
string regularExpression, dummy;
//Get regular Expression
GetValidationDetails(validType, out regularExpression, out dummy);
return regularExpression;
}
开发者ID:lucaslim,项目名称:NorthBay,代码行数:9,代码来源:ValidationHelper.cs
示例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 ();
}
开发者ID:calumjiao,项目名称:Mono-Class-Libraries,代码行数:10,代码来源:XmlValidatingReader.cs
示例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;
}
开发者ID:ritterondotnet,项目名称:CustomValidation,代码行数:11,代码来源:Validator.cs
示例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));
}
开发者ID:LorandBiro,项目名称:SpeedSlidingTrainer,代码行数:13,代码来源:BoardValidatorTests.cs
示例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);
}
开发者ID:adeewu,项目名称:huobi3j,代码行数:14,代码来源:Validator.cs
示例16: ValidationDelegateTaken
/// <summary>
/// 初始化 HtmlDocumentValidation 的新实例。
/// </summary>
/// <param name="name">此验证的名称信息(用于向用户界面显示)。</param>
/// <param name="documentValidation">一个委托,用于验证 HtmlDocument 是否符合规则。</param>
/// <param name="errorMessage">验证不符合规则时的提示信息。</param>
public ValidationDelegateTaken(String name, ValidationType validationType, System.Func<HtmlAgilityPack.HtmlDocument, bool> documentValidation, String errorMessage)
{
this.documentValidation = documentValidation;
this.errorMessage = errorMessage;
this.Name = name;
this.Type = validationType;
if (documentValidation == null)
{
throw new ArgumentNullException("documentValidation");
}
if (errorMessage == null)
{
throw new ArgumentNullException("errorMessage");
}
}
开发者ID:darklx,项目名称:Staticize,代码行数:21,代码来源:ValidationDelegateTaken.cs
示例17: Duplication_IsInvalid
private static void Duplication_IsInvalid(ValidationType validationType)
{
// Arrange
BoardValidationError[] errors;
// Act
bool isValid = BoardValidator.Validate(3, 3, new[] { 1, 2, 3, 4, 5, 6, 7, 7, 0 }, validationType, out errors);
// Assert
Assert.IsFalse(isValid);
Assert.IsTrue(errors.Length > 0);
Assert.AreEqual(BoardValidationErrorType.Duplication, errors[0].ErrorType);
Assert.IsNotNull(errors[0].Position);
Assert.AreEqual(1, errors[0].Position.X);
Assert.AreEqual(2, errors[0].Position.Y);
}
开发者ID:LorandBiro,项目名称:SpeedSlidingTrainer,代码行数:16,代码来源:BoardValidatorTests.cs
示例18: ValidationPredicateResult
public ValidationPredicateResult(bool isMatch, string message, ValidationType validationType)
{
if (message == null)
{
throw new ArgumentNullException("message");
}
if (message.Length == 0)
{
throw new ArgumentException(ValidationPredicateMessages.NullOrEmptyStringMessage, "message");
}
this.isMatch = isMatch;
this.message = message;
this.validationType = validationType;
}
开发者ID:veskokolev,项目名称:Bytes2you.Validation,代码行数:16,代码来源:ValidationPredicateResult.cs
示例19: IsValid
public bool IsValid(ValidationType validationType = ValidationType.Time)
{
switch (validationType)
{
case ValidationType.Time:
return validTill > DateTime.Now;
case ValidationType.Strict:
if (validTill > DateTime.Now)
User.Login(creditals);
else
{
throw new SecurityException("Time validation failed");
}
break;
default:
Trace.Write("Unexpectedly got to validationTypes default close");
throw new Exception("unexpected");
}
return true;
}
开发者ID:GeriHonti,项目名称:SchoolProject_SoftwareDevelopment_GPSGame,代码行数:20,代码来源:Token.cs
示例20: DateValidationAttribute
public DateValidationAttribute(ValidationType validationType, string compareWith = "", string fromDate = "")
{
_validationType = validationType;
switch (validationType)
{
case ValidationType.Compare:
{
_propertyNameToCompare = compareWith;
break;
}
case ValidationType.RangeValidation:
{
_fromDate = new DateTime(2000, 1, 1);
_toDate = DateTime.Today;
break;
}
}
}
开发者ID:stiqraschool,项目名称:eSchool,代码行数:20,代码来源:DateValidationAttribute.cs
注:本文中的ValidationType类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论