示例#1
0
        private static GetInvitationsQuery CreateGetInvitationsQuery(FilterDto filter, SortingDto sorting, PagingDto paging)
        {
            var query = new GetInvitationsQuery(
                filter.ProjectName,
                new Sorting(sorting.Direction, sorting.Property),
                new Filter(),
                new Paging(paging.Page, paging.Size)
                );

            FillFilterFromDto(filter, query.Filter);

            return(query);
        }
示例#2
0
        public async Task <ActionResult <InvitationsResult> > GetInvitations(
            [FromHeader(Name = CurrentPlantMiddleware.PlantHeader)]
            [Required]
            string plant,
            [FromQuery] FilterDto filter,
            [FromQuery] SortingDto sorting,
            [FromQuery] PagingDto paging)
        {
            var query = CreateGetInvitationsQuery(filter, sorting, paging);

            var result = await _mediator.Send(query);

            return(this.FromResult(result));
        }
示例#3
0
        public async Task <ActionResult> ExportInvitationsToExcel(
            [FromHeader(Name = CurrentPlantMiddleware.PlantHeader)]
            [Required]
            string plant,
            [FromQuery] FilterDto filter,
            [FromQuery] SortingDto sorting)
        {
            var query = CreateGetInvitationsForExportQuery(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"));
        }
示例#4
0
        private static GetInvitationsForExportQuery CreateGetInvitationsForExportQuery(FilterDto filter, SortingDto sorting)
        {
            var query = new GetInvitationsForExportQuery(
                filter.ProjectName,
                new Sorting(sorting.Direction, sorting.Property),
                new Filter()
                );

            FillFilterFromDto(filter, query.Filter);

            return(query);
        }
示例#5
0
        private static void FillFilterFromDto(FilterDto source, Filter target)
        {
            if (source.PunchOutDates != null)
            {
                target.PunchOutDates = source.PunchOutDates.ToList();
            }

            if (source.IpoStatuses != null)
            {
                target.IpoStatuses = source.IpoStatuses.ToList();
            }

            if (source.FunctionalRoleCode != null)
            {
                target.FunctionalRoleCode = source.FunctionalRoleCode;
            }

            if (source.PersonOid != null)
            {
                target.PersonOid = source.PersonOid;
            }

            if (source.CommPkgNoStartsWith != null)
            {
                target.CommPkgNoStartsWith = source.CommPkgNoStartsWith;
            }

            if (source.McPkgNoStartsWith != null)
            {
                target.McPkgNoStartsWith = source.McPkgNoStartsWith;
            }

            if (source.TitleStartsWith != null)
            {
                target.TitleStartsWith = source.TitleStartsWith;
            }

            if (source.IpoIdStartsWith != null)
            {
                target.IpoIdStartsWith = source.IpoIdStartsWith;
            }

            if (source.PunchOutDateFromUtc != null)
            {
                target.PunchOutDateFromUtc = source.PunchOutDateFromUtc;
            }

            if (source.PunchOutDateToUtc != null)
            {
                target.PunchOutDateToUtc = source.PunchOutDateToUtc;
            }

            if (source.LastChangedAtFromUtc != null)
            {
                target.LastChangedAtFromUtc = source.LastChangedAtFromUtc;
            }

            if (source.LastChangedAtToUtc != null)
            {
                target.LastChangedAtToUtc = source.LastChangedAtToUtc;
            }
        }