Ejemplo n.º 1
0
        public async Task <ActionResult <bool> > BulkDelete([FromBody] List <long> Ids)
        {
            if (UnAuthorization)
            {
                return(Forbid());
            }
            if (!ModelState.IsValid)
            {
                throw new BindException(ModelState);
            }

            CallLogFilter CallLogFilter = new CallLogFilter();

            CallLogFilter = await CallLogService.ToFilter(CallLogFilter);

            CallLogFilter.Id = new IdFilter {
                In = Ids
            };
            CallLogFilter.Selects = CallLogSelect.Id;
            CallLogFilter.Skip    = 0;
            CallLogFilter.Take    = int.MaxValue;

            List <CallLog> CallLogs = await CallLogService.List(CallLogFilter);

            CallLogs = await CallLogService.BulkDelete(CallLogs);

            if (CallLogs.Any(x => !x.IsValidated))
            {
                return(BadRequest(CallLogs.Where(x => !x.IsValidated)));
            }
            return(true);
        }
Ejemplo n.º 2
0
        private CallLogFilter ConvertFilterDTOToFilterEntity(CallLog_CallLogFilterDTO CallLog_CallLogFilterDTO)
        {
            CallLogFilter CallLogFilter = new CallLogFilter();

            CallLogFilter.Selects   = CallLogSelect.ALL;
            CallLogFilter.Skip      = CallLog_CallLogFilterDTO.Skip;
            CallLogFilter.Take      = CallLog_CallLogFilterDTO.Take;
            CallLogFilter.OrderBy   = CallLog_CallLogFilterDTO.OrderBy;
            CallLogFilter.OrderType = CallLog_CallLogFilterDTO.OrderType;

            CallLogFilter.Id                = CallLog_CallLogFilterDTO.Id;
            CallLogFilter.Title             = CallLog_CallLogFilterDTO.Title;
            CallLogFilter.Content           = CallLog_CallLogFilterDTO.Content;
            CallLogFilter.Phone             = CallLog_CallLogFilterDTO.Phone;
            CallLogFilter.CallTime          = CallLog_CallLogFilterDTO.CallTime;
            CallLogFilter.EntityReferenceId = CallLog_CallLogFilterDTO.EntityReferenceId;
            CallLogFilter.EntityId          = CallLog_CallLogFilterDTO.EntityId;
            CallLogFilter.CallTypeId        = CallLog_CallLogFilterDTO.CallTypeId;
            CallLogFilter.CallCategoryId    = CallLog_CallLogFilterDTO.CallCategoryId;
            CallLogFilter.CallEmotionId     = CallLog_CallLogFilterDTO.CallEmotionId;
            CallLogFilter.CallStatusId      = CallLog_CallLogFilterDTO.CallStatusId;
            CallLogFilter.AppUserId         = CallLog_CallLogFilterDTO.AppUserId;
            CallLogFilter.CreatorId         = CallLog_CallLogFilterDTO.CreatorId;
            CallLogFilter.CreatedAt         = CallLog_CallLogFilterDTO.CreatedAt;
            CallLogFilter.UpdatedAt         = CallLog_CallLogFilterDTO.UpdatedAt;
            return(CallLogFilter);
        }
Ejemplo n.º 3
0
        public async Task <int> Count(CallLogFilter filter)
        {
            IQueryable <CallLogDAO> CallLogs = DataContext.CallLog.AsNoTracking();

            CallLogs = DynamicFilter(CallLogs, filter);
            return(await CallLogs.CountAsync());
        }
Ejemplo n.º 4
0
        public async Task <CallLogFilter> ToFilter(CallLogFilter filter)
        {
            if (filter.OrFilter == null)
            {
                filter.OrFilter = new List <CallLogFilter>();
            }
            if (CurrentContext.Filters == null || CurrentContext.Filters.Count == 0)
            {
                return(filter);
            }
            List <Organization> Organizations = await OrganizationService.List(new OrganizationFilter
            {
                Skip      = 0,
                Take      = int.MaxValue,
                Selects   = OrganizationSelect.ALL,
                OrderBy   = OrganizationOrder.Id,
                OrderType = OrderType.ASC
            });

            foreach (var currentFilter in CurrentContext.Filters)
            {
                CallLogFilter subFilter = new CallLogFilter();
                filter.OrFilter.Add(subFilter);
                List <FilterPermissionDefinition> FilterPermissionDefinitions = currentFilter.Value;
                foreach (FilterPermissionDefinition FilterPermissionDefinition in FilterPermissionDefinitions)
                {
                    if (FilterPermissionDefinition.Name == nameof(subFilter.AppUserId))
                    {
                        subFilter.AppUserId = FilterBuilder.Merge(subFilter.AppUserId, FilterPermissionDefinition.IdFilter);
                    }
                }
            }
            return(filter);
        }
Ejemplo n.º 5
0
        public async Task <List <Ticket_CallLogDTO> > SingleListCallLog([FromBody] Ticket_CallLogFilterDTO Ticket_CallLogFilterDTO)
        {
            if (!ModelState.IsValid)
            {
                throw new BindException(ModelState);
            }

            CallLogFilter CallLogFilter = new CallLogFilter();

            CallLogFilter.Skip              = 0;
            CallLogFilter.Take              = 20;
            CallLogFilter.OrderBy           = CallLogOrder.Id;
            CallLogFilter.OrderType         = OrderType.ASC;
            CallLogFilter.Selects           = CallLogSelect.ALL;
            CallLogFilter.Id                = Ticket_CallLogFilterDTO.Id;
            CallLogFilter.EntityReferenceId = Ticket_CallLogFilterDTO.EntityReferenceId;
            CallLogFilter.CallTypeId        = Ticket_CallLogFilterDTO.CallTypeId;
            CallLogFilter.CallEmotionId     = Ticket_CallLogFilterDTO.CallEmotionId;
            CallLogFilter.AppUserId         = Ticket_CallLogFilterDTO.AppUserId;
            CallLogFilter.Title             = Ticket_CallLogFilterDTO.Title;
            CallLogFilter.Content           = Ticket_CallLogFilterDTO.Content;
            CallLogFilter.Phone             = Ticket_CallLogFilterDTO.Phone;
            CallLogFilter.CallTime          = Ticket_CallLogFilterDTO.CallTime;

            List <CallLog> CallLogs = await CallLogService.List(CallLogFilter);

            List <Ticket_CallLogDTO> Ticket_CallLogDTOs = CallLogs
                                                          .Select(x => new Ticket_CallLogDTO(x)).ToList();

            return(Ticket_CallLogDTOs);
        }
Ejemplo n.º 6
0
        public async Task <List <CallLog> > List(CallLogFilter filter)
        {
            if (filter == null)
            {
                return(new List <CallLog>());
            }
            IQueryable <CallLogDAO> CallLogDAOs = DataContext.CallLog.AsNoTracking();

            CallLogDAOs = DynamicFilter(CallLogDAOs, filter);
            CallLogDAOs = DynamicOrder(CallLogDAOs, filter);
            List <CallLog> CallLogs = await DynamicSelect(CallLogDAOs, filter);

            return(CallLogs);
        }
Ejemplo n.º 7
0
        public async Task <ActionResult <int> > CountCallLog([FromBody] Contact_CallLogFilterDTO Contact_CallLogFilterDTO)
        {
            if (UnAuthorization)
            {
                return(Forbid());
            }
            if (!ModelState.IsValid)
            {
                throw new BindException(ModelState);
            }

            CallLogFilter CallLogFilter = ConvertFilterCallLog(Contact_CallLogFilterDTO);

            CallLogFilter = await CallLogService.ToFilter(CallLogFilter);

            int count = await CallLogService.Count(CallLogFilter);

            return(count);
        }
Ejemplo n.º 8
0
        private CallLogFilter ConvertFilterCallLog(Company_CallLogFilterDTO Company_CallLogFilterDTO)
        {
            CallLogFilter CallLogFilter = new CallLogFilter();

            CallLogFilter.Selects           = CallLogSelect.ALL;
            CallLogFilter.Skip              = Company_CallLogFilterDTO.Skip;
            CallLogFilter.Take              = Company_CallLogFilterDTO.Take;
            CallLogFilter.OrderBy           = Company_CallLogFilterDTO.OrderBy;
            CallLogFilter.OrderType         = Company_CallLogFilterDTO.OrderType;
            CallLogFilter.Id                = Company_CallLogFilterDTO.Id;
            CallLogFilter.EntityReferenceId = Company_CallLogFilterDTO.EntityReferenceId;
            CallLogFilter.CallTypeId        = Company_CallLogFilterDTO.CallTypeId;
            CallLogFilter.AppUserId         = Company_CallLogFilterDTO.AppUserId;
            CallLogFilter.Title             = Company_CallLogFilterDTO.Title;
            CallLogFilter.Content           = Company_CallLogFilterDTO.Content;
            CallLogFilter.Phone             = Company_CallLogFilterDTO.Phone;
            CallLogFilter.CallTime          = Company_CallLogFilterDTO.CallTime;
            return(CallLogFilter);
        }
Ejemplo n.º 9
0
        public async Task <bool> ValidateId(CallLog CallLog)
        {
            CallLogFilter CallLogFilter = new CallLogFilter
            {
                Skip = 0,
                Take = 10,
                Id   = new IdFilter {
                    Equal = CallLog.Id
                },
                Selects = CallLogSelect.Id
            };

            int count = await UOW.CallLogRepository.Count(CallLogFilter);

            if (count == 0)
            {
                CallLog.AddError(nameof(CallLogValidator), nameof(CallLog.Id), ErrorCode.IdNotExisted);
            }
            return(count == 1);
        }
Ejemplo n.º 10
0
        public async Task <ActionResult <List <Contact_CallLogDTO> > > ListCallLog([FromBody] Contact_CallLogFilterDTO Contact_CallLogFilterDTO)
        {
            if (UnAuthorization)
            {
                return(Forbid());
            }
            if (!ModelState.IsValid)
            {
                throw new BindException(ModelState);
            }

            CallLogFilter CallLogFilter = ConvertFilterCallLog(Contact_CallLogFilterDTO);

            CallLogFilter = await CallLogService.ToFilter(CallLogFilter);

            List <CallLog> CallLogs = await CallLogService.List(CallLogFilter);

            List <Contact_CallLogDTO> Contact_CallLogDTOs = CallLogs
                                                            .Select(c => new Contact_CallLogDTO(c)).ToList();

            return(Contact_CallLogDTOs);
        }
Ejemplo n.º 11
0
        private async Task <bool> HasPermission(long Id)
        {
            CallLogFilter CallLogFilter = new CallLogFilter();

            CallLogFilter = await CallLogService.ToFilter(CallLogFilter);

            if (Id == 0)
            {
            }
            else
            {
                CallLogFilter.Id = new IdFilter {
                    Equal = Id
                };
                int count = await CallLogService.Count(CallLogFilter);

                if (count == 0)
                {
                    return(false);
                }
            }
            return(true);
        }
Ejemplo n.º 12
0
        private CallLogFilter ConvertCallLog(CustomerLead_CallLogFilterDTO CustomerLead_CallLogFilterDTO)
        {
            CallLogFilter CallLogFilter = new CallLogFilter();

            CallLogFilter.Selects   = CallLogSelect.ALL;
            CallLogFilter.Skip      = CustomerLead_CallLogFilterDTO.Skip;
            CallLogFilter.Take      = CustomerLead_CallLogFilterDTO.Take;
            CallLogFilter.OrderBy   = CustomerLead_CallLogFilterDTO.OrderBy;
            CallLogFilter.OrderType = CustomerLead_CallLogFilterDTO.OrderType;

            CallLogFilter.Id = CustomerLead_CallLogFilterDTO.Id;
            CallLogFilter.EntityReferenceId = CustomerLead_CallLogFilterDTO.EntityReferenceId;
            CallLogFilter.CallTypeId        = CustomerLead_CallLogFilterDTO.CallTypeId;
            CallLogFilter.CallEmotionId     = CustomerLead_CallLogFilterDTO.CallEmotionId;
            CallLogFilter.AppUserId         = CustomerLead_CallLogFilterDTO.AppUserId;
            CallLogFilter.Title             = CustomerLead_CallLogFilterDTO.Title;
            CallLogFilter.Content           = CustomerLead_CallLogFilterDTO.Content;
            CallLogFilter.Phone             = CustomerLead_CallLogFilterDTO.Phone;
            CallLogFilter.CallTime          = CustomerLead_CallLogFilterDTO.CallTime;
            CallLogFilter.CreatedAt         = CustomerLead_CallLogFilterDTO.CreatedAt;
            CallLogFilter.UpdatedAt         = CustomerLead_CallLogFilterDTO.UpdatedAt;
            return(CallLogFilter);
        }
Ejemplo n.º 13
0
        public async Task <List <CallLog> > List(CallLogFilter CallLogFilter)
        {
            try
            {
                List <CallLog> CallLogs = await UOW.CallLogRepository.List(CallLogFilter);

                return(CallLogs);
            }
            catch (Exception ex)
            {
                if (ex.InnerException == null)
                {
                    await Logging.CreateSystemLog(ex, nameof(CallLogService));

                    throw new MessageException(ex);
                }
                else
                {
                    await Logging.CreateSystemLog(ex.InnerException, nameof(CallLogService));

                    throw new MessageException(ex.InnerException);
                }
            }
        }
Ejemplo n.º 14
0
        public async Task <int> Count(CallLogFilter CallLogFilter)
        {
            try
            {
                int result = await UOW.CallLogRepository.Count(CallLogFilter);

                return(result);
            }
            catch (Exception ex)
            {
                if (ex.InnerException == null)
                {
                    await Logging.CreateSystemLog(ex, nameof(CallLogService));

                    throw new MessageException(ex);
                }
                else
                {
                    await Logging.CreateSystemLog(ex.InnerException, nameof(CallLogService));

                    throw new MessageException(ex.InnerException);
                }
            }
        }
Ejemplo n.º 15
0
        private IQueryable <CallLogDAO> OrFilter(IQueryable <CallLogDAO> query, CallLogFilter filter)
        {
            if (filter.OrFilter == null || filter.OrFilter.Count == 0)
            {
                return(query);
            }
            IQueryable <CallLogDAO> initQuery = query.Where(q => false);

            foreach (CallLogFilter CallLogFilter in filter.OrFilter)
            {
                IQueryable <CallLogDAO> queryable = query;
                if (CallLogFilter.Id != null && CallLogFilter.Id.HasValue)
                {
                    queryable = queryable.Where(q => q.Id, CallLogFilter.Id);
                }
                if (CallLogFilter.Title != null && CallLogFilter.Title.HasValue)
                {
                    queryable = queryable.Where(q => q.Title, CallLogFilter.Title);
                }
                if (CallLogFilter.Content != null && CallLogFilter.Content.HasValue)
                {
                    queryable = queryable.Where(q => q.Content, CallLogFilter.Content);
                }
                if (CallLogFilter.Phone != null && CallLogFilter.Phone.HasValue)
                {
                    queryable = queryable.Where(q => q.Phone, CallLogFilter.Phone);
                }
                if (CallLogFilter.CallTime != null && CallLogFilter.CallTime.HasValue)
                {
                    queryable = queryable.Where(q => q.CallTime, CallLogFilter.CallTime);
                }
                if (CallLogFilter.EntityReferenceId != null && CallLogFilter.EntityReferenceId.HasValue)
                {
                    queryable = queryable.Where(q => q.EntityReferenceId, CallLogFilter.EntityReferenceId);
                }
                if (CallLogFilter.EntityId != null && CallLogFilter.EntityId.HasValue)
                {
                    queryable = queryable.Where(q => q.EntityId, CallLogFilter.EntityId);
                }
                if (CallLogFilter.CallTypeId != null && CallLogFilter.CallTypeId.HasValue)
                {
                    queryable = queryable.Where(q => q.CallTypeId, CallLogFilter.CallTypeId);
                }
                if (CallLogFilter.CallCategoryId != null && CallLogFilter.CallCategoryId.HasValue)
                {
                    queryable = queryable.Where(q => q.CallCategoryId.HasValue).Where(q => q.CallCategoryId, CallLogFilter.CallCategoryId);
                }
                if (CallLogFilter.CallEmotionId != null && CallLogFilter.CallEmotionId.HasValue)
                {
                    queryable = queryable.Where(q => q.CallEmotionId.HasValue).Where(q => q.CallEmotionId, CallLogFilter.CallEmotionId);
                }
                if (CallLogFilter.CallStatusId != null && CallLogFilter.CallStatusId.HasValue)
                {
                    queryable = queryable.Where(q => q.CallStatusId.HasValue).Where(q => q.CallStatusId, CallLogFilter.CallStatusId);
                }
                if (CallLogFilter.AppUserId != null && CallLogFilter.AppUserId.HasValue)
                {
                    queryable = queryable.Where(q => q.AppUserId, CallLogFilter.AppUserId);
                }
                if (CallLogFilter.CreatorId != null && CallLogFilter.CreatorId.HasValue)
                {
                    queryable = queryable.Where(q => q.CreatorId, CallLogFilter.CreatorId);
                }
                initQuery = initQuery.Union(queryable);
            }
            return(initQuery);
        }
Ejemplo n.º 16
0
        private IQueryable <CallLogDAO> DynamicOrder(IQueryable <CallLogDAO> query, CallLogFilter filter)
        {
            switch (filter.OrderType)
            {
            case OrderType.ASC:
                switch (filter.OrderBy)
                {
                case CallLogOrder.Id:
                    query = query.OrderBy(q => q.Id);
                    break;

                case CallLogOrder.Title:
                    query = query.OrderBy(q => q.Title);
                    break;

                case CallLogOrder.Content:
                    query = query.OrderBy(q => q.Content);
                    break;

                case CallLogOrder.Phone:
                    query = query.OrderBy(q => q.Phone);
                    break;

                case CallLogOrder.CallTime:
                    query = query.OrderBy(q => q.CallTime);
                    break;

                case CallLogOrder.EntityReference:
                    query = query.OrderBy(q => q.EntityReferenceId);
                    break;

                case CallLogOrder.Entity:
                    query = query.OrderBy(q => q.EntityId);
                    break;

                case CallLogOrder.CallType:
                    query = query.OrderBy(q => q.CallTypeId);
                    break;

                case CallLogOrder.CallCategory:
                    query = query.OrderBy(q => q.CallCategoryId);
                    break;

                case CallLogOrder.CallEmotion:
                    query = query.OrderBy(q => q.CallEmotionId);
                    break;

                case CallLogOrder.CallStatus:
                    query = query.OrderBy(q => q.CallStatusId);
                    break;

                case CallLogOrder.AppUser:
                    query = query.OrderBy(q => q.AppUserId);
                    break;

                case CallLogOrder.Creator:
                    query = query.OrderBy(q => q.CreatorId);
                    break;
                }
                break;

            case OrderType.DESC:
                switch (filter.OrderBy)
                {
                case CallLogOrder.Id:
                    query = query.OrderByDescending(q => q.Id);
                    break;

                case CallLogOrder.Title:
                    query = query.OrderByDescending(q => q.Title);
                    break;

                case CallLogOrder.Content:
                    query = query.OrderByDescending(q => q.Content);
                    break;

                case CallLogOrder.Phone:
                    query = query.OrderByDescending(q => q.Phone);
                    break;

                case CallLogOrder.CallTime:
                    query = query.OrderByDescending(q => q.CallTime);
                    break;

                case CallLogOrder.EntityReference:
                    query = query.OrderByDescending(q => q.EntityReferenceId);
                    break;

                case CallLogOrder.Entity:
                    query = query.OrderByDescending(q => q.EntityId);
                    break;

                case CallLogOrder.CallType:
                    query = query.OrderByDescending(q => q.CallTypeId);
                    break;

                case CallLogOrder.CallCategory:
                    query = query.OrderByDescending(q => q.CallCategoryId);
                    break;

                case CallLogOrder.CallEmotion:
                    query = query.OrderByDescending(q => q.CallEmotionId);
                    break;

                case CallLogOrder.CallStatus:
                    query = query.OrderByDescending(q => q.CallStatusId);
                    break;

                case CallLogOrder.AppUser:
                    query = query.OrderByDescending(q => q.AppUserId);
                    break;

                case CallLogOrder.Creator:
                    query = query.OrderByDescending(q => q.CreatorId);
                    break;
                }
                break;
            }
            query = query.Skip(filter.Skip).Take(filter.Take);
            return(query);
        }
Ejemplo n.º 17
0
 private IQueryable <CallLogDAO> DynamicFilter(IQueryable <CallLogDAO> query, CallLogFilter filter)
 {
     if (filter == null)
     {
         return(query.Where(q => false));
     }
     query = query.Where(q => !q.DeletedAt.HasValue);
     if (filter.CreatedAt != null && filter.CreatedAt.HasValue)
     {
         query = query.Where(q => q.CreatedAt, filter.CreatedAt);
     }
     if (filter.UpdatedAt != null && filter.UpdatedAt.HasValue)
     {
         query = query.Where(q => q.UpdatedAt, filter.UpdatedAt);
     }
     if (filter.Id != null && filter.Id.HasValue)
     {
         query = query.Where(q => q.Id, filter.Id);
     }
     if (filter.Title != null && filter.Title.HasValue)
     {
         query = query.Where(q => q.Title, filter.Title);
     }
     if (filter.Content != null && filter.Content.HasValue)
     {
         query = query.Where(q => q.Content, filter.Content);
     }
     if (filter.Phone != null && filter.Phone.HasValue)
     {
         query = query.Where(q => q.Phone, filter.Phone);
     }
     if (filter.CallTime != null && filter.CallTime.HasValue)
     {
         query = query.Where(q => q.CallTime, filter.CallTime);
     }
     if (filter.EntityReferenceId != null && filter.EntityReferenceId.HasValue)
     {
         query = query.Where(q => q.EntityReferenceId, filter.EntityReferenceId);
     }
     if (filter.EntityId != null && filter.EntityId.HasValue)
     {
         query = query.Where(q => q.EntityId, filter.EntityId);
     }
     if (filter.CallTypeId != null && filter.CallTypeId.HasValue)
     {
         query = query.Where(q => q.CallTypeId, filter.CallTypeId);
     }
     if (filter.CallCategoryId != null && filter.CallCategoryId.HasValue)
     {
         query = query.Where(q => q.CallCategoryId.HasValue).Where(q => q.CallCategoryId, filter.CallCategoryId);
     }
     if (filter.CallEmotionId != null && filter.CallEmotionId.HasValue)
     {
         query = query.Where(q => q.CallEmotionId.HasValue).Where(q => q.CallEmotionId, filter.CallEmotionId);
     }
     if (filter.CallStatusId != null && filter.CallStatusId.HasValue)
     {
         query = query.Where(q => q.CallStatusId.HasValue).Where(q => q.CallStatusId, filter.CallStatusId);
     }
     if (filter.AppUserId != null && filter.AppUserId.HasValue)
     {
         query = query.Where(q => q.AppUserId, filter.AppUserId);
     }
     if (filter.CreatorId != null && filter.CreatorId.HasValue)
     {
         query = query.Where(q => q.CreatorId, filter.CreatorId);
     }
     query = OrFilter(query, filter);
     return(query);
 }
Ejemplo n.º 18
0
        private async Task <List <CallLog> > DynamicSelect(IQueryable <CallLogDAO> query, CallLogFilter filter)
        {
            List <CallLog> CallLogs = await query.Select(q => new CallLog()
            {
                Id                = filter.Selects.Contains(CallLogSelect.Id) ? q.Id : default(long),
                Title             = filter.Selects.Contains(CallLogSelect.Title) ? q.Title : default(string),
                Content           = filter.Selects.Contains(CallLogSelect.Content) ? q.Content : default(string),
                Phone             = filter.Selects.Contains(CallLogSelect.Phone) ? q.Phone : default(string),
                CallTime          = filter.Selects.Contains(CallLogSelect.CallTime) ? q.CallTime : default(DateTime),
                EntityReferenceId = filter.Selects.Contains(CallLogSelect.EntityReference) ? q.EntityReferenceId : default(long),
                EntityId          = filter.Selects.Contains(CallLogSelect.Entity) ? q.EntityId : default(long),
                CallTypeId        = filter.Selects.Contains(CallLogSelect.CallType) ? q.CallTypeId : default(long),
                CallCategoryId    = filter.Selects.Contains(CallLogSelect.CallCategory) ? q.CallCategoryId : default(long?),
                CallEmotionId     = filter.Selects.Contains(CallLogSelect.CallEmotion) ? q.CallEmotionId : default(long?),
                CallStatusId      = filter.Selects.Contains(CallLogSelect.CallStatus) ? q.CallStatusId : default(long?),
                AppUserId         = filter.Selects.Contains(CallLogSelect.AppUser) ? q.AppUserId : default(long),
                CreatorId         = filter.Selects.Contains(CallLogSelect.Creator) ? q.CreatorId : default(long),
                AppUser           = filter.Selects.Contains(CallLogSelect.AppUser) && q.AppUser != null ? new AppUser
                {
                    Id             = q.AppUser.Id,
                    Username       = q.AppUser.Username,
                    DisplayName    = q.AppUser.DisplayName,
                    Address        = q.AppUser.Address,
                    Email          = q.AppUser.Email,
                    Phone          = q.AppUser.Phone,
                    SexId          = q.AppUser.SexId,
                    Birthday       = q.AppUser.Birthday,
                    Avatar         = q.AppUser.Avatar,
                    Department     = q.AppUser.Department,
                    OrganizationId = q.AppUser.OrganizationId,
                    Longitude      = q.AppUser.Longitude,
                    Latitude       = q.AppUser.Latitude,
                    StatusId       = q.AppUser.StatusId,
                    RowId          = q.AppUser.RowId,
                    Used           = q.AppUser.Used,
                } : null,
                CallCategory = filter.Selects.Contains(CallLogSelect.CallCategory) && q.CallCategory != null ? new CallCategory
                {
                    Id   = q.CallCategory.Id,
                    Code = q.CallCategory.Code,
                    Name = q.CallCategory.Name,
                } : null,
                CallEmotion = filter.Selects.Contains(CallLogSelect.CallEmotion) && q.CallEmotion != null ? new CallEmotion
                {
                    Id          = q.CallEmotion.Id,
                    Code        = q.CallEmotion.Code,
                    Name        = q.CallEmotion.Name,
                    StatusId    = q.CallEmotion.StatusId,
                    Description = q.CallEmotion.Description,
                    Used        = q.CallEmotion.Used,
                    RowId       = q.CallEmotion.RowId,
                } : null,
                CallStatus = filter.Selects.Contains(CallLogSelect.CallStatus) && q.CallStatus != null ? new CallStatus
                {
                    Id   = q.CallStatus.Id,
                    Code = q.CallStatus.Code,
                    Name = q.CallStatus.Name,
                } : null,
                CallType = filter.Selects.Contains(CallLogSelect.CallType) && q.CallType != null ? new CallType
                {
                    Id        = q.CallType.Id,
                    Code      = q.CallType.Code,
                    Name      = q.CallType.Name,
                    ColorCode = q.CallType.ColorCode,
                    StatusId  = q.CallType.StatusId,
                    Used      = q.CallType.Used,
                } : null,
                Creator = filter.Selects.Contains(CallLogSelect.Creator) && q.Creator != null ? new AppUser
                {
                    Id             = q.Creator.Id,
                    Username       = q.Creator.Username,
                    DisplayName    = q.Creator.DisplayName,
                    Address        = q.Creator.Address,
                    Email          = q.Creator.Email,
                    Phone          = q.Creator.Phone,
                    SexId          = q.Creator.SexId,
                    Birthday       = q.Creator.Birthday,
                    Avatar         = q.Creator.Avatar,
                    Department     = q.Creator.Department,
                    OrganizationId = q.Creator.OrganizationId,
                    Longitude      = q.Creator.Longitude,
                    Latitude       = q.Creator.Latitude,
                    StatusId       = q.Creator.StatusId,
                    RowId          = q.Creator.RowId,
                    Used           = q.Creator.Used,
                } : null,
                EntityReference = filter.Selects.Contains(CallLogSelect.EntityReference) && q.EntityReference != null ? new EntityReference
                {
                    Id   = q.EntityReference.Id,
                    Code = q.EntityReference.Code,
                    Name = q.EntityReference.Name,
                } : null,
            }).ToListAsync();

            return(CallLogs);
        }