Beispiel #1
0
 // GET: Candidato
 public ActionResult Index(string estado, string puesto, string fecha_ini, string fecha_fin, string filtro_por, int?page)
 {
     try
     {
         if (fecha_ini == null)
         {
             fecha_ini = DateTime.Now.AddDays(-90).ToString("yyyy-MM-dd");
             fecha_fin = DateTime.Now.ToString("yyyy-MM-dd");
         }
         if (string.IsNullOrEmpty(puesto))
         {
             puesto = "0";
         }
         ViewBag.estado     = estado;
         ViewBag.puesto     = puesto;
         ViewBag.fecha_ini  = fecha_ini;
         ViewBag.fecha_fin  = fecha_fin;
         ViewBag.filtro_por = filtro_por;
         int paginaActual = (page ?? 1);
         ViewBag.puestos = new SelectList(ListarPuestos(), "Id", "Nombre");
         using (WSCandidato.ICandidatoServiceChannel wsCliente = ObtenerServicioCandidato())
             return(View(new PagedList.PagedList <CandidatoModel>(wsCliente.Listar(new CandidatoDTO
             {
                 FechaCreacion = DateTime.Parse(fecha_ini),
                 FechaModificacion = DateTime.Parse(fecha_fin).AddDays(1),
                 Estado = estado,
                 IdPuesto = int.Parse(puesto),
                 Observacion = filtro_por == "" ? null : filtro_por
             }).AsModel(), paginaActual, 5)));
     }catch (Exception ex)
     {
         ModelState.AddModelError(string.Empty, ex.Message);
         return(View(new PagedList.PagedList <CandidatoModel>(new List <CandidatoModel>(), 1, 1)));
     }
 }
Beispiel #2
0
 public JsonResult CandidatoPostulante(string estado, int puesto, string filtro)
 {
     try
     {
         using (WSCandidato.ICandidatoServiceChannel wsCliente = ObtenerServicioCandidato())
             return(Json(new { Success = true, Message = "Correcto", Data = wsCliente.Listar(new CandidatoDTO {
                     Estado = estado, IdPuesto = puesto, Observacion = filtro
                 }).AsModel() }, JsonRequestBehavior.AllowGet));
     }
     catch (Exception ex)
     {
         return(Json(new { Success = false, Message = ex.Message, Data = "" }, JsonRequestBehavior.AllowGet));
     }
 }