Пример #1
0
        public ActionResult RegisterStudents(List <Student> allOfStudents)
        {
            if (allOfStudents == null)
            {
                TeacherData teacherData = rsContext.getTeacher(User.Identity.Name);
                TempData["RoomID"] = teacherData.RoomId;

                return(View());
            }
            else
            {
                TeacherData teacherData = rsContext.getTeacher(User.Identity.Name);
                foreach (Student s in allOfStudents)
                {
                    s.RoomId = teacherData.RoomId;
                }
                List <StudentData> studentsData = Adapting.getStudentListAsData(allOfStudents);
                string             stud         = teacherData.registerStudentsFromList(studentsData);
                if (!stud.Equals(""))
                {
                    TempData["errorMessage"] = Resources.Resources.ThoseStudentsAreAlreadyRegistered + stud + Resources.Resources.AllTheOtherStudentsWereRegistered;
                }
                else
                {
                    TempData["infoMessage"] = Resources.Resources.StudentsRegisteredSuccessfully;
                }
                return(PartialView());
            }
        }
Пример #2
0
        // GET: Activities/DisplaySALog
        public ActionResult DisplaySALog(long ActivityId)
        {
            SALogData saqlData = (SALogData)rsContext.getActivityLog(ActivityId);
            SALog     saql     = Adapting.getShortAnswerQuestionLogFromData(saqlData);

            return(View(saql));
        }
Пример #3
0
        // GET: Teacher/EditExperiment
        public ActionResult EditExperiment(long ExpID)
        {
            ExperimentData expData = (ExperimentData)rsContext.getActivity(ExpID);
            Experiment     exp     = Adapting.getExperimentFromData(expData);

            return(View(exp));
        }
Пример #4
0
        // POST: Teacher/DisplayAmericanQuestion
        //[HttpPost]
        //[ValidateAntiForgeryToken]
        public ActionResult DisplayAmericanQuestion(long ActivityId)
        {
            AmericanQuestionData quesData    = (AmericanQuestionData)rsContext.getActivity(ActivityId);
            TeacherData          teacherData = rsContext.getTeacher(User.Identity.Name);

            if (teacherData == null)
            {
                throw new ArgumentNullException(nameof(teacherData));
            }

            //RoomData roomData = teacherData.getRoomData();
            RoomData roomData = rsContext.getRoom(teacherData.RoomId);

            if (roomData == null)
            {
                throw new ArgumentNullException(nameof(roomData));
            }

            roomData.updateCurrentActivityId(quesData.id);
            rsContext.SaveChanges();

            AmericanQuestion ques = Adapting.getAmericanQuestionFromData(quesData);

            return(View(ques));
        }
Пример #5
0
        // GET: Teacher/Dashboard
        public ActionResult Dashboard()
        {
            TeacherData teacherData = rsContext.getTeacher(User.Identity.Name);
            Teacher     teacher     = Adapting.getTeacherFromData(teacherData);

            return(View(teacher));
        }
Пример #6
0
        // GET: Activities/DisplayTFQLog
        public ActionResult DisplayTFQLog(long ActivityId)
        {
            TFQLogData tfqlData = (TFQLogData)rsContext.getActivityLog(ActivityId);
            TFQLog     tfql     = Adapting.getTFQLogFromData(tfqlData);

            return(View(tfql));
        }
Пример #7
0
        // GET: Activities/DisplayAmericanLog
        public ActionResult DisplayAmericanLog(long ActivityId)
        {
            AmericanLogData aqlData = (AmericanLogData)rsContext.getActivityLog(ActivityId);
            AmericanLog     aql     = Adapting.getAmericanLogFromData(aqlData);

            return(View(aql));
        }
Пример #8
0
        /// <summary>
        /// Adapts the control with the given control adapters, calling their Bind methods
        /// in the order that they are given here and their BindReverse methods in the
        /// reverse order that they are given here</summary>
        /// <param name="adapters">Adapters to adapt the control</param>
        /// <remarks>By convention, the bottom-most IControlAdapter should appear as the
        /// first parameter and subscribe to the Paint event in its Bind() method and subscribe
        /// to mouse events in its BindReverse() method. Likewise, the top-most IControlAdapter
        /// should be the last parameter.</remarks>
        public void Adapt(params IControlAdapter[] adapters)
        {
            OnAdapting(EventArgs.Empty);
            Adapting.Raise(this, EventArgs.Empty);

            // allow existing adapters to detach from context
            Context = null;

            foreach (IControlAdapter adapter in m_adapters)
            {
                adapter.Unbind(this);
                Dispose(adapter);
            }
            m_adapters.Clear();
            m_adapterCache.Clear();
            m_contextAdapterPreferred.Clear();

            m_adapters.AddRange(adapters);

            foreach (IControlAdapter adapter in m_adapters)
            {
                adapter.Bind(this);
            }

            for (int i = m_adapters.Count - 1; i >= 0; i--)
            {
                m_adapters[i].BindReverse(this);
            }

            OnAdapted(EventArgs.Empty);
            Adapted.Raise(this, EventArgs.Empty);

            Invalidate();
        }
Пример #9
0
        public ActionResult StudentsProgress(ActiveExperiment ae, bool flag = false)
        {
            ActiveExperimentData aeData  = Adapting.getActiveExperimentAsData(ae);
            ExperimentData       expData = (ExperimentData)rsContext.getActivity(ae.ExpID);

            if (flag == false)
            {
                rsContext.addActiveExperiment(aeData);
            }
            expData.ActiveExpID = aeData.ActiveExpID;
            ae.ActiveExpID      = aeData.ActiveExpID;
            rsContext.SaveChanges();
            TempData["NumberOfExperimentSteps"]   = expData.activities.Count;
            TempData["DifferenceBetweenMeasures"] = 0;
            TempData["NumOfMeasures"]             = 0;
            foreach (ActivityData act in expData.activities)
            {
                if (act is MeasurementData)
                {
                    MeasurementData measurement = (MeasurementData)act;
                    TempData["DifferenceBetweenMeasures"] = measurement.DifferenceBetweenMeasures;
                    TempData["NumOfMeasures"]             = measurement.NumOfMeasures;
                }
            }
            return(View("StudentsProgress", ae));
        }
Пример #10
0
        // GET: Activities/HistoryByStudent
        public ActionResult HistoryByStudent()
        {
            TeacherData teacherData = rsContext.getTeacher(User.Identity.Name);

            TempData["RoomID"] = teacherData.RoomId;
            return(View(Adapting.getStudentListFromData(rsContext.getStudentsByTeacher(teacherData.RoomId))));
        }
Пример #11
0
        // GET: Activities/DisplayExperimentLog
        public ActionResult DisplayExperimentLog(long ActivityId)
        {
            ExperimentLogData elData = (ExperimentLogData)rsContext.getActivityLog(ActivityId);
            ExperimentLog     el     = Adapting.getExperimentLogFromData(elData);

            return(View(el));
        }
Пример #12
0
        public ActionResult EditExperiment(Experiment exp)
        {
            ActivityData tempExp = rsContext.getActivity(exp.ActivityName);

            if (tempExp == null)
            {
                ExperimentData expData = Adapting.getExperimentAsData(exp);
                rsContext.addActivity(expData);
                exp.activities = new List <Activity>();
                exp            = Adapting.getExperimentFromData(expData);
            }
            else
            {
                if (tempExp is ExperimentData)
                {
                    ExperimentData expData = (ExperimentData)tempExp;
                    exp = Adapting.getExperimentFromData(expData);
                }
                else
                {
                    throw new Exception("you try to create an activity with the same name of an alredy existing activity");
                }
            }

            return(View(exp));
        }
Пример #13
0
        public ActionResult SaveAmericanQuestion(AmericanQuestion ques)
        {
            TeacherData teacherData = rsContext.getTeacher(User.Identity.Name);

            if (ques.expID == -1)
            {
                ques.RoomId = teacherData.RoomId;
                AmericanQuestionData aqData = Adapting.getAmericanQuestionAsData(ques);
                rsContext.addActivity(aqData);
                rsContext.SaveChanges();
                return(RedirectToDashboard());
            }

            else
            {
                ques.RoomId = 0;
                AmericanQuestionData aqData = Adapting.getAmericanQuestionAsData(ques);
                rsContext.addActivity(aqData);
                ExperimentData experimentData = (ExperimentData)rsContext.getActivity(ques.expID);
                aqData.experimentOrder = experimentData.activities.Count;
                experimentData.addStep(aqData);
                rsContext.SaveChanges();
                return(RedirectToAction("EditExperiment", new { ExpID = ques.expID }));
            }
        }
Пример #14
0
        // GET: Activities/ActivityLogs
        public ActionResult ActivityLogs()
        {
            TeacherData            teacherData = rsContext.getTeacher(User.Identity.Name);
            List <ActivityLogData> lstData     = rsContext.getHistory(teacherData.RoomId);
            List <ActivityLog>     lst         = Adapting.getActivityLogListFromData(lstData);

            return(View(lst));
        }
Пример #15
0
        public ActionResult SaveVideo(Video video)
        {
            ExperimentData experimentData = (ExperimentData)rsContext.getActivity(video.expID);
            VideoData      videoData      = Adapting.getVideoAsData(video);

            videoData.experimentOrder = experimentData.activities.Count;
            experimentData.addStep(videoData);
            rsContext.SaveChanges();
            return(RedirectToAction("EditExperiment", new { ExpID = video.expID }));
        }
Пример #16
0
        public ActionResult SaveImage(Image image)
        {
            ExperimentData experimentData = (ExperimentData)rsContext.getActivity(image.expID);
            ImageData      imageData      = Adapting.getImageAsData(image);

            imageData.experimentOrder = experimentData.activities.Count;
            experimentData.addStep(imageData);
            rsContext.SaveChanges();
            return(RedirectToAction("EditExperiment", new { ExpID = image.expID }));
        }
Пример #17
0
        public ActionResult SaveInstruction(Instruction instruction)
        {
            ExperimentData  experimentData  = (ExperimentData)rsContext.getActivity(instruction.expID);
            InstructionData instructionData = Adapting.getInstructionAsData(instruction);

            instructionData.experimentOrder = experimentData.activities.Count;
            experimentData.addStep(instructionData);
            rsContext.SaveChanges();
            return(RedirectToAction("EditExperiment", new { ExpID = instruction.expID }));
        }
Пример #18
0
        public ActionResult EditMeasurement(Measurement measurement)
        {
            ExperimentData  experimentData  = (ExperimentData)rsContext.getActivity(measurement.expID);
            MeasurementData measurementData = Adapting.getMeasurementAsData(measurement);

            measurementData.RoomId          = 0;
            measurementData.experimentOrder = experimentData.activities.Count;
            experimentData.addStep(measurementData);
            rsContext.SaveChanges();
            return(RedirectToAction("AddInstructionsForMeasures", new { MeasurementID = measurementData.id, NumOfParametersToMeasure = measurementData.NumOfParametersToMeasure }));
        }
Пример #19
0
        // GET: Teacher/CreateActivity
        public ActionResult CreateActivity()
        {
            TeacherData teacherData = rsContext.getTeacher(User.Identity.Name);

            if (teacherData == null)
            {
                throw new ArgumentNullException(nameof(teacherData));
            }
            Teacher teacher = Adapting.getTeacherFromData(teacherData);

            return(View(teacher));
        }
Пример #20
0
        // GET: Activities/DisplaySAQLogForStudent
        public ActionResult DisplaySAQLogForStudent(long saqID, string StudentPhone)
        {
            ActivityData        activityData = rsContext.getActivity(saqID);
            ShortAnswerQuestion saq          = Adapting.getShortAnswerQuestionFromData((ShortAnswerQuestionData)activityData);

            AnswerByPhone answer  = Adapting.getAnswerByPhoneFromData(rsContext.getAnswerByPhoneAndActivityID(saq.id, StudentPhone, saq.RoomId));
            Student       student = Adapting.getStudentFromData(rsContext.getStudent(StudentPhone, answer.RoomID));

            TempData["StudentAnswer"] = answer.Answer;
            TempData["StudentName"]   = student.FirstName + " " + student.LastName;

            return(View(saq));
        }
Пример #21
0
        // GET: Activities/DisplayTFQLogForStudent
        public ActionResult DisplayTFQLogForStudent(long tfqID, string StudentPhone)
        {
            ActivityData      activityData = rsContext.getActivity(tfqID);
            TrueFalseQuestion tfq          = Adapting.getTrueFalseQuestionFromData((TrueFalseQuestionData)activityData);

            AnswerByPhone answer  = Adapting.getAnswerByPhoneFromData(rsContext.getAnswerByPhoneAndActivityID(tfq.id, StudentPhone, tfq.RoomId));
            Student       student = Adapting.getStudentFromData(rsContext.getStudent(StudentPhone, answer.RoomID));

            TempData["StudentAnswer"] = answer.Answer;
            TempData["StudentName"]   = student.FirstName + " " + student.LastName;

            return(View(tfq));
        }
Пример #22
0
        // GET: Student/ViewRoomOrWaitingScreen
        public ActionResult ViewRoomOrWaitingScreen(StudentLoginViewModel model)
        {
            RoomData     roomData     = rsContext.getRoom(model.Room);
            ActivityData activityData = rsContext.getActivity(roomData.CurrentActivityId);

            if (activityData == null)
            {
                //Waiting Screen
                return(RedirectToAction("Wait", model));
            }
            else
            {
                if (activityData is TrueFalseQuestionData)
                {
                    //True/False Question
                    TrueFalseQuestion tfq = (TrueFalseQuestion)Adapting.getTrueFalseQuestionFromData((TrueFalseQuestionData)activityData);
                    return(RedirectToAction("TrueFalseQuestion", new { expId = -1, currActivityIndex = -1, activityId = tfq.id, numOfActivities = 0, studentPhone = model.PhoneNumber, studentRoom = model.Room }));
                }
                else if (activityData is ShortAnswerQuestionData)
                {
                    //Short Answer Question
                    ShortAnswerQuestion saq = (ShortAnswerQuestion)Adapting.getShortAnswerQuestionFromData((ShortAnswerQuestionData)activityData);
                    return(RedirectToAction("ShortAnswerQuestion", new { expId = -1, currActivityIndex = -1, activityId = saq.id, numOfActivities = 0, studentPhone = model.PhoneNumber, studentRoom = model.Room }));
                }
                else if (activityData is AmericanQuestionData)
                {
                    //American Answer Question
                    AmericanQuestion aq = (AmericanQuestion)Adapting.getAmericanQuestionFromData((AmericanQuestionData)activityData);
                    return(RedirectToAction("AmericanQuestion", new { expId = -1, currActivityIndex = -1, activityId = aq.id, numOfActivities = 0, studentPhone = model.PhoneNumber, studentRoom = model.Room }));
                }

                else if (activityData is ExperimentData)
                {
                    // Experiment
                    Experiment exp = (Experiment)Adapting.getExperimentFromData((ExperimentData)activityData);
                    if (exp.ActiveExpID == 0)
                    {
                        //Waiting Screen
                        Thread.Sleep(2000);
                        return(RedirectToAction("Wait", model));
                    }
                    return(RedirectToAction("GroupCreation", new { expId = exp.id, studentPhone = model.PhoneNumber, studentRoom = model.Room, currActivityIndex = 0 }));
                }
            }

            return(View());
        }
Пример #23
0
        public ActionResult ShowCurrentActivity()
        {
            TeacherData  teacherData  = rsContext.getTeacher(User.Identity.Name);
            RoomData     roomData     = rsContext.getRoom(teacherData.RoomId);
            ActivityData currActivity = rsContext.getActivity(roomData.CurrentActivityId);

            if (currActivity == null)
            {
                TempData["alertMessage"] = Resources.Resources.ThereIsNoActivityActivated;
                return(RedirectToAction("Dashboard"));
            }
            else
            {
                if (currActivity is TrueFalseQuestionData)
                {
                    return(View("DisplayTrueFalseQuestion", Adapting.getTrueFalseQuestionFromData((TrueFalseQuestionData)currActivity)));
                }
                else if (currActivity is ShortAnswerQuestionData)
                {
                    return(View("DisplayShortAnswerQuestion", Adapting.getShortAnswerQuestionFromData((ShortAnswerQuestionData)currActivity)));
                }
                else if (currActivity is AmericanQuestionData)
                {
                    return(View("DisplayAmericanQuestion", Adapting.getAmericanQuestionFromData((AmericanQuestionData)currActivity)));
                }
                else // experiment
                {
                    ExperimentData expData = (ExperimentData)currActivity;
                    if (expData.ActiveExpID == 0)
                    {
                        return(RedirectToAction("GroupSelection", new { ExpID = expData.id }));
                    }
                    else
                    {
                        ActiveExperimentData ae = rsContext.getActiveExperiment(expData.ActiveExpID);
                        return(StudentsProgress(Adapting.getActiveExperimentFromData(ae), true));
                    }
                }
            }
        }
Пример #24
0
 // GET: Activities/HistoryByStudent
 public ActionResult DisplayActivitiesOfStudent(string phoneNumber, long RoomID)
 {
     TempData["PhoneNumber"] = phoneNumber;
     TempData["RoomID"]      = RoomID;
     return(View(Adapting.getActivityListFromData(rsContext.getActivitiesByStudentPhone(phoneNumber, RoomID))));
 }
Пример #25
0
        // GET: Activities/HistoryByActivity
        public ActionResult HistoryByActivity()
        {
            TeacherData teacherData = rsContext.getTeacher(User.Identity.Name);

            return(View(Adapting.getActivityLogListFromData(rsContext.getHistory(teacherData.RoomId))));
        }
Пример #26
0
        // GET: Activities/ExistingActivities
        public ActionResult ExistingActivities()
        {
            TeacherData teacherData = rsContext.getTeacher(User.Identity.Name);

            return(View(Adapting.getActivityListFromData(rsContext.getMainActivities(teacherData.RoomId))));
        }