本文整理汇总了C#中IValidator.GetErrors方法的典型用法代码示例。如果您正苦于以下问题:C# IValidator.GetErrors方法的具体用法?C# IValidator.GetErrors怎么用?C# IValidator.GetErrors使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IValidator
的用法示例。
在下文中一共展示了IValidator.GetErrors方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Save
public void Save(ServicePerson servicePerson,List<Guid> sourceIds, IValidator validator = null)
{
if (validator != null && !validator.ValidEntry()) throw new InvalidDataException(validator.GetErrors());
if (servicePerson.PersonId == Guid.Empty)
{
InsertNewRecord(servicePerson, sourceIds);
}
else
{
EditSelectedRecord(servicePerson, sourceIds);
}
}
示例2: Search
public ServiceMarriageObject Search(MarriageFilterTypes filterMode, MarriageSearchFilter marriageSearchFilter, DataShaping shaping, IValidator validator = null)
{
var serviceMarriageObject = new ServiceMarriageObject();
if (!_security.IsvalidSelect()) serviceMarriageObject.ErrorStatus = "Invalid permission to select";
if (validator != null && !validator.ValidEntry()) serviceMarriageObject.ErrorStatus += " Validation failed: " + validator.GetErrors();
if (serviceMarriageObject.ErrorStatus.Length == 0)
{
if (shaping.Column.Contains("MarriageDate DESC"))
{
shaping.Column = "MarriageYear DESC";
}
else if (shaping.Column.Contains("MarriageDate"))
{
shaping.Column = "MarriageYear";
}
switch (filterMode)
{
case MarriageFilterTypes.Duplicates:
serviceMarriageObject = marriageSearchFilter.ParentId != Guid.Empty
? _marriagesDll.GetDataByUniqueRef(marriageSearchFilter.ParentId)
.ToServiceMarriageObject(shaping.Column, shaping.RecordPageSize,
shaping.RecordStart)
: new ServiceMarriageObject();
break;
case MarriageFilterTypes.Standard:
serviceMarriageObject =
_marriagesDll.GetFilteredMarriages(marriageSearchFilter)
.ToServiceMarriageObject(shaping.Column, shaping.RecordPageSize, shaping.RecordStart);
break;
case MarriageFilterTypes.IdList:
serviceMarriageObject = _marriagesDll.GetByListId(marriageSearchFilter.Ids).ToServiceMarriageObject(shaping.Column, shaping.RecordPageSize, shaping.RecordStart);
break;
}
}
return serviceMarriageObject;
}
示例3: Search
public ServicePersonObject Search(PersonSearchTypes filterMode, PersonSearchFilter personSearchFilter, DataShaping shaper, IValidator validator = null)
{
if (validator != null && !validator.ValidEntry()) throw new InvalidDataException(validator.GetErrors());
if (!_security.IsvalidSelect()) throw new SecurityException("Missing select permission");
IList<ServicePerson> tpServicePerson = new List<ServicePerson>();
switch (filterMode)
{
case PersonSearchTypes.Duplicates:
if (personSearchFilter.ParentId != Guid.Empty)
{
tpServicePerson = _personDal.GetByDupeRef(personSearchFilter.ParentId);
}
break;
case PersonSearchTypes.Simple:
tpServicePerson = _personDal.GetByFilter(personSearchFilter).OrderBy(o => o.BirthYear).ToList();
break;
case PersonSearchTypes.IdList:
tpServicePerson = _personDal.GetByIdList(personSearchFilter).OrderBy(o => o.BirthYear).ToList();
break;
}
return tpServicePerson.ToServicePersonObject(shaper.Column, shaper.RecordPageSize,shaper.RecordStart);
}