Esempio n. 1
0
        /// <summary>
        /// 获取拜访任务列表不分页
        /// </summary>
        /// <param name="input"></param>
        /// <returns></returns>
        public async Task <List <VisitTaskListDto> > GetVisitTasksListAsync(GetVisitTasksInput input)
        {
            var query = _visittaskRepository.GetAll().Where(v => v.IsDeleted == false)
                        .WhereIf(!string.IsNullOrEmpty(input.Name), u => u.Name.Contains(input.Name));
            var visittasks = await query.OrderBy(v => v.Type).AsNoTracking().ToListAsync();

            var visittaskListDtos = visittasks.MapTo <List <VisitTaskListDto> >();

            return(visittaskListDtos);
        }
Esempio n. 2
0
        /// <summary>
        /// 新增任务查询Checbox状态
        /// </summary>
        /// <param name="input"></param>
        /// <returns></returns>
        public async Task <List <VisitTaskListDto> > GetVisitTasksWithStatusAsync(GetVisitTasksInput input)
        {
            var visitList = _visittaskRepository.GetAll().Where(v => v.IsDeleted == false);
            //var taskList = _scheduletaskRepository.GetAll().Where(v =>v.IsDeleted ==false&& v.ScheduleId == input.ScheduleId);
            var taskList = _scheduletaskRepository.GetAll().Where(v => v.ScheduleId == input.ScheduleId);
            var query    = await(from v in visitList
                                 select new VisitTaskListDto
            {
                Id        = v.Id,
                Name      = v.Name,
                Type      = v.Type,
                IsExamine = v.IsExamine
            }).AsNoTracking().ToListAsync();
            var taskDto = from t in taskList
                          select new
            {
                t.TaskId,
                t.VisitNum,
                t.Id,
                t.IsDeleted
            };

            foreach (var taskItem in taskDto)
            {
                foreach (var item in query)
                {
                    if (item.Id == taskItem.TaskId)
                    {
                        if (taskItem.IsDeleted == true)
                        {
                            item.Checked  = false;
                            item.VisitNum = 1;
                        }
                        else
                        {
                            item.Checked  = true;
                            item.VisitNum = taskItem.VisitNum;
                        }
                        item.ScheduleTaskId = taskItem.Id;
                        break;
                    }
                }
            }
            return(query.OrderByDescending(v => v.Checked).ThenBy(v => v.TypeName).ToList());
        }
Esempio n. 3
0
        /// <summary>
        /// 获取VisitTask的分页列表信息
        ///</summary>
        /// <param name="input"></param>
        /// <returns></returns>
        public async Task <PagedResultDto <VisitTaskListDto> > GetPagedVisitTasksAsync(GetVisitTasksInput input)
        {
            var query = _visittaskRepository.GetAll().Where(v => v.IsDeleted == false)
                        .WhereIf(!string.IsNullOrEmpty(input.Name), u => u.Name.Contains(input.Name))
                        .WhereIf(input.TaskType.HasValue, r => r.Type == input.TaskType);
            // TODO:根据传入的参数添加过滤条件

            var visittaskCount = await query.CountAsync();

            var visittasks = await query
                             .OrderByDescending(v => v.CreationTime).AsNoTracking()
                             .PageBy(input)
                             .ToListAsync();

            // var visittaskListDtos = ObjectMapper.Map<List <VisitTaskListDto>>(visittasks);
            var visittaskListDtos = visittasks.MapTo <List <VisitTaskListDto> >();

            return(new PagedResultDto <VisitTaskListDto>(
                       visittaskCount,
                       visittaskListDtos
                       ));
        }