コード例 #1
0
ファイル: ExamenService.cs プロジェクト: noyamn/TPWeb3
        public void crearExamen(String _nombre, String _descripcion, String _fechaTope,
                               String _porcAprobacion, String _duracion, HttpRequest Request,
                               Int32 _cantidad, Int32 _idCurso)
        {
            examen ex = new examen();
            ex.nombre = _nombre;
            ex.descripcion = _descripcion;
            ex.fecha_tope = Convert.ToDateTime(_fechaTope);
            ex.porc_aprobacion = Convert.ToInt32(_porcAprobacion);
            ex.duracion = Convert.ToInt32(_duracion);
            ex.id_curso = _idCurso;

            for (int i = 1; i <= _cantidad; i++)
            {
                pregunta p = new pregunta();
                p.examen = ex;
                p.descripcion = Request.Form["P_" + i];

                for (int j = 1; j <= 5; j++)
                {
                    respuesta r = new respuesta();

                    String aux = Request.Form["R_" + i + "_" + j].Trim();
                    if (!aux.Equals(""))
                    {
                        r.pregunta = p;
                        r.descripcion = aux;

                        if (Request.Form["CB_" + i + "_" + j]!=null)
                        {
                             r.correcta = Request.Form["CB_" + i + "_" + j];
                        }
                        else
                        {
                            r.correcta = "";
                        }
                        p.respuesta.Add(r);
                    }

                }

                ctx.pregunta.AddObject(p);

            }

            ctx.examen.AddObject(ex);
            ctx.SaveChanges();
        }
コード例 #2
0
ファイル: Model1.Designer.cs プロジェクト: noyamn/TPWeb3
 /// <summary>
 /// Deprecated Method for adding a new object to the pregunta EntitySet. Consider using the .Add method of the associated ObjectSet&lt;T&gt; property instead.
 /// </summary>
 public void AddTopregunta(pregunta pregunta)
 {
     base.AddObject("pregunta", pregunta);
 }
コード例 #3
0
ファイル: Model1.Designer.cs プロジェクト: noyamn/TPWeb3
 /// <summary>
 /// Create a new pregunta object.
 /// </summary>
 /// <param name="id_pregunta">Initial value of the id_pregunta property.</param>
 public static pregunta Createpregunta(global::System.Int32 id_pregunta)
 {
     pregunta pregunta = new pregunta();
     pregunta.id_pregunta = id_pregunta;
     return pregunta;
 }