Ejemplo n.º 1
0
        static void RunCursusOption(CursusOption option)
        {
            if (option.Students)
            {
                AbstractPerson students = new AbstractPerson();
                students.DatabaseConnection = Database.Instance;

                students.DatabaseConnection.DisplayStudentsByCursus(option.CursusName);
            }
            else if (option.Quests)
            {
            }
        }
Ejemplo n.º 2
0
        public List <AbstractPerson> DisplayAllStudentsFromACursusId(int cursusId)
        {
            List <AbstractPerson> studentsOfASameCursus = new List <AbstractPerson>();

            SqlCommand cmd = new SqlCommand("sp_DisplayAllStudentsFromACursus", Connection);

            cmd.CommandType = CommandType.StoredProcedure;

            cmd.Parameters.Add("@CursusId", SqlDbType.VarChar).Value = cursusId;

            Cursus cursus = Database.GetInstance().GetCursusFromId(cursusId);

            SqlDataReader reader = cmd.ExecuteReader();

            while (reader.Read())
            {
                int      personId        = reader.GetInt32(0);
                string   personFirstName = reader.GetString(1);
                string   personLastName  = reader.GetString(2);
                string   personEmail     = reader.GetString(3);
                DateTime personBirthday  = reader.GetDateTime(4);
                int      streetNumber    = reader.GetInt32(5);
                string   streetName      = reader.GetString(6);
                string   city            = reader.GetString(7);
                string   country         = reader.GetString(8);


                Adress         adress = new Adress(streetNumber, streetName, city, country);
                AbstractPerson person = PersonFactory.Create();
                // set Person properties independently
                studentsOfASameCursus.Add(person);
            }
            reader.Close();


            return(studentsOfASameCursus);
        }
Ejemplo n.º 3
0
        public static void Main(string[] args)
        {
            /*Parser.Default.ParseArguments<EventsOption, CursusOption>(args)
             * .WithParsed<EventsOption>(RunEventsOption)
             * .WithParsed<CursusOption>(RunCursusOption);*/


            /*Event newEvent = new Event("Important meeting");
             * newEvent.StartTime = DateTime.Now;
             * newEvent.EndTime = DateTime.Now + TimeSpan.FromHours(1);
             * newEvent.Postpone(TimeSpan.FromHours(1));
             * Console.WriteLine("Another meeting is postponed");*/

            //Création d'événement pour une personne

            Event rentree = new Event("rentrée");

            rentree.StartTime = new DateTime(2019, 12, 09);
            rentree.EndTime   = new DateTime(2019, 12, 10);

            Event hackathon = new Event("hackathon");

            hackathon.StartTime = new DateTime(2020, 02, 13);
            hackathon.EndTime   = new DateTime(2020, 02, 15);

            List <Event> events = new List <Event>();

            events.Add(rentree);
            events.Add(hackathon);

            AbstractPerson person = new AbstractPerson();

            person.Agenda = events;


            DateTime date1 = new DateTime(2018, 01, 10);
            DateTime date2 = new DateTime(2020, 03, 10);

            Console.WriteLine(person.GetEvents(date1, date2, events));



            /*Cursus csharp = new Cursus();
             *
             * AbstractPerson student1 = PersonFactory.Create("Tom", null, null, csharp);
             * AbstractPerson student2 = PersonFactory.Create("Lys", null, null, csharp);
             * AbstractPerson student3 = PersonFactory.Create("Nathaniel", null, null, csharp);
             *
             *
             * List<AbstractPerson> studentsList = new List<AbstractPerson>();
             *
             * studentsList.Add(student1);
             * studentsList.Add(student2);
             * studentsList.Add(student3);
             *
             * List<AbstractPerson> instructorsList = new List<AbstractPerson>();
             *
             * AbstractPerson instructor = PersonFactory.Create("Instructor1", studentsList);
             * Console.WriteLine(instructor.GetAllStudentsOfAInstructor());
             * //Console.WriteLine(instructor.ToString());
             *
             *
             * AbstractPerson instructor2 = PersonFactory.Create("Instructor2", studentsList);
             *
             * instructorsList.Add(instructor);
             * instructorsList.Add(instructor2);
             *
             * AbstractPerson lead = PersonFactory.Create("Chef", studentsList, instructorsList);
             *
             * //Console.WriteLine(lead.ToString()); */

            // Display Students By Cursus and Instructor Id

            /*string nameCursus = "c#";
             * ;
             * AbstractPerson students = new AbstractPerson();
             * students.DatabaseConnection = Database.Instance;
             *
             * students.DatabaseConnection.DisplayStudentsByCursus(nameCursus);
             *
             * int instructorId = 3;
             *
             * students.DatabaseConnection.DisplayStudentsByInstructor(instructorId);*/
        }