public Int32 RegistrarRespuesta(PostulanteRespuestaBE respuesta)
        {
            dbRRHH = new DataBaseDA();
            Int32 salida = 0;

            try
            {
                qSQL = "SPI_RESPUESTAS";
                using (MySqlCommand cmd = new MySqlCommand(qSQL, dbRRHH.getConnectionMysql()))
                {
                    cmd.CommandType = CommandType.StoredProcedure;
                    cmd.Parameters.AddWithValue("@COD_USUARIO", respuesta.CodigoUsuario);
                    cmd.Parameters.AddWithValue("@COD_EXAMEN", respuesta.CodigoExamen);
                    cmd.Parameters.AddWithValue("@COD_PREGUNTA", respuesta.CodigoPregunta);
                    cmd.Parameters.AddWithValue("@COD_OPCION", respuesta.CodigoOpcion);
                    cmd.Parameters.AddWithValue("@RESPUESTA", respuesta.Respuesta);
                    cmd.Parameters.AddWithValue("@CORRECTO", respuesta.Correcto);
                    cmd.Parameters.AddWithValue("@PUNTAJE", respuesta.PuntajePregunta);
                    cmd.Parameters.AddWithValue("@TIEMPO", respuesta.Tiempo);

                    cmd.Connection.Open();
                    cmd.ExecuteNonQuery();
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
            finally
            {
                dbRRHH = null;
            }

            return(salida);
        }
        // GET: /Postulante/VerCV/1
        public ActionResult VerExamen(int id = 0)
        {
            ColaboradorBE colaborador = new ColaboradorBL().GetColaboradorByID(0, id);

            FachadaSesion.Colaborador2 = colaborador;

            PostulanteRespuestaBE respuestasResumen = respuestasBL.GetResumenRespuestaByPostulante(id);

            return(PartialView("VerExamen", respuestasResumen));
        }
        public List <PostulanteRespuestaBE> Listar(int id)
        {
            dbRRHH = new DataBaseDA();
            List <PostulanteRespuestaBE> lista = new List <PostulanteRespuestaBE>();

            try
            {
                qSQL = "SPS_RESPUESTAS";

                using (MySqlCommand cmd = new MySqlCommand(qSQL, dbRRHH.getConnectionMysql()))
                {
                    cmd.CommandType = CommandType.StoredProcedure;
                    cmd.Parameters.AddWithValue("@CODIGO_POSTULANTE", id);
                    cmd.Connection.Open();
                    MySqlDataReader rd = cmd.ExecuteReader();
                    while (rd.Read())
                    {
                        PostulanteRespuestaBE item = new PostulanteRespuestaBE();
                        item.ID              = (Int32)rd[0];
                        item.CodigoUsuario   = rd[1].ToString() != "" ? (Int32)rd[1] : 0;
                        item.CodigoExamen    = rd[2].ToString() != "" ? (Int32)rd[2] : 0;
                        item.CodigoPregunta  = rd[3].ToString() != "" ? (Int32)rd[3] : 0;
                        item.CodigoOpcion    = rd[4].ToString() != "" ? (Int32)rd[4] : 0;
                        item.Respuesta       = rd[5].ToString() != "" ? rd[5].ToString() : "";
                        item.Correcto        = rd[6].ToString() != "" ? (Int32)rd[6] : 0;
                        item.PuntajePregunta = rd[7].ToString() != "" ? (Int32)rd[7] : 0;
                        item.Tiempo          = rd[8].ToString() != "" ? rd[8].ToString() : "";

                        lista.Add(item);
                    }

                    if (rd != null && rd.IsClosed == false)
                    {
                        rd.Close();
                    }
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
            finally
            {
                dbRRHH = null;
            }

            return(lista);
        }
        public PostulanteRespuestaBE GetResumenRespuestaByPostulante(int Id)
        {
            dbRRHH = new DataBaseDA();
            PostulanteRespuestaBE respuesta = null;

            try
            {
                qSQL = "SPS_RESULTRESUMENBYPOSTULANTE";
                using (MySqlCommand cmd = new MySqlCommand(qSQL, dbRRHH.getConnectionMysql()))
                {
                    cmd.CommandType = CommandType.StoredProcedure;
                    cmd.Parameters.AddWithValue("@CODIGO_POSTULANTE", Id);
                    cmd.Connection.Open();
                    MySqlDataReader rd = cmd.ExecuteReader();
                    while (rd.Read())
                    {
                        respuesta                       = new PostulanteRespuestaBE();
                        respuesta.Tiempo                = rd[0].ToString() != "" ? (String)rd[0] : "";
                        respuesta.TotalPreguntas        = rd[1].ToString() != "" ? Convert.ToInt32(rd[1]) : 0;
                        respuesta.CantidadCorrecto      = rd[2].ToString() != "" ? Convert.ToInt32(rd[2]) : 0;
                        respuesta.CantidadIncorrecto    = rd[3].ToString() != "" ? Convert.ToInt32(rd[3]) : 0;
                        respuesta.CantidadNoRespondidas = rd[4].ToString() != "" ? Convert.ToInt32(rd[4]) : 0;
                        respuesta.PuntajeTotal          = rd[5].ToString() != "" ? Convert.ToInt32(rd[5]) : 0;
                        respuesta.PuntajeObtenido       = rd[6].ToString() != "" ? Convert.ToInt32(rd[6]) : 0;

                        List <PostulanteRespuestaBE> respuestas = ListarRespuestas(Id);
                        respuesta.ListaPreguntas = respuestas;
                    }
                    if (rd != null && rd.IsClosed == false)
                    {
                        rd.Close();
                    }
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
            finally
            {
                dbRRHH = null;
            }

            return(respuesta);
        }
Example #5
0
 public Int32 RegistrarRespuesta(PostulanteRespuestaBE respuesta)
 {
     return(new PostulanteRespuestaDA().RegistrarRespuesta(respuesta));
 }
Example #6
0
        public ActionResult Examen(string IdUsuario, string IdExamen, string rpta, string time)
        {
            var codigoRespuestasList = rpta.Split(',');
            var listaPreguntas       = preguntasBL.Listar(FachadaSesion.Usuario.Perfil.Examen.ID);

            var codigoUsuario = Convert.ToInt32(IdUsuario);
            var puntajeSum    = 0;

            foreach (var pregunta in listaPreguntas)
            {
                var codigoRpta = codigoRespuestasList[(pregunta.ID - 1)];
                int codRpta = 0; string cadenaRpta = string.Empty;
                var respuesta = new PostulanteRespuestaBE();
                respuesta.CodigoUsuario  = codigoUsuario;
                respuesta.CodigoExamen   = Convert.ToInt32(IdExamen);
                respuesta.CodigoPregunta = pregunta.ID;
                if (codigoRpta == "NR")
                {
                    codRpta = -1;
                }
                else
                {
                    if (pregunta.ID == 13)
                    {
                        cadenaRpta = codigoRpta;
                        codRpta    = 0;
                    }
                    else
                    {
                        codRpta = Convert.ToInt32(codigoRpta);
                    }
                }
                respuesta.CodigoOpcion = codRpta;
                respuesta.Respuesta    = cadenaRpta;

                var codigoRespuestaCorrecta = (from r in pregunta.listaOpciones
                                               where r.CorrectoEx == 1
                                               select r).FirstOrDefault();

                if (pregunta.ID == 13)
                {
                    respuesta.Correcto        = 1;
                    respuesta.PuntajePregunta = pregunta.PuntajeEx;
                    puntajeSum += pregunta.PuntajeEx;
                }
                else
                {
                    if (codigoRespuestaCorrecta.ID == codRpta)
                    {
                        respuesta.Correcto        = 1;
                        respuesta.PuntajePregunta = pregunta.PuntajeEx;
                        puntajeSum += pregunta.PuntajeEx;
                    }
                    else
                    {
                        respuesta.Correcto        = 0;
                        respuesta.PuntajePregunta = 0;
                    }
                }

                respuesta.Tiempo = time;
                respuestasBL.RegistrarRespuesta(respuesta);
            }

            ColaboradorBE postulante = new ColaboradorBE();
            UsuarioBE     usuario    = new UsuarioBE();

            usuario.CodigoUsuario    = Convert.ToInt32(IdUsuario);
            postulante.Usuario       = usuario;
            postulante.RindioExamen  = 1; /// 1: Si rindio examen 0: No rindio examen
            postulante.PuntajeExamen = puntajeSum;

            colaboradorBL.UpdatePostulanteExamen(postulante);

            return(Json(new { status = "Success" }));
        }
Example #7
0
        // GET: Resultados
        public ActionResult Resultados()
        {
            PostulanteRespuestaBE respuestasResumen = respuestasBL.GetResumenRespuestaByPostulante(FachadaSesion.Usuario.CodigoUsuario);

            return(View("Resultados", respuestasResumen));
        }