public IEnumerator EnableGameObjectBehavior()
        {
            // Given EnableGameObjectBehavior,
            TrainingSceneObject trainingSceneObject = TestingUtils.CreateSceneObject("TestObject");

            ICourse training1 = new LinearTrainingBuilder("Training")
                                .AddChapter(new LinearChapterBuilder("Chapter")
                                            .AddStep(new BasicCourseStepBuilder("Step")
                                                     .Enable("TestObject")))
                                .Build();

            // When we serialize and deserialize a training course with it
            ICourse training2 = Serializer.CourseFromByteArray(Serializer.CourseToByteArray(training1));

            EnableGameObjectBehavior behavior1 = training1.Data.FirstChapter.Data.FirstStep.Data.Behaviors.Data.Behaviors.First() as EnableGameObjectBehavior;
            EnableGameObjectBehavior behavior2 = training2.Data.FirstChapter.Data.FirstStep.Data.Behaviors.Data.Behaviors.First() as EnableGameObjectBehavior;

            // Then it's target training scene object is still the same.
            Assert.IsNotNull(behavior1);
            Assert.IsNotNull(behavior2);
            Assert.AreEqual(behavior1.Data.Target.Value, behavior2.Data.Target.Value);

            TestingUtils.DestroySceneObject(trainingSceneObject);

            return(null);
        }
Ejemplo n.º 2
0
        public static void RenderCourseClassesOnTheConsole(ICourse courseWithClasses)
        {
            StringBuilder sb = new StringBuilder();

            sb.AppendFormat("CourseID {0}", courseWithClasses.Id).AppendLine();
            sb.AppendFormat("Course Name: {0}", courseWithClasses.CourseName).AppendLine().AppendLine().AppendLine();
            sb.AppendFormat("{0}", "COUNDUCTED CLASSES: ").AppendLine().AppendLine();

            foreach (var course in courseWithClasses.ConductedClasses)
            {
                sb.AppendFormat("Date:{0}.{1}.{2} Start:[{4}:{5}] End:[{6}:{7}] Hours:{3} Teacher:({8} {9})",
                    course.DateOfConduction.Day, course.DateOfConduction.Month,
                    course.DateOfConduction.Year,
                    course.ConductedClassHours,
                    course.ClassStartHour.Hour, course.ClassStartHour.Minute,
                    course.ClassEndHour.Hour, course.ClassEndHour.Minute,
                    course.Teacher.FirstName, course.Teacher.LastName).AppendLine();
            }

            sb.AppendLine().AppendLine().AppendLine();

            string str = sb.ToString();

            Console.WriteLine(str);
        }
Ejemplo n.º 3
0
        public void LeaveCourse(ICourse course)
        {
            Validator.CheckIfNull(course, "Parameter should not be null!");

            course.RemoveStudent(this);
            this.courses.Remove(course);
        }
Ejemplo n.º 4
0
        public static void RenderCourseClassesOnTheConsole(ICourse courseWithClasses)
        {
            StringBuilder sb = new StringBuilder();

            sb.AppendFormat("CourseID {0}", courseWithClasses.Id).AppendLine();
            sb.AppendFormat("Course Name: {0}", courseWithClasses.CourseName).AppendLine().AppendLine().AppendLine();
            sb.AppendFormat("{0}", "COUNDUCTED CLASSES: ").AppendLine().AppendLine();

            foreach (var course in courseWithClasses.ConductedClasses)
            {
                sb.AppendFormat("Date:{0}.{1}.{2} Start:[{4}:{5}] End:[{6}:{7}] Hours:{3} Teacher:({8} {9})",
                                course.DateOfConduction.Day, course.DateOfConduction.Month,
                                course.DateOfConduction.Year,
                                course.ConductedClassHours,
                                course.ClassStartHour.Hour, course.ClassStartHour.Minute,
                                course.ClassEndHour.Hour, course.ClassEndHour.Minute,
                                course.Teacher.FirstName, course.Teacher.LastName).AppendLine();
            }

            sb.AppendLine().AppendLine().AppendLine();

            string str = sb.ToString();

            Console.WriteLine(str);
        }
Ejemplo n.º 5
0
        /// <summary>
        /// Returns the <see cref="ICourse"/> contained in given <see cref="TrainingWindow"/>.
        /// </summary>
        protected ICourse ExtractTraining(TrainingWindow window)
        {
            ICourse course = window.GetTrainingCourse();

            Assert.NotNull(course);
            return(course);
        }
Ejemplo n.º 6
0
        public void JoinCourse(ICourse course)
        {
            Validator.CheckIfNull(course, "Parameter should not be null!");

            course.AddStudent(this);
            this.courses.Add(course);
        }
Ejemplo n.º 7
0
        public IEnumerator BaseTraining()
        {
            // Given base training
            ICourse training1 = new LinearTrainingBuilder("Training")
                                .AddChapter(new LinearChapterBuilder("Chapter")
                                            .AddStep(new BasicStepBuilder("Step")))
                                .Build();

            JsonTrainingSerializer.Serialize(training1);

            // When we serialize and deserialize it
            ICourse training2 = JsonTrainingSerializer.Deserialize(JsonTrainingSerializer.Serialize(training1));

            // Then it should still be base training, have the same name and the first chapter with the same name.
            Assert.AreEqual(typeof(Course), training1.GetType());
            Assert.AreEqual(training1.GetType(), training2.GetType());

            Assert.AreEqual(training1.Data.Name, "Training");
            Assert.AreEqual(training1.Data.Name, training2.Data.Name);

            Assert.AreEqual(training1.Data.FirstChapter.Data.Name, "Chapter");
            Assert.AreEqual(training1.Data.FirstChapter.Data.Name, training2.Data.FirstChapter.Data.Name);

            return(null);
        }
Ejemplo n.º 8
0
        public IEnumerator TextToSpeechAudio()
        {
            // Given we have TextToSpeechAudio instance,
            TextToSpeechAudio audio = new TextToSpeechAudio(new LocalizedString("TestPath"));

            ICourse course = new LinearTrainingBuilder("Training")
                             .AddChapter(new LinearChapterBuilder("Chapter")
                                         .AddStep(new BasicStepBuilder("Step")
                                                  .DisableAutomaticAudioHandling()
                                                  .AddBehavior(new PlayAudioBehavior(audio, BehaviorExecutionStages.Activation))))
                             .Build();

            // When we serialize and deserialize a training with it,
            ICourse testCourse = JsonTrainingSerializer.Deserialize(JsonTrainingSerializer.Serialize(course));

            // Then the text to generate sound from should be the same.
            IAudioData data1 = ((PlayAudioBehavior)course.Data.FirstChapter.Data.FirstStep.Data.Behaviors.Data.Behaviors.First()).Data.AudioData;
            IAudioData data2 = ((PlayAudioBehavior)testCourse.Data.FirstChapter.Data.FirstStep.Data.Behaviors.Data.Behaviors.First()).Data.AudioData;

            string audioPath1 = TestingUtils.GetField <LocalizedString>(data1, "text").Key;
            string audioPath2 = TestingUtils.GetField <LocalizedString>(data2, "text").Key;

            Assert.AreEqual(data1.GetType(), data2.GetType());

            Assert.AreEqual(audioPath1, "TestPath");
            Assert.AreEqual(audioPath1, audioPath2);

            return(null);
        }
Ejemplo n.º 9
0
 /// <summary>
 /// Create student
 /// </summary>
 /// <param name="name">Name of student</param>
 /// <param name="course">Ref on course</param>
 public Student(string name, ICourse course) : this(name)
 {
     logger.Trace("Create student");
     logger.Info($"Student name is {name}. Course : {course.Name}");
     CheckCourse(course);
     RegisterOnCourse(course);
 }
 public CourseResult(ICourse course, string examPoints, string coursePoints)
 {
     this.Course       = course;
     this.ExamPoints   = float.Parse(examPoints);
     this.CoursePoints = float.Parse(coursePoints);
     this.CalculateGrade();
 }
        public IEnumerator UnlockObjectBehavior()
        {
            // Given a training with UnlockObjectBehavior
            TrainingSceneObject trainingSceneObject = TestingUtils.CreateSceneObject("TestObject");

            ICourse training1 = new LinearTrainingBuilder("Training")
                                .AddChapter(new LinearChapterBuilder("Chapter")
                                            .AddStep(new BasicStepBuilder("Step")
                                                     .AddBehavior(new UnlockObjectBehavior(trainingSceneObject))))
                                .Build();

            // When we serialize and deserialize it
            ICourse training2 = Serializer.CourseFromByteArray(Serializer.CourseToByteArray(training1));

            UnlockObjectBehavior behavior1 = training1.Data.FirstChapter.Data.FirstStep.Data.Behaviors.Data.Behaviors.First() as UnlockObjectBehavior;
            UnlockObjectBehavior behavior2 = training2.Data.FirstChapter.Data.FirstStep.Data.Behaviors.Data.Behaviors.First() as UnlockObjectBehavior;

            // Then that behavior's target should not change.
            Assert.IsNotNull(behavior1);
            Assert.IsNotNull(behavior2);
            Assert.AreEqual(behavior1.Data.Target.Value, behavior2.Data.Target.Value);

            // Cleanup
            TestingUtils.DestroySceneObject(trainingSceneObject);

            return(null);
        }
Ejemplo n.º 12
0
        public static string Serialize(ICourse deserialized)
        {
            JObject jObject = JObject.FromObject(deserialized, JsonSerializer.Create(SerializerSettings));

            jObject.Add("$serializerVersion", Version);
            return(jObject.ToString());
        }
Ejemplo n.º 13
0
        public bool CloneCourse(int key)
        {
            ICourse cr = GetCourse(key);

            AddCourse((ICourse)cr.Clone());
            return(true);
        }
        public IEnumerator ObjectInRangeCondition()
        {
            // Given a training with ObjectInRangeCondition,
            TrainingSceneObject testObjectToo         = TestingUtils.CreateSceneObject("TestObjectToo");
            TransformInRangeDetectorProperty detector = testObjectToo.gameObject.AddComponent <TransformInRangeDetectorProperty>();
            TrainingSceneObject testObject            = TestingUtils.CreateSceneObject("TestObject");

            ICourse training1 = new LinearTrainingBuilder("Training")
                                .AddChapter(new LinearChapterBuilder("Chapter")
                                            .AddStep(new BasicStepBuilder("Step")
                                                     .AddCondition(new ObjectInRangeCondition(testObject, detector, 1.5f))))
                                .Build();

            // When we serialize and deserialize it
            ICourse training2 = Serializer.CourseFromByteArray(Serializer.CourseToByteArray(training1));

            // Then that condition's target, detector and range should stay unchanged.
            ObjectInRangeCondition condition1 = training1.Data.FirstChapter.Data.FirstStep.Data.Transitions.Data.Transitions.First().Data.Conditions.First() as ObjectInRangeCondition;
            ObjectInRangeCondition condition2 = training2.Data.FirstChapter.Data.FirstStep.Data.Transitions.Data.Transitions.First().Data.Conditions.First() as ObjectInRangeCondition;

            Assert.IsNotNull(condition1);
            Assert.IsNotNull(condition2);
            Assert.AreEqual(condition1.Data.Range, condition2.Data.Range);
            Assert.AreEqual(condition1.Data.Target.Value, condition2.Data.Target.Value);
            Assert.AreEqual(condition1.Data.DistanceDetector.Value, condition2.Data.DistanceDetector.Value);

            // Cleanup
            TestingUtils.DestroySceneObject(testObjectToo);
            TestingUtils.DestroySceneObject(testObject);

            return(null);
        }
Ejemplo n.º 15
0
 public ClasseCourseController(ICourse _crs, IClass _cls
                               , IClasseCourse _cc)
 {
     cls = _cls;
     cc  = _cc;
     crs = _crs;
 }
        public IEnumerator BehaviorSequence()
        {
            // Given a training with a behaviors sequence
            BehaviorSequence sequence = new BehaviorSequence(true, new List <IBehavior>
            {
                new DelayBehavior(0f),
                new EmptyBehaviorMock()
            });
            ICourse course = new LinearTrainingBuilder("Training")
                             .AddChapter(new LinearChapterBuilder("Chapter")
                                         .AddStep(new BasicStepBuilder("Step")
                                                  .AddBehavior(sequence)))
                             .Build();

            // When we serialize and deserialize it
            ICourse deserializedCourse = Serializer.CourseFromByteArray(Serializer.CourseToByteArray(course));

            BehaviorSequence deserializedSequence = deserializedCourse.Data.FirstChapter.Data.FirstStep.Data.Behaviors.Data.Behaviors.First() as BehaviorSequence;

            // Then the values stay the same.
            Assert.IsNotNull(deserializedSequence);
            Assert.AreEqual(sequence.Data.PlaysOnRepeat, deserializedSequence.Data.PlaysOnRepeat);

            List <IBehavior> behaviors             = sequence.Data.Behaviors;
            List <IBehavior> deserializedBehaviors = deserializedSequence.Data.Behaviors;

            Assert.AreEqual(behaviors.First().GetType(), deserializedBehaviors.First().GetType());
            Assert.AreEqual(behaviors.Last().GetType(), deserializedBehaviors.Last().GetType());
            Assert.AreEqual(behaviors.Count, deserializedBehaviors.Count);
            yield break;
        }
Ejemplo n.º 17
0
        /// <summary>
        /// Sets a new course in the training workflow editor window after asking to save the current one, if needed.
        /// </summary>
        /// <param name="course">New course to set.</param>
        /// <returns>True if the course is set, false if the user cancels the operation.</returns>
        public bool SetTrainingCourseWithUserConfirmation(ICourse course)
        {
            if (activeCourse != null && IsDirty)
            {
                if (IsDirty)
                {
                    int userConfirmation = TestableEditorElements.DisplayDialogComplex("Unsaved changes detected.", "Do you want to save the changes to a current training course?", "Save", "Cancel", "Discard");
                    if (userConfirmation == 0)
                    {
                        SaveTraining();
                        if (activeCourse.Data.Name.Equals(course.Data.Name))
                        {
                            return(true);
                        }
                    }
                    else if (userConfirmation == 1)
                    {
                        return(false);
                    }
                }
            }

            SetTrainingCourse(course);
            return(true);
        }
Ejemplo n.º 18
0
        public void LoadTrainingCourseFromFile(string path)
        {
            if (string.IsNullOrEmpty(path) || File.Exists(path) == false)
            {
                return;
            }

            ICourse course   = SaveManager.LoadTrainingCourseFromFile(path);
            string  filename = Path.GetFileNameWithoutExtension(path);

            if (course.Data.Name.Equals(filename) == false)
            {
                bool userConfirmation = TestableEditorElements.DisplayDialog("Course name does not match filename.",
                                                                             string.Format("The training course name (\"{0}\") does not match the filename (\"{1}\"). To be able to load the training course, it must be renamed to \"{1}\".", course.Data.Name, filename),
                                                                             "Rename Course",
                                                                             "Cancel");

                if (userConfirmation == false)
                {
                    return;
                }

                course.Data.Name = filename;
                SaveManager.SaveTrainingCourseToFile(course);
            }

            SetTrainingCourseWithUserConfirmation(course);
            IsDirty = false;
        }
        public IEnumerator MoveObjectBehavior()
        {
            // Given training with MoveObjectBehavior
            TrainingSceneObject moved            = TestingUtils.CreateSceneObject("moved");
            TrainingSceneObject positionProvider = TestingUtils.CreateSceneObject("positionprovider");
            ICourse             training1        = new LinearTrainingBuilder("Training")
                                                   .AddChapter(new LinearChapterBuilder("Chapter")
                                                               .AddStep(new BasicStepBuilder("Step")
                                                                        .AddBehavior(new MoveObjectBehavior(moved, positionProvider, 24.7f))))
                                                   .Build();

            // When that training is serialized and deserialzied
            ICourse training2 = Serializer.CourseFromByteArray(Serializer.CourseToByteArray(training1));

            // Then we should have two identical move object behaviors
            MoveObjectBehavior behavior1 = training1.Data.FirstChapter.Data.FirstStep.Data.Behaviors.Data.Behaviors.First() as MoveObjectBehavior;
            MoveObjectBehavior behavior2 = training2.Data.FirstChapter.Data.FirstStep.Data.Behaviors.Data.Behaviors.First() as MoveObjectBehavior;

            Assert.IsNotNull(behavior1);
            Assert.IsNotNull(behavior2);
            Assert.IsFalse(ReferenceEquals(behavior1, behavior2));
            Assert.AreEqual(behavior1.Data.Target.Value, behavior2.Data.Target.Value);
            Assert.AreEqual(behavior1.Data.PositionProvider.Value, behavior2.Data.PositionProvider.Value);
            Assert.AreEqual(behavior1.Data.Duration, behavior2.Data.Duration);

            // Cleanup created game objects.
            TestingUtils.DestroySceneObject(moved);
            TestingUtils.DestroySceneObject(positionProvider);

            return(null);
        }
Ejemplo n.º 20
0
 public CourseController(ICourse CourseRepo, ITeacher TeacherRepo, IStudent StudentRepo, ICourseAssignmnet CourseAssignmentRepo)
 {
     this.CourseRepo           = CourseRepo;
     this.TeacherRepo          = TeacherRepo;
     this.StudentRepo          = StudentRepo;
     this.CourseAssignmentRepo = CourseAssignmentRepo;
 }
Ejemplo n.º 21
0
        /// <summary>
        /// Save the training to given path.
        /// </summary>
        public static bool SaveTrainingCourseToFile(ICourse course)
        {
            try
            {
                if (course == null)
                {
                    throw new NullReferenceException("The training course is not saved because it doesn't exist.");
                }

                string path = GetTrainingPath(course);

                string directory = Path.GetDirectoryName(path);
                if (string.IsNullOrEmpty(directory) == false && Directory.Exists(directory) == false)
                {
                    Directory.CreateDirectory(directory);
                }

                string serialized = JsonTrainingSerializer.Serialize(course);
                File.WriteAllText(path, serialized);
                // Check if saved as asset. If true, import it.
                TryReloadAssetByFullPath(path);
                return(true);
            }
            catch (Exception e)
            {
                TestableEditorElements.DisplayDialog("Error while saving the training course!", e.ToString(), "Close");
                logger.Error(e);
                return(false);
            }
        }
Ejemplo n.º 22
0
        private static void ShowCourse(ICourse course)
        {
            Console.WriteLine(course.ShowDetails());
            Console.WriteLine("Would you like to update these details? (Y/N)");
            var choice = Console.ReadLine();

            choice = choice?.ToLower();
            switch (choice)
            {
            case "y":
            case "ye":
            case "yes":

                if (course is not CourseClass c)
                {
                    UpdateCourse(course);
                    break;
                }

                UpdateClass(c);


                break;
            }
            AddStuff();
        }
        public static string CourseOutput(ICourse course)
        {
            var sb = new StringBuilder();

            sb.AppendLine("* Course:");
            sb.AppendLine($" - Name: {course.Name}");
            sb.AppendLine($" - Lectures per week: {course.LecturesPerWeek}");
            sb.AppendLine($" - Starting date: {course.StartingDate:yyyy-MM-dd hh:mm:ss tt}");
            sb.AppendLine($" - Ending date: {course.EndingDate:yyyy-MM-dd hh:mm:ss tt}");
            sb.AppendLine($" - Onsite students: {course.OnsiteStudents.Count}");
            sb.AppendLine($" - Online students: {course.OnlineStudents.Count}");
            sb.AppendLine(" - Lectures:");

            if (course.Lectures.Count == 0)
            {
                sb.AppendLine("  * There are no lectures in this course!");
            }
            else
            {
                foreach (var lecture in course.Lectures)
                {
                    sb.AppendLine(lecture.ToString());
                }
            }
            return(sb.ToString().TrimEnd());
        }
Ejemplo n.º 24
0
 /// <summary>
 /// Method for setting mark of student who listen this course in the dictionary and saving in the file.
 /// </summary>
 /// <param name="student">Student</param>
 /// <param name="course">Course</param>
 /// <param name="professor">Lector of the course</param>
 public void SetMark(IStudent student, ICourse course, Professor professor)
 {
     NLogger.Logger.Trace("Archive open");
     if (!dictionary.ContainsKey(student))
     {
         dictionary.Add(student, new Dictionary <ICourse, double>());
     }
     if (!dictionary[student].ContainsKey(course))
     {
         dictionary[student].Add(course, professor.SetTheMark(student));
     }
     try
     {
         NLogger.Logger.Trace("Trying to write mark at the file");
         using (BinaryWriter writer = new BinaryWriter(File.OpenWrite(fileName)))
         {
             writer.Write(student.StudentName + ": " + dictionary[student][course] + ".");
         }
     }
     catch (IOException e)
     {
         NLogger.Logger.Error("Error of writing. " + e.Message);
         throw;
     }
     catch (ObjectDisposedException e)
     {
         NLogger.Logger.Error("The stream is closed. " + e.Message);
         throw;
     }
     NLogger.Logger.Trace("Marks were setted and write.");
 }
 public UifiedTestCenterController(ICourse course, IUniteTest uniteTest, IUniteTestScore uniteTestScore, IUniteTestInfo uniteTestInfo)
 {
     _course = course;
     _uniteTest = uniteTest;
     _uniteTestScore = uniteTestScore;
     _uniteTestInfo = uniteTestInfo;
 }
Ejemplo n.º 26
0
        /// <inheritdoc />
        protected override void Then(CourseWindow window)
        {
            ICourse  result       = ExtractTraining(window);
            IChapter firstChapter = result.Data.Chapters.First();

            // The chapter exits
            Assert.NotNull(firstChapter);

            // The step exits
            IStep firstStep = firstChapter.Data.FirstStep;

            Assert.NotNull(firstChapter);

            IList <ITransition> transitions = GetTransitionsFromStep(firstStep);

            // It has two transition.
            Assert.That(transitions.Count == 2);

            ITransition firstTransition  = transitions[0];
            ITransition secondTransition = transitions[1];
            IStep       nextStep;

            // The first step's transition points to itself.
            if (TryToGetStepFromTransition(firstTransition, out nextStep))
            {
                Assert.That(firstStep == nextStep);
            }

            // The second step's transition is the end of the course.
            Assert.False(TryToGetStepFromTransition(secondTransition, out nextStep));
        }
Ejemplo n.º 27
0
 public void Remove(ICourse course)
 {
     if(this.courses.Contains(course))
     {
         this.courses.Remove(course);
     }
 }
Ejemplo n.º 28
0
 public virtual void addNewCourseToDB(ICourse acourse)
 {
     try
     {
         SqlDataReader rdr = null;
         SqlCommand    cmd = new SqlCommand("dbo.CreateNewCourse", connection);
         cmd.CommandType = CommandType.StoredProcedure;
         cmd.Parameters.Add(new SqlParameter("@CourseID", acourse.CourseID));
         cmd.Parameters.Add(new SqlParameter("@name", acourse.Name));
         cmd.Parameters.Add(new SqlParameter("@departmentID_fk", acourse.DeptID));
         cmd.Parameters.Add(new SqlParameter("@priceEU", acourse.PriceEU));
         cmd.Parameters.Add(new SqlParameter("@priceNonEU", acourse.PriceNonEU));
         cmd.Parameters.Add(new SqlParameter("@courseDesc", acourse.Desc));
         cmd.Parameters.Add(new SqlParameter("@points", acourse.Points));
         cmd.Parameters.Add(new SqlParameter("@Capacity", acourse.Capacity));
         cmd.Parameters.Add(new SqlParameter("@curCapacity", acourse.CurCapacity));
         cmd.Parameters.Add(new SqlParameter("@isnight", acourse.IsNightCourse));
         rdr = cmd.ExecuteReader();
         rdr.Close();
     }
     catch (System.Exception excep)
     {
         if (connection.State.ToString() == "Open")
         {
             connection.Close();
             // MessageBox.Show("Error");
         }
         //Application.Exit();
         //Environment.Exit(0); //Force the application to close
     }
 }
Ejemplo n.º 29
0
        /// <inheritdoc />
        protected override void Then(TrainingWindow window)
        {
            ICourse result = ExtractTraining(window);

            IChapter firstChapter = result.Data.Chapters.First();

            Assert.NotNull(firstChapter);

            IStep firstStep = firstChapter.Data.FirstStep;

            Assert.NotNull(firstStep);

            IList <ITransition> transitions = GetTransitionsFromStep(firstStep);

            Assert.That(transitions.Count == 1);

            IStep nextStep;

            if (TryToGetStepFromTransition(transitions.First(), out nextStep))
            {
                Assert.Fail("First step is not the end of the chapter.");
            }

            Assert.Null(nextStep);
        }
Ejemplo n.º 30
0
        public ICourseResult CreateCourseResult(ICourse course, string examPoints, string coursePoints)
        {
            var parsedExamPoints   = float.Parse(examPoints);
            var parsedCoursePoints = float.Parse(coursePoints);

            return(new CourseResult(course, parsedExamPoints, parsedCoursePoints));
        }
Ejemplo n.º 31
0
        public override string ToString()
        {
            StringBuilder teacherInfo = new StringBuilder();

            teacherInfo.Append("Teacher: ");
            teacherInfo.AppendFormat("Name={0}", this.Name);

            if (this.courses.Count > 0)
            {
                teacherInfo.Append("; Courses=[");

                for (int i = 0; i < this.courses.Count; i++)
                {
                    ICourse currentCourse = this.courses[i];

                    if (i != this.courses.Count - 1)
                    {
                        teacherInfo.AppendFormat("{0}, ", currentCourse.Name);
                    }
                    else
                    {
                        teacherInfo.AppendFormat("{0}", currentCourse.Name);
                    }
                }

                teacherInfo.Append("]");
            }

            return(teacherInfo.ToString());
        }
Ejemplo n.º 32
0
 public DepartmentController(IDepartment _dep, IClass _cls,
                             ICourse _crs)
 {
     dep = _dep;
     cls = _cls;
     crs = _crs;
 }
Ejemplo n.º 33
0
 public Course(ICourse course)
 {
     Id = course.Id;
     Name = course.Name;
     ExpirationTime = course.ExpirationTime;
     Professor = course.Professor;
     State = course.State;
 }
Ejemplo n.º 34
0
 public CourseEntity(ICourse course)
     : this()
 {
     RowKey = course.Id.ToString();
     Name = course.Name;
     ExpirationTime = course.ExpirationTime;
     ProfessorId = course.Professor.Id;
     State = course.State.ToString();
 }
Ejemplo n.º 35
0
        public void EnrollInCourse(ICourse course)
        {
            if (this.EnrolledCourses.ContainsKey(course.Name))
            {
                throw new DuplicateEntryInStructureException(this.UserName, course.Name);
            }

            this.enrolledCourses.Add(course.Name, course);
        }
Ejemplo n.º 36
0
        public void AddCourse(ICourse course)
        {
            if (course == null)
            {
                throw new ArgumentNullException("Teacher course cannot be null or empty!");
            }

            this.courses.Add(course);
        }
Ejemplo n.º 37
0
        public void AddCourse(ICourse course)
        {
            if (courses == null)
            {
                throw new ArgumentNullException("Course to be added cannot be null!");
            }

            this.Courses.Add(course);
        }
Ejemplo n.º 38
0
 public ClassInfo(DateTime dateOfConduction, DateTime  classStartHour, DateTime classEndHour, ITeacher teacher, ICourse course)
 {
     this.DateOfConduction = dateOfConduction;
     this.ClassStartHour = classStartHour;
     this.ClassEndHour = classEndHour;
     this.ClassLengthInMinutes = this.CalculateClassLengthInMinutes(this.ClassStartHour, this.ClassEndHour);
     this.ConductedClassHours = this.CalculateNumberOfHoursTaken(this.ClassLengthInMinutes);
     this.Teacher = teacher;
     this.Course = course;
 }
Ejemplo n.º 39
0
        public void RemoveCourse(ICourse course)
        {
            Validator.CheckIfNull<ICourse>(course);
            var indexOfCourse = FindFirstIndex(course);

            if (indexOfCourse < 0)
            {
                throw new ArgumentException("Course could not be found.");
            }

            this.courses.RemoveAt(indexOfCourse);
        }
Ejemplo n.º 40
0
        public void AddCourse(ICourse course)
        {
            Validator.CheckIfNull<ICourse>(course);
            var indexOfCourse = FindFirstIndex(course);

            if (!(indexOfCourse < 0))
            {
                throw new ArgumentException("Course is already listed in the school.");
            }

            this.courses.Add(course);
        }
Ejemplo n.º 41
0
        public ThreeCourseMeal(ICourse entrée,
            ICourse mainCourse, ICourse dessert)
        {
            if (entrée == null)
            {
                throw new ArgumentNullException("entrée");
            }
            if (mainCourse == null)
            {
                throw new ArgumentNullException("mainCourse");
            }
            if (dessert == null)
            {
                throw new ArgumentNullException("dessert");
            }

            this.entrée = entrée;
            this.mainCourse = mainCourse;
            this.dessert = dessert;
        }
Ejemplo n.º 42
0
 public AddLectures(ICourse course)
     : base(course)
 {
 }
Ejemplo n.º 43
0
 public void AddCourse(ICourse course)
 {
     Courses.Add(course.Name);
 }
Ejemplo n.º 44
0
 public static void Add(ICourse course)
 {
     Course.courseList.Add(course);
 }
Ejemplo n.º 45
0
 public void AddCourse(ICourse course)
 {
     courses = new List<ICourse>();
     courses.Add(course);
 }
Ejemplo n.º 46
0
 public void AddCourse(ICourse course)
 {
     teacherCources.Add(course);
 }
Ejemplo n.º 47
0
 public Enroll(ICourse course)
     : base(course)
 {
 }
Ejemplo n.º 48
0
        public static bool IsMax(ICourse course)
        {
            if(course.MaxCapacity==null)
                return false;

            int count;

            using (Command cmd=new Command("count_"+Selection.Entity))
            {
                try
                {
                    count = SelectionGateway.CountByCourse(cmd, course.Id);
                }
                catch
                {
                    count = 0;
                }
            }

            return count >= course.MaxCapacity.Value;
        }
Ejemplo n.º 49
0
 public void AddCourse(ICourse course)
 {
     this.TeacherCourses.Add(course);
 }
Ejemplo n.º 50
0
 public CourseResources(ICourse course, IEnumerable<IResource> resources)
     : base(course)
 {
     Resources = resources.ToList().AsReadOnly();
 }
Ejemplo n.º 51
0
 private int FindFirstIndex(ICourse course)
 {
     for (int i = 0; i < this.courses.Count; i++)
     {
         if (course.Equals(this.courses[i]))
         {
             return i;
         }
     }
     return -1;
 }
Ejemplo n.º 52
0
 public CourseDetails(ICourse course)
     : base(course)
 {
 }
Ejemplo n.º 53
0
 public void AddCourse(ICourse course)
 {
     Validate.IsNull(course, "Teacher AddCourse");
     this.courses.Add(course);
 }
 public void AddCourse(ICourse course)
 {
     courses.Add(course);
 }
Ejemplo n.º 55
0
 public void AttendCourse(ICourse courseToAttend)
 {
     courseToAttend.InsertStudent(this);
 }
Ejemplo n.º 56
0
 public Create(ICourse course)
     : base(course)
 {
 }
Ejemplo n.º 57
0
 public void AddCourse(ICourse course)
 {
     this.Courses.Add(course);
 }
Ejemplo n.º 58
0
 public CourseController(ICourse Course)
 {
     _Course = Course;
 }
Ejemplo n.º 59
0
 public void LeaveCourse(ICourse courseToAttend)
 {
     courseToAttend.RemoveStudent(this);
 }
Ejemplo n.º 60
0
 public int CompareTo(ICourse other) => string.Compare(this.Name, other.Name, StringComparison.Ordinal);