// GET: Solicitud
        public ActionResult Index(string solEst, string solDesc, string solEmp, string solSol, string solSuc, string solNum)
        {
            //Buscar estados posibles para una solicitud de venta y las pasa a la vista
            ViewBag.solEst = new SelectList(_service.EstadosSolVentas());
            PopulateTipoSolicitanteDropDownList();
            //var solicitudes = db.Solicituds
            //                    .Include(c => c.Solicitud_Cliente)
            //                    .Include(c => c.Solicitud_Prospecto)
            //                    .Include(c => c.Solicitud_Empleado)
            //                    .Include(c => c.Solicitud_Paginas)
            //                    .Include(c => c.Solicitud_Ordenes)
            //                    .Include(c => c.Solicitud_LineasSolicitud);
            //return View(db.Solicituds.ToList());
            //return View(solicitudes.ToList());

            SolicitudStatus estSol = new SolicitudStatus();

            Enum.TryParse(solEst, out estSol);

            //SolicitudStatus MyStatus = new SolicitudStatus();
            //SolicitudStatus MyStatus = (SolicitudStatus)Enum.Parse(typeof(SolicitudStatus), solventaestado, true);
            // Filter para la lista de Solicitudes de venta si hay algun campo de filtro con informacion
            if (!String.IsNullOrEmpty(solDesc) || !string.IsNullOrEmpty(solEst) ||
                !String.IsNullOrEmpty(solEmp) || !string.IsNullOrEmpty(solSol) ||
                !String.IsNullOrEmpty(solSuc) || !string.IsNullOrEmpty(solNum)
                )
            {
                var solicitudes_filtradas = _service.FilterSolVentas(solDesc, estSol, solEst, solEmp, solSol, solSuc, solNum);

                //return View(_service.FilterSolVentas(searchString, solventaestado));
                return(View(solicitudes_filtradas));
            }

            return(View(_service.ListSolVentas()));
        }
예제 #2
0
        public IQueryable <Solicitud> FilterSolVentas(string solDesc, SolicitudStatus estSol, string solEst, string solEmp, string solSol, string solSuc, string solNum)
        {
            //var solventas = from s in _entities.Solicituds select s;
            var solventas = _entities.Solicituds
                            .Include(c => c.Solicitud_Cliente)
                            .Include(c => c.Solicitud_Prospecto)
                            .Include(c => c.Solicitud_Empleado)
                            .Include(c => c.Solicitud_Paginas.Select(p => p.Pagina_Orden))
                            .Include(c => c.Solicitud_Ordenes)
                            .Include(c => c.Solicitud_Sucursal.Sucursal_Empresa)
                            .Include(c => c.Solicitud_LineasSolicitud)
                            .Include(c => c.Solicitud_Pagos.Select(p => p.Pago_Cuenta));

            if (!String.IsNullOrEmpty(solDesc))
            {
                solventas = solventas.Where(s => s.SolicitudDescripcion.Contains(solDesc));
            }

            //if (!string.IsNullOrEmpty(Functions.GetEnumDescription(solventaestado)))
            if (!string.IsNullOrEmpty(solEst))
            {
                solventas = solventas.Where(x => x.SolicitudEstado == estSol);
            }

            if (!string.IsNullOrEmpty(solEmp))
            {
                solventas = solventas.Where(x => x.Solicitud_Empleado.PersonaNombre.Contains(solEmp) || x.Solicitud_Empleado.PersonaApellido.Contains(solEmp));
            }

            if (!string.IsNullOrEmpty(solSol))
            {
                solventas = solventas.Where(x => x.Solicitud_Cliente.PersonaNombre.Contains(solSol) || x.Solicitud_Prospecto.PersonaNombre.Contains(solSol) ||
                                            x.Solicitud_Cliente.PersonaApellido.Contains(solSol) || x.Solicitud_Prospecto.PersonaApellido.Contains(solSol));
            }

            if (!string.IsNullOrEmpty(solSuc))
            {
                solventas = solventas.Where(x => x.Solicitud_Sucursal.SucursalNombre.Contains(solSuc));
            }

            if (!string.IsNullOrEmpty(solNum))
            {
                solventas = solventas.Where(x => x.SolicitudNum == Int32.Parse(solNum));
            }

            return(solventas);
        }
예제 #3
0
 public IQueryable <Solicitud> FilterSolVentas(string solDesc, SolicitudStatus estSol, string solEst, string solEmp, string solSol, string solSuc, string solNum)
 {
     return(_repository.FilterSolVentas(solDesc, estSol, solEst, solEmp, solSol, solSuc, solNum));
 }