public bool Modificar(int idS, Postulante ganador)
        {
            if (ganador == null)
            {
                return(false);
            }

            using (Context.AdjudicacionContext db = new Context.AdjudicacionContext())
            {
                try
                {
                    db.Postulantes.Attach(ganador);
                    var r = db.Sorteos.Find(idS);
                    r.Realizado = true;
                    r.Ganador   = ganador;
                    var s = db.Sorteos.ToList();
                    foreach (Sorteo unS in s)
                    {
                        unS.PostulantesIns.Remove(ganador);
                    }
                    var v = db.Viviendas.Find(r.ViviendaId);
                    v.Estado = "Sorteada";
                    db.SaveChanges();
                    return(true);
                }
                catch (Exception ex)
                {
                    Debug.WriteLine(ex.Message + "Otro error");
                    return(false);
                }
            }
            return(false);
        }
 public bool InscripcionASorteoPostulante(string idPostulante, int idSorteo)
 {
     using (Context.AdjudicacionContext db = new Context.AdjudicacionContext())
     {
         try
         {
             if (db.Sorteos.Where(c => c.Ganador.Cedula == idPostulante).FirstOrDefault() != null)
             {
                 return(false);
             }
             else
             {
                 Sorteo     unS = db.Sorteos.Find(idSorteo);
                 Postulante unP = db.Postulantes.Find(idPostulante);
                 unS.PostulantesIns.Add(unP);
                 unP.SorteosIns.Add(unS);
                 db.SaveChanges();
                 return(true);
             }
         }
         catch (Exception ex)
         {
             Debug.WriteLine(ex.Message + "Otro error");
             return(false);
         }
     }
 }
        public async Task <IActionResult> Grabar(string nombre, string apellido, string email, string password,
                                                 DateTime fechaNacimiento, string genero, string telefono, string zipCode, bool tieneEstudio, bool tieneExperiencia,
                                                 string estado)
        {
            var postulante = new Postulante()
            {
                Nombre           = nombre,
                Apellido         = apellido,
                Email            = email,
                Password         = password,
                FechaNacimiento  = fechaNacimiento,
                Genero           = genero,
                Telefono         = telefono,
                ZipCode          = zipCode,
                TieneEstudio     = tieneEstudio,
                TieneExperiencia = tieneExperiencia,
                Estado           = estado
            };

            bool exito;

            exito = await CandidatoRepository.Insertar(postulante);

            return(Json(exito));
        }
Example #4
0
 private void Tabla_CurrentCellChanged(object sender, EventArgs e)
 {
     if (!status && ((DataGrid)sender).CurrentCell.Item is Postulante)
     {
         p = ((DataGrid)sender).CurrentCell.Item as Postulante;
     }
 }
Example #5
0
        public ListarBeneficiados()
        {
            InitializeComponent();
            Postulante post = new Postulante();

            gvListado.ItemsSource = post.ReadAll();
        }
Example #6
0
        public frmVisualizarPostulantes()
        {
            InitializeComponent();
            postulantes = new BindingList <Postulante>();

            Postulante     p1  = null;
            Colegio        c1  = new Colegio();
            List <Colegio> lc1 = new List <Colegio>();

            lc1.Add(c1);
            p1 = new Postulante(Convert.ToDateTime("01/01/2018"), 1, 21, null, "5to", 3434245, 231, null);

            Postulante     p2  = null;
            Colegio        c2  = new Colegio();
            List <Colegio> lc2 = new List <Colegio>();

            lc2.Add(c2);

            p2 = new Postulante(Convert.ToDateTime("02/03/2018"), 4, 22, null, "5to", 322432, 12, null);

            postulantes.Add(p1);
            postulantes.Add(p2);

            dgv.DataSource = postulantes;
        }
Example #7
0
        public ActionResult RealizarSorteo(int idS)
        {
            if (Session["Tipo"] == null || Session["Tipo"].ToString() != "Jefe")
            {
                return(new HttpStatusCodeResult(HttpStatusCode.Forbidden));
            }
            IEnumerable <Postulante> postulantes = repP.BuscarPostulantesByIdSorteo(idS);

            if (postulantes != null && postulantes.Count() > 0)
            {
                var        random    = new Random();
                var        resultado = random.Next(0, postulantes.Count() - 1);
                Postulante ganador   = postulantes.ElementAt(resultado);
                if (ganador != null)
                {
                    if (repS.Modificar(idS, ganador))
                    {
                        ViewBag.Mensaje = "Se realizó el sorteo con exito! El ganador es el postulante: " + ganador.Nombre;
                        return(View());
                    }
                    ViewBag.Mensaje = "No se realizó el sorteo";
                    return(View());
                }
                ViewBag.Mensaje = "No se realizó el sorteo";
                return(View());
            }
            ViewBag.Mensaje = "No se realizó el sorteo, no hay postulantes inscriptos al sorteo";
            return(View());
        }
Example #8
0
        public ActionResult Form(Postulante model)
        {
            //MODEL IS VALID
            if (ModelState.IsValid)
            {
                string subject = string.Empty;
                if (model.cv_job_area != null)
                {
                    subject  = model.cv_job_area[0] + " - ";
                    subject += model.cv_salary;
                    subject += (model.cv_applyto.Equals("OTHER")) ? " (MULTIPLE)" : "";
                }
                else
                {
                    subject  = "No Job Area - ";
                    subject += model.cv_salary;
                    subject += (model.cv_applyto.Equals("OTHER")) ? " (MULTIPLE)" : "";
                }

                string body = ParseBody(model);


                MailHelper.SendMail(CountryHelper.getAddress(model.cv_applyto), body, subject, model.cv_file);

                return(this.RedirectToAction("Submit", "Upload", model.cv_name));
            }

            //INVALID MODEL
            return(View(model));
        }
 public RequerimientoPostPage(Postulante modelo)
 {
     InitializeComponent();
     idPost     = modelo.idPostulante;
     postulante = modelo;
     ListaRequereimiento();
 }
Example #10
0
 public ActionResult Form(Postulante model)
 {
     if (ModelState.IsValid)
     {
         ViewBag.cv_name = model.cv_name;
         return(this.RedirectToAction("Submit"));
     }
     return(View(model));
 }
Example #11
0
 private void Postulante_List_ItemSelected(object sender, SelectedItemChangedEventArgs e)
 {
     if (e.SelectedItem != null)
     {
         Postulante modelo = (Postulante)e.SelectedItem;
         //Navigation.PushAsync(new PostulantesPregPage(modelo));
         Navigation.PushAsync(new RequerimientoPostPage(modelo));
     }
 }
Example #12
0
        public string ParseBody(Postulante model)
        {
            string body = string.Empty;

            using (StreamReader reader = new StreamReader(Server.MapPath("~/Templates/emailTemplate_" + CountryHelper.getLangForCountry(model.cv_applyto) + ".html")))
            {
                body = reader.ReadToEnd();
            }
            body = body.Replace("{cv_name}", model.cv_name);
            body = body.Replace("{cv_lastname}", model.cv_lastname);
            body = body.Replace("{cv_dateofbirth}", model.cv_dateofbirth.Day + "/" + model.cv_dateofbirth.Month + "/" + model.cv_dateofbirth.Year);
            body = body.Replace("{cv_email}", model.cv_email);
            body = body.Replace("{cv_country}", model.cv_country);
            body = body.Replace("{cv_city}", model.cv_city);
            body = body.Replace("{cv_degree}", model.cv_degree);
            body = body.Replace("{cv_english}", model.cv_english);
            body = body.Replace("{cv_howto}", model.cv_howto);
            body = body.Replace("{cv_availability}", model.cv_availability);

            if (model.cv_job_area != null)
            {
                string fillUp = "";

                fillUp += "<ol>";

                for (int i = 0; i < model.cv_job_area.Length; i++)
                {
                    fillUp += "<li>" + model.cv_job_area[i] + "</li>";
                }

                fillUp += "</ol>";

                body = body.Replace("{cv_job_area}", fillUp);
            }
            else
            {
                body = body.Replace("{cv_job_area}", "");
            }

            string travel_disp;

            if (bool.Parse(model.cv_travel_disp))
            {
                travel_disp = "Si";
            }
            else
            {
                travel_disp = "No";
            }
            body = body.Replace("{cv_travel_disp}", travel_disp);
            body = body.Replace("{cv_otherinfo}", model.cv_otherinfo);
            body = body.Replace("{cv_salary}", model.cv_salary);

            return(body);
        }
        // GET: api/Postulante/{id}
        public IHttpActionResult Get(int id)
        {
            Postulante objPostulante = new Postulante();

            //GettingListOfListaDePregDet : Este Objeto almacenará la ListaDePregDet
            objPostulante = GetPostulanteDA.listPostulanteByIdPos(id);

            var resultado = objPostulante;

            return(Json(resultado));
        }
Example #14
0
 public Postulante Crear(Postulante postulanteAcrear)
 {
     try
     {
         return(PostulanteDAO.Crear(postulanteAcrear));
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
Example #15
0
        // POST: api/Postulante

        public IHttpActionResult Post([FromBody] Postulante unPostulante)
        {
            if (repo.AddPostulante(unPostulante))
            {
                return(Created("SE CREO", unPostulante));
            }
            else
            {
                return(InternalServerError());
            }
        }
Example #16
0
 public Postulante Modificar(Postulante postulanteAmodificar)
 {
     try
     {
         return(PostulanteDAO.Modificar(postulanteAmodificar));
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
Example #17
0
        private void btnAprobar_Click(object sender, EventArgs e)
        {
            Postulante aux = new Postulante();

            //ID = aux.VerIDPostulante(lblNombre.Text, lblApellido.Text);
            aux.ModificarEstadoPostulante(postulanteID, necesidad, 4);

            lblNombre.Text              = "__________";
            lblApellido.Text            = "__________";
            txtCurriculum.Text          = "";
            dgrVerPropuestos.DataSource = new Necesidad().VerPropuestosDeNecesidad(necesidad);
        }
        public PostulantesPregPage(Requerimiento reque, Postulante modelo)
        {
            InitializeComponent();
            url = Servicio.IP + "pregunta/listPregDetByPost/" + modelo.idPostulante;
            ListaPreguntas();
            BindingContext  = modelo;
            idPostulantes   = modelo.idPostulante;
            idRequerimiento = modelo.idRequerimiento;

            requerimiento = reque;
            postulantes   = modelo;
        }
Example #19
0
        public static Postulante logeoPostulante(string correo, string codDePostulanteGenerado)
        {
            Postulante    rpts = new Postulante();
            SqlConnection cn   = new SqlConnection(Conexion.cn);

            try
            {
                DynamicParameters dypa = new DynamicParameters();
                dypa.Add("@correo", correo);
                dypa.Add("@codPos", codDePostulanteGenerado);
                rpts = cn.QueryFirst <Postulante>("xamApp.xam_LoginPostulante", dypa, commandType: CommandType.StoredProcedure);

                if (rpts.nombre == null)
                {
                    rpts.nombre = "No existe";
                }
            }
            catch (Exception e)
            {
                #region Imprimiendo Log
                string error       = e.Message;
                string carpeta_Log = ConfigurationManager.AppSettings["ruta_log"];

                StreamWriter sw = File.AppendText(carpeta_Log);

                DateTime Hoy = DateTime.Now;

                var    minuto    = Hoy.Minute;
                var    hora      = Hoy.Hour;
                string fecha_Hoy = Hoy.ToString("dd-MM-yyyy");

                sw.WriteLine("---------------------------------");

                sw.WriteLine("EXCEPTION - Date: " + fecha_Hoy + " " + hora + ":" + minuto + ")");

                sw.WriteLine("\t From LoginBO.logeoPostulante(" + correo + "," + codDePostulanteGenerado + ");");

                sw.WriteLine("\t Message Error: " + error);

                sw.WriteLine("---------------------------------");

                sw.Close();
                #endregion
                rpts        = new Postulante();
                rpts.nombre = "Error: " + e;
            }
            finally
            {
                cn.Close();
                cn.Dispose();
            }
            return(rpts);
        }
        public static Postulante listPostulanteByIdPos(int idPostulante)
        {
            Postulante listPostulante = new Postulante();

            SqlConnection cn = new SqlConnection(Conexion.cn);

            try
            {
                DynamicParameters dypa = new DynamicParameters();
                dypa.Add("@idPostulante", idPostulante);
                listPostulante = cn.QueryFirst <Postulante>("xamApp.xam_sp_listPostulanteByIdPos", dypa, commandType: CommandType.StoredProcedure);
            }
            catch (Exception e)
            {
                //listPostulanteByIdPos
                #region Imprimiendo Log
                string error       = e.Message;
                string carpeta_Log = ConfigurationManager.AppSettings["ruta_log"];

                StreamWriter sw = File.AppendText(carpeta_Log);

                DateTime Hoy = DateTime.Now;

                var    minuto    = Hoy.Minute;
                var    hora      = Hoy.Hour;
                string fecha_Hoy = Hoy.ToString("dd-MM-yyyy");

                sw.WriteLine("---------------------------------");

                sw.WriteLine("EXCEPTION - Date: " + fecha_Hoy + " " + hora + ":" + minuto + ")");

                sw.WriteLine("\t From PostulanteBO.listPostulanteByIdPos(idPostulante" + idPostulante + ");");

                sw.WriteLine("\t Message Error: " + error);

                sw.WriteLine("---------------------------------");

                sw.Close();
                #endregion

                listPostulante = new Postulante();
            }
            finally
            {
                cn.Close();
                cn.Dispose();
            }

            return(listPostulante);
        }
Example #21
0
        private void BtnAgregar_Click(object sender, RoutedEventArgs e)
        {
            bool b = true;

            //primero se insertan los objetos.
            if (Convert.ToBoolean(chkConyuge.IsChecked))
            {
                Conyuge c = new Conyuge
                {
                    Rut_conyuge     = txtRutC.Text,
                    Nombre_completo = txtNombreC.Text
                };
                b = con.Insert(c, false);
            }
            if (!b)
            {
                //error
                return;
            }
            Postulante p = new Postulante
            {
                Rut               = txtRut.Text,
                Nombre_completo   = txtNombre.Text + " " + txtApellido.Text,
                Nacimiento        = dtNacimiento.DisplayDate,
                Nacionalidad      = ((ComboBoxItem)cbNacionalidad.SelectedValue).Content.ToString(),
                Titulo            = txtTitulo.Text.Trim().Equals("") ? "Sin titulo profesional" : txtTitulo.Text,
                Cargas_familiares = Int32.Parse(txtCargas.Text),
                P_indigena        = Convert.ToBoolean(chkIndigena.IsChecked),
                Fono_c            = Int32.Parse(txtFonoC.Text),
                Fono_t            = Int32.Parse(txtFonoT.Text),
                Fono_m            = Int32.Parse(txtFonoM.Text),
                Email             = txtEmail.Text,
                Direccion         = txtDireccion.Text,
                Codigo_postal     = Int32.Parse(txtPostal.Text),
                Rut_conyuge       = Convert.ToBoolean(chkConyuge.IsChecked)?txtRutC.Text:null
            };

            b = con.Insert(p, false);
            if (!b)
            {
                //error
                return;
            }
            //luego se retorna a la pagina anterior
            ((Postulantes)pagina).Refresh();
            window.Back();
        }
Example #22
0
 public bool AddPostulante(Postulante P)
 {
     if (P.Validar() && P != null)
     {
         using (Context.AdjudicacionContext db = new Context.AdjudicacionContext())
         {
             P.Usuario.Rol = "Postulante";
             db.Postulantes.Add(P);
             db.SaveChanges();
             return(true);
         }
     }
     else
     {
         return(false);
     }
 }
Example #23
0
        public IHttpActionResult loginPostulante(string correo, string codDePostGen)
        {
            Postulante postulante = new Postulante();

            try
            {
                #region Validando
                postulante = getLogin.logeoPostulante(correo, codDePostGen);
                #endregion
            }
            catch (Exception e)
            {
                var rsp = "error: " + e;
                return(Json(rsp));
            }
            return(Json(new { postulante.idRequerimiento, postulante.idPostulante, postulante.nombre, postulante.flagEstadoRespuestas }));
        }
Example #24
0
        public static async Task <bool> Insertar(Postulante postulante)
        {
            bool exito = true;

            var json = JsonConvert.SerializeObject(postulante);
            var data = new StringContent(json, Encoding.UTF8, "application/json");

            using var httpClient = new HttpClient();
            using var response   = await httpClient.PostAsync("http://localhost:19112/api/Postulante/PostPostulante", data);

            string apiResponse = await response.Content.ReadAsStringAsync();

            var postulantes = JsonConvert.DeserializeObject <Postulante>(apiResponse);

            if (postulantes == null)
            {
                exito = false;
            }

            return(exito);
        }
 public ActionResult Create(Postulante unPostulante)
 {
     if (unPostulante != null)
     {
         var tareaPost = cliente.PostAsJsonAsync(postulanteUri, unPostulante);
         var result    = tareaPost.Result;
         if (result.IsSuccessStatusCode)
         {
             return(RedirectToAction("Login", "Usuario"));
         }
         else
         {
             ViewBag.Mensaje = "No quedaste registrado, verifica que sean datos validos.";
             return(View(unPostulante));
         }
     }
     else
     {
         TempData["ResultadoOperacion"] = "Ups! Verifique los datos";
         return(View(unPostulante));
     }
 }
        public DetallePuntaje(Postulacion origen)
        {
            InitializeComponent();

            try
            {
                if (txtBuscarPostulante.Text != null)
                {
                    Cone = Oracle.abrirConexion();

                    OracleCommand cmd = new OracleCommand("FN_LISTAR_TODO", Cone);
                    cmd.CommandType = CommandType.StoredProcedure;
                    List <Postulante> listaBeneficiados = new List <Postulante>();


                    OracleParameter copia_cursor = cmd.Parameters.Add("L_TODO", OracleDbType.RefCursor);     // es igual a %rowtype
                    copia_cursor.Direction = ParameterDirection.ReturnValue;

                    OracleParameter rut = new OracleParameter("rut", OracleDbType.Varchar2);
                    rut.Direction = ParameterDirection.Input;
                    rut.Value     = txtBuscarPostulante.Text;

                    cmd.ExecuteNonQuery();

                    OracleDataReader info_leida = ((OracleRefCursor)copia_cursor.Value).GetDataReader();     //lo parseamos a cursor, por los distintos tipo de datos que contiene
                    while (info_leida.Read())
                    {
                        //rescatamos
                        Postulante pos = new Postulante();
                        pos.Rut            = info_leida.GetString(0);
                        pos.Nombre         = info_leida.GetString(1);
                        pos.Edad           = info_leida.GetInt32(2);
                        pos.PuntjEdad      = info_leida.GetInt32(3);
                        pos.CantCargas     = info_leida.GetInt32(4);
                        pos.PuntjCargas    = info_leida.GetInt32(5);
                        pos.EstadoCivil    = info_leida.GetString(6);
                        pos.PuntjCivil     = info_leida.GetInt32(7);
                        pos.PuebloIndigena = info_leida.GetString(8);
                        pos.PuntjIndigena  = info_leida.GetInt32(9);
                        pos.MontoAhorrado  = info_leida.GetString(10);
                        pos.PuntjAhorro    = info_leida.GetInt32(11);
                        pos.Titulo         = info_leida.GetString(12);
                        pos.PuntjTitulo    = info_leida.GetInt32(13);
                        pos.Region         = info_leida.GetString(14);
                        pos.PuntjRegion    = info_leida.GetInt32(15);
                        pos.TipoVivienda   = info_leida.GetString(16);
                        pos.ValorVivienda  = info_leida.GetString(17);
                        pos.PuntjTotal     = info_leida.GetInt32(18);


                        //agregamos a la lista
                        listaBeneficiados.Add(pos);
                    }

                    gvListarFiltro.ItemsSource = listaBeneficiados;
                    txtAhorro.Text             = pos.PuntjAhorro.ToString();
                    txtCarga.Text       = pos.PuntjCargas.ToString();
                    txtEdad.Text        = pos.PuntjEdad.ToString();
                    txtEstadoCivil.Text = pos.PuntjCivil.ToString();
                    txtIndigena.Text    = pos.PuntjIndigena.ToString();
                    txtRegion.Text      = pos.PuntjRegion.ToString();
                    txtTitulo.Text      = pos.PuntjTitulo.ToString();
                    txtTotal.Text       = pos.PuntjTotal.ToString();
                }
            }
            catch (Exception exa)
            {
                MessageBox.Show("Error!" + exa.Message);
            }
        }
Example #27
0
 private void Tabla_CellEditEnding(object sender, DataGridCellEditEndingEventArgs e)
 {
     p      = ((Postulante)e.Row.Item);
     status = true;
 }
        public ActionResult Modify(FormCollection collection)
        {
            try
            {
                BSolicitudAdmision objSolicitud  = new BSolicitudAdmision();
                BApoderado         objApoderado  = new BApoderado();
                BPostulante        objPostulante = new BPostulante();
                BCitaAdmision      objCita       = new BCitaAdmision();

                if (objPostulante.ListarTodo().Any(v => v.IdPostulante != Convert.ToInt32(collection["CodPostulante"]) && v.NumeroDocumento == collection["NumDocumentoPostulante"]))
                {
                    return(Json(new { success = true, responseText = "Ya existe un postulante con el mismo N° Documento. No se puede crear la solicitud." }, JsonRequestBehavior.AllowGet));
                }
                else if (objPostulante.ListarTodo().Any(v => v.IdPostulante != Convert.ToInt32(collection["CodPostulante"]) && v.Nombre == collection["NombresPostulante"] && v.Apellido == collection["ApellidosPostulante"]))
                {
                    return(Json(new { success = true, responseText = "Ya existe un postulante con los mismos nombres. No se puede crear la solicitud." }, JsonRequestBehavior.AllowGet));
                }
                else if (DateTime.ParseExact(collection["FechaNacimientoPostulante"], "dd/MM/yyyy", System.Globalization.CultureInfo.InvariantCulture).Date < DateTime.Now.AddYears(-20).Date)
                {
                    return(Json(new { success = true, responseText = "Edad del postulante no es admitida." }, JsonRequestBehavior.AllowGet));
                }
                else
                {
                    Apoderado apoderado = new Apoderado()
                    {
                        IdApoderado      = Convert.ToInt32(collection["CodApoderado"]),
                        Nombre           = collection["NombresApoderado"],
                        Apellido         = collection["ApellidosApoderado"],
                        VinculoApoderado = new VinculoApoderado()
                        {
                            IdVinculoApoderado = Convert.ToInt32(collection["CodVinculo"])
                        },
                        TipoDocumento = new TipoDocumento()
                        {
                            IdTipoDocumento = Convert.ToInt32(collection["CodTipoDocumentoApoderado"])
                        },
                        NumeroDocumento = collection["NumDocumentoApoderado"],
                        Ocupacion       = collection["OcupacionApoderado"],
                        Email           = collection["EmailApoderado"],
                        Telefono        = collection["TelefonoApoderado"],
                        Direccion       = collection["DireccionApoderado"]
                    };

                    Postulante postulante = new Postulante()
                    {
                        IdPostulante = Convert.ToInt32(collection["CodPostulante"]),
                        Nombre       = collection["NombresPostulante"],
                        Apellido     = collection["ApellidosPostulante"],
                        Genero       = new Genero()
                        {
                            IdGenero = Convert.ToInt32(collection["CodGenero"])
                        },
                        TipoDocumento = new TipoDocumento()
                        {
                            IdTipoDocumento = Convert.ToInt32(collection["CodTipoDocumentoPostulante"])
                        },
                        NumeroDocumento = collection["NumDocumentoPostulante"],
                        FechaNacimiento = DateTime.ParseExact(collection["FechaNacimientoPostulante"], "dd/MM/yyyy", System.Globalization.CultureInfo.InvariantCulture),
                        LugarNacimiento = collection["LugarNacimientoPostulante"],
                        Ciudad          = new Ciudad()
                        {
                            IdCiudad = Convert.ToInt32(collection["CodCiudad"])
                        },
                        Apoderado = apoderado
                    };

                    SolicitudAdmision solicitud = new SolicitudAdmision()
                    {
                        IdSolicitudAdmision = Convert.ToInt32(collection["CodSolicitudAdmision"]),
                        Postulante          = postulante,
                        Grado = new Grado()
                        {
                            IdGrado = Convert.ToInt32(collection["CodGrado"])
                        },
                        Sucursal = new Sucursal()
                        {
                            IdSucursal = Convert.ToInt32(collection["CodSucursal"])
                        },
                        FechaSolicitud = DateTime.Now
                    };

                    objApoderado.Modificar(apoderado);
                    objPostulante.Modificar(postulante);
                    SolicitudAdmision solicitudCreada = objSolicitud.Modificar(solicitud);

                    if (solicitudCreada.IdSolicitudAdmision > 0)
                    {
                        return(Json(new { success = true, responseText = "OK" }, JsonRequestBehavior.AllowGet));
                    }
                    else
                    {
                        return(Json(new { success = true, responseText = "Ocurrió un incoveniente al modificar el registro" }, JsonRequestBehavior.AllowGet));
                    }
                }
            }
            catch (Exception ex)
            {
                return(Json(new { success = false, responseText = ex.Message }, JsonRequestBehavior.AllowGet));
            }
        }
        private async void btnCalcular_Click(object sender, RoutedEventArgs e)
        {
            try
            {
                if (txtBuscarPostulante.Text.Length > 0)
                {
                    Cone = Oracle.abrirConexion();

                    OracleCommand cmd = new OracleCommand("FN_LISTAR_TODO", Cone);
                    cmd.CommandType = CommandType.StoredProcedure;

                    List <Postulante> listaBeneficiados = new List <Postulante>();

                    OracleParameter rut = new OracleParameter("rut", OracleDbType.Varchar2);
                    rut.Direction = ParameterDirection.Input;
                    rut.Value     = txtBuscarPostulante.Text;

                    OracleParameter copia_cursor = cmd.Parameters.Add("L_BUSCAR", OracleDbType.RefCursor); // es igual a %rowtype
                    copia_cursor.Direction = ParameterDirection.ReturnValue;

                    cmd.Parameters.Add(rut); //añade la variable de entrada
                    cmd.ExecuteNonQuery();

                    OracleDataReader info_leida = ((OracleRefCursor)copia_cursor.Value).GetDataReader(); //lo parseamos a cursor, por los distintos tipo de datos que contiene
                    while (info_leida.Read())
                    {
                        //rescatamos
                        Postulante pos = new Postulante();
                        pos.Rut            = info_leida.GetString(0);
                        pos.Nombre         = info_leida.GetString(1);
                        pos.Edad           = info_leida.GetInt32(2);
                        pos.PuntjEdad      = info_leida.GetInt32(3);
                        pos.CantCargas     = info_leida.GetInt32(4);
                        pos.PuntjCargas    = info_leida.GetInt32(5);
                        pos.EstadoCivil    = info_leida.GetString(6);
                        pos.PuntjCivil     = info_leida.GetInt32(7);
                        pos.PuebloIndigena = info_leida.GetString(8);
                        pos.PuntjIndigena  = info_leida.GetInt32(9);
                        pos.MontoAhorrado  = info_leida.GetString(10);
                        pos.PuntjAhorro    = info_leida.GetInt32(11);
                        pos.Titulo         = info_leida.GetString(12);
                        pos.PuntjTitulo    = info_leida.GetInt32(13);
                        pos.Region         = info_leida.GetString(14);
                        pos.PuntjRegion    = info_leida.GetInt32(15);
                        pos.TipoVivienda   = info_leida.GetString(16);
                        pos.ValorVivienda  = info_leida.GetString(17);
                        pos.PuntjTotal     = info_leida.GetInt32(18);

                        txtAhorro.Text      = info_leida.GetInt32(11).ToString();
                        txtCarga.Text       = info_leida.GetInt32(5).ToString();
                        txtEdad.Text        = info_leida.GetInt32(3).ToString();
                        txtEstadoCivil.Text = info_leida.GetInt32(7).ToString();
                        txtIndigena.Text    = info_leida.GetInt32(9).ToString();
                        txtRegion.Text      = info_leida.GetInt32(15).ToString();
                        txtTitulo.Text      = info_leida.GetInt32(13).ToString();
                        txtTotal.Text       = info_leida.GetInt32(18).ToString();
                        //agregamos a la lista
                        listaBeneficiados.Add(pos);
                    }

                    gvListarFiltro.ItemsSource = listaBeneficiados;
                }
                else
                {
                    txtAhorro.Clear();
                    txtCarga.Clear();
                    txtEdad.Clear();
                    txtEstadoCivil.Clear();
                    txtIndigena.Clear();
                    txtRegion.Clear();
                    txtTitulo.Clear();
                    txtTotal.Clear();
                }
            }
            catch (Exception ex)
            {
                await this.ShowMessageAsync("Mensaje:",
                                            string.Format("Error al Buscar el Postulante"));
            }
        }