public IEnumerable <EV_CLIENTE> GetClientePaginacao(FilterClientes filter, string order, int offset, int limit) { var skip = (offset - 1) * limit < 0 ? 0 : (offset - 1) * limit; var query = Dbset.Include("AD_ORGAOS").Include("EV_INSCRICAO").Where(x => (x.NOME.Contains(filter.Nome) || filter.Nome == null) && (x.NOME.StartsWith(filter.Letra) || filter.Letra == null) && (x.RG.StartsWith(filter.Rg) || filter.Rg == null) && (x.INSTITUICAO.Contains(filter.Instituicao) || filter.Instituicao == null) && (x.SEXO.Contains(filter.Sexo) || filter.Sexo == null) && (x.TEL_CELULAR.Contains(filter.Telcelular) || filter.Telcelular == null) && (x.CPF.StartsWith(filter.Cpf) || filter.Cpf == null) && (x.EMAIL.Contains(filter.Email) || filter.Email == null) && (x.CIDADE.Contains(filter.Cidade) || filter.Cidade == null) && (x.DTNASCIMENTO == filter.Dtaniversario || filter.Dtaniversario == null) && (x.EV_INSCRICAO.Any(y => y.EVENTOID == filter.Eventoid) || filter.Eventoid == null || filter.Eventoid == 0)); if (order == "asc") { var _object = CompiledQuery.Compile <ObjectContext, IQueryable <EV_CLIENTE> >(ctx => query.OrderBy(x => x.DTCADASTRO).Skip(skip).Take(limit)); return(_object.Invoke(((IObjectContextAdapter)Entities).ObjectContext).ToList()); } else { var _object = CompiledQuery.Compile <ObjectContext, IQueryable <EV_CLIENTE> >(ctx => query.OrderByDescending(x => x.DTCADASTRO).Skip(skip).Take(limit)); return(_object.Invoke(((IObjectContextAdapter)Entities).ObjectContext).ToList()); } }
public override async Task UpdateAsync(MeetingAgenda entityToUpdate) { var existsEntity = await Dbset.Include(x => x.MeetingAgendaUsers).FirstOrDefaultAsync(x => x.Id == entityToUpdate.Id); existsEntity.Name = entityToUpdate.Name; existsEntity.Number = entityToUpdate.Number; existsEntity.IsDraft = entityToUpdate.IsDraft; existsEntity.UpdatedBy = entityToUpdate.UpdatedBy; existsEntity.UpdatedDate = DateTime.Now; if (!entityToUpdate.IsRemoved) { var existsUsers = existsEntity.MeetingAgendaUsers; DbContext.MeetingAgendaUsers.RemoveRange(existsUsers); foreach (var user in entityToUpdate.MeetingAgendaUsers) { user.MeetingAgendaId = entityToUpdate.Id; user.CreatedBy = entityToUpdate.UpdatedBy; user.CreatedDate = DateTime.Now; user.UpdatedBy = entityToUpdate.UpdatedBy; user.UpdatedDate = DateTime.Now; await DbContext.MeetingAgendaUsers.AddAsync(user); } } }
public virtual IEnumerable <EV_INSCRICAO> GetInscricaoByClienteId(int clientId) { var query = Dbset.Include("EV_EVENTO").Include("EV_CLIENTE").Where(x => x.CLIENTEID == clientId).OrderBy(x => x.CRIADO); var _object = CompiledQuery.Compile <ObjectContext, IQueryable <EV_INSCRICAO> >(ctx => query); return(_object.Invoke(((IObjectContextAdapter)Entities).ObjectContext).ToList()); }
public IEnumerable <EV_INSCRICAO> GetInscricaoPaginacao(string search, string order, int offset, int limit) { var skip = (offset - 1) * limit < 0 ? 0 : (offset - 1) * limit; var date = DateTime.TryParse(search, out DateTime dataPagamento); if (date) { var query = Dbset.Include("EV_EVENTO").Include("EV_CLIENTE").Where(x => x.DATAPAGAMENTO.Equals(dataPagamento)); var _object = CompiledQuery.Compile <ObjectContext, IQueryable <EV_INSCRICAO> >(ctx => query.Skip(skip).Take(limit)); return(_object.Invoke(((IObjectContextAdapter)Entities).ObjectContext).ToList()); } if (order == "asc") { var query = Dbset.Include("EV_EVENTO").Include("EV_CLIENTE").Where(x => x.EV_EVENTO.NOME.Contains(search) || x.EV_CLIENTE.NOME.Contains(search) || x.PAGO.Contains(search) || x.BOLETOEMITIDO.Contains(search) || x.TURNO.Contains(search)); var _object = CompiledQuery.Compile <ObjectContext, IQueryable <EV_INSCRICAO> >(ctx => query.Skip(skip).Take(limit)); return(_object.Invoke(((IObjectContextAdapter)Entities).ObjectContext).ToList()); } else { var query = Dbset.Include("EV_EVENTO").Include("EV_CLIENTE").Where(x => x.EV_EVENTO.NOME.Contains(search) || x.EV_CLIENTE.NOME.Contains(search) || x.PAGO.Contains(search) || x.BOLETOEMITIDO.Contains(search) || x.TURNO.Contains(search)); var _object = CompiledQuery.Compile <ObjectContext, IQueryable <EV_INSCRICAO> >(ctx => query.Skip(skip).Take(limit)); return(_object.Invoke(((IObjectContextAdapter)Entities).ObjectContext).ToList()); } }
public IEnumerable <EV_EVENTO> GetAllEventoInscritos() { var query = Dbset.Include("EV_INSCRICAO").OrderBy(x => x.DTCADASTRO); var _object = CompiledQuery.Compile <ObjectContext, IQueryable <EV_EVENTO> >(ctx => query.Where(X => X.EV_INSCRICAO.Count() > 0)); return(_object.Invoke(((IObjectContextAdapter)Entities).ObjectContext).ToList()); }
public IEnumerable <User> GetAllWithFilters(int currentUserId, string searchName, string searchEmail, string sortColumn, bool sortDirectionIsAscending, short page, byte pageSize) { searchName = searchName ?? ""; searchEmail = searchEmail ?? ""; var users = Dbset.Include(x => x.Membership).Where(x => x.Id != currentUserId && x.Name.Contains(searchName) && x.Email.Contains(searchEmail)); switch (sortColumn) { case "Email": users = sortDirectionIsAscending ? users.OrderBy(x => x.Email) : users.OrderByDescending(x => x.Email); break; case "Name": users = sortDirectionIsAscending ? users.OrderBy(x => x.Name) : users.OrderByDescending(x => x.Name); break; case "DateRegistered": users = sortDirectionIsAscending ? users.OrderBy(x => x.DateRegistered) : users.OrderByDescending(x => x.DateRegistered); break; case "LastLoginAt": users = sortDirectionIsAscending ? users.OrderBy(x => x.LastLoginAt) : users.OrderByDescending(x => x.LastLoginAt); break; case "IsBanned": users = sortDirectionIsAscending ? users.OrderBy(x => x.IsBanned) : users.OrderByDescending(x => x.IsBanned); break; default: users = users.OrderByDescending(x => x.DateRegistered); break; } return(users.Skip(pageSize * (page - 1)).Take(pageSize).ToList()); }
/// <summary> /// Get Product with Related entities by Id /// </summary> /// <param name="id"></param> /// <returns></returns> public Product GetProductByIdWithInclude(int id) { return(Dbset .Include(x => x.Brand) .Include(x => x.SubCategory) .ThenInclude(x => x.RootCategory) .FirstOrDefault(x => x.Id == id)); }
/// <summary> /// Get All Products with Related entities /// </summary> /// <returns></returns> public IEnumerable <Product> GetAllProductsWithInclude() { return(Dbset .Include(x => x.Brand) .Include(x => x.SubCategory) .ThenInclude(x => x.RootCategory) .ToList()); }
public IEnumerable <EV_INSCRICAO> GetInscricaoPaginacao(string order, int offset, int limit) { var skip = (offset - 1) * limit < 0 ? 0 : (offset - 1) * limit; if (order == "asc") { var query = Dbset.Include("EV_EVENTO").Include("EV_CLIENTE").OrderBy(x => x.CRIADO); var _object = CompiledQuery.Compile <ObjectContext, IQueryable <EV_INSCRICAO> >(ctx => query.Skip(skip).Take(limit)); return(_object.Invoke(((IObjectContextAdapter)Entities).ObjectContext).ToList()); } else { var query = Dbset.Include("EV_EVENTO").Include("EV_CLIENTE").OrderByDescending(x => x.CRIADO); var _object = CompiledQuery.Compile <ObjectContext, IQueryable <EV_INSCRICAO> >(ctx => query.Skip(skip).Take(limit)); return(_object.Invoke(((IObjectContextAdapter)Entities).ObjectContext).ToList()); } }
public int GetTotalRegistros(FilterClientes filter) { var query = Dbset.Include("EV_INSCRICAO").Where(x => (x.NOME.Contains(filter.Nome) || filter.Nome == null) && (x.NOME.StartsWith(filter.Letra) || filter.Letra == null) && (x.INSTITUICAO.Contains(filter.Instituicao) || filter.Instituicao == null) && (x.SEXO.Contains(filter.Sexo) || filter.Sexo == null) && (x.TEL_CELULAR.Contains(filter.Telcelular) || filter.Telcelular == null) && (x.CPF.StartsWith(filter.Cpf) || filter.Cpf == null) && (x.EMAIL.Contains(filter.Email) || filter.Email == null) && (x.CIDADE.Contains(filter.Cidade) || filter.Cidade == null) && (x.DTNASCIMENTO == filter.Dtaniversario || filter.Dtaniversario == null) && (x.EV_INSCRICAO.Any(y => y.EVENTOID == filter.Eventoid) || filter.Eventoid == null || filter.Eventoid == 0)); var _object = CompiledQuery.Compile <ObjectContext, int>(ctx => query.Count()); return(_object.Invoke(((IObjectContextAdapter)Entities).ObjectContext)); }
public int GetTotalRegistros(string search) { int totalRegistros = 0; var date = DateTime.TryParse(search, out DateTime dataPagamento); if (date) { totalRegistros = Dbset.Include("EV_EVENTO").Include("EV_CLIENTE").Where(x => x.DATAPAGAMENTO.Equals(dataPagamento)).Count(); } else { totalRegistros = Dbset.Include("EV_EVENTO").Include("EV_CLIENTE").Where(x => x.EV_EVENTO.NOME.Contains(search) || x.EV_CLIENTE.NOME.Contains(search) || x.PAGO.Contains(search) || x.BOLETOEMITIDO.Contains(search) || x.TURNO.Contains(search)).Count(); } var _object = CompiledQuery.Compile <ObjectContext, int>(ctx => totalRegistros); return(_object.Invoke(((IObjectContextAdapter)Entities).ObjectContext)); }
public IEnumerable <EV_EVENTO> GetEventoPaginacao(string search, string order, int offset, int limit) { var skip = (offset - 1) * limit < 0 ? 0 : (offset - 1) * limit; var query = Dbset.Include("EV_EVENTODATAS").Where(x => x.NOME.Contains(search) || x.NOME.Contains(search) || x.SITUACAO.Contains(search) || x.DISPONIVEL.Contains(search)); if (order == "asc") { var _object = CompiledQuery.Compile <ObjectContext, IQueryable <EV_EVENTO> >(ctx => query.OrderBy(x => x.DTCADASTRO).Skip(skip).Take(limit)); return(_object.Invoke(((IObjectContextAdapter)Entities).ObjectContext).ToList()); } else { var _object = CompiledQuery.Compile <ObjectContext, IQueryable <EV_EVENTO> >(ctx => query.OrderByDescending(x => x.DTCADASTRO).Skip(skip).Take(limit)); return(_object.Invoke(((IObjectContextAdapter)Entities).ObjectContext).ToList()); } }
public Order GetById(int id) { return(Dbset.Include(order => order.OrderDetails) .FirstOrDefault(order => order.OrderID == id)); }
public IEnumerable <Task> GetAllByUserId(int userId) { return(Dbset.Include(x => x.CompletedTaskItems).Where(x => x.UserId == userId).ToList()); }
public override async Task <IEnumerable <Data> > FindAsync(Expression <Func <Data, bool> > spec) { return(await Dbset .Include(i => i.Articles) .ToListAsync()); }
public override Data FindById(DateTime id) { return(Dbset .Include(i => i.Articles) .FirstOrDefault(d => d.Id.Equals(id))); }
public IQueryable <TTrack_Person_Role> Include(System.Linq.Expressions.Expression <Func <TTrack_Person_Role, TRole> > path) { return(Dbset.Include(path)); }
public override async Task <MeetingAgenda> GetAsync(int id) { return(await Dbset.Include(x => x.MeetingAgendaUsers).FirstOrDefaultAsync(x => x.Id == id)); }
public override IEnumerable <Data> Find(Expression <Func <Data, bool> > spec) { return(Dbset .Include(i => i.Articles) .ToList()); }
public override Data FindOne(Expression <Func <Data, bool> > spec) { return(Dbset .Include(i => i.Articles) .FirstOrDefault(spec)); }
public override async Task <Data> FindOneAsync(Expression <Func <Data, bool> > spec) { return(await Dbset .Include(i => i.Articles) .FirstOrDefaultAsync(spec)); }
/// <summary> /// Get All Sub Categories with related entities /// </summary> /// <returns></returns> public IEnumerable <SubCategory> GetSubCategoriesWithInclude() { return(Dbset.Include(x => x.RootCategory).ToList()); }
public override async Task <Data> FindByIdAsync(DateTime id) { return(await Dbset .Include(i => i.Articles) .FirstOrDefaultAsync(d => d.Id.Equals(id))); }
public IQueryable <TTrack_Genre> Include(System.Linq.Expressions.Expression <Func <TTrack_Genre, TGenre> > path) { return(Dbset.Include(path)); }
/// <summary> /// Get All Monitorings with User Information /// </summary> /// <returns></returns> public IEnumerable <Monitor> GetAllMonitoringsWithUserInfo() { return(Dbset.Include(x => x.User).ToList()); }
public Customer GetById(int id) { return(Dbset.Include(customer => customer.Country) .FirstOrDefault(customer => customer.CustomerIdentifier == id)); }