public ActionResult Index(string option, string search, string currentFilter, string sortOrder, int?page) { try { tablaGeneralBLL = new TablaGeneralBLLImpl(); personaBll = new PersonasBLLImpl(); } catch (Exception ex) { ex = new Exception(); return(View()); } ViewBag.CurrentSort = sortOrder; if (search != null) { page = 1; } else { search = currentFilter; } ViewBag.CurrenFilter = search; int pageSize = 4; int pageNumber = (page ?? 1); if (option == "Cédula") { ViewBag.idPersona = new SelectList(tablaGeneralBLL.Consulta("Persona", "tipo"), "idTablaGeneral", "descripcion"); List <Persona> listaPersonas = personaBll.Find(x => x.cedula == search && x.idTipo == 1 || search == null).ToList(); PagedList <Persona> model = new PagedList <Persona>(listaPersonas, pageNumber, pageSize); return(View(model.ToPagedList(pageNumber, pageSize))); } else if (option == "Nombre Completo") { ViewBag.idPersona = new SelectList(tablaGeneralBLL.Consulta("Persona", "tipo"), "idTablaGeneral", "descripcion"); List <Persona> listaPersonas = personaBll.Find(x => x.cedula == search && x.idTipo == 1 || search == null).ToList(); PagedList <Persona> model = new PagedList <Persona>(listaPersonas, pageNumber, pageSize); return(View(model)); } else if (option == "Correo") { ViewBag.idPersona = new SelectList(tablaGeneralBLL.Consulta("Persona", "tipo"), "idTablaGeneral", "descripcion"); List <Persona> listaPersonas = personaBll.Find(x => x.cedula == search && x.idTipo == 1 || search == null).ToList(); PagedList <Persona> model = new PagedList <Persona>(listaPersonas, pageNumber, pageSize); return(View(model)); } else if (option == "Observación") { ViewBag.idPersona = new SelectList(tablaGeneralBLL.Consulta("Persona", "tipo"), "idTablaGeneral", "descripcion"); List <Persona> listaPersonas = personaBll.Find(x => x.cedula == search && x.idTipo == 1 || search == null).ToList(); PagedList <Persona> model = new PagedList <Persona>(listaPersonas, pageNumber, pageSize); return(View(model)); } else { ViewBag.idPersona = new SelectList(tablaGeneralBLL.Consulta("Persona", "tipo"), "idTablaGeneral", "descripcion"); ViewBag.Cedula = String.IsNullOrEmpty(sortOrder) ? "cedulades" : ""; ViewBag.NombreCompleto = sortOrder == "NombreCompleto" ? "nombrecomdes" : "NombreCompleto"; var personas = from s in personaBll.Find(x => search == null && x.idTipo == 1) select s; switch (sortOrder) { case "cedulades": personas = personas.OrderByDescending(s => s.cedula); break; case "nombrecomdes": personas = personas.OrderByDescending(s => s.nombreCompleto); break; case "NombreCompleto": personas = personas.OrderBy(s => s.nombreCompleto); break; default: personas = personas.OrderBy(s => s.cedula); break; } List <Persona> listaPersonas = personas.ToList(); foreach (Persona persona in listaPersonas) { tablaGeneralBLL = new TablaGeneralBLLImpl(); persona.TablaGeneral = tablaGeneralBLL.Get(persona.idTipo); //TablaGeneral es el {get;set} para poder traer idTipo de tabla general } PagedList <Persona> model = new PagedList <Persona>(listaPersonas, pageNumber, pageSize); return(View(model)); } }
public ActionResult Index(string option, string search, string currentFilter, string sortOrder, int?page) { try { tablaGeneralBLL = new TablaGeneralBLLImpl(); personaBLL = new PersonasBLLImpl(); usuarioBLL = new UsuarioBLLImpl(); casoBLL = new CasoBLLImpl(); } catch (Exception ex) { ex = new Exception(); return(View()); } ViewBag.CurrentSort = sortOrder; if (search != null) { page = 1; } else { search = currentFilter; } ViewBag.CurrentFilter = search; int pageSize = 4; int pageNumber = (page ?? 1); if (option == "Número de Caso") { ViewBag.idTipo = new SelectList(tablaGeneralBLL.Consulta("Casos", "tipo"), "idTablaGeneral", "descripcion"); List <Caso> listaCaso = casoBLL.Find(x => x.numeroCaso == 1 && x.idTipo == 20 || search == null).ToList(); PagedList <Caso> model = new PagedList <Caso>(listaCaso, pageNumber, pageSize); return(View(model.ToPagedList(pageNumber, pageSize))); } else if (option == "Materia") { ViewBag.idTipo = new SelectList(tablaGeneralBLL.Consulta("Casos", "tipo"), "idTablaGeneral", "descripcion"); List <Caso> listaCaso = casoBLL.Find(x => x.materia == search && x.idTipo == 20 || search == null).ToList(); PagedList <Caso> model = new PagedList <Caso>(listaCaso, pageNumber, pageSize); return(View(model)); } else if (option == "Descripción") { ViewBag.idTipo = new SelectList(tablaGeneralBLL.Consulta("Casos", "tipo"), "idTablaGeneral", "descripcion"); List <Caso> listaCaso = casoBLL.Find(x => x.descripcion == search && x.idTipo == 20 || search == null).ToList(); PagedList <Caso> model = new PagedList <Caso>(listaCaso, pageNumber, pageSize); return(View(model)); } else if (option == "Observación") { ViewBag.idTipo = new SelectList(tablaGeneralBLL.Consulta("Casos", "tipo"), "idTablaGeneral", "descripcion"); List <Caso> listaCaso = casoBLL.Find(x => x.observacion == search && x.idTipo == 20 || search == null).ToList(); PagedList <Caso> model = new PagedList <Caso>(listaCaso, pageNumber, pageSize); return(View(model)); } else { ViewBag.idTipo = new SelectList(tablaGeneralBLL.Consulta("Casos", "tipo"), "idTablaGeneral", "descripcion"); ViewBag.NumeroCaso = String.IsNullOrEmpty(sortOrder) ? "CasoDes" : ""; var casos = from s in casoBLL.Find(x => search == null && x.idTipo == 20) select s; switch (sortOrder) { case "CasoDes": casos = casos.OrderByDescending(s => s.numeroCaso); break; default: casos = casos.OrderBy(s => s.numeroCaso); break; } List <Caso> listacasos = casos.ToList(); foreach (Caso caso in listacasos) { tablaGeneralBLL = new TablaGeneralBLLImpl(); personaBLL = new PersonasBLLImpl(); usuarioBLL = new UsuarioBLLImpl(); caso.Persona = personaBLL.Get(caso.idPersona); caso.Usuario = usuarioBLL.Get(caso.idUsuario); caso.TablaGeneral = tablaGeneralBLL.Get(caso.idEstado); caso.TablaGeneral1 = tablaGeneralBLL.Get(caso.idTipo); caso.TablaGeneral2 = tablaGeneralBLL.Get(caso.tipoLitigante); } PagedList <Caso> model = new PagedList <Caso>(listacasos, pageNumber, pageSize); return(View(model)); } }
public ActionResult TablaDocumentos(string option, string search, string currentFilter, string sortOrder, int salent, int?page) { try { tablaGeneralBLL = new TablaGeneralBLLImpl(); documentoBll = new DocumentoBLLImpl(); } catch (Exception) { return(View()); } List <Documento> listaDocumentos; if (salent == 1) { listaDocumentos = documentoBll.listaEntradas(); } else { listaDocumentos = documentoBll.listaSalidas(); } foreach (Documento documento in listaDocumentos) { tablaGeneralBLL = new TablaGeneralBLLImpl(); documento.TablaGeneral = tablaGeneralBLL.Get(documento.idOrigen); documento.TablaGeneral3 = tablaGeneralBLL.Get(documento.tipoOrigen); documento.TablaGeneral2 = tablaGeneralBLL.Get(documento.idOrigen); if (documento.idEstado.HasValue) { int i = (int)(documento.idEstado); documento.TablaGeneral1 = tablaGeneralBLL.Get(i); } } ViewBag.CurrentSort = sortOrder; if (search != null) { page = 1; } else { search = currentFilter; } ViewBag.CurrentFilter = search; int pageSize = 4; int pageNumber = (page ?? 1); ViewBag.idTipo = new SelectList(tablaGeneralBLL.Consulta("Documentos", "tipo"), "idTablaGeneral", "descripcion"); ViewBag.NumeroOficio = String.IsNullOrEmpty(sortOrder) ? "numerodocdes" : ""; ViewBag.Ingreso = sortOrder == "Ingreso" ? "IngresoDes" : "Ingreso"; ViewBag.FechaDeIngreso = sortOrder == "Fecha" ? "FechaDes" : "Fecha"; var documentos = from s in documentoBll.Find(x => search == null && x.idTipo == 3 || x.idTipo == 23) select s; switch (sortOrder) { case "numerodocdes": documentos = documentos.OrderByDescending(s => s.numeroDocumento); break; case "Fecha": documentos = documentos.OrderBy(s => s.fecha); break; case "FechaDes": documentos = documentos.OrderByDescending(s => s.fecha); break; case "Ingreso": documentos = documentos.OrderBy(s => s.numeroIngreso); break; case "IngresoDes": documentos = documentos.OrderByDescending(s => s.numeroIngreso); break; default: documentos = documentos.OrderBy(s => s.numeroDocumento); break; } PagedList <Documento> model = new PagedList <Documento>(listaDocumentos, pageNumber, pageSize); return(View(model)); }
public ActionResult Index(string option, string search, int page = 1, int pageSize = 4) { try { tablaGeneralBLL = new TablaGeneralBLLImpl(); casoBLL = new CasoBLLImpl(); personaBLL = new PersonasBLLImpl(); usuarioBLL = new UsuarioBLLImpl(); } catch (Exception ex) { } if (option == "Materia") { List <Caso> listacaso = casoBLL.Find(x => x.materia == search && x.idCaso == 3 || search == null).ToList(); PagedList <Caso> model = new PagedList <Caso>(listacaso, page, pageSize); return(View(model)); } else if (option == "Abogado") { List <Caso> listacaso = casoBLL.Find(x => x.numeroCaso == Int32.Parse(search) && x.idCaso == 3 || search == null).ToList(); PagedList <Caso> model = new PagedList <Caso>(listacaso, page, pageSize); return(View(model)); } else if (option == "Tipo de litigante") { List <Caso> listacaso = casoBLL.Find(x => x.tipoLitigante == Int32.Parse(search) && x.idCaso == 3 || search == null).ToList(); PagedList <Caso> model = new PagedList <Caso>(listacaso, page, pageSize); return(View(model)); } else if (option == "Número de caso") { List <Caso> listacaso = casoBLL.Find(x => x.numeroCaso == Int32.Parse(search) && x.idCaso == 3 || search == null).ToList(); PagedList <Caso> model = new PagedList <Caso>(listacaso, page, pageSize); return(View(model)); } else if (option == "Estado") { List <Caso> listacaso = casoBLL.Find(x => x.idEstado == Int32.Parse(search) && x.idCaso == 3 || search == null).ToList(); PagedList <Caso> model = new PagedList <Caso>(listacaso, page, pageSize); return(View(model)); } else { ViewBag.tipoLitigante = new SelectList(tablaGeneralBLL.Consulta("Casos", "tipoLitigio"), "idTablaGeneral", "descripcion"); ViewBag.idUsuario = new SelectList(usuarioBLL.Consulta(), "idUsuario", "nombre"); ViewBag.idTipo = new SelectList(tablaGeneralBLL.Consulta("Casos", "tipo"), "idTablaGeneral", "descripcion"); List <Caso> listacaso = casoBLL.Find(x => search == null && x.idTipo == 19).ToList(); foreach (Caso caso in listacaso) { caso.Persona = personaBLL.Get(caso.idPersona); caso.Usuario = usuarioBLL.Get(caso.idUsuario); caso.TablaGeneral = tablaGeneralBLL.Get(caso.idEstado); caso.TablaGeneral1 = tablaGeneralBLL.Get(caso.idTipo); caso.TablaGeneral2 = tablaGeneralBLL.Get(caso.tipoLitigante); } PagedList <Caso> model = new PagedList <Caso>(listacaso, page, pageSize); List <Caso> documento = casoBLL.GetAll(); return(View(model)); } }
public ActionResult Index(string option, string search, string currentFilter, string sortOrder, int?page) { try { tablaGeneralBLL = new TablaGeneralBLLImpl(); documentoBll = new DocumentoBLLImpl(); } catch (Exception) { return(View()); } ViewBag.CurrentSort = sortOrder; if (search != null) { page = 1; } else { search = currentFilter; } ViewBag.CurrentFilter = search; int pageSize = 4; int pageNumber = (page ?? 1); if (option == "Número de oficio") { ViewBag.idTipo = new SelectList(tablaGeneralBLL.Consulta("Documentos", "tipo"), "idTablaGeneral", "descripcion"); List <Documento> listaDocumentos = documentoBll.Find(x => x.numeroDocumento == search && x.idTipo == 3 || search == null).ToList(); PagedList <Documento> model = new PagedList <Documento>(listaDocumentos, pageNumber, pageSize); return(View(model.ToPagedList(pageNumber, pageSize))); } else if (option == "Número de Ingreso") { ViewBag.idTipo = new SelectList(tablaGeneralBLL.Consulta("Documentos", "tipo"), "idTablaGeneral", "descripcion"); List <Documento> listaDocumentos = documentoBll.Find(x => x.numeroIngreso == search && x.idTipo == 3 || search == null).ToList(); PagedList <Documento> model = new PagedList <Documento>(listaDocumentos, pageNumber, pageSize); return(View(model)); } if (option == "Asunto") { ViewBag.idTipo = new SelectList(tablaGeneralBLL.Consulta("Documentos", "tipo"), "idTablaGeneral", "descripcion"); List <Documento> listaDocumentos = documentoBll.Find(x => x.asunto == search && x.idTipo == 3 || search == null && x.idTipo == 3).ToList(); PagedList <Documento> model = new PagedList <Documento>(listaDocumentos, pageNumber, pageSize); return(View(model)); } else { ViewBag.idTipo = new SelectList(tablaGeneralBLL.Consulta("Documentos", "tipo"), "idTablaGeneral", "descripcion"); ViewBag.NumeroOficio = String.IsNullOrEmpty(sortOrder) ? "numerodocdes" : ""; ViewBag.Ingreso = sortOrder == "Ingreso" ? "IngresoDes" : "Ingreso"; ViewBag.FechaDeIngreso = sortOrder == "Fecha" ? "FechaDes" : "Fecha"; var documentos = from s in documentoBll.Find(x => search == null && x.idTipo == 3 || x.idTipo == 23) select s; switch (sortOrder) { case "numerodocdes": documentos = documentos.OrderByDescending(s => s.numeroDocumento); break; case "Fecha": documentos = documentos.OrderBy(s => s.fecha); break; case "FechaDes": documentos = documentos.OrderByDescending(s => s.fecha); break; case "Ingreso": documentos = documentos.OrderBy(s => s.numeroIngreso); break; case "IngresoDes": documentos = documentos.OrderByDescending(s => s.numeroIngreso); break; default: documentos = documentos.OrderBy(s => s.numeroDocumento); break; } List <Documento> listaDocumentos = documentos.ToList(); foreach (Documento documento in listaDocumentos) { tablaGeneralBLL = new TablaGeneralBLLImpl(); documento.TablaGeneral = tablaGeneralBLL.Get(documento.idOrigen); documento.TablaGeneral3 = tablaGeneralBLL.Get(documento.tipoOrigen); documento.TablaGeneral2 = tablaGeneralBLL.Get(documento.idOrigen); if (documento.idEstado.HasValue) { int i = (int)(documento.idEstado); documento.TablaGeneral1 = tablaGeneralBLL.Get(i); } } //var m = documentoBll.listaSalidas(); //var m0 = documentoBll.listaEntradas(); //var m1 = documentoBll.consultaNumeroIngreso(); //var m2 = documentoBll.generaNumIngreso(); //var m3 = documentoBll.consultaNumeroIngreso(); //var z = documentoBll.getNomenclatura("Servicios Informaticos"); PagedList <Documento> model = new PagedList <Documento>(listaDocumentos, pageNumber, pageSize); return(View(model)); } }