Example #1
0
        public async Task <(bool hasReport, object report, string message)> GetSaleFile(FilterBaseTrackingDto filterDto)
        {
            var result = await _saleFileRepository.GetSaleFile(filterDto.Start, filterDto.Length, filterDto.CurrentMonth, filterDto.CurrentYear, filterDto.Network, filterDto.FileStatusId);

            if (!result.Rows.Any())
            {
                return(false, null, "Nenhum registro encontrado");
            }

            var report = new
            {
                data = result.Rows.Select(x =>
                                          new[] {
                    x.User.Name,
                    x.Network.Name,
                    x.FileStatus.Description,
                    $"https://programamaistop.com.br/api/wwwroot/Content/Spreadsheet/Sale/{x.FileName}",
                    $"{x.CurrentMonth.ToString()}/{x.CurrentYear.ToString()}",
                    x.CreatedAt.ToString("dd/MM/yyyy")
                }).ToArray(),
                recordsTotal    = result.Count,
                recordsFiltered = result.Count
            };

            return(true, report, "Registros encontrado com sucesso!");
        }