public ResponsePageObj <ApplicationRecordDto> ApplicationRecordQuery(ApplicationSearchDto searchDto) { ResponsePageObj <ApplicationRecordDto> res = new ResponsePageObj <ApplicationRecordDto>(); res = _applicationService.SearchApplication(searchDto); return(res); }
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); }