Пример #1
0
 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);
 }
Пример #2
0
 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);
 }
Пример #3
0
        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);
        }