public LanguageCourseForChildren(string courseName, ECourseActivityStatus activityStatus, EGroupType groupType, ECoursePlace coursePlace,
     decimal price, IList<IPerson> studentsInCourse, IList<IPerson> teachersInCourse, IList<IClassInfo> conductedClasses, EAge age, ELanguage language, 
     ELanguageLevelForChildren languageLevelForChildren)
     : base(courseName, activityStatus, groupType, coursePlace, price, studentsInCourse, teachersInCourse, conductedClasses, age)
 {
     this.Language = language;
     this.LanguageLevel = languageLevelForChildren;
 }
Example #2
0
 public void cleartext()
 {
     EID.Clear();
     EName.Clear();
     EAge.Clear();
     EPhone.Clear();
     ECNIC.Clear();
     EPass.Clear();
 }
        public static string RenderCourseToConsole(string courseType, ulong id, string courseName, ECourseActivityStatus activityStatus,
                                                   EGroupType groupType, ECoursePlace coursePlace,
                                                   decimal price, IList <IPerson> studentsInCourse, IList <IPerson> teachersInCourse,
                                                   EAge age, ECoursePlace place, ELanguage language,
                                                   ELanguageLevelForAdults languageLevelForAdults)
        {
            StringBuilder sb = new StringBuilder();

            sb.AppendLine(new string('*', 30));
            sb.AppendLine(new string('*', 30));
            sb.AppendFormat("{0}", courseType).AppendLine();
            sb.AppendFormat("{0}", id).AppendLine();
            sb.AppendFormat("{0}", courseName).AppendLine();
            sb.AppendFormat("{0}", activityStatus).AppendLine();
            sb.AppendFormat("{0}", groupType).AppendLine();
            sb.AppendFormat("{0}", coursePlace).AppendLine();
            sb.AppendFormat("{0}", age).AppendLine();
            sb.AppendFormat("{0}", language).AppendLine();
            sb.AppendFormat("{0}", languageLevelForAdults).AppendLine();
            sb.AppendFormat("{0} lev(s)", price).AppendLine().AppendLine();

            sb.AppendLine(new string('-', 30));

            sb.AppendLine("Teachers leading the course: ").AppendLine();
            foreach (var teacher in teachersInCourse)
            {
                sb.AppendFormat("{0}", teacher.ToString()).AppendLine().AppendLine();
            }
            sb.AppendLine(new string('-', 30));
            sb.AppendLine().AppendLine();

            sb.AppendLine(new string('-', 30));
            sb.AppendLine("Students taking part in the course: ").AppendLine();
            foreach (var student in studentsInCourse)
            {
                sb.AppendFormat("{0}", student.ToString()).AppendLine().AppendLine();
            }
            sb.AppendLine(new string('-', 30));

            sb.AppendLine().AppendLine();
            sb.AppendLine(new string('*', 30));
            sb.AppendLine(new string('*', 30));

            return(sb.ToString());
        }
        public static string RenderCourseToConsole(string courseType, ulong id, string courseName, ECourseActivityStatus activityStatus, 
            EGroupType groupType, ECoursePlace coursePlace,
            decimal price, IList<IPerson> studentsInCourse, IList<IPerson> teachersInCourse, 
            EAge age, ECoursePlace place, ELanguage language,
            ELanguageLevelForAdults languageLevelForAdults)
        {
            StringBuilder sb = new StringBuilder();

            sb.AppendLine(new string('*', 30));
            sb.AppendLine(new string('*', 30));
            sb.AppendFormat("{0}", courseType).AppendLine();
            sb.AppendFormat("{0}", id).AppendLine();
            sb.AppendFormat("{0}", courseName).AppendLine();
            sb.AppendFormat("{0}", activityStatus).AppendLine();
            sb.AppendFormat("{0}", groupType).AppendLine();
            sb.AppendFormat("{0}", coursePlace).AppendLine();
            sb.AppendFormat("{0}", age).AppendLine();
            sb.AppendFormat("{0}", language).AppendLine();
            sb.AppendFormat("{0}", languageLevelForAdults).AppendLine();
            sb.AppendFormat("{0} lev(s)", price).AppendLine().AppendLine();

            sb.AppendLine(new string('-', 30));

            sb.AppendLine("Teachers leading the course: ").AppendLine();
            foreach (var teacher in teachersInCourse)
            {
                sb.AppendFormat("{0}", teacher.ToString()).AppendLine().AppendLine();
            }
            sb.AppendLine(new string('-', 30));
            sb.AppendLine().AppendLine();

            sb.AppendLine(new string('-', 30));
            sb.AppendLine("Students taking part in the course: ").AppendLine();
            foreach (var student in studentsInCourse)
            {
                sb.AppendFormat("{0}", student.ToString()).AppendLine().AppendLine();
            }
            sb.AppendLine(new string('-', 30));

            sb.AppendLine().AppendLine();
            sb.AppendLine(new string('*', 30));
            sb.AppendLine(new string('*', 30));

            return sb.ToString();
        }
 protected AdultCourse(string courseName, ECourseActivityStatus activityStatus, EGroupType groupType, ECoursePlace coursePlace,
                       decimal price, IList <IPerson> studentsInCourse, IList <IPerson> teachersInCourse, IList <IClassInfo> conductedClasses, EAge age)
     : base(courseName, activityStatus, groupType, coursePlace, price, studentsInCourse, teachersInCourse, conductedClasses)
 {
     this.Age = age;
 }
Example #6
0
        public void ExecuteCreate(string[] commandWords)
        {
            string[] cW = commandWords;
            switch (cW[1])
            {
            case "course_participant":
                Person courseParticipant = new CourseParticipant(cW[2], cW[3], cW[4],
                                                                 cW[5], this.ConvertStrintIntoDateTime(cW[6]), cW[7], cW[8], cW[9], cW[10],
                                                                 this.ConvertStrintIntoDateTime(cW[11]), ESallaryType.Monthly,
                                                                 decimal.Parse(cW[13]));
                this.ExecuteAdd(courseParticipant);
                break;

            case "teacher":
                Person teacher = new Teacher(cW[2], cW[3], cW[4],
                                             cW[5], this.ConvertStrintIntoDateTime(cW[6]), cW[7], cW[8], cW[9], cW[10],
                                             this.ConvertStrintIntoDateTime(cW[11]), ESallaryType.Monthly,
                                             decimal.Parse(cW[13]));
                this.ExecuteAdd(teacher);
                break;

            case "secretary":
                Person secretary = new Secretary(cW[2], cW[3], cW[4],
                                                 cW[5], this.ConvertStrintIntoDateTime(cW[6]), cW[7], cW[8], cW[9], cW[10],
                                                 this.ConvertStrintIntoDateTime(cW[11]), ESallaryType.Monthly,
                                                 decimal.Parse(cW[13]));
                this.ExecuteAdd(secretary);
                break;

            case "adult_language_course":
                string courseName                   = CourseInputer.CourseNameCreator(cW[2]);
                ECourseActivityStatus status        = CourseInputer.CourseActivityCreator(cW[3]);
                EGroupType            groupType     = CourseInputer.GroupTypeCreator(cW[4]);
                ECoursePlace          coursePlace   = cW[5] == "local" ? ECoursePlace.Local : ECoursePlace.Online;
                decimal            coursePrice      = decimal.Parse(cW[6]);
                IList <IPerson>    coursists        = CourseInputer.GetCoursistsInCourse(cW[7]);
                IList <IPerson>    teachers         = CourseInputer.GetTeachersInCourse(cW[8]);
                IList <IClassInfo> conductedClasses = new List <IClassInfo>();
                EAge      age                 = EAge.Adults;
                ELanguage language            = CourseInputer.GetLanguage(cW[11]);
                ELanguageLevelForAdults level = CourseInputer.LanguageLevelAdults("a1");
                LanguageCourseForAdults languageCourseAdults = new LanguageCourseForAdults(courseName, status, groupType,
                                                                                           coursePlace, coursePrice, coursists, teachers, conductedClasses, age, language, level);
                Course.Add(languageCourseAdults);
                break;

            case "class":
                ICourse courseToAddToClass = null;

                ulong courseId = ulong.Parse(cW[5].Split('_')[1]);
                foreach (var currentCourse in Course.CourseList)
                {
                    if (currentCourse.Id == courseId)
                    {
                        courseToAddToClass = currentCourse;
                    }
                }

                ITeacher teacherToAddToClass = null;

                ulong teacherId = ulong.Parse(cW[6].Split('_')[1]);
                foreach (var currentTeacher in Person.GetAllTeachers())
                {
                    if (currentTeacher.Id == teacherId)
                    {
                        teacherToAddToClass = (ITeacher)currentTeacher;
                    }
                }

                string[] conductionDateString = cW[2].Split('_')[1].Split('.');
                int      conductionDateYear   = int.Parse(conductionDateString[2]);
                int      conductionDateMonth  = int.Parse(conductionDateString[1]);
                int      conductionDateDay    = int.Parse(conductionDateString[0]);
                DateTime conductionDate       = new DateTime(conductionDateYear, conductionDateMonth, conductionDateDay);

                string[] startHourStringArray = cW[3].Split('_')[2].Split(':');
                int      startHourHour        = int.Parse(startHourStringArray[0]);
                int      startHourMinutes     = int.Parse(startHourStringArray[1]);
                DateTime startHour            = new DateTime(conductionDateYear, conductionDateMonth, conductionDateDay, startHourHour, startHourMinutes, 0);

                string[] endHourStringArray = cW[4].Split('_')[2].Split(':');
                int      endHourHour        = int.Parse(endHourStringArray[0]);
                int      endHourMinutes     = int.Parse(endHourStringArray[1]);
                DateTime endHour            = new DateTime(conductionDateYear, conductionDateMonth, conductionDateDay, endHourHour, endHourMinutes, 0);

                ClassInfo currentClass = new ClassInfo(conductionDate, startHour, endHour, teacherToAddToClass, courseToAddToClass);

                bool presentTeacher = false;

                foreach (var teacherInCourse in courseToAddToClass.TeachersInCourse)
                {
                    if (teacherInCourse.Id == teacherToAddToClass.Id)
                    {
                        presentTeacher = true;
                        break;
                    }
                }

                if (presentTeacher == true)
                {
                    courseToAddToClass.AddConductedClass(currentClass);
                }
                else
                {
                    throw new ArgumentException(String.Format("There's no teacher with ID {0} who conducts classes in the course with ID {1}",
                                                              teacherToAddToClass.Id, courseToAddToClass.Id));
                }
                break;

            default:
                break;
            }
        }
Example #7
0
 public LanguageCourseForChildren(string courseName, ECourseActivityStatus activityStatus, EGroupType groupType, ECoursePlace coursePlace,
                                  decimal price, IList <IPerson> studentsInCourse, IList <IPerson> teachersInCourse, IList <IClassInfo> conductedClasses, EAge age, ELanguage language,
                                  ELanguageLevelForChildren languageLevelForChildren)
     : base(courseName, activityStatus, groupType, coursePlace, price, studentsInCourse, teachersInCourse, conductedClasses, age)
 {
     this.Language      = language;
     this.LanguageLevel = languageLevelForChildren;
 }
Example #8
0
        private unsafe void UpdateHumanChangeToCell(Human* hptr, SimulationData data, EAge previousAge)
        {
            EAge newAge = hptr->GetAge();

            if (previousAge != newAge)
            {

                lock (data.Cells[hptr->CurrentCell])
                {
                    PopulationCell currentcell = data.Cells[hptr->CurrentCell];

                    if (hptr->GetGender() == EGender.Female)
                    {
                        if (newAge == EAge.Child)
                        {
                            --currentcell.FemaleBabies;
                            ++currentcell.FemaleChildren;
                        }
                        else if (newAge == EAge.Adult)
                        {
                            --currentcell.FemaleChildren;
                            ++currentcell.FemaleAdults;
                        }
                        else if (newAge == EAge.Senior)
                        {
                            --currentcell.FemaleAdults;
                            ++currentcell.FemaleSeniors;
                        }
                    }
                    else
                    {
                        if (newAge == EAge.Child)
                        {
                            --currentcell.MaleBabies;
                            ++currentcell.MaleChildren;
                        }
                        else if (newAge == EAge.Adult)
                        {
                            --currentcell.MaleChildren;
                            ++currentcell.MaleAdults;
                        }
                        else if (newAge == EAge.Senior)
                        {
                            --currentcell.MaleAdults;
                            ++currentcell.MaleSeniors;
                        }
                    }
                }
            }
        }
Example #9
0
        private unsafe void AssignProfession(Human* hptr, EAge previousAge)
        {
            EAge newAgegroup = hptr->GetAge();

            if (newAgegroup != previousAge)
            {
                if (newAgegroup == EAge.Child)
                {
                    hptr->SetProfession(EProfession.Pupil);
                }
                else if (newAgegroup == EAge.Adult)
                {
                    int choice = RANDOM.Next(6);
                    switch (choice)
                    {
                        case 0: hptr->SetProfession(EProfession.Student); break;
                        case 1: hptr->SetProfession(EProfession.Plumber); break;
                        case 2: hptr->SetProfession(EProfession.Commuter); break;
                        case 3: hptr->SetProfession(EProfession.DeskJobber); break;
                        case 4: hptr->SetProfession(EProfession.TravellingSalesman); break;
                        case 5: hptr->SetProfession(EProfession.Housewife); break;
                    }
                }
                else if (newAgegroup == EAge.Senior)
                {
                    hptr->SetProfession(EProfession.Housewife);
                }
                else
                {
                    throw new Exception("Someone seemed to have found the fountain of Youth" +
                    "atleast he wasn't a baby before this Agetick and now he is. MAGIC!");
                }
            }
            else
            {
                if (hptr->GetProfession() == EProfession.Student && hptr->GetAgeInYears() >= 30)
                {
                    int choice = RANDOM.Next(5);
                    switch (choice)
                    {
                        case 0: hptr->SetProfession(EProfession.Plumber); break;
                        case 1: hptr->SetProfession(EProfession.Commuter); break;
                        case 2: hptr->SetProfession(EProfession.DeskJobber); break;
                        case 3: hptr->SetProfession(EProfession.TravellingSalesman); break;
                        case 4: hptr->SetProfession(EProfession.Housewife); break;
                    }
                }
            }
        }
 protected AdultCourse(string courseName, ECourseActivityStatus activityStatus, EGroupType groupType, ECoursePlace coursePlace,
     decimal price, IList<IPerson> studentsInCourse, IList<IPerson> teachersInCourse, IList<IClassInfo> conductedClasses, EAge age)
     : base(courseName, activityStatus, groupType, coursePlace, price, studentsInCourse, teachersInCourse, conductedClasses)
 {
     this.Age = age;
 }