コード例 #1
0
        public JsonResult agregar_cuenta_persona(modelo_agregar_cuenta_persona datos_cuenta_personas)
        {
            try{
                db.Database.ExecuteSqlCommand("exec sp_inserta_persona_curriculum  @nombre_persona  = {0}, @apellido_paterno_persona = {1} ,@apellido_materno_persona = {2} , " +
                                              "@identificacion_persona ={3} , @digito_verificador_identificacion_persona = {4}, @correo_electronico_persona  = {5}, @fecha_nacimiento_persona = {6} , @clave_persona = {7} ," +
                                              " @id_comuna = {8} , @id_tipo_identificacion_persona  = {9}, @id_tipo_persona = {10}, @direccion_curriculum = {11} ,@telefono_curriculum_1  ={12}, " +
                                              " @telefono_curriculum_2 = {13},@sueldo_esperado = {14}", datos_cuenta_personas.nombre_persona, datos_cuenta_personas.apellido_paterno_persona, datos_cuenta_personas.apellido_materno_persona,
                                              datos_cuenta_personas.identificacion_persona, datos_cuenta_personas.digito_verificador_identificacion_persona, datos_cuenta_personas.correo_electronico_persona,
                                              datos_cuenta_personas.fecha_nacimiento_persona, datos_cuenta_personas.clave_persona_1, datos_cuenta_personas.id_comuna, datos_cuenta_personas.id_tipo_identificacion_persona,
                                              datos_cuenta_personas.id_tipo_persona, datos_cuenta_personas.direccion_curriculum, datos_cuenta_personas.telefono_curriculum_1,
                                              datos_cuenta_personas.telefono_curriculum_2, datos_cuenta_personas.sueldo_esperado);

                ms.enviar_correo(null, datos_cuenta_personas.correo_electronico_persona, 0);

                return(Json(new { success = true, respuesta = new { caca = "caca" } }, JsonRequestBehavior.AllowGet));
            }
            catch (Exception ex)
            {
                return(Json(null, JsonRequestBehavior.AllowGet));
            }
        }
コード例 #2
0
        public ActionResult create_postulacion(List <respuesta_cuestionario_multiple> respuesta_cuestionario_multiple, datos_oferta datos_oferta)
        {
            try
            {
                if (Session.Contents.Count < 1)
                {
                    return(RedirectToAction("LogOff", "login"));
                }
                int id_persona = Convert.ToInt32(Session["persona_id"]);

                if (datos_oferta.id_cuestionario != 0)
                {
                    foreach (var item in respuesta_cuestionario_multiple)

                    {
                        if (item.id_tipo_pregunta == 1)
                        {
                            if (item.id_respuesta == null)
                            {
                                return(Json(new { success = false, responseText = "error plox" }, JsonRequestBehavior.AllowGet));
                            }
                            else
                            {
                                if (a1 != null)
                                {
                                    a1 = String.Concat(a1, " (zxc1) ", item.id_pregunta);
                                }
                                else
                                {
                                    a1 = item.id_pregunta.ToString();
                                }
                                if (a2 != null)
                                {
                                    a2 = String.Concat(a2, " (zxc1) ", item.id_respuesta);
                                }
                                else
                                {
                                    a2 = item.id_respuesta;
                                }
                            }
                        }
                        if (item.id_tipo_pregunta == 0)
                        {
                            if (item.respuesta_pregunta == null)
                            {
                                return(Json(new { success = false, responseText = "error plox" }, JsonRequestBehavior.AllowGet));
                            }
                            else
                            {
                                if (b1 != null)
                                {
                                    b1 = String.Concat(b1, " (zxc1) ", item.id_pregunta);
                                }
                                else
                                {
                                    b1 = item.id_pregunta.ToString();
                                }
                                if (b2 != null)
                                {
                                    b2 = String.Concat(b2, " (zxc1) ", item.respuesta_pregunta);
                                }
                                else
                                {
                                    b2 = item.respuesta_pregunta;
                                }
                            }
                        }
                    }
                }

                int bol = db.Database.SqlQuery <int>("select id_postulacion from postulaciones where id_persona = {0} and id_oferta = {1}", id_persona, datos_oferta.id_oferta).Count();
                if (bol == 0)
                {
                    db.Database.ExecuteSqlCommand("Exec sp_inserta_postulacion_cuestionario @id_persona = {0}, @id_oferta  = {1}, @id_cuestionario ={2} , @ids_pregunta_1 = {3} , @ids_respuestas_1 = {4} , @ids_pregunta_2 = {5} , @texto_respuesta_2 = {6} ", id_persona, datos_oferta.id_oferta, datos_oferta.id_cuestionario, a1, a2, b1, b2);

                    var k = db.personas.Find(id_persona);
                    m.enviar_correo(null, k.correo_electronico_persona, 2);
                    return(Json(new { success = true, responseText = "Te postulaste exitosamente" }, JsonRequestBehavior.AllowGet));
                }
                else
                {
                    return(Json(new { success = false, responseText = "ya estabas postulado para esta oferta" }, JsonRequestBehavior.AllowGet));
                }
            }
            catch (Exception ex)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
        }