コード例 #1
0
        private async Task <bool> ValidateResolve(Ticket Ticket)
        {
            if (Ticket.IsClose.HasValue && Ticket.IsClose.Value)
            {
                if (Ticket.TicketResolveTypeId.HasValue == false)
                {
                    Ticket.AddError(nameof(TicketValidator), nameof(Ticket.TicketResolveType), ErrorCode.TicketResolveTypeEmpty);
                }

                if (string.IsNullOrWhiteSpace(Ticket.ResolveContent))
                {
                    Ticket.AddError(nameof(TicketValidator), nameof(Ticket.ResolveContent), ErrorCode.ResolveContentEmpty);
                }
            }
            return(Ticket.IsValidated);
        }
コード例 #2
0
 public async Task <bool> ValidateTicketSource(Ticket Ticket)
 {
     if (Ticket.TicketSource == null)
     {
         Ticket.AddError(nameof(TicketValidator), nameof(Ticket.TicketSource), ErrorCode.TicketSourceEmpty);
     }
     return(Ticket.IsValidated);
 }
コード例 #3
0
 public async Task <bool> ValidateTicketPriority(Ticket Ticket)
 {
     if (Ticket.TicketPriority == null)
     {
         Ticket.AddError(nameof(TicketValidator), nameof(Ticket.TicketPriority), ErrorCode.TicketPriorityEmpty);
     }
     return(Ticket.IsValidated);
 }
コード例 #4
0
 public async Task <bool> ValidateTicketIssueLevel(Ticket Ticket)
 {
     if (Ticket.TicketIssueLevel == null)
     {
         Ticket.AddError(nameof(TicketValidator), nameof(Ticket.TicketIssueLevel), ErrorCode.TicketIssueLevelEmpty);
     }
     return(Ticket.IsValidated);
 }
コード例 #5
0
 public async Task <bool> ValidateCustomer(Ticket Ticket)
 {
     if (Ticket.Customer == null)
     {
         Ticket.AddError(nameof(TicketValidator), nameof(Ticket.Customer), ErrorCode.CustomerEmpty);
     }
     return(Ticket.IsValidated);
 }
コード例 #6
0
 public async Task <bool> ValidateContent(Ticket Ticket)
 {
     if (string.IsNullOrWhiteSpace(Ticket.Content))
     {
         Ticket.AddError(nameof(TicketValidator), nameof(Ticket.Content), ErrorCode.ContentEmpty);
     }
     return(Ticket.IsValidated);
 }
コード例 #7
0
        public async Task <bool> ValidateId(Ticket Ticket)
        {
            TicketFilter TicketFilter = new TicketFilter
            {
                Skip = 0,
                Take = 10,
                Id   = new IdFilter {
                    Equal = Ticket.Id
                },
                Selects = TicketSelect.Id
            };

            int count = await UOW.TicketRepository.Count(TicketFilter);

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