public async Task <bool> ValidateColorCode(TicketStatus TicketStatus) { if (string.IsNullOrWhiteSpace(TicketStatus.ColorCode)) { TicketStatus.AddError(nameof(TicketStatusValidator), nameof(TicketStatus.ColorCode), ErrorCode.ColorCodeEmpty); } else if (TicketStatus.ColorCode.Length > 20) { TicketStatus.AddError(nameof(TicketStatusValidator), nameof(TicketStatus.ColorCode), ErrorCode.ColorCodeOverLength); } return(TicketStatus.IsValidated); }
public async Task <bool> ValidateStatus(TicketStatus TicketStatus) { if (StatusEnum.ACTIVE.Id != TicketStatus.StatusId && StatusEnum.INACTIVE.Id != TicketStatus.StatusId) { TicketStatus.AddError(nameof(TicketStatusValidator), nameof(TicketStatus.Status), ErrorCode.StatusNotExisted); } return(TicketStatus.IsValidated); }
public async Task <bool> ValidateId(TicketStatus TicketStatus) { TicketStatusFilter TicketStatusFilter = new TicketStatusFilter { Skip = 0, Take = 10, Id = new IdFilter { Equal = TicketStatus.Id }, Selects = TicketStatusSelect.Id }; int count = await UOW.TicketStatusRepository.Count(TicketStatusFilter); if (count == 0) { TicketStatus.AddError(nameof(TicketStatusValidator), nameof(TicketStatus.Id), ErrorCode.IdNotExisted); } return(count == 1); }