public void DeleteActivity(long actId)
        {
            ActivityData activity = getActivity(actId);

            Activities.Remove(activity);
            SaveChanges();
        }
Beispiel #2
0
        public void addStep(ActivityData activity)
        {
            RoadScholarContext rsContext = new RoadScholarContext();

            activities.Add(activity);
            rsContext.SaveChanges();
        }
Beispiel #3
0
 public ActivityLogData(ActivityData a, DateTime d)
 {
     this.ActivityName   = a.ActivityName;
     this.isMainActivity = a.isMainActivity;
     this.expID          = a.expID;
     this.RoomId         = a.RoomId;
     this.date           = d;
 }
 public ActivityLogData(ActivityData a, DateTime d)
 {
     this.ActivityName = a.ActivityName;
     this.isMainActivity = a.isMainActivity;
     this.expID = a.expID;
     this.RoomId = a.RoomId;
     this.date = d;
 }
Beispiel #5
0
 public ActivityData(ActivityData a)
 {
     this.ActivityName    = a.ActivityName;
     this.isMainActivity  = a.isMainActivity;
     this.expID           = a.expID;
     this.RoomId          = a.RoomId;
     this.Type            = a.Type;
     this.experimentOrder = a.experimentOrder;
 }
Beispiel #6
0
 public ActivityData(ActivityData a)
 {
     this.ActivityName = a.ActivityName;
     this.isMainActivity = a.isMainActivity;
     this.expID = a.expID;
     this.RoomId = a.RoomId;
     this.Type = a.Type;
     this.experimentOrder = a.experimentOrder;
 }
Beispiel #7
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);
            }
        }
        public List <ActivityData> getActivitiesByStudentPhone(string studentPhone, long RoomID)
        {
            List <ActivityData>      lstData           = new List <ActivityData>();
            List <AnswerByPhoneData> allAnswersByPhone = AnswersByPhone.ToList();

            // Add all the questions activities of a student
            foreach (AnswerByPhoneData sData in allAnswersByPhone)
            {
                if (sData.Phone == studentPhone && sData.RoomID == RoomID)
                {
                    ActivityData ad = getActivity(sData.ActivityId);
                    if (ad.expID == -1)
                    {
                        lstData.Add(ad);
                    }
                }
            }

            // TODO Add all the experiments activities of a student

            return(lstData);
        }
Beispiel #9
0
 public void addStep(ActivityData activity)
 {
     RoadScholarContext rsContext = new RoadScholarContext();
     activities.Add(activity);
     rsContext.SaveChanges();
 }
Beispiel #10
0
 private static ActivityData getActivityAsData(Activity act)
 {
     ActivityData aData = new ActivityData();
     aData.ActivityName = act.ActivityName;
     aData.expID = act.expID;
     aData.id = act.id;
     aData.isMainActivity = act.isMainActivity;
     aData.RoomId = act.RoomId;
     aData.Type = act.Type;
     return aData;
 }
Beispiel #11
0
 public static Activity getActivityFromData(ActivityData activityData)
 {
     if (activityData == null)
         return null;
     Activity a = new Activity();
     a.ActivityName = activityData.ActivityName;
     a.expID = activityData.expID;
     a.id = activityData.id;
     a.isMainActivity = activityData.isMainActivity;
     a.RoomId = activityData.RoomId;
     a.Type = activityData.Type;
     return a;
 }
 public void addActivity(ActivityData activity)
 {
     Activities.Add(activity);
     SaveChanges();
 }