protected override Yw_SubjectContent GetContent(
            QuestionInputModel sub,
            SubjectBll bll,
            int currentUser,
            Yw_SubjectContent content)
        {
            TrueFalse           subject        = sub as TrueFalse;
            Yw_TrueFalseContent derivedContent = null;

            if (content == null)
            {
                derivedContent = new Yw_TrueFalseContent();
                derivedContent.Ysc_CreateTime  = DateTime.Now;
                derivedContent.Ysc_Creator     = currentUser;
                derivedContent.Ysc_SubjectType = subject.SubjectType;
            }
            else
            {
                derivedContent = content as Yw_TrueFalseContent;
            }
            derivedContent.Ysc_Editor      = currentUser;
            derivedContent.Ysc_Explain     = subject.Explain;
            derivedContent.Ysc_Content_Obj = new TrueFalseContentObj
            {
                StemType = (int)subject.StemType,
                Stem     = UeditorContentFactory.FetchUrl(subject.Name, subject.StemType)
            };
            derivedContent.Ysc_Answer_Obj = new TrueFalseAnswerObj
            {
                Answer = subject.Answer
            };
            derivedContent.Ysc_UpdateTime = DateTime.Now;

            return(derivedContent);
        }
Exemplo n.º 2
0
        /// <summary>
        /// New game
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void newToolStripMenuItem_Click(object sender, EventArgs e)
        {
            OpenFileDialog openFileDialog = new OpenFileDialog();

            openFileDialog.Filter = "XML файлы|*.XML|Все файлы|*.*";

            if (openFileDialog.ShowDialog() == DialogResult.OK)
            {
                // initialize new list of questions
                database = new TrueFalse(openFileDialog.FileName);
                database.LoadQuestions();

                // enable radio buttons
                rbtNo.Enabled  = true;
                rbtYes.Enabled = true;

                // initialize new game
                game = new TrustGame();

                // update status bar
                UpdateStatusStrip();

                // start the game
                Game();
            }
        }
Exemplo n.º 3
0
        // GET: Admin/TrueFalses/Delete/5
        public ActionResult Delete(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            TrueFalse TrueFalse = db.TrueFalses.Find(id);

            if (TrueFalse == null)
            {
                return(HttpNotFound());
            }
            if (TrueFalse.UrlImagen != null)
            {
                string fullPath = Request.MapPath("~/media/upload/TrueFalse/Audios/" + TrueFalse.Audio);
                if (System.IO.File.Exists(fullPath))
                {
                    System.IO.File.Delete(fullPath);
                }
                fullPath = Request.MapPath("~/media/upload/TrueFalse/" + TrueFalse.UrlImagen);
                if (System.IO.File.Exists(fullPath))
                {
                    System.IO.File.Delete(fullPath);
                }
            }

            db.TrueFalses.Remove(TrueFalse);
            db.SaveChanges();
            return(RedirectToAction("Create", "TrueFalses", new { id = TrueFalse.BloqueId }));
        }
Exemplo n.º 4
0
        public void TestQuestionConstructor()
        {
            TrueFalse trueFalse = new TrueFalse(true);
            Question  question  = new Question("Dogs have four feet.", trueFalse);

            Assert.AreEqual("Dogs have four feet.", question.Value);
            Assert.AreEqual($"0 - False{Environment.NewLine}1 - True{Environment.NewLine}", question.Answer.ListOptions());
        }
Exemplo n.º 5
0
        public void QuestionPrintsErrorWhenListIsEmpty()
        {
            TrueFalse trueFalse = new TrueFalse(true);
            Question  question  = new Question("Dogs have four feet.", trueFalse);
            Quiz      quiz      = new Quiz();

            Assert.AreEqual("There are no questions to quiz. Please add questions.", quiz.Start());
        }
Exemplo n.º 6
0
        public void TrueFalseConstructorTest()
        {
            TrueFalse trueFalse = new TrueFalse(true);

            Assert.AreEqual("True", trueFalse.CorrectAnswer);

            trueFalse = new TrueFalse(false);
            Assert.AreEqual("False", trueFalse.CorrectAnswer);
        }
 public LoadTypePresenter([NotNull] ApplicationPresenter applicationPresenter, [NotNull] LoadTypeView view, [NotNull] VLoadType loadtype)
     : base(view, "ThisLoadType.HeaderString", loadtype, applicationPresenter)
 {
     _applicationPresenter = applicationPresenter;
     ThisLoadType          = loadtype;
     _amountForTesting     = 1000;
     TrueFalse.Add(true);
     TrueFalse.Add(false);
     RefreshUsedIn();
 }
Exemplo n.º 8
0
        private void openToolStripMenuItem_Click(object sender, EventArgs e)
        {
            OpenFileDialog ofd = new OpenFileDialog();

            ofd.Filter = "XML files (*.xml)|*.xml";
            if (ofd.ShowDialog() == DialogResult.OK)
            {
                database = new TrueFalse(ofd.FileName);
                database.Load();
                textBox.Text = database.Next();
            }
        }
Exemplo n.º 9
0
    void Start()
    {
        bomb    = GameObject.Find("Bomb").GetComponent <TNT>();
        player  = GameObject.Find("Player").GetComponent <Rigidbody> ();
        trigger = GameObject.Find("TrueFalseTrigger").GetComponent <TrueFalse> ();
        camera1 = GameObject.Find("Character/PlayerCam").GetComponent <Camera>();
        camera2 = GameObject.Find("MainCamera1").GetComponent <Camera>();
        camera3 = GameObject.Find("MainCamera2").GetComponent <Camera>();

        camera2.enabled = false;
        camera3.enabled = false;
    }
Exemplo n.º 10
0
 void Start()
 {
     bomb            = GameObject.Find("Bomb").GetComponent <TNT>();
     player          = GameObject.Find("Player").GetComponent <Rigidbody> ();
     trigger         = GameObject.Find("TrueFalseTrigger").GetComponent <TrueFalse> ();
     camera1         = GameObject.Find("Character/PlayerCam").GetComponent <Camera>();
     camera2         = GameObject.Find("MainCamera1").GetComponent <Camera>();
     camera3         = GameObject.Find("MainCamera2").GetComponent <Camera>();
     oculus          = GameObject.Find("Player/Character/OVRCameraController");
     isOculus        = GameObject.Find("Player/Character/OVRCameraController").activeInHierarchy;
     camera2.enabled = false;
     camera3.enabled = false;
 }
Exemplo n.º 11
0
        protected override QuestionInputModel ConvertToDerived(
            Yw_SubjectContent content)
        {
            TrueFalse           inputModel = new TrueFalse();
            Yw_TrueFalseContent c          = content as Yw_TrueFalseContent;

            inputModel.Answer   = c.Ysc_Answer_Obj.Answer;
            inputModel.StemType = (UeditorType)c.Ysc_Content_Obj.StemType;
            inputModel.Name     = UeditorContentFactory.RestoreContent(
                c.Ysc_Content_Obj.Stem,
                inputModel.StemType);
            return(inputModel);
        }
Exemplo n.º 12
0
        // Обработчик пункта меню Open
        private void miOpen_Click(object sender, EventArgs e)
        {
            OpenFileDialog ofd = new OpenFileDialog();

            if (ofd.ShowDialog() == DialogResult.OK)
            {
                database = new TrueFalse(ofd.FileName);
                database.Load();
                nudNumber.Minimum = 1;
                nudNumber.Maximum = database.Count;
                nudNumber.Value   = 1;
            }
        }
Exemplo n.º 13
0
        public JsonResult GetTrueFalse(int id)
        {
            TrueFalse         TrueFalse = db.TrueFalses.Find(id);
            Bloque            bloque    = db.Bloques.Find(TrueFalse.BloqueId);
            PreguntaTrueFalse pregunta  = new PreguntaTrueFalse()
            {
                UrlImagen   = TrueFalse.UrlImagen,
                Enunciado   = TrueFalse.Enunciado,
                Audio       = TrueFalse.Audio,
                Explicacion = bloque.Explicacion
            };

            return(Json(pregunta, JsonRequestBehavior.AllowGet));
        }
Exemplo n.º 14
0
        private void openToolStripMenuItem_Click(object sender, EventArgs e)
        {
            OpenFileDialog ofd = new OpenFileDialog();

            ofd.Filter = "XML files (*.xml)|*.xml";
            if (ofd.ShowDialog() == DialogResult.OK)
            {
                database = new TrueFalse(ofd.FileName);
                database.Load();
                numericUpDown.Minimum = 1;
                numericUpDown.Maximum = database.Count;
                numericUpDown.Value   = 1;
                textBox.ReadOnly      = false;
            }
        }
Exemplo n.º 15
0
        // Обработчик пункта меню New
        private void miNew_Click(object sender, EventArgs e)
        {
            SaveFileDialog sfd = new SaveFileDialog();

            if (sfd.ShowDialog() == DialogResult.OK)
            {
                database = new TrueFalse(sfd.FileName);
                database.Add("123", true);
                database.Save();
                nudNumber.Minimum = 1;
                nudNumber.Maximum = 1;
                nudNumber.Value   = 1;
            }
            ;
        }
Exemplo n.º 16
0
    // Start is called before the first frame update
    void Start()
    {
        if (gameObject.activeInHierarchy)
        {
            gameObject.SetActive(false);
        }

        // button listeners
        resume.onClick.AddListener(delegate { Resume(); });
        restart.onClick.AddListener(delegate { Restart(); });
        help.onClick.AddListener(delegate { Help(); });
        exit.onClick.AddListener(delegate { Exit(); });

        // find the level's main script
        levelScript = GameObject.Find("Quiz UI").GetComponent <TrueFalse>();
    }
Exemplo n.º 17
0
        private void newToolStripMenuItem_Click(object sender, EventArgs e)
        {
            SaveFileDialog sfd = new SaveFileDialog();

            sfd.FileName   = "Questions";
            sfd.DefaultExt = "xml";
            sfd.Filter     = ".xml";
            if (sfd.ShowDialog() == DialogResult.OK)
            {
                database = new TrueFalse(sfd.FileName);
                numericUpDown.Minimum = 1;
                numericUpDown.Maximum = 1;
                numericUpDown.Value   = 1;
                textBox.ReadOnly      = false;
            }
            ;
        }
Exemplo n.º 18
0
        // GET: Admin/TrueFalses/Edit/5
        public ActionResult Edit(int id, int?examenId)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            TrueFalse TrueFalse = db.TrueFalses.Find(id);

            if (TrueFalse == null)
            {
                return(HttpNotFound());
            }

            TrueFalseEditViewModel viewModel = new TrueFalseEditViewModel();

            viewModel.Inicializar(TrueFalse.BloqueId);
            viewModel.ExamenId  = examenId;
            viewModel.TrueFalse = TrueFalse;
            return(View(viewModel));
        }
Exemplo n.º 19
0
        protected override QuestionInputModel ConvertToDerived2(Yw_SubjectContent content)
        {
            TrueFalse inputModel = new TrueFalse();

            if (content != null)
            {
                Yw_TrueFalseContent c = content as Yw_TrueFalseContent;
                inputModel.Answer   = c.Ysc_Answer_Obj.Answer;
                inputModel.StemType = (UeditorType)c.Ysc_Content_Obj.StemType;
                inputModel.Name     = UeditorContentFactory.RestoreContent(
                    c.Ysc_Content_Obj.Stem,
                    inputModel.StemType);
            }
            else
            {
                inputModel.StemType = UeditorType.Text;
                inputModel.Name     = string.Empty;
                inputModel.Answer   = 1;
            }
            return(inputModel);
        }
Exemplo n.º 20
0
        public JsonResult Contestar(int id, bool respuesta)
        {
            TrueFalse          TrueFalse = db.TrueFalses.Find(id);
            ResultadoTrueFalse resultado = new ResultadoTrueFalse();

            if (TrueFalse.RespuestaCorrecta == respuesta)
            {
                resultado.Correcto = true;
                AuthRepository  authRepository = new AuthRepository();
                ApplicationUser user           = authRepository.FindByName(User.Identity.Name);

                user.PuntosActual = user.PuntosActual + 1;
                user.PuntosTotal  = user.PuntosTotal + 1;

                var userResult = authRepository.Update(user);

                ContenidoHelper.QuitarMistake(TrueFalse.BloqueId, id);
            }
            else
            {
                resultado.Correcto = false;
            }
            if (TrueFalse.Explicacion == "-")
            {
                if (resultado.Correcto)
                {
                    resultado.Explicacion = "Correcto";
                }
                else
                {
                    resultado.Explicacion = "Incorrecto";
                }
            }
            else
            {
                resultado.Explicacion = TrueFalse.Explicacion;
            }

            return(Json(resultado, JsonRequestBehavior.AllowGet));
        }
Exemplo n.º 21
0
 private void imSaveAs_Click(object sender, EventArgs e)
 {
     if (saveFileDialog1.ShowDialog() == DialogResult.Cancel)
     {
         return;
     }
     // сохраняем текст в файл
     if (database == null)
     {
         database = new TrueFalse(saveFileDialog1.FileName);
         database.Add("123", true);
         database.Save();
         nudNumber.Minimum = 1;
         nudNumber.Maximum = 1;
         nudNumber.Value   = 1;
         MessageBox.Show("Файл сохранен");
     }
     else
     {
         database.FileName = saveFileDialog1.FileName;
         database.Save();
         MessageBox.Show("Файл сохранен");
     }
 }
Exemplo n.º 22
0
        // Saves question to test
        protected void btnSaveQuestion_Click(object sender, EventArgs e)
        {

            // Multiple choice question checked and saved
            if(rblChooseQuestion.SelectedValue == "Multiple Choice")
                if(txtMCQuestion.Text != String.Empty)
                    if (txtMC1.Text != String.Empty || txtMC2.Text != String.Empty || txtMC3.Text != String.Empty || txtMC4.Text != String.Empty)
                    {
                        Question newQuestion = new Question(questionCounter, Int32.Parse(ddlPointValue.SelectedValue), "Multiple Choice");

                        if(rdbMC1.Checked == true)
                        {
                            MultipleChoice newMCQuestion = new MultipleChoice(questionCounter, txtMCQuestion.Text, "A");
                        }
                        else if (rdbMC2.Checked == true)
                        {
                            MultipleChoice newMCQuestion = new MultipleChoice(questionCounter, txtMCQuestion.Text, "B");
                        }
                        else if (rdbMC3.Checked == true)
                        {
                            MultipleChoice newMCQuestion = new MultipleChoice(questionCounter, txtMCQuestion.Text, "C");
                        }
                        else
                        {
                            MultipleChoice newMCQuestion = new MultipleChoice(questionCounter, txtMCQuestion.Text, "D");
                        }

                        MultipleChoiceChoice MCOption1 = new MultipleChoiceChoice(questionCounter, 'A', txtMC1.Text);
                        MultipleChoiceChoice MCOption2 = new MultipleChoiceChoice(questionCounter, 'A', txtMC2.Text);
                        MultipleChoiceChoice MCOption3 = new MultipleChoiceChoice(questionCounter, 'A', txtMC3.Text);
                        MultipleChoiceChoice MCOption4 = new MultipleChoiceChoice(questionCounter, 'A', txtMC4.Text);

                        questionList.Add(newQuestion);
                    }

            // True False Question checked and saved
            if(rblChooseQuestion.SelectedValue == "True False")
                if(txtTFQuestion.Text != String.Empty)
                {
                    Question newQuestion = new Question(questionCounter,Int32.Parse(ddlPointValue.SelectedValue), "True/False");
                    TrueFalse newTFQuestion = new TrueFalse(questionCounter, txtTFQuestion.Text, rblTrueFalse.SelectedValue.ToString());
                    questionList.Add(newQuestion);
                }

            // Fill in the Blank question checked and saved
            if (rblChooseQuestion.SelectedValue == "Short Answer")
                if (txtFBAnswer.Text != String.Empty)
                {
                    Question newQuestion = new Question(questionCounter, Int32.Parse(ddlPointValue.SelectedValue), "Short Answer");
                    if (txtFBStatementBegin.Text != String.Empty && txtFBStatementEnd.Text != String.Empty)
                    {
                        ShortAnswer newSAQuestion = new ShortAnswer(questionCounter, txtFBStatementBegin.Text, txtFBAnswer.Text, txtFBStatementEnd.Text);
                    }
                    else if(txtFBStatementBegin.Text != String.Empty)
                    {
                        ShortAnswer newSAQuestion = new ShortAnswer(questionCounter, String.Empty, txtFBAnswer.Text, txtFBStatementEnd.Text);
                    }
                    else
                    {
                        ShortAnswer newSAQuestion = new ShortAnswer(questionCounter, txtFBStatementBegin.Text, txtFBAnswer.Text, String.Empty);
                    }
                    questionList.Add(newQuestion);
                }

            // Matching question checked and saved
            if(rblChooseQuestion.SelectedValue == "Matching")
            {
                if (txtSectionName.Text != String.Empty)
                {
                    Question newQuestion = new Question(questionCounter, Int32.Parse(ddlPointValue.SelectedValue), "Matching");
                    Matching newMatching = new Matching(questionCounter, txtSectionName.Text);
                    if (txtMQuestion1.Text != String.Empty && txtMAnswer1.Text != String.Empty)
                    {
                        MatchingQuestions newChoice1 = new MatchingQuestions(4, txtMQuestion1.Text, txtMAnswer1.Text);
                    }
                    if (txtMQuestion2.Text != String.Empty && txtMAnswer2.Text != String.Empty)
                    {
                        MatchingQuestions newChoice2 = new MatchingQuestions(4, txtMQuestion2.Text, txtMAnswer2.Text);
                    }
                    if (txtMQuestion3.Text != String.Empty && txtMAnswer3.Text != String.Empty)
                    {
                        MatchingQuestions newChoice3 = new MatchingQuestions(4, txtMQuestion3.Text, txtMAnswer3.Text);
                    }
                    if (txtMQuestion4.Text != String.Empty && txtMAnswer4.Text != String.Empty)
                    {
                        MatchingQuestions newChoice4 = new MatchingQuestions(4, txtMQuestion4.Text, txtMAnswer4.Text);
                    }
                    questionList.Add(newQuestion);
                }
            }

            // Essay question checked and saved
            if (rblChooseQuestion.SelectedValue == "Essay")
                if (txtEQuestion.Text != String.Empty)
                {
                    Question newQuestion = new Question(questionCounter, Int32.Parse(ddlPointValue.SelectedValue), "Essay");
                    Essay newEssayQuestion = new Essay(questionCounter, txtEQuestion.Text);
                    questionList.Add(newQuestion);
                }

            // tentative way to have unique questionIds
            questionCounter++;
        }
Exemplo n.º 23
0
        public JsonResult FinExamen(int id, PreguntaExamen[] respuestas)
        {
            var userId   = ((ClaimsIdentity)User.Identity).FindFirst("UserId").Value;
            int aciertos = 0;
            int totales  = respuestas.Length;

            List <RespuestaIncorrecta> respuestasIncorrectas = new List <RespuestaIncorrecta>();

            foreach (var pregunta in respuestas)
            {
                bool   acertada              = false;
                string enunciado             = "";
                string respuestaCorrecta     = "";
                string respuestaSeleccionada = "";


                if (pregunta.tipo == "Tests")
                {
                    Test test = db.Tests.Find(pregunta.id);
                    if (pregunta.respuesta != null && test.RespuestaCorrecta.ToString() == pregunta.respuesta)
                    {
                        aciertos++;
                        acertada = true;
                    }
                    else
                    {
                        enunciado             = test.Enunciado;
                        respuestaCorrecta     = ObtenerRespuestaTest(test, test.RespuestaCorrecta);
                        respuestaSeleccionada = ObtenerRespuestaTest(test, Convert.ToInt32(pregunta.respuesta));
                    }
                }
                if (pregunta.tipo == "FillTheGaps")
                {
                    if (pregunta.respuesta != null)
                    {
                        pregunta.respuesta = pregunta.respuesta.Replace(',', '#');
                    }
                    FillTheGap fillTheGap = db.FillTheGaps.Find(pregunta.id);
                    if (pregunta.respuesta != null && fillTheGap.Respuestas.ToLower() == pregunta.respuesta.ToLower())
                    {
                        aciertos++;
                        acertada = true;
                    }
                    else
                    {
                        enunciado         = fillTheGap.Enunciado;
                        respuestaCorrecta = fillTheGap.Respuestas.Replace('#', ' ');
                        if (pregunta.respuesta != null)
                        {
                            respuestaSeleccionada = pregunta.respuesta.Replace('#', ' ');
                        }
                    }
                }
                if (pregunta.tipo == "TrueFalses")
                {
                    TrueFalse TrueFalse = db.TrueFalses.Find(pregunta.id);
                    if (pregunta.respuesta != null && TrueFalse.RespuestaCorrecta.ToString() == pregunta.respuesta)
                    {
                        aciertos++;
                        acertada = true;
                    }
                    else
                    {
                        enunciado             = TrueFalse.Enunciado;
                        respuestaCorrecta     = TrueFalse.RespuestaCorrecta.ToString();
                        respuestaSeleccionada = pregunta.respuesta;
                    }
                }
                if (pregunta.tipo == "AudioSentenceExercises")
                {
                    if (pregunta.respuesta != null)
                    {
                        pregunta.respuesta = pregunta.respuesta.Replace(',', '#');
                    }
                    AudioSentenceExercise audioSentence = db.AudioSentenceExercises.Find(pregunta.id);
                    if (pregunta.respuesta != null && audioSentence.Respuestas.ToLower() == pregunta.respuesta.ToLower())
                    {
                        aciertos++;
                        acertada = true;
                    }
                    else
                    {
                        enunciado         = audioSentence.Enunciado;
                        respuestaCorrecta = audioSentence.Respuestas.Replace('#', ' ');
                        if (pregunta.respuesta != null)
                        {
                            respuestaSeleccionada = pregunta.respuesta.Replace('#', ' ');
                        }
                    }
                }

                if (!acertada)
                {
                    RespuestaIncorrecta respuestaInc = new RespuestaIncorrecta();
                    respuestaInc.Pregunta              = enunciado;
                    respuestaInc.RespuestaCorrecta     = respuestaCorrecta;
                    respuestaInc.RespuestaSeleccionada = respuestaSeleccionada;
                    respuestaInc.Tipo       = pregunta.tipo;
                    respuestaInc.PreguntaId = pregunta.id;
                    respuestasIncorrectas.Add(respuestaInc);
                }
            }


            bool _aprobado = (aciertos >= 28);



            FinExamenTest resultado = new Models.FinExamenTest();

            resultado.Correctas          = aciertos;
            resultado.Aprobado           = _aprobado;
            resultado.Porcentaje         = (aciertos * 100 / totales);
            resultado.IdSiguienteLeccion = 0;
            resultado.SiguienteLeccion   = "";


            SubTema _subtemaActual = SubTemaDataAccess.ObtenerSubTemas(db).FirstOrDefault(s => s.SubTemaId == id);
            SubTema _siguienteTema = SubTemaDataAccess.ObtenerSubTemas(db).Where(s => s.TemaId == _subtemaActual.TemaId && s.Orden > _subtemaActual.Orden).OrderBy(s => s.Orden).FirstOrDefault();

            resultado.UltimoExamen = true;
            if (_siguienteTema != null)
            {
                resultado.UltimoExamen = false;
                if (_aprobado)
                {
                    resultado.IdSiguienteLeccion = _siguienteTema.SubTemaId;
                    resultado.SiguienteLeccion   = _siguienteTema.Descripcion;



                    var  BloquearSubtemas = ((ClaimsIdentity)User.Identity).FindFirst("BloquearSubtemas").Value;
                    bool anyadir          = true;
                    if (Convert.ToBoolean(BloquearSubtemas))
                    {
                        var listaSubtemasAcceso = db.SubTemaAccesoUsuarios.Where(sau => sau.AlumnoId == userId).Select(sau => sau.SubTemaId).ToList();
                        if (!listaSubtemasAcceso.Contains(_siguienteTema.SubTemaId))
                        {
                            anyadir = false;
                        }
                    }
                    if (anyadir)
                    {
                        SubTemaDesbloqueado _desbloqueado = new SubTemaDesbloqueado
                        {
                            AlumnoId        = userId,
                            FechaDesbloqueo = DateTime.Now,
                            SubTemaId       = _siguienteTema.SubTemaId
                        };
                        db.SubTemaDesbloqueados.Add(_desbloqueado);
                        db.SaveChanges();
                    }
                }
            }

            var    NombreUsuario = ((ClaimsIdentity)User.Identity).FindFirst("NombreUsuario").Value;
            Examen _examen       = new Examen
            {
                Aciertos     = aciertos,
                AlumnoId     = userId,
                NombreAlumno = NombreUsuario,
                Aprobado     = _aprobado,
                SubTemaId    = id,
                Fallos       = totales - aciertos,
                FechaExamen  = DateTime.Now,
                Total        = totales
            };

            _examen.RespuestasIncorrectas = respuestasIncorrectas;

            db.Examenes.Add(_examen);
            db.SaveChanges();

            return(Json(resultado, JsonRequestBehavior.AllowGet));
        }
Exemplo n.º 24
0
 public void TeatData()
 {
     test = new TrueFalse(Dictionnaries.tfQuestions, Dictionnaries.tfCorrects);
 }
Exemplo n.º 25
0
        public void TrueFalseListOptionsReturnsString()
        {
            TrueFalse trueFalse = new TrueFalse(false);

            Assert.AreEqual($"0 - False{Environment.NewLine}1 - True{Environment.NewLine}", trueFalse.ListOptions());
        }
Exemplo n.º 26
0
        public ActionResult EditTrueFalseSubjectConfirm(TrueFalse subject)
        {
            var id = SaveSubject(subject);

            return(Json(new SuccessJsonResponse(new { id = id, button = subject.Button })));
        }
Exemplo n.º 27
0
        public static Component CloneNode(Component node, BinaryTree bt, char current = '!', char rename = '!')
        {
            Component newNode;

            if (node is BiImplication)
            {
                newNode = new BiImplication();
            }
            else if (node is Implication)
            {
                newNode = new Implication();
            }
            else if (node is Conjunction)
            {
                newNode = new Conjunction();
            }
            else if (node is Disjunction)
            {
                newNode = new Disjunction();
            }
            else if (node is Negation negation)
            {
                newNode = new Negation();
                ((Negation)newNode).GammaProcessed = negation.GammaProcessed;
            }
            else if (node is Nand)
            {
                newNode = new Nand();
            }
            else if (node is TrueFalse)
            {
                newNode = new TrueFalse(((TrueFalse)node).Data);
            }
            else if (node is Predicate predicate)
            {
                newNode = new Predicate(node.Symbol);
                predicate.ObjectVariables.Variables.ForEach(x => ((IVariableContainer)newNode)
                                                            .ObjectVariables.AddPropositionalVariable(CloneVariableForPredicate(x, current, rename))
                                                            );
            }
            else if (node is Universal universal)
            {
                newNode = new Universal();
                universal.ObjectVariables.Variables.ForEach(x => ((IVariableContainer)newNode)
                                                            .ObjectVariables.AddPropositionalVariable(CloneVariableForPredicate(x, current, rename))
                                                            );
                ((Universal)newNode).GammaProcessed = universal.GammaProcessed;
            }
            else if (node is Existential existential)
            {
                newNode = new Existential();
                existential.ObjectVariables.Variables.ForEach(x => ((IVariableContainer)newNode)
                                                              .ObjectVariables.AddPropositionalVariable(CloneVariableForPredicate(x, current, rename))
                                                              );
            }
            else
            {//
                newNode = new Variable(((Variable)node).Symbol, ((Variable)node).BindVariable);
                bt.PropositionalVariables.AddPropositionalVariable((Variable)newNode);
            }

            newNode.Parent = node.Parent;
            if (node is CompositeComponent)
            {
                if (node is Negation)
                {
                    newNode.LeftNode = CloneNode(node.LeftNode, bt, current, rename);
                }
                else
                {
                    newNode.LeftNode = node.LeftNode != null?CloneNode(node.LeftNode, bt, current, rename) : node.LeftNode;

                    newNode.RightNode = node.RightNode != null?CloneNode(node.RightNode, bt, current, rename) : node.RightNode;
                }
            }
            newNode.NodeNumber++;
            return(newNode);
        }