Exemple #1
0
 public async Task <bool> ValidateColorCode(TicketPriority TicketPriority)
 {
     if (string.IsNullOrWhiteSpace(TicketPriority.ColorCode))
     {
         TicketPriority.AddError(nameof(TicketPriorityValidator), nameof(TicketPriority.ColorCode), ErrorCode.ColorCodeEmpty);
     }
     else if (TicketPriority.ColorCode.Length > 20)
     {
         TicketPriority.AddError(nameof(TicketPriorityValidator), nameof(TicketPriority.ColorCode), ErrorCode.ColorCodeOverLength);
     }
     return(TicketPriority.IsValidated);
 }
Exemple #2
0
 public async Task <bool> ValidateStatus(TicketPriority TicketPriority)
 {
     if (StatusEnum.ACTIVE.Id != TicketPriority.StatusId && StatusEnum.INACTIVE.Id != TicketPriority.StatusId)
     {
         TicketPriority.AddError(nameof(TicketPriorityValidator), nameof(TicketPriority.Status), ErrorCode.StatusNotExisted);
     }
     return(TicketPriority.IsValidated);
 }
Exemple #3
0
        public async Task <bool> ValidateId(TicketPriority TicketPriority)
        {
            TicketPriorityFilter TicketPriorityFilter = new TicketPriorityFilter
            {
                Skip = 0,
                Take = 10,
                Id   = new IdFilter {
                    Equal = TicketPriority.Id
                },
                Selects = TicketPrioritySelect.Id
            };

            int count = await UOW.TicketPriorityRepository.Count(TicketPriorityFilter);

            if (count == 0)
            {
                TicketPriority.AddError(nameof(TicketPriorityValidator), nameof(TicketPriority.Id), ErrorCode.IdNotExisted);
            }
            return(count == 1);
        }