private static GetTagsForExportQuery CreateGetTagsForExportQuery(FilterDto filter, SortingDto sorting) { var query = new GetTagsForExportQuery( filter.ProjectName, new Sorting(sorting.Direction, sorting.Property), new Filter() ); FillFilterFromDto(filter, query.Filter); return(query); }
private static GetTagsQuery CreateGetTagsQuery(FilterDto filter, SortingDto sorting, PagingDto paging) { var query = new GetTagsQuery( filter.ProjectName, new Sorting(sorting.Direction, sorting.Property), new Filter(), new Paging(paging.Page, paging.Size) ); FillFilterFromDto(filter, query.Filter); return(query); }
public async Task <ActionResult <TagsResult> > GetTags( [FromHeader(Name = CurrentPlantMiddleware.PlantHeader)] [Required] string plant, [FromQuery] FilterDto filter, [FromQuery] SortingDto sorting, [FromQuery] PagingDto paging) { var query = CreateGetTagsQuery(filter, sorting, paging); var result = await _mediator.Send(query); return(this.FromResult(result)); }
public async Task <ActionResult> ExportTagsToExcel( [FromHeader(Name = CurrentPlantMiddleware.PlantHeader)] [Required] string plant, [FromQuery] FilterDto filter, [FromQuery] SortingDto sorting) { var query = CreateGetTagsForExportQuery(filter, sorting); var result = await _mediator.Send(query); if (result.ResultType != ResultType.Ok) { return(this.FromResult(result)); } var excelMemoryStream = _excelConverter.Convert(result.Data); excelMemoryStream.Position = 0; return(File(excelMemoryStream, "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet", $"{_excelConverter.GetFileName()}.xlsx")); }
private static void FillFilterFromDto(FilterDto source, Filter target) { if (source.VoidedFilter.HasValue) { target.VoidedFilter = source.VoidedFilter.Value; } if (source.ActionStatus.HasValue) { target.ActionStatus = source.ActionStatus; } if (source.DueFilters != null) { target.DueFilters = source.DueFilters.ToList(); } if (source.PreservationStatus.HasValue) { target.PreservationStatus = source.PreservationStatus; } if (source.RequirementTypeIds != null) { target.RequirementTypeIds = source.RequirementTypeIds.ToList(); } if (source.AreaCodes != null) { target.AreaCodes = source.AreaCodes.ToList(); } if (source.DisciplineCodes != null) { target.DisciplineCodes = source.DisciplineCodes.ToList(); } if (source.ResponsibleIds != null) { target.ResponsibleIds = source.ResponsibleIds.ToList(); } if (source.TagFunctionCodes != null) { target.TagFunctionCodes = source.TagFunctionCodes.ToList(); } if (source.ModeIds != null) { target.ModeIds = source.ModeIds.ToList(); } if (source.JourneyIds != null) { target.JourneyIds = source.JourneyIds.ToList(); } if (source.StepIds != null) { target.StepIds = source.StepIds.ToList(); } if (source.TagNoStartsWith != null) { target.TagNoStartsWith = source.TagNoStartsWith; } if (source.CommPkgNoStartsWith != null) { target.CommPkgNoStartsWith = source.CommPkgNoStartsWith; } if (source.McPkgNoStartsWith != null) { target.McPkgNoStartsWith = source.McPkgNoStartsWith; } if (source.PurchaseOrderNoStartsWith != null) { target.PurchaseOrderNoStartsWith = source.PurchaseOrderNoStartsWith; } if (source.StorageAreaStartsWith != null) { target.StorageAreaStartsWith = source.StorageAreaStartsWith; } if (source.CallOffStartsWith != null) { target.CallOffStartsWith = source.CallOffStartsWith; } }