/// <summary> /// Получить данные для списка /// </summary> /// <param name="parametr"></param> /// <returns></returns> public async Task <ReportResultData> GetDataList(BaseModelReportParam parametr) { var resultData = new ReportResultData(); var accessForm = await _accessManager.GetAccessFormAsync(parametr.UserName, parametr.FormId); if (accessForm != null && (int)accessForm.TypeAccec < 2) { throw new UserMessageException("Вы запросили данные режима, на который у вас не открыты права"); } var formModelDto = (await _reportDbContext.FormModel.FirstOrDefaultAsync(f => f.Id == parametr.FormId)).Map <FormModelDto>(); if (formModelDto == null) { throw new UserMessageException("Не удалось определить форму"); } resultData.FormModel = formModelDto; resultData.FieldAccess = await _reportManager.GetFieldsFormWithProfileAsync(parametr.UserName, parametr.FormId, false, fields => fields.Where(f => (f.IsVisibleList ?? false) || string.IsNullOrWhiteSpace(f.Express))); var report = AutoFac.ResolveNamed <IReportEngineData>(string.IsNullOrWhiteSpace(formModelDto.NameClassDataEngine) ? nameof(ReportEngineDefaultData) : formModelDto.NameClassDataEngine); var resultDataFieldAccess = resultData.FieldAccess as FieldAccessDto[] ?? resultData.FieldAccess.ToArray(); resultData.Data = GetDataAccess(report == null ? null : await report.GetDataList(parametr), resultDataFieldAccess); resultData.Columns = await _columnCreater.GetColumns(resultDataFieldAccess); resultData.KeyField = resultDataFieldAccess.FirstOrDefault(f => f.IsKey ?? false)?.Name; resultData.FormProperty = await _columnCreater.GetProperty(resultDataFieldAccess, formModelDto); return(resultData); }