예제 #1
0
 public void EnsureSeedDataCreated()
 {
     Trainers.Add(new Trainer()
     {
         Id = new Guid("8B176CF0-D3E4-4C5E-93DC-CF9F793040AC"), Username = "******"
     });
 }
예제 #2
0
        public void AddTrainer(string fname, string lname, string subject)
        {
            int current_id = Trainers.Count + 1;
            var trainer    = new Trainer(current_id, fname, lname, subject);

            Trainers.Add(trainer);
            PrivateSchool.OutputTrainer(trainer);
        }
예제 #3
0
        internal bool TryAddTrainer(Trainer trainer)
        {
            if (Trainers.Contains(trainer))
            {
                return(false);
            }

            Trainers.Add(trainer);

            return(true);
        }
예제 #4
0
 public void AddTrainer()
 {
     try
     {
         Trainers.Add(new Trainer(TrainerName, TrainerSurname, System.Int32.Parse(TrainerAge), TrainerGender, TrainerRegion, TrainerHometown, TrainerClass));
     }
     catch (Exception e)
     {
         MessageBox.Show(e.ToString());
     }
     this.CloseAction();
 }
예제 #5
0
        public BattleContext(IList <ITrainer> trainers)
        {
            foreach (var trainer in trainers)
            {
                Trainers.Add(CreateTrainer(trainer));
            }

            foreach (var trainer in Trainers)
            {
                ActiveTrainers.Add(trainer);
            }
        }
예제 #6
0
        private async Task LoadTrainers()
        {
            var trainers = await trainerLookupDataService.LoadTrainerLookupItemsAsync();

            foreach (var trainer in trainers)
            {
                Trainers.Add(new NavigationItemViewModel(
                                 eventAggregator,
                                 trainer.Id,
                                 trainer.DisplayMember,
                                 nameof(TrainerDetailViewModel)));
            }
        }
예제 #7
0
        static void AddTrainer()
        {
            Console.Clear();
            Console.WriteLine("Please enter a trainer in the following format: \"< FirstName > < LastName > < Subject >\"");
            Console.WriteLine("In case of multiple entries use a comma to separate each trainer. Example: \"Konstantinos Takakis Programming,John Doe Gymnastics\"");

            string[] trainers = Console.ReadLine().Split(',');
            foreach (string trainerInfo in trainers)
            {
                string[] tokens = trainerInfo.Split(' ');
                Trainers.Add(new Trainer(tokens[0], tokens[1], tokens[2]));
            }

            TrainerMenu();
        }
예제 #8
0
        public void InputTrainerPerCourse()
        {
            Console.WriteLine("Enter a Course: ");
            Course.InputCourse();
            Console.WriteLine("How many trainers has the course?");
            int j = Convert.ToInt32(Console.ReadLine());

            Console.WriteLine("Please enter the Trainers: ");
            for (int i = 0; i < j; i++)
            {
                Trainer t = new Trainer();
                t.InputTrainer();
                Trainers.Add(t);
            }
        }
예제 #9
0
 void _increaseOccupationNum(CSPersonnel person, int occupation)
 {
     if (occupation == CSConst.potWorker)
     {
         if (!m_Workers.Contains(person))
         {
             m_Workers.Add(person);
         }
         m_WorkerNum++;
     }
     else if (occupation == CSConst.potSoldier)
     {
         if (!m_Soldiers.Contains(person))
         {
             m_Soldiers.Add(person);
         }
         m_SoldierNum++;
     }
     else if (occupation == CSConst.potFarmer)
     {
         if (!m_Farmers.Contains(person))
         {
             m_Farmers.Add(person);
         }
         m_FarmerNum++;
     }
     else if (occupation == CSConst.potProcessor)
     {
         if (!m_Processors.Contains(person))
         {
             m_Processors.Add(person);
         }
         m_ProcessorNum++;
     }
     else if (occupation == CSConst.potTrainer)
     {
         if (!Trainers.Contains(person))
         {
             Trainers.Add(person);
         }
         m_TrainerNum++;
     }
 }
예제 #10
0
 public override ProcessResult ProcessMessage(int userid, string text)
 {
     // Обработка сообщений с обучением
     if (Trainers.Contains(userid))
     {
         return(ProcessMessageFromTrainer(userid, text));
     }
     // Обработка команды начала обучения
     else if (text.ToLower() == "учить")
     {
         Trainers.Add(userid);
         CallUsersGridUpdate(new UsersGridUpdateEventArgs("LearningNow", userid, "Yes"));
         vk.SendMessage(userid, "Добро пожаловать в режим обучения бота.\n" +
                        "В данном режиме вы можете научить меня отвечать на различные сообщения.\n" +
                        "Чтобы добавить фразы, которыми я буду отвечать на определённое сообщение, " +
                        "пришлите мне сообщение в виде: ШАБЛОН *перенос строки* ОТВЕТ. " +
                        "Ответов можно добавлять несколько, разделяя их так же переносом строки.\n" +
                        "Пример:\n\nЗДРАВСТВУЙ\nПриветик\nДобрый день\nХей! Как делишки?\n\n" +
                        "Таким образом бот будет отвечать на сообщение с текстом \"здравствуй\" одной из трёх фраз.\n" +
                        "Так же вы можете дать ответ на одну из фраз, которую писали боту, на которую он не смог ответить сам," +
                        "тем самым так же пополнив его базу данных. Для получения случайной фразы, на которую нужно дать ответ, напишите ОТВЕТ" +
                        "Ближайшее время будет добавлена возможность вводить шаблоны в виде регулярных выражений.\n" +
                        "Для выхода из режима обучения пожалуйста напишите ОТМЕНА\n\n" +
                        "Надеюсь Вы научите меня правильно отвечать. Пожалуйста, не вставляйте различные ссылки/рекламу в ответы," +
                        "или же сообщения не по теме. Злоупотребление данной функцией может привести к вашей блокировке. <3");
         return(ProcessResult.Processed);
     }
     // Ответ на фразу, ответ на которую существует
     else if (CustomAnswers.ContainsKey(text.ToLower()) || CustomAnswers.ContainsKey(text.ToLower() + '?') || CustomAnswers.ContainsKey(text.ToLower().Trim(new[] { ' ', '.', '?', '!' })))
     {
         text = text.ToLower();
         var answers = CustomAnswers.ContainsKey(text) ? CustomAnswers[text] :
                       (CustomAnswers.ContainsKey(text + '?') ? CustomAnswers[text + '?'] : CustomAnswers[text.Trim(new[] { ' ', '.', '?', '!' })]);
         var i = rnd.Next(answers.Count);
         vk.SendMessage(userid, answers[i]);
         return(ProcessResult.Processed);
     }
     // Добавление фразы в неотвеченные
     NotAnswered.Add(text);
     Tab.Invoke((Action)(() => Tab.listBoxNotAnswered.Items.Add(text)));
     return(ProcessResult.Skipped);
 }
예제 #11
0
        public Trainers GetTrainers(string id)
        {
            Trainers trainers = new Trainers();

            try
            {
                string query = $"select * from dsto_Trainer where yref_training = '{id}' and Deleted=0";
                var    table = DbInfo.ExecuteSelectQuery(query);
                if (table.Rows.Count > 0)
                {
                    foreach (DataRow row in table.Rows)
                    {
                        Trainer trainer = trainers.Add();
                        InitTrainer(trainer, row);
                    }
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }

            return(trainers);
        }
예제 #12
0
        public void MakeTrainer()
        {
            Trainer newTrain = new Trainer();

            Trainers.Add(newTrain);

            Console.WriteLine("Enter trainer's first name: ");
            newTrain.FirstName = Console.ReadLine();

            if (newTrain.FirstName.Length < 1)
            {
                Console.WriteLine("First name was left empty");
                Console.WriteLine("Will put synthetic data");
                newTrain.FirstName = "Xaralampos";
            }

            Console.WriteLine("Enter trainer's last name: ");
            newTrain.LastName = Console.ReadLine();

            if (newTrain.LastName.Length < 1)
            {
                Console.WriteLine("Last name was left empty");
                Console.WriteLine("Will put synthetic data");
                newTrain.LastName = "Lampropoulos";
            }

            Console.WriteLine("Enter trainer's subject: ");
            newTrain.Subject = Console.ReadLine();

            if (newTrain.Subject.Length < 1)
            {
                Console.WriteLine("Subject was left empty");
                Console.WriteLine("Will put synthetic data");
                newTrain.Subject = "UNIX Systems";
            }
        }
        public void ContinueAddingTrainerOrNot()
        {
            string answer = CheckContinueOrNot();

            while (answer.ToUpper() == "C")
            {
                Console.Clear();
                Welcome();
                Trainer t = new Trainer();
                t.Initrainer();
                Trainers.Add(t);
                t.PrintTheTrainerEntry();
                Console.WriteLine("\n\tPress C to Continue Adding : ");
                Console.WriteLine("\tPress B to go Back to Menu : ");
                Console.Write("\t                           : ");
                answer = StringAnswer();
            }
            if (answer.ToUpper() == "B")
            {
                Console.Clear();
                Welcome();
                InsertMenu();
            }
        }
예제 #14
0
        private static void AddMember(Role role)
        {
            Console.WriteLine("Enter username");
            string username = Console.ReadLine();

            if (string.IsNullOrEmpty(username))
            {
                throw new Exception("You must enter username");
            }

            Admin   admin   = SearchAdmins(username);
            Trainer trainer = SearchTrainers(username);
            Student student = SearchStudents(username);

            if (admin != null || trainer != null || student != null)
            {
                throw new Exception("User with this username already exists");
            }

            Console.WriteLine("Enter first name");
            string firstName = Console.ReadLine();

            if (string.IsNullOrEmpty(firstName))
            {
                throw new Exception("You must enter first name");
            }

            Console.WriteLine("Enter last name");
            string lastName = Console.ReadLine();

            if (string.IsNullOrEmpty(lastName))
            {
                throw new Exception("You must enter last name");
            }

            int age = int.Parse(Console.ReadLine());

            if (age < 16)
            {
                throw new Exception("Age must be greater than 16");
            }

            if (role == Role.Admin)
            {
                Admins.Add(new Admin(username, firstName, lastName, age));
            }
            else if (role == Role.Trainer)
            {
                Trainers.Add(new Trainer(username, firstName, lastName, age));
            }
            else
            {
                Student newStudent = new Student(username, firstName, lastName, age);

                Console.WriteLine("Enter subject name");
                string  currentSubject = Console.ReadLine();
                Subject current        = Subjects.FirstOrDefault(x => x.Name == currentSubject);
                newStudent.CurrentSubject = current;

                Students.Add(newStudent);
            }
        }
        // Menu Insert Data

        public void InsertMenu()
        {
            string answer = string.Empty;

            Console.ForegroundColor = ConsoleColor.Yellow;
            Console.WriteLine("\tMENU\n");
            Console.ForegroundColor = ConsoleColor.White;
            Console.WriteLine("\t1. Add new Course\n");
            Console.WriteLine("\t2. Add new Trainer\n");
            Console.WriteLine("\t3. Add new Assignment\n");
            Console.WriteLine("\t4. Add new Student\n");
            Console.Write("\t5. ");
            Console.ForegroundColor = ConsoleColor.Yellow;
            Console.WriteLine("Return to Main Menu\n");
            Console.ForegroundColor = ConsoleColor.White;
            Console.Write("\t0. ");
            Console.ForegroundColor = ConsoleColor.Cyan;
            Console.WriteLine("LogOut\n");
            Console.ForegroundColor = ConsoleColor.White;
            Console.Write("\tChoice : ");
            answer = StringAnswer();
            while (!(answer == "1" || answer == "2" || answer == "3" || answer == "4" || answer == "5" || answer == "0"))
            {
                Console.ForegroundColor = ConsoleColor.Red;
                Console.WriteLine("\tChoose Between (1,2,3,4,5,0)");
                Console.Beep();
                Console.ForegroundColor = ConsoleColor.White;
                Console.Write("\tChoice : ");
                answer = StringAnswer();
            }
            switch (answer)
            {
            case "1":
                Console.Clear();
                Welcome();
                Course c = new Course();
                c.InitializeCourse();
                Courses.Add(c);
                c.PrintTheCourseEntry();
                ContinueAddingCourseOrNot();
                break;

            case "2":
                Console.Clear();
                Welcome();
                Trainer t = new Trainer();
                t.Initrainer();
                Trainers.Add(t);
                t.PrintTheTrainerEntry();
                ContinueAddingTrainerOrNot();
                break;

            case "3":
                Console.Clear();
                Welcome();
                Assignment a = new Assignment();
                a.InitializeAssignment();
                Assignments.Add(a);
                a.PrintTheAssignmentEntry();
                ContinueAddingAsOrNot();
                break;

            case "4":
                Console.Clear();
                Welcome();
                Student s = new Student();
                s.InitStudent();
                Students.Add(s);
                s.PrintTheStudentEntry();
                ContinueAddingStudOrNot();
                break;

            case "5":
                GobackStartmenu();
                break;

            case "0":
                LogOut();
                break;
            }
        }
예제 #16
0
        public Data()
        {
            //creating students
            Student s1 = new Student("Panagiotis", "Grigoriou", new DateTime(1987, 3, 4), 3000);
            Student s2 = new Student("Konstantinos", "Pantelidis", new DateTime(1991, 6, 2), 4000);
            Student s3 = new Student("Spiros", "Aggelatos", new DateTime(1996, 4, 7), 3500);
            Student s4 = new Student("Dimitris", "Pantelopoulos", new DateTime(2000, 5, 2), 6200);
            Student s5 = new Student("Antonis", "Mixelakakis", new DateTime(1989, 10, 3), 5800);

            Students.Add(s1);
            Students.Add(s2);
            Students.Add(s3);
            Students.Add(s4);
            Students.Add(s5);

            //creating courses
            Course c1 = new Course("Javascript", "Web Development", "Practical Subject", new DateTime(2020, 1, 10), new DateTime(2020, 3, 11));
            Course c2 = new Course("C++", "Object-Oriented Programming", "Practical Subject", new DateTime(2020, 1, 18), new DateTime(2020, 4, 2));
            Course c3 = new Course("Pascal", "Procedural Programming", "Theoretical Subject", new DateTime(2020, 2, 15), new DateTime(2020, 5, 20));
            Course c4 = new Course("Visual Basic", "Windows Application Development", "Practical Subject", new DateTime(2020, 3, 20), new DateTime(2020, 6, 1));

            Courses.Add(c1);
            Courses.Add(c2);
            Courses.Add(c3);
            Courses.Add(c4);

            //creating trainers
            Trainer t1 = new Trainer("Giannis", "Aggelopoulos", "Object-Oriented Programming");
            Trainer t2 = new Trainer("Manolis", "Daskalakis", "Procedural Programming");
            Trainer t3 = new Trainer("Giorgos", "Mpatzoglou", "Procedural Programming");
            Trainer t4 = new Trainer("Thanassis", "Giorgakopoulos", "Object-Oriented Programming");

            Trainers.Add(t1);
            Trainers.Add(t2);
            Trainers.Add(t3);
            Trainers.Add(t4);

            //creating assignments
            Assignment a1 = new Assignment("Project Bank", "Banking application for android phones", new DateTime(2020, 4, 24), 40, 200);
            Assignment a2 = new Assignment("Project E-shop", "Shopping website", new DateTime(2020, 6, 11), 20, 100);
            Assignment a3 = new Assignment("Project Library", "Book rental service", new DateTime(2020, 4, 15), 35, 200);
            Assignment a4 = new Assignment("Project Cinema", "Movie distribution to cinemas", new DateTime(2020, 1, 2), 73, 100);
            Assignment a5 = new Assignment("Project Stocks", "Stock change notifications", new DateTime(2020, 3, 27), 110, 200);
            Assignment a6 = new Assignment("Project Architecture", "Blueprint making software", new DateTime(2020, 3, 24), 40, 150);

            Assignments.Add(a1);
            Assignments.Add(a2);
            Assignments.Add(a3);
            Assignments.Add(a4);
            Assignments.Add(a5);
            Assignments.Add(a6);

            //putting students in mini-lists (students per Course)
            List <Student> C1Stu = new List <Student>();
            List <Student> C2Stu = new List <Student>();
            List <Student> C3Stu = new List <Student>();

            C1Stu.Add(s2);
            C1Stu.Add(s3);

            C2Stu.Add(s1);
            C2Stu.Add(s2);
            C2Stu.Add(s3);

            C3Stu.Add(s1);

            //putting mini-lists in big lists (students per Course)
            StudentPerCourse stuPerCour1 = new StudentPerCourse(c1, C1Stu);
            StudentPerCourse stuPerCour2 = new StudentPerCourse(c2, C2Stu);
            StudentPerCourse stuPerCour3 = new StudentPerCourse(c3, C3Stu);

            StudentsPerCourse.Add(stuPerCour1);
            StudentsPerCourse.Add(stuPerCour2);
            StudentsPerCourse.Add(stuPerCour3);

            //putting trainers in mini-lists (trainers per Course)
            List <Trainer> C1Train = new List <Trainer>();
            List <Trainer> C2Train = new List <Trainer>();
            List <Trainer> C3Train = new List <Trainer>();

            C1Train.Add(t1);
            C1Train.Add(t2);

            C2Train.Add(t1);
            C2Train.Add(t3);

            C3Train.Add(t4);
            C3Train.Add(t1);

            //putting mini-lists in big lists (trainers per Course)
            TrainerPerCourse trainPerCour1 = new TrainerPerCourse(c1, C1Train);
            TrainerPerCourse trainPerCour2 = new TrainerPerCourse(c2, C2Train);
            TrainerPerCourse trainPerCour3 = new TrainerPerCourse(c3, C3Train);

            TrainersPerCourse.Add(trainPerCour1);
            TrainersPerCourse.Add(trainPerCour2);
            TrainersPerCourse.Add(trainPerCour3);

            //putting assignments in mini-lists (assignments per Course)
            List <Assignment> C1Assign = new List <Assignment>();
            List <Assignment> C2Assign = new List <Assignment>();
            List <Assignment> C3Assign = new List <Assignment>();

            C1Assign.Add(a1);
            C1Assign.Add(a2);

            C2Assign.Add(a3);

            C3Assign.Add(a5);
            C3Assign.Add(a4);

            //putting mini-lists in big lists (assignments per Course)
            AssignmentPerCourse assignPerCour1 = new AssignmentPerCourse(c1, C1Assign);
            AssignmentPerCourse assignPerCour2 = new AssignmentPerCourse(c2, C2Assign);
            AssignmentPerCourse assignPerCour3 = new AssignmentPerCourse(c3, C2Assign);

            AssignmentsPerCourse.Add(assignPerCour1);
            AssignmentsPerCourse.Add(assignPerCour2);
            AssignmentsPerCourse.Add(assignPerCour3);

            //putting assignments in mini-lists (assignments per Student)
            List <Assignment> S1Assign = new List <Assignment>();
            List <Assignment> S2Assign = new List <Assignment>();
            List <Assignment> S3Assign = new List <Assignment>();

            S1Assign.Add(a1);
            S1Assign.Add(a2);

            S2Assign.Add(a3);
            S2Assign.Add(a4);
            S2Assign.Add(a5);

            S3Assign.Add(a6);

            //putting mini-lists in big lists (assignments per Student)
            AssignmentPerStudent assignPerStu1 = new AssignmentPerStudent(s1, S1Assign);
            AssignmentPerStudent assignPerStu2 = new AssignmentPerStudent(s2, S2Assign);
            AssignmentPerStudent assignPerStu3 = new AssignmentPerStudent(s3, S3Assign);

            AssignmentsPerStudent.Add(assignPerStu1);
            AssignmentsPerStudent.Add(assignPerStu2);
            AssignmentsPerStudent.Add(assignPerStu3);

            //putting courses in mini-lists (courses per Student)
            List <Course> S1Cour = new List <Course>();
            List <Course> S2Cour = new List <Course>();
            List <Course> S3Cour = new List <Course>();

            S1Cour.Add(c2);
            S1Cour.Add(c3);


            S2Cour.Add(c1);
            S2Cour.Add(c2);

            S3Cour.Add(c1);
            S3Cour.Add(c2);

            //putting mini-lists in big lists (courses per Student)
            CoursePerStudent courPerStu1 = new CoursePerStudent(s1, S1Cour);
            CoursePerStudent courPerStu2 = new CoursePerStudent(s2, S2Cour);
            CoursePerStudent courPerStu3 = new CoursePerStudent(s3, S3Cour);


            CoursesPerStudent.Add(courPerStu1);
            CoursesPerStudent.Add(courPerStu2);
            CoursesPerStudent.Add(courPerStu3);

            //-------------------------------------------------------

            //AssignmentCourseStudent ACS1 = new AssignmentCourseStudent(s1, c2, a3);
            //AssignmentCourseStudent ACS2 = new AssignmentCourseStudent(s1, c3, a6);
            //AssignmentCourseStudent ACS3 = new AssignmentCourseStudent(s2, c1, a1);
            //AssignmentCourseStudent ACS4 = new AssignmentCourseStudent(s2, c2, a4);
            //AssignmentCourseStudent ACS5 = new AssignmentCourseStudent(s3, c1, a2);
            //AssignmentCourseStudent ACS6 = new AssignmentCourseStudent(s3, c2, a5);

            //ACSList.Add(ACS1);
            //ACSList.Add(ACS2);
            //ACSList.Add(ACS3);
            //ACSList.Add(ACS4);
            //ACSList.Add(ACS5);
            //ACSList.Add(ACS6);
        }
예제 #17
0
 public static void AddTrainer(Trainer trainer)
 {
     Trainers.Add(trainer);
 }