Ejemplo n.º 1
0
        public static AmericanLog getAmericanLogFromData(AmericanLogData aqlData)
        {
            AmericanLog aql = new AmericanLog();

            aql.ActivityName = aqlData.ActivityName;
            aql.expID = aqlData.expID;
            aql.id = aqlData.id;
            aql.isMainActivity = aqlData.isMainActivity;
            aql.RoomId = aqlData.RoomId;

            aql.question = aqlData.question;
            aql.explaination = aqlData.explaination;

            aql.correctAnswer = aqlData.correctAnswer;
            aql.counterFirst = aqlData.counterFirst;
            aql.counterSecond = aqlData.counterSecond;
            aql.counterThird = aqlData.counterThird;
            aql.counterFourth = aqlData.counterFourth;

            aql.firstAnswer = aqlData.firstAnswer;
            aql.secondAnswer = aqlData.secondAnswer;
            aql.thirdAnswer = aqlData.thirdAnswer;
            aql.fourthAnswer = aqlData.fourthAnswer;

            aql.studentsAnswers = new List<AnswerByPhone>();
            if (aqlData.studentsAnswers != null)
            {
                foreach (AnswerByPhoneData abpData in aqlData.studentsAnswers)
                {
                    aql.studentsAnswers.Add(getAnswerByPhoneFromData(abpData));
                }
            }
            return aql;
        }
Ejemplo n.º 2
0
        // GET: Teacher/Dashboard1
        public ActionResult Dashboard1(long id)
        {
            TeacherData teacherData = rsContext.getTeacher(User.Identity.Name);
            RoomData roomData = rsContext.getRoom(teacherData.RoomId);
            roomData.updateCurrentActivityId(0);
            rsContext.SaveChanges();

            // Save activity log
            ActivityData actData = rsContext.getActivity(id);
            if (actData is TrueFalseQuestionData)
            {
                TFQLogData tfqlData = new TFQLogData((TrueFalseQuestionData)actData, DateTime.Now);
                rsContext.addActivityLog(tfqlData);
                ((TrueFalseQuestionData)actData).reset();
                rsContext.SaveChanges();
            }
            else if (actData is AmericanQuestionData)
            {
                AmericanLogData aqlData = new AmericanLogData((AmericanQuestionData)actData, DateTime.Now);
                rsContext.addActivityLog(aqlData);
                ((AmericanQuestionData)actData).reset();
                rsContext.SaveChanges();
            }
            else if (actData is ShortAnswerQuestionData)
            {
                SALogData saqlData = new SALogData((ShortAnswerQuestionData)actData, DateTime.Now);
                rsContext.addActivityLog(saqlData);
                rsContext.SaveChanges();
            }
            else {
                ActiveExperimentData activeExpData = rsContext.getActiveExperiment(id);
                List<StudentData> studentsInRoom = rsContext.getStudentsByTeacher(roomData.id);
                foreach (StudentData studentData in studentsInRoom)
                {
                    studentData.GroupID = 0;
                }
                ExperimentData expData = (ExperimentData) rsContext.getActivity(activeExpData.ExpID);
                expData.ActiveExpID = 0;
                //rsContext.addActiveExpLog(activeExpData); //TODO
                rsContext.SaveChanges();
            }

            return RedirectToDashboard();
        }