public List <ActivityData> getMainActivities(long roomID)
        {
            List <ActivityData> lst = new List <ActivityData>();
            List <ActivityData> allMainActivities = Activities.Where(act => act.isMainActivity == true).ToList();

            foreach (ActivityData act in allMainActivities)
            {
                if (act.RoomId == roomID)
                {
                    lst.Add(act);
                }
                else if (act.Type == "Experiment" && act.RoomId == 0)
                {
                    if (allMainActivities.Where(otherAct => otherAct.Type == "Experiment" &&
                                                act.ActivityName == otherAct.ActivityName && otherAct.RoomId == roomID).ToList().Count == 0)
                    {
                        if (((ExperimentData)act).activities.Count != 0)
                        {
                            ExperimentData copiedExp = new ExperimentData((ExperimentData)act);
                            copiedExp.RoomId = roomID;
                            addActivity(copiedExp);
                            lst.Add(copiedExp);
                        }
                    }
                }
            }
            return(lst);
        }
示例#2
0
 public ExperimentLogData(ExperimentData e, DateTime d, long NumOfMeasuresGraph, long DiffBetweenMeasuresGraph) : base(e, d)
 {
     this.expID                    = -1;
     this.ActiveExpID              = e.ActiveExpID;
     this.NumOfMeasuresGraph       = NumOfMeasuresGraph;
     this.DiffBetweenMeasuresGraph = DiffBetweenMeasuresGraph;
     this.ExperimentQuestion       = e.ExperimentQuestion;
 }
示例#3
0
        public ExperimentData(ExperimentData exp) : base(exp)
        {
            this.expID = -1;
            this.ExperimentQuestion = exp.ExperimentQuestion;
            this.Type = "Experiment";
            RoadScholarContext rsContext = new RoadScholarContext();

            this.activities = new List <ActivityData>();
            foreach (ActivityData act in exp.activities)
            {
                ActivityData copiedActivity = null;
                if (act is TrueFalseQuestionData)
                {
                    copiedActivity = new TrueFalseQuestionData((TrueFalseQuestionData)act);
                    rsContext.addActivity(copiedActivity);
                }
                else if (act is AmericanQuestionData)
                {
                    copiedActivity = new AmericanQuestionData((AmericanQuestionData)act);
                    rsContext.addActivity(copiedActivity);
                }
                else if (act is ShortAnswerQuestionData)
                {
                    copiedActivity = new ShortAnswerQuestionData((ShortAnswerQuestionData)act);
                    rsContext.addActivity(copiedActivity);
                }
                else if (act is InstructionData)
                {
                    copiedActivity = new InstructionData((InstructionData)act);
                    rsContext.addActivity(copiedActivity);
                }
                else if (act is ImageData)
                {
                    copiedActivity = new ImageData((ImageData)act);
                    rsContext.addActivity(copiedActivity);
                }
                else if (act is VideoData)
                {
                    copiedActivity = new VideoData((VideoData)act);
                    rsContext.addActivity(copiedActivity);
                }
                else if (act is MeasurementData)
                {
                    copiedActivity = new MeasurementData((MeasurementData)act);
                    rsContext.addActivity(copiedActivity);
                }
                this.activities.Add(copiedActivity);
            }
        }
示例#4
0
 public ExperimentData(ExperimentData exp) : base(exp)
 {
     this.expID = -1;
     this.ExperimentQuestion = exp.ExperimentQuestion;
     this.Type = "Experiment";
     RoadScholarContext rsContext = new RoadScholarContext();
     this.activities = new List<ActivityData>();
     foreach (ActivityData act in exp.activities)
     {
         ActivityData copiedActivity = null;
         if (act is TrueFalseQuestionData)
         {
             copiedActivity = new TrueFalseQuestionData((TrueFalseQuestionData)act);
             rsContext.addActivity(copiedActivity);
         }
         else if (act is AmericanQuestionData)
         {
             copiedActivity = new AmericanQuestionData((AmericanQuestionData)act);
             rsContext.addActivity(copiedActivity);
         }
         else if (act is ShortAnswerQuestionData)
         {
             copiedActivity = new ShortAnswerQuestionData((ShortAnswerQuestionData)act);
             rsContext.addActivity(copiedActivity);
         }
         else if (act is InstructionData)
         {
             copiedActivity = new InstructionData((InstructionData)act);
             rsContext.addActivity(copiedActivity);
         }
         else if (act is ImageData)
         {
             copiedActivity = new ImageData((ImageData)act);
             rsContext.addActivity(copiedActivity);
         }
         else if (act is VideoData)
         {
             copiedActivity = new VideoData((VideoData)act);
             rsContext.addActivity(copiedActivity);
         }
         else if (act is MeasurementData)
         {
             copiedActivity = new MeasurementData((MeasurementData)act);
             rsContext.addActivity(copiedActivity);
         }
         this.activities.Add(copiedActivity);
     }
 }
示例#5
0
        public static ExperimentData getExperimentAsData(Experiment exp)
        {
            ExperimentData expData = new ExperimentData();
            expData.ActivityName = exp.ActivityName;
            expData.expID = exp.expID;
            expData.id = exp.id;
            expData.RoomId = exp.RoomId;

            expData.ExperimentQuestion = exp.ExperimentQuestion;
            expData.activities = new List<ActivityData>();
            if (exp.activities != null)
            {
                foreach (Activity act in exp.activities)
                {
                    expData.activities.Add(getActivityAsData(act));
                }
            }
            return expData;
        }
示例#6
0
        public static Experiment getExperimentFromData(ExperimentData expData)
        {
            Experiment exp = new Experiment();
            exp.ActivityName = expData.ActivityName;
            exp.expID = expData.expID;
            exp.id = expData.id;
            exp.isMainActivity = expData.isMainActivity;
            exp.RoomId = expData.RoomId;

            exp.ExperimentQuestion = expData.ExperimentQuestion;
            exp.Type = expData.Type;
            exp.ActiveExpID = expData.ActiveExpID;
            exp.activities = new List<Activity>();
            if (expData.activities != null)
            {
                foreach (ActivityData actData in expData.activities)
                {
                    exp.activities.Add(getActivityFromData(actData));
                }
            }
            return exp;
        }