public async Task <StatusCliente> GetById(StatusClienteFilter model)
        {
            var _statuscliente = await this.SingleOrDefaultAsync(this.GetAll(this.DataAgregation(model))
                                                                 .Where(_ => _.StatusClienteId == model.StatusClienteId));

            return(_statuscliente);
        }
        public IQueryable <StatusCliente> GetBySimplefilters(StatusClienteFilter filters)
        {
            var querybase = this.GetAll(this.DataAgregation(filters))
                            .WithBasicFilters(filters)
                            .WithCustomFilters(filters);

            return(querybase);
        }
        public async Task <dynamic> GetDataCustom(StatusClienteFilter filters)
        {
            var querybase = await this.ToListAsync(this.GetBySimplefilters(filters).Select(_ => new
            {
                Id = _.StatusClienteId,
            }));

            return(querybase);
        }
        public async Task <IEnumerable <dynamic> > GetDataListCustom(StatusClienteFilter filters)
        {
            var querybase = await this.ToListAsync(this.GetBySimplefilters(filters).Select(_ => new
            {
                Id   = _.StatusClienteId,
                Name = _.Nome
            }));

            return(querybase);
        }
        public async Task <IActionResult> Get([FromQuery] StatusClienteFilter filters)
        {
            var result = new HttpResult <StatusClienteDto>(this._logger);

            try
            {
                var searchResult = await this._app.GetByFilters(filters);

                return(result.ReturnCustomResponse(this._app, searchResult, filters));
            }
            catch (Exception ex)
            {
                return(result.ReturnCustomException(ex, "Calemas.Erp - StatusCliente", filters));
            }
        }
        public async Task <IActionResult> Get(int id, [FromQuery] StatusClienteFilter filters)
        {
            var result = new HttpResult <StatusClienteDto>(this._logger);

            try
            {
                filters.StatusClienteId = id;
                var returnModel = await this._app.GetOne(filters);

                return(result.ReturnCustomResponse(this._app, returnModel));
            }
            catch (Exception ex)
            {
                return(result.ReturnCustomException(ex, "Calemas.Erp - StatusCliente", id));
            }
        }
Esempio n. 7
0
        public async Task <IActionResult> Get([FromQuery] StatusClienteFilter filters)
        {
            var result = new HttpResult <dynamic>(this._logger);

            try
            {
                if (filters.FilterBehavior == FilterBehavior.GetDataItem)
                {
                    var searchResult = await this._rep.GetDataItem(filters);

                    return(result.ReturnCustomResponse(searchResult, filters));
                }

                if (filters.FilterBehavior == FilterBehavior.GetDataCustom)
                {
                    var searchResult = await this._rep.GetDataCustom(filters);

                    return(result.ReturnCustomResponse(searchResult, filters));
                }

                if (filters.FilterBehavior == FilterBehavior.GetDataListCustom)
                {
                    var searchResult = await this._rep.GetDataListCustom(filters);

                    return(result.ReturnCustomResponse(searchResult, filters));
                }

                if (filters.FilterBehavior == FilterBehavior.Export)
                {
                    var searchResult = await this._rep.GetDataListCustom(filters);

                    var export = new ExportExcelCustom <dynamic>(filters);
                    var file   = export.ExportFile(this.Response, searchResult, "StatusCliente");
                    return(File(file, export.ContentTypeExcel(), export.GetFileName()));
                }

                throw new InvalidOperationException("invalid FilterBehavior");
            }
            catch (Exception ex)
            {
                return(result.ReturnCustomException(ex, "Calemas.Erp - StatusCliente", filters));
            }
        }
Esempio n. 8
0
        public virtual Task <PaginateResult <StatusCliente> > GetByFiltersPaging(StatusClienteFilter filters)
        {
            var queryBase = this._rep.GetBySimplefilters(filters);

            return(this._rep.PagingAndDefineFields(filters, queryBase));
        }
Esempio n. 9
0
        public virtual async Task <IEnumerable <StatusCliente> > GetByFilters(StatusClienteFilter filters)
        {
            var queryBase = this._rep.GetBySimplefilters(filters);

            return(await this._rep.ToListAsync(queryBase));
        }
Esempio n. 10
0
 public virtual async Task <StatusCliente> GetOne(StatusClienteFilter filters)
 {
     return(await this._rep.GetById(filters));
 }
 public static IQueryable <StatusCliente> OrderByDomain(this IQueryable <StatusCliente> queryBase, StatusClienteFilter filters)
 {
     return(queryBase.OrderBy(_ => _.StatusClienteId));
 }
Esempio n. 12
0
        public static IQueryable <StatusCliente> WithBasicFilters(this IQueryable <StatusCliente> queryBase, StatusClienteFilter filters)
        {
            var queryFilter = queryBase;

            if (filters.StatusClienteId.IsSent())
            {
                queryFilter = queryFilter.Where(_ => _.StatusClienteId == filters.StatusClienteId);
            }
            if (filters.Nome.IsSent())
            {
                queryFilter = queryFilter.Where(_ => _.Nome.Contains(filters.Nome));
            }
            if (filters.Descricao.IsSent())
            {
                queryFilter = queryFilter.Where(_ => _.Descricao.Contains(filters.Descricao));
            }
            if (filters.Ativo.IsSent())
            {
                queryFilter = queryFilter.Where(_ => _.Ativo == filters.Ativo);
            }
            if (filters.UserCreateId.IsSent())
            {
                queryFilter = queryFilter.Where(_ => _.UserCreateId == filters.UserCreateId);
            }
            if (filters.UserCreateDateStart.IsSent())
            {
                queryFilter = queryFilter.Where(_ => _.UserCreateDate >= filters.UserCreateDateStart);
            }
            if (filters.UserCreateDateEnd.IsSent())
            {
                filters.UserCreateDateEnd = filters.UserCreateDateEnd.AddDays(1).AddMilliseconds(-1);
                queryFilter = queryFilter.Where(_ => _.UserCreateDate <= filters.UserCreateDateEnd);
            }

            if (filters.UserAlterId.IsSent())
            {
                queryFilter = queryFilter.Where(_ => _.UserAlterId != null && _.UserAlterId.Value == filters.UserAlterId);
            }
            if (filters.UserAlterDateStart.IsSent())
            {
                queryFilter = queryFilter.Where(_ => _.UserAlterDate != null && _.UserAlterDate.Value >= filters.UserAlterDateStart.Value);
            }
            if (filters.UserAlterDateEnd.IsSent())
            {
                filters.UserAlterDateEnd = filters.UserAlterDateEnd.Value.AddDays(1).AddMilliseconds(-1);
                queryFilter = queryFilter.Where(_ => _.UserAlterDate != null && _.UserAlterDate.Value <= filters.UserAlterDateEnd);
            }



            return(queryFilter);
        }
Esempio n. 13
0
        public static IQueryable <StatusCliente> WithCustomFilters(this IQueryable <StatusCliente> queryBase, StatusClienteFilter filters)
        {
            var queryFilter = queryBase;


            return(queryFilter);
        }