public IActionResult Index(int Pag, int Registros, string Search) { List <Models.Factura> Facturas = null; if (Search != null) { Facturas = _dbContext.Factura.Include(e => e.Pago) .Where(e => e.NombreFactura.Contains(Search)).ToList(); } else { Facturas = _dbContext.Factura.Include(e => e.Pago).ToList(); } string host = Request.Scheme + "://" + Request.Host.Value; object[] resultado = new Paginador <Models.Factura>().paginador(Facturas, Pag, Registros, "Facturas", "Factura", "Index", host); DataPaginador <Models.Factura> modelo = new DataPaginador <Models.Factura> { Lista = (List <Models.Factura>)resultado[2], Pagi_info = (string)resultado[0], Pagi_navegacion = (string)resultado[1] }; return(View(modelo)); }
public ActionResult Index(int pagina = 1) { int _TotalRegistros = 0; _TotalRegistros = con.servicios.Count(); _Servicios = con.servicios.OrderBy(x => x.NombreServicio) .Skip((pagina - 1) * _RegistrosPorPagina) .Take(_RegistrosPorPagina) .ToList(); foreach (var i in _Servicios) { i.Id = i.Id; i.Clave = Seguridad.Decrypt(i.Clave); i.NombreServicio = Seguridad.Decrypt(i.NombreServicio); } var _TotalPaginas = (int)Math.Ceiling((double)_TotalRegistros / _RegistrosPorPagina); _PaginadorServicios = new Paginador <Servicios>() { RegistrosPorPagina = _RegistrosPorPagina, TotalRegistros = _TotalRegistros, TotalPaginas = _TotalPaginas, PaginaActual = pagina, Resultado = _Servicios }; return(View(_PaginadorServicios)); }
private DataPaginador <InputModelRegistrar> getProveedores(int id, String Search) { Object[] objects = new Object[3]; var url = Request.Scheme + "://" + Request.Host.Value; var data = _objeto._provedores.getProveedores(Search); if (data.Count > 0) { objects = new Paginador <InputModelRegistrar>().paginador(data, id, "Compras", "Compras", "Compras/Compras", url); } else { objects[0] = "No data"; objects[1] = "No data"; objects[2] = new List <InputModelRegistrar>(); } var models = new DataPaginador <InputModelRegistrar> { List = (List <InputModelRegistrar>)objects[2], Pagi_info = (String)objects[0], Pagi_navegacion = (String)objects[1], Input = new InputModelRegistrar() }; return(models); }
public Paginador <Orcamento> Get(FiltroOrcamento filtro) { IQueryable <Orcamento> query = context.Orcamento; if (filtro.Id != 0) { query = query.Where(x => x.Id == filtro.Id); } if (filtro.TipoPedido != null && filtro.TipoPedido != "") { query = query.Where(x => x.TipoPedido.Contains(filtro.TipoPedido)); } int registros = query.Count(); List <Orcamento> orcamentos = query.ToList(); Paginador <Orcamento> dados = new Paginador <Orcamento> { Pagina = filtro.Pagina, QtdeItensTotal = registros, ItensPorPagina = filtro.ItensPorPagina, QtdedePaginas = Convert.ToInt32(Math.Ceiling(Convert.ToDouble(registros) / filtro.ItensPorPagina)), Dados = orcamentos }; return(dados); }
public IActionResult Index(int Pag, int Registros, string Search) { List <Models.Empleado> Empleados = null; if (Search != null) { Empleados = _dbContext.Empleado.Where(e => e.NombreEmpleado.Contains(Search)).ToList(); } else { Empleados = _dbContext.Empleado.ToList(); } string host = Request.Scheme + "://" + Request.Host.Value; object[] resultado = new Paginador <Models.Empleado>().paginador(Empleados, Pag, Registros, "Empleados", "Empleado", "Index", host); DataPaginador <Models.Empleado> modelo = new DataPaginador <Models.Empleado> { Lista = (List <Models.Empleado>)resultado[2], Pagi_info = (string)resultado[0], Pagi_navegacion = (string)resultado[1] }; return(View(modelo)); }
// GET: Usuarios public async Task <ActionResult> Index(int id, String Search) { if (objeto._signInManager.IsSignedIn(User)) { var url = Request.Scheme + "://" + Request.Host.Value; //esta forma de realizar digamos la búsqueda no me ha convencido nada var objects = new Paginador <InputModelRegistrar>().paginador(await objeto._usuarios.GetUsuariosAsync(Search), id, "Usuarios", "Usuarios", "Index", url); var models = new DataPaginador <InputModelRegistrar> { //posicion 2 tiene el query que contiene la coleccion de datos de todas las paginas que tenemos. List = (List <InputModelRegistrar>)objects[2], Pagi_info = (String)objects[0], Pagi_navegacion = (String)objects[1], Input = new InputModelRegistrar() }; /* * var data = User.Claims.FirstOrDefault(u => u.Type.Equals("" + * "http://schemas.microsoft.com/ws/2008/06/identity/claims/role")).Value; */ //ViewData["Roles"] = _usuarios.userData(HttpContext); //esta linea ultima de codigo no hace falta pq lo que queremos es que nos pagine los usuarios //var model = await objeto._usuarios.getTUsuariosAsync(); return(View(models)); } return(View()); }
public IActionResult Index(int id, String Search) { if (_objeto._signInManager.IsSignedIn(User)) { Object[] objects = new Object[3]; var url = Request.Scheme + "://" + Request.Host.Value; var data = _objeto._compras.getTCompras(Search); if (0 < data.Count) { objects = new Paginador <TCompras>().paginador(data, id, "Compras", "Compras", "Index", url); } else { objects[0] = "No data"; objects[1] = "No data"; objects[2] = new List <TCompras>(); } var models = new DataPaginador <TCompras> { List = (List <TCompras>)objects[2], Pagi_info = (String)objects[0], Pagi_navegacion = (String)objects[1], Input = new TCompras() }; listProductos = models.List; return(View(models)); } else { return(RedirectToAction(nameof(HomeController.Index), "Home")); } }
private DataPaginador <TProductos> getProductos(int id, String Search) { Object[] objects = new Object[3]; var url = Request.Scheme + "://" + Request.Host.Value; var data = _objeto._productos.getTProductos(Search); if (0 < data.Count) { objects = new Paginador <TProductos>().paginador(data, id, "Productos", "Productos", "Inventario/Inventario", url); } else { objects[0] = "No data"; objects[1] = "No data"; objects[2] = new List <TProductos>(); } var models = new DataPaginador <TProductos> { List = (List <TProductos>)objects[2], Pagi_info = (String)objects[0], Pagi_navegacion = (String)objects[1], Input = new TProductos() }; listProductos = models.List; return(models); }
public IActionResult Index(int?edad, int pagina = 1) { if (pagina < 1) { pagina = 1; } var cantidadRegistrosPorPagina = 10; // parámetro bool predicado(Persona x) => !edad.HasValue || edad.Value == x.Edad; var personas = _context.Personas.Where(predicado).OrderBy(x => x.Id) .Skip((pagina - 1) * cantidadRegistrosPorPagina) .Take(cantidadRegistrosPorPagina).ToList(); int totalDeRegistros; if (edad != null) { totalDeRegistros = _context.Personas.Where(x => x.Edad == edad).Count(); this.ViewBag.Edad = edad; } else { totalDeRegistros = _context.Personas.Count(); } var paginador = new Paginador(totalDeRegistros, pagina, cantidadRegistrosPorPagina); this.ViewBag.Paginador = paginador; return(View(personas)); }
// GET: Usuarios public async Task <ActionResult> Index(int id, String Search) { if (objeto._signInManager.IsSignedIn(User)) { var url = Request.Scheme + "://" + Request.Host.Value; //esta forma de realizar digamos la búsqueda no me ha convencido nada var objects = new Paginador <InputModelRegistrar>().paginador(await objeto._usuarios.GetUsuariosAsync(Search), id, "Usuarios", "Usuarios", "Index", url); var models = new DataPaginador <InputModelRegistrar> { //posicion 2 tiene el query que contiene la coleccion de datos de todas las paginas que tenemos. List = (List <InputModelRegistrar>)objects[2], Pagi_info = (String)objects[0], Pagi_navegacion = (String)objects[1], Input = new InputModelRegistrar() }; return(View(models)); } else { //aqui tal cual paso la vista más adelante lo mismo paso un modelo que quiero cargar o algo return(View("Index2")); } }
public IActionResult Ventas(int id) { if (_objeto._signInManager.IsSignedIn(User)) { var url = Request.Scheme + "://" + Request.Host.Value; Object[] objects = new Object[3]; var data = _context.TTempo_ventas.ToList(); if (0 < data.Count) { objects = new Paginador <TTempo_ventas>().paginador(data, id, "", "Ventas", "Ventas", url); } else { objects[0] = "No hay datos que mostrar"; objects[1] = "No hay datos que mostrar"; objects[2] = new List <TTempo_ventas>(); } models = new DataPaginador <TTempo_ventas> { List = (List <TTempo_ventas>)objects[2], Pagi_info = (String)objects[0], Pagi_navegacion = (String)objects[1], Input = new TTempo_ventas(), dataCliente = new DataCliente() }; return(View(models)); } else { return(RedirectToAction(nameof(HomeController.Index), "Home")); } }
public void restablecer() { _accion = "insert"; _num_pagina = 1; _imagePictureBox.Image = _imageBitmap; _textBoxCliente[0].Text = ""; _textBoxCliente[1].Text = ""; _textBoxCliente[2].Text = ""; _textBoxCliente[3].Text = ""; _textBoxCliente[4].Text = ""; _textBoxCliente[5].Text = ""; _checkBoxCredito.Checked = false; _checkBoxCredito.ForeColor = Color.LightSlateGray; _labelCliente[0].Text = "NID"; _labelCliente[0].ForeColor = Color.LightSlateGray; _labelCliente[1].Text = "Nombre"; _labelCliente[1].ForeColor = Color.LightSlateGray; _labelCliente[2].Text = "Apellido"; _labelCliente[2].ForeColor = Color.LightSlateGray; _labelCliente[3].Text = "Email"; _labelCliente[3].ForeColor = Color.LightSlateGray; _labelCliente[4].Text = "Telefono"; _labelCliente[4].ForeColor = Color.LightSlateGray; _labelCliente[5].Text = "Direccion"; _labelCliente[5].ForeColor = Color.LightSlateGray; SearchClientes(""); listClientes = TClientes.ToList(); if (listClientes.Count > 0) { _paginadorClientes = new Paginador <TClientes>(listClientes, _labelCliente[6], _reg_por_pagina); } }
public IActionResult HistoryTickets(int id, String Search) { if (_objeto._signInManager.IsSignedIn(User)) { Object[] objects = new Object[3]; var url = Request.Scheme + "://" + Request.Host.Value; var lists = _objeto._proveedores.getTickets(Search); if (0 < lists.Count) { objects = new Paginador <TTickets>().paginador(lists, id, "Proveedores", "Historiales", "HistoryTickets", url); } else { objects[0] = "No data"; objects[1] = "No data"; objects[2] = new List <TTickets>(); } var models = new DataPaginador <TTickets> { List = (List <TTickets>)objects[2], Pagi_info = (String)objects[0], Pagi_navegacion = (String)objects[1], Input = new TTickets() }; listTicket = models.List; return(View(models)); } else { return(RedirectToAction(nameof(HomeController.Index), "Home")); } }
public void registro_paginas() { _num_pagina = 1; _reg_por_pagina = (int)_numericUpDown.Value; switch (_seccion) { case 1: listCliente = TClientes.ToList(); if (listCliente.Count > 0) { _paginadorClientes = new Paginador <TClientes>(listCliente, _labelCliente[6], _reg_por_pagina); } searchClientes(""); break; case 2: listReport = TReportes_clientes.ToList(); if (listReport.Count > 0) { _paginadorReport = new Paginador <TReportes_clientes>(listReport, _labelCliente[6], _reg_por_pagina); GetReportes(""); } break; } }
public override object OnGet(Tarea request) { try{ var httpRequest = RequestContext.Get <IHttpRequest>(); return(Factory.Execute(proxy => { long?totalCount = null; var paginador = new Paginador(httpRequest); var visitor = ReadExtensions.CreateExpression <Tarea>(); var predicate = PredicateBuilder.True <Tarea>(); var userId = int.Parse(httpRequest.GetSession().UserAuthId); predicate = q => q.UserId == userId; if (request.IdCliente.HasValue && request.IdCliente.Value != default(int)) { predicate = q => q.IdCliente == request.IdCliente.Value; } if (!request.NitCliente.IsNullOrEmpty()) { predicate = predicate.AndAlso(q => q.NitCliente.StartsWith(request.NitCliente)); } if (!request.NombreCliente.IsNullOrEmpty()) { predicate = predicate.AndAlso(q => q.NombreCliente.Contains(request.NombreCliente)); } var qs = httpRequest.QueryString["Cumplida"]; bool cumplida; if (bool.TryParse(qs, out cumplida)) { predicate = predicate.AndAlso(q => q.Cumplida == cumplida); } visitor.Where(predicate).OrderByDescending(f => f.Fecha); if (paginador.PageNumber.HasValue) { visitor.Select(r => Sql.Count(r.Id)); totalCount = proxy.Count(visitor); visitor.Select(); int rows = paginador.PageSize.HasValue? paginador.PageSize.Value:BL.ResponsePageSize; visitor.Limit(paginador.PageNumber.Value * rows, rows); } return new Response <Tarea>() { TotalCount = totalCount, Data = proxy.Get(visitor) }; })); } catch (Exception e) { return(HttpResponse.ErrorResult <Response <Tarea> >(e, "GetTareaError")); } }
public void restablacer() { _seccion = 1; _accion = "insert"; _num_pagina = 1; _imagePictureBox.Image = _imagBitmap; _textBoxCliente[0].Text = string.Empty; _textBoxCliente[1].Text = string.Empty; _textBoxCliente[2].Text = string.Empty; _textBoxCliente[3].Text = string.Empty; _textBoxCliente[4].Text = string.Empty; _textBoxCliente[5].Text = string.Empty; _checkBoxCredito.Checked = false; _checkBoxCredito.ForeColor = Color.LightSlateGray; _labelCliente[0].Text = "Nid"; _labelCliente[0].ForeColor = Color.LightSlateGray; _labelCliente[1].Text = "Nombre"; _labelCliente[1].ForeColor = Color.LightSlateGray; _labelCliente[2].Text = "Apellido"; _labelCliente[2].ForeColor = Color.LightSlateGray; _labelCliente[3].Text = "Email"; _labelCliente[3].ForeColor = Color.LightSlateGray; _labelCliente[4].Text = "Telefono"; _labelCliente[4].ForeColor = Color.LightSlateGray; _labelCliente[5].Text = "Direccion"; _labelCliente[5].ForeColor = Color.LightSlateGray; searchClientes(""); //Metodo que agrega registro al listCliente = TClientes.ToList(); if (listCliente.Count > 0) { _paginadorClientes = new Paginador <TClientes>(listCliente, _labelCliente[6], _reg_por_pagina); } }
public IActionResult Index(int Pag, int Registros, string Search) { List <Curso> cursos = null; if (Search != null) { cursos = _dbContext.Curso.Include(e => e.Categoria) .Where(e => e.NombreCurso.Contains(Search) || e.Categoria.NombreCategoria.Contains(Search)).ToList(); } else { cursos = _dbContext.Curso.Include(e => e.Categoria).ToList(); } string host = Request.Scheme + "://" + Request.Host.Value; object[] resultado = new Paginador <Curso>().paginador(cursos, Pag, Registros, "Cursos", "Curso", "Index", host); DataPaginador <Curso> modelo = new DataPaginador <Curso> { Lista = (List <Curso>)resultado[2], Pagi_info = (string)resultado[0], Pagi_navegacion = (string)resultado[1] }; return(View(modelo)); }
public Paginador <Pregunta> PaginadorPreguntas(int pagina) { pagina = 1; int RegistrosPorPagina = 10; int TotalRegistros = 0; List <Pregunta> ListaPreguntas = null; Paginador <Pregunta> pagPreg = null; TotalRegistros = bdContexto.Preguntas.Count(); ListaPreguntas = bdContexto.Preguntas.OrderBy(p => p.Nro) .Skip((pagina - 1) * RegistrosPorPagina) .Take(RegistrosPorPagina) .ToList(); var TotalPaginas = (int)Math.Ceiling((double)TotalRegistros / RegistrosPorPagina); pagPreg = new Paginador <Pregunta>() { RegistrosPorPagina = RegistrosPorPagina, TotalRegistros = TotalRegistros, TotalPaginas = TotalPaginas, PaginaActual = pagina, Resultado = ListaPreguntas }; return(pagPreg); }
public async Task <ActionResult> ConsultaGeneralXFiltroAsync( [ModelBinder(typeof(FilterModelBinderIngCieRom))] object filtro, [ModelBinder(typeof(FilterModelBinderPaginador))] Paginador paginador, [ModelBinder(typeof(ModelBinderGridCieExtraParam))] IParams extraParam, [ModelBinder(typeof(ModelBinderConfig))] Config config) { object result = await _ConsultaXFiltroAsync(filtro, config, paginador, extraParam); return(Json(result, JsonRequestBehavior.AllowGet)); }
public Paginador <Cliente> Get(FiltroCliente filtro) { IQueryable <Cliente> query = context.Cliente; if (filtro.Id != 0) { query = query.Where(x => x.Id == filtro.Id); } if (filtro.Nome != null && filtro.Nome != "") { query = query.Where(x => x.Pessoa.Nome.Contains(filtro.Nome)); } if (filtro.Cpf != null && filtro.Cpf != "") { query = query.Where(x => x.Pessoa.Cpf.Contains(filtro.Cpf)); } if (filtro.Cnpj != null && filtro.Cnpj != "") { query = query.Where(x => x.Pessoa.Cnpj.Contains(filtro.Cnpj)); } if (filtro.Rg != null && filtro.Rg != "") { query = query.Where(x => x.Pessoa.Rg.Contains(filtro.Rg)); } if (filtro.Celular != null && filtro.Celular != "") { query = query.Where(x => x.Pessoa.Celular.Contains(filtro.Celular)); } if (filtro.Email != null && filtro.Email != "") { query = query.Where(x => x.Pessoa.Email.Contains(filtro.Email)); } if (filtro.Inativo == 0 || filtro.Inativo == 1) { query = query.Where(x => x.Pessoa.Inativo == filtro.Inativo); } int registros = query.Count(); List <Cliente> clientes = query.ToList(); Paginador <Cliente> dados = new Paginador <Cliente> { Pagina = filtro.Pagina, QtdeItensTotal = registros, ItensPorPagina = filtro.ItensPorPagina, QtdedePaginas = Convert.ToInt32(Math.Ceiling(Convert.ToDouble(registros) / filtro.ItensPorPagina)), Dados = clientes }; return(dados); }
private async Task <object> _ConsultaGeneral(Paginador paginador, Config config, IParams extraParams) { (extraParams as RecalculoParm).Tipo = Tipo ?? 0; (extraParams as RecalculoParm).Periodo = new DateTime(DateTime.Now.Date.Year, DateTime.Now.Date.Month, DateTime.DaysInMonth(DateTime.Now.Date.Year, DateTime.Now.Date.Month)); object result = await business.ConsultarAsync(null, config, paginador, extraParams); return(result); }
public JsonResult <Paginador <Produto> > Get(Tipo tipo) { Paginador <Produto> paginador = new Paginador <Produto> { Dados = busines.Get(tipo) }; return(Json(paginador)); }
public Paginador <Estoque> GetAll() { Paginador <Estoque> paginador = new Paginador <Estoque> { Dados = rep.GetAll() }; return(paginador); }
public async Task <ActionResult> ConsultaGeneral( [ModelBinder(typeof(FilterModelBinderPaginador))] Paginador paginador, [ModelBinder(typeof(PxQIngresosRomRecalculoConfigBinder))] Config config, [ModelBinder(typeof(ModelBinderPxQIngresosRomRecalculoParam))] IParams extraParams) { object result = await _ConsultaGeneral(paginador, config, extraParams); return(Json(result, JsonRequestBehavior.AllowGet));; }
public Paginador <Compra> GetAll() { Paginador <Compra> paginador = new Paginador <Compra> { Dados = rep.GetAll() }; return(paginador); }
public Paginador <Fornecedor> Get(FiltroFornecedor filtro) { IQueryable <Fornecedor> query = context.Fornecedor; if (filtro.Id != 0) { query = query.Where(x => x.Id == filtro.Id); } if (filtro.Nome != null && filtro.Nome != "") { query = query.Where(x => x.Pessoa.Nome.Contains(filtro.Nome)); } if (filtro.Cpf != null && filtro.Cpf != "") { query = query.Where(x => x.Pessoa.Cpf.Contains(filtro.Cpf)); } if (filtro.Cnpj != null && filtro.Cnpj != "") { query = query.Where(x => x.Pessoa.Cnpj.Contains(filtro.Cnpj)); } if (filtro.Rg != null && filtro.Rg != "") { query = query.Where(x => x.Pessoa.Rg.Contains(filtro.Rg)); } if (filtro.Celular != null && filtro.Celular != "") { query = query.Where(x => x.Pessoa.Celular.Contains(filtro.Celular)); } if (filtro.Email != null && filtro.Email != "") { query = query.Where(x => x.Pessoa.Email.Contains(filtro.Email)); } if (filtro.Inativo == 0 || filtro.Inativo == 1) { query = query.Where(x => x.Pessoa.Inativo == filtro.Inativo); } int registros = query.Count(); List <Fornecedor> fornecedores = query.ToList(); Paginador <Fornecedor> dados = new Paginador <Fornecedor>(); dados.Pagina = filtro.Pagina; dados.QtdeItensTotal = registros; dados.ItensPorPagina = filtro.ItensPorPagina; dados.QtdedePaginas = Convert.ToInt32(Math.Ceiling(Convert.ToDouble(registros) / filtro.ItensPorPagina)); dados.Dados = fornecedores; return(dados); }
public void Registro_Paginas() { _num_pagina = 1; _reg_por_pagina = (int)_numericUpDown.Value; listClientes = TClientes.ToList(); if (listClientes.Count > 0) { _paginadorClientes = new Paginador <TClientes>(listClientes, _labelCliente[6], _reg_por_pagina); SearchClientes(""); } }
public void restablecerReport() { //_seccion = 2; GetReportes(""); listReport = TReportes_clientes.ToList(); if (listReport.Count > 0) { _paginadorReport = new Paginador <TReportes_clientes>(listReport, _labelCliente[6], _reg_por_pagina); } }
public Paginador <Produto> ObterProdutos(string referencia, int fornecedor, int categoria, int pagina, int itensPorPagina) { var sql = ""; sql += "Select Count(*) FROM Produto "; if (referencia.Length > 0) { sql += " Where Id ='" + referencia + "'"; } if (fornecedor > 0) { sql += " And FornecedorId =" + fornecedor; } if (categoria > 0) { sql += " And CategoriaId =" + categoria; } int registros = _context.Database.SqlQuery <int>(sql).FirstOrDefault(); sql = " DECLARE @PageNumber AS INT, @RowspPage AS INT"; sql += " SET @PageNumber = " + pagina; sql += " SET @RowspPage = " + itensPorPagina; sql += " SELECT * FROM("; sql += " SELECT ROW_NUMBER() OVER(ORDER BY Id) AS NUMBER,"; sql += " * FROM Produto "; if (referencia.Length > 0) { sql += " Where Id ='" + referencia + "'"; } if (fornecedor > 0) { sql += " And FornecedorId =" + fornecedor; } if (categoria > 0) { sql += " And CategoriaId =" + categoria; } sql += " ) AS TBL"; sql += " WHERE NUMBER BETWEEN((@PageNumber - 1) * @RowspPage + 1) AND(@PageNumber * @RowspPage)"; sql += " ORDER BY Id"; List <Produto> produtos = _context.Database.SqlQuery <Produto>(sql).ToList(); Paginador <Produto> dados = new Paginador <Produto>(); dados.Pagina = pagina; dados.ItensPorPagina = itensPorPagina; dados.QtdedePaginas = Convert.ToInt32(Math.Ceiling(Convert.ToDouble(registros) / itensPorPagina)); dados.Dados = produtos; return(dados); }
public async Task <object> ConsultarAsync(object filter, Config config, Paginador paginador, IParams extraParams) { using (UnitOfWork uow = UnitOfWork.Create()) { string periodo = (extraParams as IPeriodo).Periodo.ToString("yyyy-MM-dd"); await Repos.InsertAsync("spPXQIngresosRecalculoInsert", uow, new SqlParameter { ParameterName = "@periodo", Value = periodo }); uow.Commit(); } return(await ConsultaXFiltroAsync(filter, config, paginador, extraParams)); }