public ResponsePageObj <ApplicationRecordDto> ApplicationRecordQuery(ApplicationSearchDto searchDto) { ResponsePageObj <ApplicationRecordDto> res = new ResponsePageObj <ApplicationRecordDto>(); res = _applicationService.SearchApplication(searchDto); return(res); }
public List <ApplicationRecord> Search(ApplicationSearchDto searchDto) { var list = Context.ApplicationRecords.ToList(); if (searchDto.StatusList != null && searchDto.StatusList.Count != 0) { list = list.Where(p => searchDto.StatusList.Contains(p.Status)).ToList(); } if (!string.IsNullOrWhiteSpace(searchDto.Name)) { list = list.Where(p => p.Name.Equals(searchDto.Name)).ToList(); } if (!string.IsNullOrWhiteSpace(searchDto.PhoneNumber)) { list = list.Where(p => p.PhoneNumber.Equals(searchDto.PhoneNumber)).ToList(); } if (searchDto.AccessControlAddressList != null && searchDto.AccessControlAddressList.Count != 0) { list = list.Where(p => searchDto.AccessControlAddressList.Contains(p.AccessControlAddress)).ToList(); } if (searchDto.ApplicationTimeRange != null && searchDto.ApplicationTimeRange.Count != 0) { list = list.Where(p => p.ApplicationTime <= searchDto.ApplicationTimeRange[1] && p.ApplicationTime >= searchDto.ApplicationTimeRange[0]).ToList(); } return(list); }
public ReturnObj <string> CreateExcel(ApplicationSearchDto searchDto, string rootPath) { try { List <ApplicationRecord> applicationRecords = _applicationDao.Search(searchDto); ExcelHelper.CreatApplicationRecordExcel(applicationRecords, rootPath); } catch (Exception e) { throw e; } return(new ReturnObj <string>()); }
public ResponsePageObj <ApplicationRecordDto> SearchApplication(ApplicationSearchDto searchDto) { ResponsePageObj <ApplicationRecordDto> res = new ResponsePageObj <ApplicationRecordDto>(); try { List <ApplicationRecord> applicationRecords = _applicationDao.Search(searchDto); res.Page.TotalCount = applicationRecords.Count; res.Page.TotalPages = (int)Math.Ceiling(res.Page.TotalCount / searchDto.PageSize * 1.0); res.Data = new List <ApplicationRecordDto>(); applicationRecords = applicationRecords.Skip(searchDto.CurrentPage * searchDto.PageSize - searchDto.PageSize) .Take(searchDto.PageSize).ToList(); applicationRecords.ForEach((v) => { ApplicationRecordDto dto = new ApplicationRecordDto { Id = v.Id, Name = v.Name, PhoneNumber = v.PhoneNumber, AccessControlAddress = v.AccessControlAddress, Purpose = v.Purpose, ApplicationTime = v.ApplicationTime, AgreeTime = v.AgreeTime, LeaveTime = v.LeaveTime, EnterPictureSrc = v.EnterPictureSrc, LeavePictureSrc = v.LeavePictureSrc, Status = (ApplicationStatus)v.Status, RecordCode = v.RecordCode }; res.Data.Add(dto); }); res.Success = true; } catch (Exception e) { res.Msg = "系统错误,请联系管理员"; return(res); } return(res); }
public ReturnObj <string> CreateExcel(ApplicationSearchDto searchDto) { ReturnObj <string> res = _applicationService.CreateExcel(searchDto, _webHostEnvironment.WebRootPath); return(res); }