예제 #1
0
        public async Task <Pagination <Servico> > ListAsync(int offset, int limit)
        {
            this._logger.LogDebug("Starting ListAsync");

            this._logger.LogDebug("Validating pagination parameters");

            if (limit - offset > 100)
            {
                this._validationService.Throw("Limit", "Too much items for pagination", limit, Validation.PaginationExceedsLimits);
            }

            this._logger.LogDebug("Retriving paginated list of Servicos");

            var list = await _sqlService.ListAsync <Servico>(ServicosQuery.PAGINATE, new
            {
                Offset = offset,
                Limit  = limit
            });

            this._logger.LogDebug("Retriving the number of Servicos");

            var total = await _sqlService.CountAsync(ServicosQuery.TOTAL, new
            {
                CreatedBy = _authenticatedService.Token().Subject
            });

            this._logger.LogDebug("Retriving the number of servicos");

            var pagination = new Pagination <Servico>()
            {
                Offset = offset,
                Limit  = limit,
                Items  = list,
                Total  = total
            };

            this._logger.LogDebug("Ending ListAsync");

            return(pagination);
        }
예제 #2
0
        public async Task <Pagination <ServicoFuncionario> > ListAsync(int offset, int limit, int servicoId)
        {
            this._logger.LogDebug("Starting ListAsync");

            this._logger.LogDebug("Validating pagination parameters");

            if (limit - offset > 100)
            {
                this._validationService.Throw("Limit", "Too much items for pagination", limit, Validation.PaginationExceedsLimits);
            }

            this._logger.LogDebug("Retriving paginated list of products");

            var list = await _sqlService.ListAsync <ServicoFuncionario>(ServicoFuncionarioQuery.PAGINATE, new
            {
                Offset    = offset,
                Limit     = limit,
                SERVICOID = servicoId
            });

            this._logger.LogDebug("Retriving the number of funcionarios registered by the authenticated funcionario");

            var total = await _sqlService.CountAsync(ServicoFuncionarioQuery.TOTAL, new { SERVICOID = servicoId });

            this._logger.LogDebug("Retriving the number of funcionarios registered by the authenticated funcionario");

            var pagination = new Pagination <ServicoFuncionario>()
            {
                Offset = offset,
                Limit  = limit,
                Items  = list,
                Total  = total
            };

            this._logger.LogDebug("Ending ListAsync");

            return(pagination);
        }
예제 #3
0
        public async Task <Pagination <EnderecoFuncionario> > ListAsync(int offset, int limit, int funcionarioId)
        {
            this._logger.LogDebug("Starting ListAsync");

            this._logger.LogDebug("Validating pagination parameters");

            if (limit - offset > 100)
            {
                this._validationService.Throw("Limit", "Too much items for pagination", limit, Validation.PaginationExceedsLimits);
            }

            this._logger.LogDebug("Retriving paginated list of enderecos");

            var list = await _sqlService.ListAsync <EnderecoFuncionario>(EnderecosFunQuery.PAGINATE, new
            {
                Offset        = offset,
                Limit         = limit,
                FUNCIONARIOID = funcionarioId
            });

            this._logger.LogDebug("Retriving the number of enderecos registered");

            var total = await _sqlService.CountAsync(EnderecosFunQuery.TOTAL, new { FUNCIONARIOID = funcionarioId });

            this._logger.LogDebug("Retriving the number of enderecos registered");

            var pagination = new Pagination <EnderecoFuncionario>()
            {
                Offset = offset,
                Limit  = limit,
                Items  = list,
                Total  = total
            };

            this._logger.LogDebug("Ending ListAsync");

            return(pagination);
        }
예제 #4
0
        public async Task <Pagination <ContatoCliente> > ListAsync(int offset, int limit, int clienteId)
        {
            this._logger.LogDebug("Starting ListAsync");

            this._logger.LogDebug("Validating pagination parameters");

            if (limit - offset > 100)
            {
                this._validationService.Throw("Limit", "Too much items for pagination", limit, Validation.PaginationExceedsLimits);
            }

            this._logger.LogDebug("Retriving paginated list of contatos");

            var list = await _sqlService.ListAsync <ContatoCliente>(ContatoClienteQuery.PAGINATE, new
            {
                Offset    = offset,
                Limit     = limit,
                ClienteId = clienteId
            });

            this._logger.LogDebug("Retriving the number of contatos registered");

            var total = await _sqlService.CountAsync(ContatoClienteQuery.TOTAL, new { });

            this._logger.LogDebug("Retriving the number of contatos registered");

            var pagination = new Pagination <ContatoCliente>()
            {
                Offset = offset,
                Limit  = limit,
                Items  = list,
                Total  = total
            };

            this._logger.LogDebug("Ending ListAsync");

            return(pagination);
        }