static void Main(string[] args) { #region Enums DateTime today = DateTime.Now; // example of casting into integer int dayOfWeek = (int)today.DayOfWeek; //Console.WriteLine(dayOfWeek); // this is an edge case, we ussualy compare enum to enum if (dayOfWeek == (int)DaysOfWeek.Friday) { //Console.WriteLine("PARTYYYY !!"); } #endregion // Creating objects from class Participant Participant trainer1 = new Participant("Dejan", "Jovanov", 28, AcademyRole.CoTrainer); // trainer1.Role = AcademyRole.CoTrainer; // trainer1.PrintParticipant(); Participant trainer2 = new Participant("Kristina", "Spasevska", 33, AcademyRole.CoTrainer); Participant student1 = new Participant("Radmila", "Sokolovska", 34, AcademyRole.Student); Participant student2 = new Participant("Blagoja", "Grozdanovski", 30, AcademyRole.Student); Participant[] academyParticipants = new Participant[] { trainer1, trainer2, student1, student2 }; // Using helper method which is defined with STATIC access modifier, and can be // invoked without instanciating object from the class ParticipantHelper.FindParticipantByRole(AcademyRole.CoTrainer, academyParticipants); Console.ReadLine(); }
static void Main(string[] args) { Console.WriteLine("Hello World!"); Participant trainer = new Participant("Kristina", "Spasevska", 34, AcademyRole.Trainer); Participant assistant = new Participant("Panche", "Manaskov", 21, AcademyRole.Assistant); Participant student01 = new Participant("Ceca", "Vasileva", 18, AcademyRole.Student); Participant student02 = new Participant("Ivan", "Jamandilov", 22, AcademyRole.Student); Participant[] academyParticipants = new Participant[] { trainer, assistant, student01, student02 }; // using helper service class with static method // we do not instantiate with new ParticipantHelper.FindParticipantByRole(AcademyRole.Trainer, academyParticipants); Console.ReadLine(); }
static void Main(string[] args) { Participant participant1 = new Participant(); participant1.FirstName = "Miodrag"; participant1.LastName = "Cekikj"; participant1.DateOfBirth = new DateTime(1989, 5, 15); participant1.Role = AcademyRole.Trainer; participant1.Greetings(); var participant2 = new Participant(); participant2.FirstName = "Goce"; participant2.LastName = "Kabov"; participant2.DateOfBirth = new DateTime(1992, 5, 15); participant2.Role = AcademyRole.Assistant; participant2.Greetings(); var participant3 = new Participant("Bob", "Marley"); participant3.Role = AcademyRole.Assistant; Console.ForegroundColor = ConsoleColor.Yellow; participant3.PrintFullName(); var participant4 = new Participant() { FirstName = "Tupac", LastName = "Shakur", Subjects = new Subject[2] }; //Added Subjects with Tools #region MyRegion var cSharBasic = new Subject(); cSharBasic.Title = "C# Basic"; cSharBasic.Semester = 2; cSharBasic.Tools = new Tooling() { MainIDE = "VS 2019", AlternativeIDE = "VS Code" }; var cSharpAdvanced = new Subject(); cSharpAdvanced.Title = "C# Advanced"; cSharpAdvanced.Semester = 2; cSharpAdvanced.Tools = new Tooling() { MainIDE = "VS 2019", AlternativeIDE = "VS Code" }; #endregion participant4.PrintFullName(); var participants = new Participant[4]; participants[0] = participant1; participants[1] = participant2; participants[2] = participant3; participants[3] = participant4; ParticipantHelper.FindParticipantByRole(participants, AcademyRole.Trainer); //Added more Participant with subjects and tools, from 1st semester #region MyRegion var introductionTrainer = new Participant() { FirstName = "Risto", LastName = "Panchevski", Role = AcademyRole.Trainer, Subjects = new Subject[] { new Subject() { Title = "Introduction to Web Development", Semester = 1 } } }; var htmlCssTrainer = new Participant() { FirstName = "Jane", LastName = "Dimeski", Role = AcademyRole.Trainer, Subjects = new Subject[] { new Subject() { Title = "HTML", Semester = 1, Tools = new Tooling() { MainIDE = "Sublime Text 3" } }, new Subject() { Title = "CSS", Semester = 1, Tools = new Tooling() { MainIDE = "Sublime Text 3" } } } }; var htmlCssAssistant = new Participant() { FirstName = "Vukashin", LastName = "Obradovikj", Role = AcademyRole.Assistant, Subjects = new Subject[] { new Subject() { Title = "HTML", Semester = 1, Tools = new Tooling() { MainIDE = "Sublime Text 3" } }, new Subject() { Title = "CSS", Semester = 1, Tools = new Tooling() { MainIDE = "Sublime Text 3" } } } }; var jsBasicCotrainer = new Participant() { FirstName = "Trajan", LastName = "Stevkovski", Role = AcademyRole.Cotrainer, Subjects = new Subject[] { new Subject() { Title = "Java Script Basic", Semester = 1, Tools = new Tooling() { MainIDE = "VS Code", AlternativeIDE = "VS 2019" } } } }; var jsCotrainer = new Participant() { FirstName = "Ivo", LastName = "Kostovski", Role = AcademyRole.Cotrainer, Subjects = new Subject[] { new Subject() { Title = "Java Script Basic", Semester = 1, Tools = new Tooling() { MainIDE = "VS Code", AlternativeIDE = "VS 2019" } }, new Subject() { Title = "Java Script Advanced", Semester = 1, Tools = new Tooling() { MainIDE = "VS Code", AlternativeIDE = "VS 2019" } } } }; var jsAdvancedCotrainer = new Participant() { FirstName = "Aleksandar", LastName = "Kocevski", Role = AcademyRole.Cotrainer, Subjects = new Subject[] { new Subject() { Title = "Java Script Advanced", Semester = 1, Tools = new Tooling() { MainIDE = "VS Code", AlternativeIDE = "VS 2019" } } } }; var firstSemesterTrainers = new Participant[6]; firstSemesterTrainers[0] = introductionTrainer; firstSemesterTrainers[1] = htmlCssTrainer; firstSemesterTrainers[2] = htmlCssAssistant; firstSemesterTrainers[3] = jsBasicCotrainer; firstSemesterTrainers[4] = jsCotrainer; firstSemesterTrainers[5] = jsAdvancedCotrainer; ParticipantHelper.PrintTrainersAndAssistantsFrom1stSemester(firstSemesterTrainers); #endregion Console.ReadLine(); }
static void Main(string[] args) { //var assistant = new Assistant(); //var student = new Student(); Trainer trainer = new Trainer("Miodrag", "Cekikj"); trainer.DateOfBirth = new DateTime(1989, 5, 15); //trainer.Role = AcademyRole.Trainer; int[] numbers = new int[] { 1, 2, 3 }; trainer.Subjects = new Subject[] { new Subject() { Title = "C# Basic", Semester = 2, Tools = new Tooling() { MainIDE = "Visual Studio 2019", AlternativeIDE = "Visual Studio Code" } }, new Subject() { Title = "C# Advanced", Semester = 2, Tools = new Tooling() { MainIDE = "Visual Studio 2019", AlternativeIDE = "Visual Studio Code" } } }; trainer.Greetings(); var assistant = new Assistant(); assistant.FirstName = "Goce"; assistant.LastName = "Kabov"; assistant.DateOfBirth = new DateTime(1992, 5, 15); assistant.Role = AcademyRole.Assistant; assistant.Greetings(); var student1 = new Participant("Bob", "Marley"); student1.Role = AcademyRole.Assistant; Console.ForegroundColor = ConsoleColor.Yellow; student1.PrintFullName(); var student2 = new Participant() { FirstName = "Tupac", LastName = "Shakur" }; var cSharpBasic = new Subject(); cSharpBasic.Title = "C# Basic"; cSharpBasic.Semester = 2; var cSharpAdvanced = new Subject(); cSharpAdvanced.Title = "C# Advanced"; cSharpAdvanced.Semester = 2; //participant4.Subjects = new string[] {"C# Basic", "C# Advanced"}; student2.Subjects = new Subject[] { cSharpBasic, cSharpAdvanced }; foreach (var subject in student2.Subjects) { Console.WriteLine(subject.Title); } student2.PrintFullName(); var participants = new Participant[4]; participants[0] = trainer; participants[1] = assistant; participants[2] = student1; participants[3] = student2; ParticipantHelper.FindParticipantByRole(participants, AcademyRole.Trainer); Console.ReadLine(); }
static void Main(string[] args) { var participants = new Participant(); //Filling the list with participants participants.Participants.Add( new Participant() { FirstName = "Goce", LastName = "Kabov", DateOfBirth = new DateTime(1992, 5, 15), Role = AcademyRole.Assistant }); participants.Participants.Add(new Participant() { FirstName = "Vukashin", LastName = "Obradovikj", DateOfBirth = new DateTime(1989, 3, 15), Role = AcademyRole.Assistant }); participants.Participants.Add(new Participant() { FirstName = "Maja", LastName = "Jovanovska", DateOfBirth = new DateTime(1987, 5, 25), Role = AcademyRole.Student }); participants.Participants.Add(new Participant() { FirstName = "Ljupco", LastName = "Kalkov", DateOfBirth = new DateTime(1987, 4, 1), Role = AcademyRole.Student }); participants.Participants.Add(new Participant() { FirstName = "Biljana", LastName = "Davidovska", DateOfBirth = new DateTime(1984, 5, 15), Role = AcademyRole.Student }); var miodrag = new Participant() { FirstName = "Miodrag", LastName = "Cekic", DateOfBirth = new DateTime(1989, 5, 15), Role = AcademyRole.Trainer, }; var jane = new Participant() { FirstName = "Jane", LastName = "Dimeski", DateOfBirth = new DateTime(1989, 2, 15), Role = AcademyRole.Trainer }; var trajan = new Participant() { FirstName = "Trajan", LastName = "Stevkovski", DateOfBirth = new DateTime(1989, 6, 15), Role = AcademyRole.Trainer }; var ivo = new Participant() { FirstName = "Ivo", LastName = "Kostovski", DateOfBirth = new DateTime(1989, 5, 15), Role = AcademyRole.Trainer }; var aleksandar = new Participant() { FirstName = "Aleksandar", LastName = "Kocevski", DateOfBirth = new DateTime(1989, 5, 15), Role = AcademyRole.Assistant }; participants.Participants.AddRange(new List <Participant>() { ivo, trajan, aleksandar, jane }); //Filling the list with Subjects var cSharpBasic = (new Subject() { Title = "C# Basic", Semester = 2, Tools = new Tooling() { MainIDE = "VS 2019", AlternativeIDE = "VS Code" } }); var cSharpAdvanced = (new Subject() { Title = "C# Advanced", Semester = 2, Tools = new Tooling() { MainIDE = "VS 2019", AlternativeIDE = "VS Code" } }); var jsBasic = (new Subject() { Title = "JS Basic", Semester = 1, Tools = new Tooling() { MainIDE = "VS Code", AlternativeIDE = "VS 2019" } }); var jsAdvanced = (new Subject() { Title = "JS Advanced", Semester = 1, Tools = new Tooling() { MainIDE = "VS Code", AlternativeIDE = "VS 2019" } }); var html = (new Subject() { Title = "HTML", Semester = 1, Tools = new Tooling() { MainIDE = "SublimeText3", AlternativeIDE = "SublimeText" } }); var css = (new Subject() { Title = "CSS", Semester = 1, Tools = new Tooling() { MainIDE = "SublimeText3", AlternativeIDE = "SublimeText" } }); participants.Subjects.AddRange(new List <Subject>() { html, css, jsBasic, jsAdvanced, cSharpBasic, cSharpAdvanced }); participants.SubjectTrainers.Add(jane, html); participants.SubjectTrainers.Add(trajan, jsBasic); participants.SubjectTrainers.Add(ivo, jsAdvanced); participants.SubjectTrainers.Add(miodrag, cSharpBasic); ParticipantHelper.PrintAllParticipants(participants.Participants); ParticipantHelper.FindParticipantByRole(participants.Participants, AcademyRole.Student); ParticipantHelper.PrintSubjects(participants.Subjects); ParticipantHelper.PrintTrainersBySubjects(participants.SubjectTrainers); Console.WriteLine(DateTime.Today.Month); Console.WriteLine(DateTime.Today.Day); Console.WriteLine(DateTime.Today); Console.ReadLine(); }
static void Main(string[] args) { Participant participant1 = new Participant(); participant1.FirstName = "Miodrag"; participant1.LastName = "Cekikj"; participant1.DateOfBirth = new DateTime(1989, 5, 15); participant1.Role = AcademyRole.Trainer; participant1.Subjects = new Subject[] { new Subject() { Title = "C# Basic", Semester = 2, Tools = new Tooling() { MainIDE = "Visual Studio", AlternativeIDE = "Visual Studio Code" } }, new Subject() { Title = "C# Advanced", Semester = 2, Tools = new Tooling() { MainIDE = "Visual Studio", AlternativeIDE = "Visual Studio Code" } } }; participant1.Greetings(); var participant2 = new Participant(); participant2.FirstName = "Goce"; participant2.LastName = "Kabov"; participant2.DateOfBirth = new DateTime(1992, 5, 15); participant2.Role = AcademyRole.Assistant; participant2.Greetings(); var participant3 = new Participant("Bob", "Marley"); participant3.Role = AcademyRole.Assistant; Console.ForegroundColor = ConsoleColor.Yellow; participant3.PrintFullName(); var participant4 = new Participant() { FirstName = "Tupac", LastName = "Shakur" }; var cSharpBasic = new Subject(); cSharpBasic.Title = "C# Basic"; cSharpBasic.Semester = 2; var cSharpAdvanced = new Subject(); cSharpAdvanced.Title = "C# Advanced"; cSharpAdvanced.Semester = 2; //participant4.Subjects = new string[] {"C# Basic", "C# Advanced"}; participant4.Subjects = new Subject[] { cSharpBasic, cSharpAdvanced }; foreach (var subject in participant4.Subjects) { Console.WriteLine(subject.Title); } participant4.PrintFullName(); var participants = new Participant[4]; participants[0] = participant1; participants[1] = participant2; participants[2] = participant3; participants[3] = participant4; ParticipantHelper.FindParticipantByRole(participants, AcademyRole.Trainer); Console.ReadLine(); }
static void Main(string[] args) { Participant participant1 = new Participant(); participant1.FirstName = "Miodrag"; participant1.LastName = "Cekikj"; participant1.DateOfBirth = new DateTime(1989, 5, 15); participant1.Role = AcademyRole.Trainer; participant1.Subjects = new Subject[] { new Subject() { Title = "C# Basic", Semester = 2, Tools = new Tooling() { MainIDE = "Visual Studio", AlternativeIDE = "Visual Studio Code" } }, new Subject() { Title = "C# Advanced", Semester = 2, Tools = new Tooling() { MainIDE = "Visual Studio", AlternativeIDE = "Visual Studio Code" } } }; participant1.Greetings(); var participant2 = new Participant(); participant2.FirstName = "Goce"; participant2.LastName = "Kabov"; participant2.DateOfBirth = new DateTime(1992, 5, 15); participant2.Role = AcademyRole.Assistant; participant2.Greetings(); participant2.Subjects = new Subject[] { new Subject() { Title = "HTML", Semester = 1, Tools = new Tooling() { MainIDE = "Sublime", AlternativeIDE = "N/A", } }, new Subject() { Title = "CSS", Semester = 1, Tools = new Tooling() { MainIDE = "Sublime", AlternativeIDE = "N/A", } } }; var participant3 = new Participant("Bob", "Marley"); participant3.Role = AcademyRole.Assistant; Console.ForegroundColor = ConsoleColor.Yellow; participant3.PrintFullName(); participant3.Subjects = new Subject[] { new Subject { Title = ".NET", Semester = 3, Tools = new Tooling() { MainIDE = "Visual Studio", AlternativeIDE = "Visual Studio Code", } }, new Subject { Title = ".NET - Advanced ", Semester = 3, Tools = new Tooling() { MainIDE = "Visual Studio", AlternativeIDE = "Visual Studio Code", } }, }; var participant4 = new Participant() { FirstName = "Dimitar", LastName = "Risteski", Role = AcademyRole.Student, }; participant4.Subjects = new Subject[] { new Subject { Title = "Java Script Basic", Semester = 1, Tools = new Tooling() { MainIDE = "Visual Studio Code", AlternativeIDE = "Sublime", } }, new Subject { Title = "Java Script Advanced", Semester = 1, Tools = new Tooling() { MainIDE = "Visual Studio Code", AlternativeIDE = "Sublime", } }, }; Console.BackgroundColor = ConsoleColor.Yellow; Console.ForegroundColor = ConsoleColor.DarkBlue; Console.WriteLine($"Check: Name {participant4.FirstName} Role:{participant4.Role} " + $"\nTitle: {participant4.Subjects[1].Title} code: {participant4.Subjects[1].Tools.Code} \n" + $"MainIDE {participant4.Subjects[1].Tools.MainIDE}"); Console.ResetColor(); foreach (var subject in participant4.Subjects) { Console.WriteLine(subject.Title); } participant4.PrintFullName(); var participants = new Participant[4]; participants[0] = participant1; participants[1] = participant2; participants[2] = participant3; participants[3] = participant4; ParticipantHelper.FindParticipantByRole(participants, AcademyRole.Trainer); Console.ReadLine(); }
static void Main(string[] args) { var participant1 = new Participant(); participant1.FirstName = "Miodrag"; participant1.LastName = "Cekikj"; participant1.DateOfBirth = new DateTime(1989, 5, 15); participant1.Role = AcademyRole.Trainer; // List of Subjects instead of array----Also in class Participant initiated public List Subject participant1.Subjects = new List <Subject>() { new Subject() { Title = "C# Basic", Semester = 2, Tools = new Tooling() { MainIDE = "Visual Studio", AlternativeIDE = "Visual Studio Code" } }, new Subject() { Title = "C# Advanced", Semester = 2, Tools = new Tooling() { MainIDE = "Visual Studio", AlternativeIDE = "Visual Studio Code" } } }; participant1.Greetings(); Console.WriteLine("-----------------------------------------------"); var participant2 = new Participant(); participant2.FirstName = "Goce"; participant2.LastName = "Kabov"; participant2.DateOfBirth = new DateTime(1992, 5, 15); participant2.Role = AcademyRole.Assistant; participant2.Greetings(); Console.WriteLine("-----------------------------------------------"); var participant3 = new Participant("Bob", "Marley"); participant3.Role = AcademyRole.Assistant; Console.ForegroundColor = ConsoleColor.DarkYellow; participant3.PrintFullName(); Console.WriteLine("-----------------------------------------------"); Console.ForegroundColor = ConsoleColor.Yellow; var participant4 = new Participant() { FirstName = "Tupac", LastName = "Shakur" }; var cSharpBasic = new Subject(); cSharpBasic.Title = "C# Basic"; cSharpBasic.Semester = 2; var cSharpAdvanced = new Subject(); cSharpAdvanced.Title = "C# Advanced"; cSharpAdvanced.Semester = 2; //List of Subject for participant4 participant4.Subjects = new List <Subject>(); participant4.Subjects.Add(cSharpBasic); participant4.Subjects.Add(cSharpAdvanced); foreach (var subject in participant4.Subjects) { Console.WriteLine(subject.Title); } participant4.PrintFullName(); Console.WriteLine("-----------------------------------------------"); // List of Participants and setting a specific Index List <Participant> participants = new List <Participant>(); participants.Insert(0, participant1); participants.Insert(1, participant2); participants.Insert(2, participant3); participants.Insert(3, participant4); // Corection of the first parameter and appropriatelly in to ParticipantHelper method in Helpers Folder ParticipantHelper.FindParticipantByRole(participants, AcademyRole.Trainer); Console.ReadLine(); }
static void Main(string[] args) { Trainer trainer = new Trainer("Miodrag", "Cekikj"); trainer.DateOfBirth = new DateTime(1989, 5, 15); trainer.Subjects = new List <Subject> { new Subject() { Title = "C# Basic", Semester = 2, Tools = new Tooling() { MainIDE = "Visual Studio 2019", AlternativeIDE = "Visual Studio Code" } }, new Subject() { Title = "C# Advanced", Semester = 2, Tools = new Tooling() { MainIDE = "Visual Studio 2019", AlternativeIDE = "Visual Studio Code" } } }; trainer.Greetings(); var assistant = new Assistant(); assistant.FirstName = "Goce"; assistant.LastName = "Kabov"; assistant.DateOfBirth = new DateTime(1992, 5, 15); assistant.Greetings(); var bob = new Assistant("Bob", "Marley"); bob.Role = AcademyRole.Assistant; bob.Subjects = new List <Subject> { new Subject { Title = ".NET", Semester = 3, Tools = new Tooling() { MainIDE = "Visual Studio", AlternativeIDE = "Visual Studio Code", } }, new Subject { Title = ".NET - Advanced ", Semester = 3, Tools = new Tooling() { MainIDE = "Visual Studio", AlternativeIDE = "Visual Studio Code", } }, }; Console.ForegroundColor = ConsoleColor.Yellow; var student = new Student() { FirstName = "Dimitar", LastName = "Risteski", DateOfBirth = new DateTime(1988, 5, 15), }; student.Subjects = new List <Subject> { new Subject { Title = "Java Script Basic", Semester = 1, Tools = new Tooling() { MainIDE = "Visual Studio Code", AlternativeIDE = "Sublime", } }, new Subject { Title = "Java Script Advanced", Semester = 1, Tools = new Tooling() { MainIDE = "Visual Studio Code", AlternativeIDE = "Sublime", } }, }; student.Greetings(); foreach (var subject in student.Subjects) { Console.WriteLine(subject.Title); } var student2 = new Student() { FirstName = "Tupac", LastName = "Shakur" }; var cSharpBasic = new Subject(); cSharpBasic.Title = "C# Basic"; cSharpBasic.Semester = 2; var cSharpAdvanced = new Subject(); cSharpAdvanced.Title = "C# Advanced"; cSharpAdvanced.Semester = 2; student2.Subjects = new List <Subject>(); student2.Subjects.Add(cSharpBasic); student2.Subjects.Add(cSharpAdvanced); foreach (var subject in student2.Subjects) { Console.WriteLine(subject.Title); } var participants = new Queue <Participant>(); participants.Enqueue(trainer); participants.Enqueue(assistant); participants.Enqueue(bob); participants.Enqueue(student); participants.Enqueue(student2); ParticipantHelper.FindParticipantByRole(participants, AcademyRole.Trainer); ParticipantHelper.FindParticipantByRole(participants, AcademyRole.Assistant); ParticipantHelper.FindParticipantByRole(participants, AcademyRole.Student); Console.ReadLine(); }