public JsonResult PlanificacionIns(EPlanificacion entidadPlanificacion)
        {
            string xml = string.Empty;

            foreach (EPlanificacionSucursalAlmacen eps in entidadPlanificacion.ListaPlanificacionSucursalAlmacen)
            {
                if (eps.IdSucursalAlmacen == 0)
                {
                    return(Json(new ERespuesta {
                        Estado = 0, Mensaje = "Seleccionar el sucursal-almacén"
                    }));
                }
            }

            if (entidadPlanificacion.FechaInicioWithFormat == "01/01/0001")
            {
                return(Json(new ERespuesta {
                    Estado = 0, Mensaje = "Completar la fecha de ejecucion"
                }));
            }

            xml = ConvertToXML.Registrar_XML(entidadPlanificacion);

            ERespuesta objRespuesta = objPlanificacion.SIGESU_PlanificacionIns(xml);

            return(Json(objRespuesta));
        }
Exemplo n.º 2
0
        public ERespuesta SIGESU_PlanificacionAct(EPlanificacion entidadPlanificacion)
        {
            try
            {
                using (var db = new SIGESUEntities())
                {
                    var result = db.SIGESU_PlanificacionAct(
                        entidadPlanificacion.IdPlanificacion,
                        entidadPlanificacion.NumeroPlanificacion,
                        entidadPlanificacion.FechaInicio,
                        entidadPlanificacion.FechaFin,
                        entidadPlanificacion.Remuestreo,
                        entidadPlanificacion.Observacion,
                        entidadPlanificacion.Estado,
                        entidadPlanificacion.IdEspecialista,
                        entidadPlanificacion.IdLaboratorio,
                        entidadPlanificacion.IdPlanificacionOrigen,
                        entidadPlanificacion.IdSucursalAlmacen
                        ).FirstOrDefault();

                    ERespuesta objRespuesta =
                        Mapper.Map <ERespuesta>(result);

                    return(objRespuesta);
                }
            }
            catch (Exception ex)
            {
                throw new Exception(ex.Message);
            }
        }
Exemplo n.º 3
0
        public ERespuesta Actualizar(EInClinica inClinica)
        {
            Clinica    cli       = _mapper.Map <Clinica>(inClinica);
            ERespuesta respuesta = operacionesdb.OpeActualizar(cli);

            return(respuesta);
        }
        public ERespuesta SIGESU_PlanificacionLaboratorioActxIdPlanificacionxImpresion(EPlanificacionLaboratorio entidadPlanificacionLaboratorio)
        {
            try
            {
                using (var db = new SIGESUEntities())
                {
                    var result = db.SIGESU_PlanificacionLaboratorioActxIdPlanificacionxImpresion(
                        entidadPlanificacionLaboratorio.IdPlanificacion,
                        entidadPlanificacionLaboratorio.NumeroVeces,
                        entidadPlanificacionLaboratorio.Resultado,
                        entidadPlanificacionLaboratorio.FechaCheckin,
                        entidadPlanificacionLaboratorio.FechaeEdicion,
                        entidadPlanificacionLaboratorio.FechaValidacion,
                        entidadPlanificacionLaboratorio.FechaImpresion,
                        entidadPlanificacionLaboratorio.AplicaRemuestreo,
                        entidadPlanificacionLaboratorio.ResultadoAdverso
                        ).FirstOrDefault();

                    ERespuesta objRespuesta =
                        Mapper.Map <ERespuesta>(result);

                    return(objRespuesta);
                }
            }
            catch (Exception ex)
            {
                throw new Exception(ex.Message);
            }
        }
Exemplo n.º 5
0
        public ERespuesta ConsultarPorDoctor(long doc)
        {
            ERespuesta result = new ERespuesta();

            result.Clinicas = repositorioClinica.ConsultarPorDoctor(doc);

            return(ValidarRespuesta(result));
        }
Exemplo n.º 6
0
        public ERespuesta ConsultarPorUsuario(string usr)
        {
            ERespuesta result = new ERespuesta();

            result.Clinicas = repositorioClinica.ConsultarPorUsuario(usr);

            return(ValidarRespuesta(result));
        }
Exemplo n.º 7
0
        public ERespuesta Consultar()
        {
            ERespuesta result = new ERespuesta();

            result.Clinicas = repositorioClinica.Consultar();

            return(ValidarRespuesta(result));
        }
Exemplo n.º 8
0
        public ERespuesta ConsultaAvanzadaPorEspecialidad(EBodyConsultarPorCiudadEsp entrada)
        {
            ERespuesta result = new ERespuesta();

            result.Clinicas = repositorioClinica.ConsultaAvanzadaPorEspecialidad(entrada.IdEspecialidad);

            return(ValidarRespuesta(result));
        }
        public JsonResult PlanificacionActAprobado(int IdPlanificacion, string NumeroEstado)
        {
            EPlanificacion entidadPlanificacion = new EPlanificacion();

            entidadPlanificacion        = objPlanificacion.SIGESU_PlanificacionSelxIdPlanificacion(IdPlanificacion);
            entidadPlanificacion.Estado = NumeroEstado;
            ERespuesta objRespuesta = objPlanificacion.SIGESU_PlanificacionAct(entidadPlanificacion);

            return(Json(objRespuesta));
        }
Exemplo n.º 10
0
        public ERespuesta ConsultarPorId(EBodyConsultarPor entrada)
        {
            ERespuesta  result = new ERespuesta();
            EOutClinica aux    = repositorioClinica.ConsultarPorId(entrada.Id);

            if (aux != null)
            {
                result.Clinicas.Add(aux);
            }

            return(ValidarRespuesta(result));
        }
        public JsonResult GrabarPropuesta(EPlanificacion entidadPlanificacion)
        {
            string           xml = string.Empty;
            List <EProducto> listaProductosPropuestos = new List <EProducto>();

            foreach (EPlanificacionSucursal eps in entidadPlanificacion.ListaPlanificacionSucursal)
            {
                if (eps.COD_SUCURSAL == null)
                {
                    return(Json(new Entidades.DTO_TP3.ERespuesta {
                        Estado = 0, Mensaje = "Seleccionar el sucursal"
                    }));
                }
            }

            if (entidadPlanificacion.FechaInicioWithFormat == "01/01/0001")
            {
                return(Json(new ERespuesta {
                    Estado = 0, Mensaje = "Completar la fecha inicio de ejecucion"
                }));
            }

            if (entidadPlanificacion.FechaFinWithFormat == "01/01/0001")
            {
                return(Json(new ERespuesta {
                    Estado = 0, Mensaje = "Completar la fecha fin de ejecucion"
                }));
            }

            //Obtener lista de productos propuestos.
            //En base a estas listas, se crearán dos tipos de planificaciones: Laboratorio y Campo

            listaProductosPropuestos = objProducto.GCPS_SP_ProductoEnPlanificacionSel();

            //PLANIFICACION TIPO LABORATORIO
            entidadPlanificacion.TipoPlanificacion = Constantes.TipoPlanificacion.LABORATORIO;
            entidadPlanificacion.detalleProductos  = listaProductosPropuestos.Where(x => x.TIPOPLAN.Equals(Constantes.TipoPlanificacion.LABORATORIO)).ToList();

            xml = ConvertToXML.Registrar_XML(entidadPlanificacion);

            objPlanificacion.GCPS_SP_PlanificacionIns(xml);


            //PLANIFICACION TIPO CAMPO
            entidadPlanificacion.TipoPlanificacion = Constantes.TipoPlanificacion.CAMPO;
            entidadPlanificacion.detalleProductos  = listaProductosPropuestos.Where(x => x.TIPOPLAN.Equals(Constantes.TipoPlanificacion.CAMPO)).ToList();;

            xml = ConvertToXML.Registrar_XML(entidadPlanificacion);

            ERespuesta objRespuesta = objPlanificacion.GCPS_SP_PlanificacionIns(xml);

            return(Json(objRespuesta));
        }
Exemplo n.º 12
0
        public ActionResult PlanificacionLaboratorioIns(int IdPlanificacion)
        {
            try
            {
                ERespuesta objRespuesta = objPlanificacionLaboratorio.SIGESU_PlanificacionLaboratorioIns(IdPlanificacion);

                return(Json(objRespuesta));
            }
            catch (Exception ex)
            {
                throw new Exception(ex.Message);
            }
        }
Exemplo n.º 13
0
        private ERespuesta ValidarRespuesta(ERespuesta result)
        {
            if (result.Clinicas.Count == 0)
            {
                result.Error.Codigo  = "01";
                result.Error.Mensaje = "No se encontraron datos en la base";
            }
            else
            {
                result.Error.Codigo  = "00";
                result.Error.Mensaje = "Ok";
            }

            return(result);
        }
Exemplo n.º 14
0
        public ERespuesta SIGESU_PlanificacionIns(string xml)
        {
            try
            {
                using (var db = new SIGESUEntities())
                {
                    var result = db.SIGESU_PlanificacionIns(xml).FirstOrDefault();

                    ERespuesta objRespuesta =
                        Mapper.Map <ERespuesta>(result);

                    return(objRespuesta);
                }
            }
            catch (Exception ex)
            {
                throw new Exception(ex.Message);
            }
        }
Exemplo n.º 15
0
        internal ERespuesta OpeActualizar(Clinica clinica)
        {
            ERespuesta eRespuesta = new ERespuesta();

            using (var cli = new cita_doctorContext())
            {
                var theClinic = (from cl in cli.Clinica
                                 .Where(c => (c.Id == clinica.Id))
                                 select cl).FirstOrDefault();

                theClinic.Nombre      = clinica.Nombre;
                theClinic.Telefono    = clinica.Telefono;
                theClinic.Email       = clinica.Email;
                theClinic.RazonSocial = clinica.RazonSocial;
                theClinic.InfoGeneral = clinica.InfoGeneral;
                theClinic.Direccion   = clinica.Direccion;
                theClinic.Referencia  = clinica.Referencia;
                theClinic.IdCiudad    = clinica.IdCiudad;
                theClinic.IdProvincia = clinica.IdProvincia;
                theClinic.Estado      = clinica.Estado;

                try
                {
                    cli.SaveChanges();
                    eRespuesta.Clinicas.Add(_mapper.Map <EOutClinica>(clinica));
                    eRespuesta.Error.Codigo  = "00";
                    eRespuesta.Error.Mensaje = "Ok";
                }
                catch (Exception e)
                {
                    eRespuesta.Error.Codigo  = "01";
                    eRespuesta.Error.Mensaje = e.Message;

                    return(eRespuesta);
                }
            }

            eRespuesta.Clinicas.Add(_mapper.Map <EOutClinica>(clinica));

            return(eRespuesta);
        }
Exemplo n.º 16
0
        public ActionResult PlanificacionImprimir(int IdPlanificacionLaboratorio)
        {
            try
            {
                EServidor entidadServidor = new EServidor();
                entidadServidor = objServidor.SIGESU_ServidorSel();

                EPlanificacionLaboratorio entidadPlanificacionLaboratorio =
                    objPlanificacionLaboratorio.SIGESU_PlanificacionLaboratorioSelxIdPlanificacionLaboratorio(IdPlanificacionLaboratorio);

                entidadPlanificacionLaboratorio.FechaImpresion = entidadServidor.FechaHoraActual;

                ERespuesta objRespuesta = objPlanificacionLaboratorio.SIGESU_PlanificacionLaboratorioActxIdPlanificacionxImpresion(entidadPlanificacionLaboratorio);

                return(Json(objRespuesta));
            }
            catch (Exception ex)
            {
                throw new Exception(ex.Message);
            }
        }
Exemplo n.º 17
0
        public ActionResult PlanificacionLaboratorioActResultadoAdverso(int IdPlanificacionLaboratorio, string Resultado)
        {
            try
            {
                EServidor entidadServidor = new EServidor();
                entidadServidor = objServidor.SIGESU_ServidorSel();

                EPlanificacionLaboratorio entidadPlanificacionLaboratorio =
                    objPlanificacionLaboratorio.SIGESU_PlanificacionLaboratorioSelxIdPlanificacionLaboratorio(IdPlanificacionLaboratorio);

                entidadPlanificacionLaboratorio.ResultadoAdverso = Resultado;
                entidadPlanificacionLaboratorio.FechaeEdicion    = entidadServidor.FechaHoraActual;

                ERespuesta objRespuesta = objPlanificacionLaboratorio.SIGESU_PlanificacionLaboratorioAct(entidadPlanificacionLaboratorio);

                return(Json(objRespuesta));
            }
            catch (Exception ex)
            {
                throw new Exception(ex.Message);
            }
        }
Exemplo n.º 18
0
        internal ERespuesta OpeInsertar(Clinica clinica)
        {
            ERespuesta eRespuesta = new ERespuesta();

            using (var cli = new cita_doctorContext())
            {
                cli.Clinica.Add(clinica);
                try
                {
                    cli.SaveChanges();
                    eRespuesta.Error.Codigo  = "00";
                    eRespuesta.Error.Mensaje = "Ok";
                }
                catch (Exception e)
                {
                    eRespuesta.Error.Codigo  = "01";
                    eRespuesta.Error.Mensaje = e.Message;

                    return(eRespuesta);
                }
            }

            return(eRespuesta);
        }
Exemplo n.º 19
0
    public void EnviarExamen(string examen, string fecha, string hora, string minuto, string tituloTema, string contenidoTema, int idCurso)
    {
        ETema tema = new ETema();


        contenidoTema = contenidoTema.Replace("\n\n", "");

        contenidoTema = contenidoTema.Replace("\n", "");

        tema.IdCurso     = idCurso;
        tema.Titulo      = tituloTema;
        tema.Informacion = contenidoTema;

        Base.Insertar(tema);

        EExamen examenCreado = new EExamen();

        examenCreado.IdTema = tema.Id;

        int dia  = Int32.Parse(fecha.Split('/')[0]);
        int mes  = Int32.Parse(fecha.Split('/')[1]);
        int anio = Int32.Parse(fecha.Split('/')[2]);

        DateTime fechaFinalizacion = new DateTime(anio, mes, dia, Int32.Parse(hora), Int32.Parse(minuto), 0);

        examenCreado.FechaFin = fechaFinalizacion;

        Base.Insertar(examenCreado);

        JArray preguntasJson = JArray.Parse(examen);

        foreach (JToken preguntaJson in preguntasJson)
        {
            EPregunta pregunta = new EPregunta();
            pregunta.IdExamen     = examenCreado.Id;
            pregunta.TipoPregunta = preguntaJson["tipoPregunta"].ToString();
            pregunta.Pregunta     = preguntaJson["pregunta"].ToString();
            pregunta.Porcentaje   = Int32.Parse(preguntaJson["porcentaje"].ToString());

            Base.Insertar(pregunta);

            if (pregunta.TipoPregunta.Equals("Múltiple con única respuesta"))
            {
                List <JToken> respuestasJson          = preguntaJson["respuestas"].ToList();
                int           indiceRespuestaCorrecta = Int32.Parse(preguntaJson["respuestaMarcada"].ToString());

                foreach (JToken respuestaJson in respuestasJson)
                {
                    ERespuesta respuesta = new ERespuesta();
                    respuesta.IdPregunta = pregunta.Id;
                    respuesta.Respuesta  = respuestaJson.ToString();

                    if (respuestasJson.IndexOf(respuestaJson) == indiceRespuestaCorrecta)
                    {
                        respuesta.Estado = true;
                    }
                    else
                    {
                        respuesta.Estado = false;
                    }

                    Base.Insertar(respuesta);
                }
            }

            if (pregunta.TipoPregunta.Equals("Múltiple con múltiple respuesta"))
            {
                List <JToken> respuestasJson = preguntaJson["respuestas"].ToList();
                List <JToken> indicesRespuestasMarcadasJson = preguntaJson["respuestasMarcadas"].ToList();
                List <int>    indicesRespuestasMarcadas     = new List <int>();

                foreach (JToken indiceRespuestaMarcadaJson in indicesRespuestasMarcadasJson)
                {
                    indicesRespuestasMarcadas.Add(Int32.Parse(indiceRespuestaMarcadaJson.ToString()));
                }

                foreach (JToken respuestaJson in respuestasJson)
                {
                    ERespuesta respuesta = new ERespuesta();
                    respuesta.IdPregunta = pregunta.Id;
                    respuesta.Respuesta  = respuestaJson.ToString();

                    if (indicesRespuestasMarcadas.Contains(respuestasJson.IndexOf(respuestaJson)))
                    {
                        respuesta.Estado = true;
                    }
                    else
                    {
                        respuesta.Estado = false;
                    }

                    Base.Insertar(respuesta);
                }
            }
        }
    }
Exemplo n.º 20
0
        public ERespuesta Insertar(EInClinica entrada)
        {
            ERespuesta respuesta = repositorioClinica.Inertar(entrada);

            return(respuesta);
        }
Exemplo n.º 21
0
        public ERespuesta Actualizar(EInClinica entrada)
        {
            ERespuesta respuesta = repositorioClinica.Actualizar(entrada);

            return(respuesta);
        }
        public JsonResult PlanificacionAct(EPlanificacion entidadPlanificacion)
        {
            ERespuesta objRespuesta = objPlanificacion.SIGESU_PlanificacionAct(entidadPlanificacion);

            return(Json(objRespuesta));
        }
Exemplo n.º 23
0
    public void ResponderExamen(EExamen examen, EUsuario usuario, string respuestas)
    {
        EEjecucionExamen ejecucion = new EEjecucionExamen();

        ejecucion.NombreUsuario  = usuario.NombreDeUsuario;
        ejecucion.IdExamen       = examen.Id;
        ejecucion.FechaEjecucion = System.DateTime.Now;
        ejecucion.Respuestas     = respuestas;

        List <int> notas = new List <int>();

        List <EPregunta> preguntas = GetPreguntas(examen);


        JArray respuestasExamenJson = JArray.Parse(respuestas);

        foreach (EPregunta pregunta in preguntas)
        {
            JArray respuestasPreguntaJson = (JArray)respuestasExamenJson[preguntas.IndexOf(pregunta)]["Respuestas"];

            if (respuestasPreguntaJson.Count == 0)
            {
                notas.Add(0);
            }
            else
            {
                if (pregunta.TipoPregunta.Equals("Múltiple con única respuesta"))
                {
                    int indiceRespuesta = Int32.Parse(respuestasPreguntaJson[0].ToString());

                    List <ERespuesta> respuestasPregunta = GetRespuestas(pregunta);
                    ERespuesta        respuestaCorrecta  = respuestasPregunta.Where(x => x.Estado == true).First();

                    int indiceRespuestaCorrecta = respuestasPregunta.IndexOf(respuestaCorrecta);

                    if (indiceRespuesta == indiceRespuestaCorrecta)
                    {
                        notas.Add(50);
                    }
                    else
                    {
                        notas.Add(0);
                    }
                }
                else if (pregunta.TipoPregunta.Equals("Múltiple con múltiple respuesta"))
                {
                    List <int> indicesRespuestas = new List <int>();

                    foreach (JToken respuesta in respuestasPreguntaJson)
                    {
                        indicesRespuestas.Add(Int32.Parse(respuesta.ToString()));
                    }

                    List <ERespuesta> respuestasPregunta  = GetRespuestas(pregunta);
                    List <ERespuesta> respuestasCorrectas = respuestasPregunta.Where(x => x.Estado == true).ToList();

                    List <int> indicesRespuestasCorrectas = new List <int>();

                    foreach (ERespuesta respuesta in respuestasCorrectas)
                    {
                        if (respuesta.Estado)
                        {
                            indicesRespuestasCorrectas.Add(respuestasCorrectas.IndexOf(respuesta));
                        }
                    }

                    List <int> subNotas = new List <int>();

                    foreach (ERespuesta respuesta in respuestasCorrectas)
                    {
                        subNotas.Add(0);
                    }


                    foreach (int indice in indicesRespuestas)
                    {
                        if (indicesRespuestasCorrectas.Contains(indice))
                        {
                            int posicionIndice = indicesRespuestasCorrectas.IndexOf(indice);

                            subNotas[posicionIndice] = 50;
                        }
                    }


                    int nota = (int)subNotas.Average();

                    notas.Add(nota);
                }
                else
                {
                    notas.Add(-1);
                }
            }
        }

        string notasJson = JsonConvert.SerializeObject(notas);

        ejecucion.Calificacion = notasJson;

        Base.Insertar(ejecucion);
    }
Exemplo n.º 24
0
    protected void Page_Load(object sender, EventArgs e)
    {
        bool isCalificando = (bool)Session[Constantes.CALIFICACION_EXAMEN];


        usuario = (EUsuario)Session[Constantes.USUARIO_SELECCIONADO];

        GestionExamen gestorExamenes = new GestionExamen();

        tema = (ETema)Session[Constantes.TEMA_SELECCIONADO_PARA_CALIFICAR_EXAMEN];

        EExamen examen = gestorExamenes.GetExamen(tema);

        ejecucion = gestorExamenes.GetEjecucion(examen, usuario);

        bool isExamenCalificado = gestorExamenes.IsExamenCalificado(ejecucion);

        if (!isCalificando || isExamenCalificado)
        {
            botonCalificar.Visible = false;
        }

        JArray respuestasExamenJson = JArray.Parse(ejecucion.Respuestas);

        preguntas = gestorExamenes.GetPreguntas(examen);

        int    minutos      = examen.FechaFin.Minute;
        string textoMinutos = minutos.ToString();

        if (minutos < 10)
        {
            textoMinutos = textoMinutos.Insert(0, "0");
        }

        etiquetaFecha.Text = "Fecha límite " + examen.FechaFin.Day + "/" + examen.FechaFin.Month + "/" + examen.FechaFin.Year + " a las " + examen.FechaFin.Hour + ":" + textoMinutos;


        foreach (EPregunta pregunta in preguntas)
        {
            Panel panelPregunta = new Panel();
            Table tablaPregunta = new Table();

            tablaPregunta.BackColor = Color.FromArgb(195, 201, 209);
            tablaPregunta.Width     = Unit.Percentage(60);
            tablaPregunta.Style.Add("border-radius", "10px");

            if (pregunta.TipoPregunta.Equals("Múltiple con única respuesta"))
            {
                List <ERespuesta> respuestas = gestorExamenes.GetRespuestas(pregunta);

                TableRow  filaPregunta  = new TableRow();
                TableCell celdaPregunta = new TableCell();

                Label textoPregunta = new Label();
                textoPregunta.Text = pregunta.Pregunta;

                celdaPregunta.Controls.Add(textoPregunta);
                celdaPregunta.Style.Add(HtmlTextWriterStyle.PaddingLeft, "3%");
                celdaPregunta.Style.Add(HtmlTextWriterStyle.PaddingTop, "1%");
                celdaPregunta.Style.Add(HtmlTextWriterStyle.PaddingBottom, "1%");

                filaPregunta.Cells.Add(celdaPregunta);
                tablaPregunta.Rows.Add(filaPregunta);

                int    indicePregunta        = preguntas.IndexOf(pregunta);
                JToken respuestaPreguntaJson = respuestasExamenJson[indicePregunta]["Respuestas"];

                int indiceRespuestaMarcada;

                if (respuestaPreguntaJson[0].ToString() == "")
                {
                    indiceRespuestaMarcada = -1;
                }
                else
                {
                    indiceRespuestaMarcada = Int32.Parse(respuestaPreguntaJson[0].ToString());
                }


                ERespuesta respuestaCorrecta = respuestas.Where(x => x.Estado == true).First();

                int indiceRespuestaCorrecta = respuestas.IndexOf(respuestaCorrecta);

                foreach (ERespuesta respuesta in respuestas)
                {
                    TableRow  fila        = new TableRow();
                    TableCell celda       = new TableCell();
                    Button    botonMarcar = new Button();
                    botonMarcar.Width  = 16;
                    botonMarcar.Height = 16;

                    botonMarcar.Enabled = false;

                    System.Web.UI.WebControls.Image indicadorCorrecto = null;

                    if (respuestas.IndexOf(respuesta) == indiceRespuestaMarcada)
                    {
                        botonMarcar.BackColor = Color.Black;

                        indicadorCorrecto        = new System.Web.UI.WebControls.Image();
                        indicadorCorrecto.Width  = 16;
                        indicadorCorrecto.Height = 16;

                        if (indiceRespuestaCorrecta == indiceRespuestaMarcada)
                        {
                            indicadorCorrecto.ImageUrl = "Correcto.png";
                        }
                        else
                        {
                            indicadorCorrecto.ImageUrl = "Incorrecto.png";
                        }
                    }

                    Label textoRespuesta = new Label();
                    textoRespuesta.Text = respuesta.Respuesta;

                    celda.Controls.Add(botonMarcar);
                    celda.Controls.Add(textoRespuesta);
                    if (indicadorCorrecto != null)
                    {
                        celda.Controls.Add(indicadorCorrecto);
                    }

                    celda.Style.Add(HtmlTextWriterStyle.PaddingLeft, "3%");
                    celda.Style.Add(HtmlTextWriterStyle.PaddingTop, "1%");
                    celda.Style.Add(HtmlTextWriterStyle.PaddingBottom, "1%");

                    fila.Cells.Add(celda);
                    tablaPregunta.Rows.Add(fila);
                }


                TableRow  filaRespuestaCorrecta  = new TableRow();
                TableCell celdaRespuestaCorrecta = new TableCell();

                Label textoRespuestaCorrecta = new Label();
                textoRespuestaCorrecta.Text = "Respuesta correcta: " + respuestaCorrecta.Respuesta;

                celdaRespuestaCorrecta.Controls.Add(textoRespuestaCorrecta);

                celdaRespuestaCorrecta.Controls.Add(textoRespuestaCorrecta);
                celdaRespuestaCorrecta.Style.Add(HtmlTextWriterStyle.PaddingLeft, "3%");
                celdaRespuestaCorrecta.Style.Add(HtmlTextWriterStyle.PaddingTop, "1%");
                celdaRespuestaCorrecta.Style.Add(HtmlTextWriterStyle.PaddingBottom, "1%");

                filaRespuestaCorrecta.Cells.Add(celdaRespuestaCorrecta);
                tablaPregunta.Rows.Add(filaRespuestaCorrecta);



                TableRow  filaPorcentaje  = new TableRow();
                TableCell celdaPorcentaje = new TableCell();

                Label textoPorcentaje = new Label();
                textoPorcentaje.Text = "Porcentaje: " + pregunta.Porcentaje + "%";

                celdaPorcentaje.Controls.Add(textoPorcentaje);
                celdaPorcentaje.Style.Add(HtmlTextWriterStyle.PaddingLeft, "3%");
                celdaPorcentaje.Style.Add(HtmlTextWriterStyle.PaddingTop, "1%");
                celdaPorcentaje.Style.Add(HtmlTextWriterStyle.PaddingBottom, "1%");

                filaPorcentaje.Cells.Add(celdaPorcentaje);
                tablaPregunta.Rows.Add(filaPorcentaje);

                TableRow  filaNota  = new TableRow();
                TableCell celdaNota = new TableCell();

                Label textoNota = new Label();

                JArray notasJson = JArray.Parse(ejecucion.Calificacion);
                JToken notaJson  = notasJson[indicePregunta];

                textoNota.Text = "Nota: " + notaJson.ToString();

                celdaNota.Controls.Add(textoNota);
                celdaNota.Style.Add(HtmlTextWriterStyle.PaddingLeft, "3%");
                celdaNota.Style.Add(HtmlTextWriterStyle.PaddingTop, "1%");
                celdaNota.Style.Add(HtmlTextWriterStyle.PaddingBottom, "1%");

                filaNota.Cells.Add(celdaNota);
                tablaPregunta.Rows.Add(filaNota);
            }
            else if (pregunta.TipoPregunta.Equals("Múltiple con múltiple respuesta"))
            {
                List <ERespuesta> respuestas = gestorExamenes.GetRespuestas(pregunta);

                TableRow  filaPregunta  = new TableRow();
                TableCell celdaPregunta = new TableCell();

                Label textoPregunta = new Label();
                textoPregunta.Text = pregunta.Pregunta;

                celdaPregunta.Controls.Add(textoPregunta);
                celdaPregunta.Style.Add(HtmlTextWriterStyle.PaddingLeft, "3%");
                celdaPregunta.Style.Add(HtmlTextWriterStyle.PaddingTop, "1%");
                celdaPregunta.Style.Add(HtmlTextWriterStyle.PaddingBottom, "1%");

                filaPregunta.Cells.Add(celdaPregunta);
                tablaPregunta.Rows.Add(filaPregunta);

                int    indicePregunta          = preguntas.IndexOf(pregunta);
                JToken respuestasPreguntasJson = respuestasExamenJson[indicePregunta]["Respuestas"];

                List <int> indicesRespuestasMarcadas = new List <int>();

                foreach (JToken respuestaPreguntaJson in respuestasPreguntasJson)
                {
                    indicesRespuestasMarcadas.Add(Int32.Parse(respuestaPreguntaJson.ToString()));
                }

                List <ERespuesta> respuestasCorrectas = respuestas.Where(x => x.Estado == true).ToList();

                List <int> indicesRespuestasCorrectas = new List <int>();

                foreach (ERespuesta respuesta in respuestasCorrectas)
                {
                    indicesRespuestasCorrectas.Add(respuestas.IndexOf(respuesta));
                }

                foreach (ERespuesta respuesta in respuestas)
                {
                    TableRow  fila     = new TableRow();
                    TableCell celda    = new TableCell();
                    CheckBox  checkBox = new CheckBox();

                    checkBox.Enabled = false;

                    System.Web.UI.WebControls.Image indicadorCorrecto = null;

                    if (indicesRespuestasMarcadas.Contains(respuestas.IndexOf(respuesta)))
                    {
                        checkBox.Checked = true;

                        indicadorCorrecto        = new System.Web.UI.WebControls.Image();
                        indicadorCorrecto.Width  = 16;
                        indicadorCorrecto.Height = 16;

                        if (indicesRespuestasCorrectas.Contains(respuestas.IndexOf(respuesta)))
                        {
                            indicadorCorrecto.ImageUrl = "Correcto.png";
                        }
                        else
                        {
                            indicadorCorrecto.ImageUrl = "Incorrecto.png";
                        }
                    }

                    Label textoRespuesta = new Label();
                    textoRespuesta.Text = respuesta.Respuesta;

                    celda.Controls.Add(checkBox);
                    celda.Controls.Add(textoRespuesta);
                    if (indicadorCorrecto != null)
                    {
                        celda.Controls.Add(indicadorCorrecto);
                    }

                    celda.Style.Add(HtmlTextWriterStyle.PaddingLeft, "3%");
                    celda.Style.Add(HtmlTextWriterStyle.PaddingTop, "1%");
                    celda.Style.Add(HtmlTextWriterStyle.PaddingBottom, "1%");

                    fila.Cells.Add(celda);
                    tablaPregunta.Rows.Add(fila);
                }


                TableRow  filaRespuestasCorrectas  = new TableRow();
                TableCell celdaRespuestasCorrectas = new TableCell();

                Label textoRespuestasCorrectas = new Label();

                string respuestasCorrectasString = "";

                foreach (ERespuesta respuesta in respuestasCorrectas)
                {
                    respuestasCorrectasString += respuesta.Respuesta + ", ";
                }

                respuestasCorrectasString = respuestasCorrectasString.Substring(0, respuestasCorrectasString.Length - 2);

                textoRespuestasCorrectas.Text = "Respuestas correctas: " + respuestasCorrectasString;

                celdaRespuestasCorrectas.Controls.Add(textoRespuestasCorrectas);

                celdaRespuestasCorrectas.Controls.Add(textoRespuestasCorrectas);
                celdaRespuestasCorrectas.Style.Add(HtmlTextWriterStyle.PaddingLeft, "3%");
                celdaRespuestasCorrectas.Style.Add(HtmlTextWriterStyle.PaddingTop, "1%");
                celdaRespuestasCorrectas.Style.Add(HtmlTextWriterStyle.PaddingBottom, "1%");

                filaRespuestasCorrectas.Cells.Add(celdaRespuestasCorrectas);
                tablaPregunta.Rows.Add(filaRespuestasCorrectas);

                TableRow  filaPorcentaje  = new TableRow();
                TableCell celdaPorcentaje = new TableCell();

                Label textoPorcentaje = new Label();
                textoPorcentaje.Text = "Porcentaje: " + pregunta.Porcentaje + "%";

                celdaPorcentaje.Controls.Add(textoPorcentaje);
                celdaPorcentaje.Style.Add(HtmlTextWriterStyle.PaddingLeft, "3%");
                celdaPorcentaje.Style.Add(HtmlTextWriterStyle.PaddingTop, "1%");
                celdaPorcentaje.Style.Add(HtmlTextWriterStyle.PaddingBottom, "1%");

                filaPorcentaje.Cells.Add(celdaPorcentaje);
                tablaPregunta.Rows.Add(filaPorcentaje);

                TableRow  filaNota  = new TableRow();
                TableCell celdaNota = new TableCell();

                Label textoNota = new Label();

                JArray notasJson = JArray.Parse(ejecucion.Calificacion);
                JToken notaJson  = notasJson[indicePregunta];

                textoNota.Text = "Nota: " + notaJson.ToString();

                celdaNota.Controls.Add(textoNota);
                celdaNota.Style.Add(HtmlTextWriterStyle.PaddingLeft, "3%");
                celdaNota.Style.Add(HtmlTextWriterStyle.PaddingTop, "1%");
                celdaNota.Style.Add(HtmlTextWriterStyle.PaddingBottom, "1%");

                filaNota.Cells.Add(celdaNota);
                tablaPregunta.Rows.Add(filaNota);
            }
            else if (pregunta.TipoPregunta.Equals("Abierta"))
            {
                TableRow  filaPregunta  = new TableRow();
                TableCell celdaPregunta = new TableCell();

                Label textoPregunta = new Label();
                textoPregunta.Text = pregunta.Pregunta;

                celdaPregunta.Controls.Add(textoPregunta);
                celdaPregunta.Style.Add(HtmlTextWriterStyle.PaddingLeft, "3%");
                celdaPregunta.Style.Add(HtmlTextWriterStyle.PaddingTop, "1%");
                celdaPregunta.Style.Add(HtmlTextWriterStyle.PaddingBottom, "1%");

                filaPregunta.Cells.Add(celdaPregunta);
                tablaPregunta.Rows.Add(filaPregunta);


                TextBox campoRespuesta = new TextBox();
                campoRespuesta.TextMode = TextBoxMode.MultiLine;
                campoRespuesta.Style.Add(HtmlTextWriterStyle.Width, "95%");
                campoRespuesta.Style.Add(HtmlTextWriterStyle.Height, "100px");
                campoRespuesta.Enabled = false;

                JArray respuestasJsonExamen   = JArray.Parse(ejecucion.Respuestas);
                JToken respuestasJsonPregunta = respuestasJsonExamen[preguntas.IndexOf(pregunta)];

                campoRespuesta.Text = respuestasJsonPregunta["Respuestas"][0].ToString();

                TableRow  filaCampo  = new TableRow();
                TableCell celdaCampo = new TableCell();

                celdaCampo.Controls.Add(campoRespuesta);
                celdaCampo.Style.Add(HtmlTextWriterStyle.PaddingLeft, "3%");
                celdaCampo.Style.Add(HtmlTextWriterStyle.PaddingTop, "1%");
                celdaCampo.Style.Add(HtmlTextWriterStyle.PaddingBottom, "1%");
                filaCampo.Controls.Add(celdaCampo);



                tablaPregunta.Rows.Add(filaCampo);


                TableRow  filaPorcentaje  = new TableRow();
                TableCell celdaPorcentaje = new TableCell();

                Label textoPorcentaje = new Label();
                textoPorcentaje.Text = "Porcentaje: " + pregunta.Porcentaje + "%";

                celdaPorcentaje.Controls.Add(textoPorcentaje);
                celdaPorcentaje.Style.Add(HtmlTextWriterStyle.PaddingLeft, "3%");
                celdaPorcentaje.Style.Add(HtmlTextWriterStyle.PaddingTop, "1%");
                celdaPorcentaje.Style.Add(HtmlTextWriterStyle.PaddingBottom, "1%");

                filaPorcentaje.Cells.Add(celdaPorcentaje);
                tablaPregunta.Rows.Add(filaPorcentaje);


                TableRow  filaNota  = new TableRow();
                TableCell celdaNota = new TableCell();

                DropDownList desplegableNota = new DropDownList();

                ListItem itemInicial = new ListItem();
                itemInicial.Value = "Nota";
                itemInicial.Text  = itemInicial.Value;

                desplegableNota.Items.Add(itemInicial);

                for (int nota = 0; nota <= 50; nota++)
                {
                    ListItem item = new ListItem();
                    item.Value = nota.ToString();
                    item.Text  = item.Value;

                    desplegableNota.Items.Add(item);
                }

                JArray notasJson = JArray.Parse(ejecucion.Calificacion);
                JToken notaJson  = notasJson[preguntas.IndexOf(pregunta)];

                int notaPregunta = Int32.Parse(notaJson.ToString());

                Label textoNota = new Label();
                textoNota.Text = "Nota: " + notaJson.ToString();

                if (notaPregunta == -1)
                {
                    celdaNota.Controls.Add(desplegableNota);
                    desplegablesNotas.Add(desplegableNota);
                }
                else
                {
                    celdaNota.Controls.Add(textoNota);
                }

                celdaNota.Style.Add(HtmlTextWriterStyle.PaddingLeft, "3%");
                celdaNota.Style.Add(HtmlTextWriterStyle.PaddingTop, "1%");
                celdaNota.Style.Add(HtmlTextWriterStyle.PaddingBottom, "1%");

                filaNota.Cells.Add(celdaNota);

                if (isCalificando && !isExamenCalificado)
                {
                    tablaPregunta.Rows.Add(filaNota);
                }
            }
            else
            {
                TableRow  filaPregunta  = new TableRow();
                TableCell celdaPregunta = new TableCell();

                Label textoPregunta = new Label();
                textoPregunta.Text = pregunta.Pregunta;

                celdaPregunta.Controls.Add(textoPregunta);
                celdaPregunta.Style.Add(HtmlTextWriterStyle.PaddingLeft, "3%");
                celdaPregunta.Style.Add(HtmlTextWriterStyle.PaddingTop, "1%");
                celdaPregunta.Style.Add(HtmlTextWriterStyle.PaddingBottom, "1%");

                filaPregunta.Cells.Add(celdaPregunta);
                tablaPregunta.Rows.Add(filaPregunta);

                TableRow  filaArchivo  = new TableRow();
                TableCell celdaArchivo = new TableCell();

                LinkButton hiperEnlaceArchivo = new LinkButton();

                JArray respuestasJsonExamen   = JArray.Parse(ejecucion.Respuestas);
                JToken respuestasJsonPregunta = respuestasJsonExamen[preguntas.IndexOf(pregunta)];

                JArray notasJson = JArray.Parse(ejecucion.Calificacion);
                JToken notaJson  = notasJson[preguntas.IndexOf(pregunta)];

                int notaPregunta = Int32.Parse(notaJson.ToString());


                if (notaPregunta == -1)
                {
                    hiperEnlaceArchivo.Text   = respuestasJsonPregunta["Respuestas"][0].ToString();
                    hiperEnlaceArchivo.Click += new EventHandler(VerArchivo);

                    celdaArchivo.Controls.Add(hiperEnlaceArchivo);
                    celdaArchivo.Style.Add(HtmlTextWriterStyle.PaddingLeft, "3%");
                    celdaArchivo.Style.Add(HtmlTextWriterStyle.PaddingTop, "1%");
                    celdaArchivo.Style.Add(HtmlTextWriterStyle.PaddingBottom, "1%");

                    filaArchivo.Cells.Add(celdaArchivo);

                    tablaPregunta.Rows.Add(filaArchivo);
                }


                TableRow  filaPorcentaje  = new TableRow();
                TableCell celdaPorcentaje = new TableCell();

                Label textoPorcentaje = new Label();
                textoPorcentaje.Text = "Porcentaje: " + pregunta.Porcentaje + "%";

                celdaPorcentaje.Controls.Add(textoPorcentaje);
                celdaPorcentaje.Style.Add(HtmlTextWriterStyle.PaddingLeft, "3%");
                celdaPorcentaje.Style.Add(HtmlTextWriterStyle.PaddingTop, "1%");
                celdaPorcentaje.Style.Add(HtmlTextWriterStyle.PaddingBottom, "1%");


                filaPorcentaje.Cells.Add(celdaPorcentaje);
                tablaPregunta.Rows.Add(filaPorcentaje);


                TableRow  filaNota  = new TableRow();
                TableCell celdaNota = new TableCell();

                DropDownList desplegableNota = new DropDownList();

                ListItem itemInicial = new ListItem();
                itemInicial.Value = "Nota";
                itemInicial.Text  = itemInicial.Value;

                desplegableNota.Items.Add(itemInicial);

                for (int nota = 0; nota <= 50; nota++)
                {
                    ListItem item = new ListItem();
                    item.Value = nota.ToString();
                    item.Text  = item.Value;

                    desplegableNota.Items.Add(item);
                }


                Label textoNota = new Label();
                textoNota.Text = "Nota: " + notaJson.ToString();

                if (notaPregunta == -1)
                {
                    celdaNota.Controls.Add(desplegableNota);
                    desplegablesNotas.Add(desplegableNota);
                }
                else
                {
                    celdaNota.Controls.Add(textoNota);
                }

                celdaNota.Style.Add(HtmlTextWriterStyle.PaddingLeft, "3%");
                celdaNota.Style.Add(HtmlTextWriterStyle.PaddingTop, "1%");
                celdaNota.Style.Add(HtmlTextWriterStyle.PaddingBottom, "1%");

                filaNota.Cells.Add(celdaNota);

                if (isCalificando && !isExamenCalificado)
                {
                    tablaPregunta.Rows.Add(filaNota);
                }
            }

            panelPregunta.Controls.Add(tablaPregunta);

            Literal saltoDeLinea = new Literal();
            saltoDeLinea.Text = "<br>";

            panelContenido.Controls.Add(panelPregunta);
            panelContenido.Controls.Add(saltoDeLinea);
        }

        etiquetaNota.Text = "Nota: " + GetNotaPonderada();
    }