Пример #1
0
 static void Main(string[] args)
 {
     var personFactory = new PersonFactory();
     var person1       = personFactory.CreatePerson("Ivan"); Console.WriteLine(person1);
     var person2       = personFactory.CreatePerson("John"); Console.WriteLine(person2);
 }
Пример #2
0
        private static void Main(string[] args)
        {
            EmployeeFactory = ServiceLocator.Get<EmployeeFactory>();
            ProjectFactory = ServiceLocator.Get<ProjectFactory>();
            InternFactory = ServiceLocator.Get<InternFactory>();
            CompanyFactory = ServiceLocator.Get<CompanyFactory>();
            ContractorFactory = ServiceLocator.Get<ContractorFactory>();
            PersonFactory = ServiceLocator.Get<PersonFactory>();
            PersonRepository = ServiceLocator.Get<IPersonRepository>();
            PersonSkillsRepository = ServiceLocator.Get<IPersonSkillsRepository>();
            CompanyRepository = ServiceLocator.Get<ICompanyRepository>();
            TaskFactory = ServiceLocator.Get<TaskFactory>();

            try
            {
                Logger.Logger.AddToLog("----Begining of the program-----");

                PopulatingDb();

                //PersonRepository.UpdatePerson(15016, "White", "Dude", "1999-1-31");
                //PersonRepository.UpdatePerson(19022, lname: "White", fname: "Dude");
                //PersonRepository.UpdatePerson(15015, bdate: "2005-12-12");
                //PersonRepository.DeletePerson(15019);

                //ShowAllPersons();
                //ShowPersonSkillsByFirstname("Person 1");
                //ShowPersonByTaskname("Task 1");
                //ShowPersonLastnameById(3003);
                // ShowEmployeeDetails1();
                //ShowPersonRowsHavingMoreThanOneSkill();
                //ShowAllPersonsWithSkills();
                //ShowAllPersonsFirstAndLastNames_ProjectionList();
                //ShowPersonByLNameOrByFName;

                Console.ReadLine();

            ////Proxy
            //                var appointment = new DirectorProxy(intern, director);
            //                appointment.NewAppontment(DateTime.Today);
            //                var appointment2 = new DirectorProxy(contractor, director);
            //                appointment2.NewAppontment(DateTime.Today);
            //                Console.ReadLine();

            ////observer
            //                var hr = new HumanResources();
            //                ProjectFactory.Subscribe(director);
            //                ProjectFactory.Subscribe(hr);
            //                ProjectFactory.CreateProject(1, "Rufus", "Making first project");
            //                Console.ReadLine();

            //                //TDD
            //                var internlist = new List<Intern>();
            //                internlist.Add(intern);
            //                internlist.Add(intern2);
            //                var hiredList = hr.Hire(internlist);
            }
            catch (InternValidationException exc1)
            {
                Console.WriteLine("{1} = {0}", exc1.Message, exc1.PersonName);
                Console.ReadLine();
                //throw;
            }
            catch (ArgumentOutOfRangeException exc2)
            {
                Console.WriteLine(" = {0}", exc2.Message);
                Console.ReadLine();
                //throw;
            }
            catch (NullReferenceException exc3)
            {
                Console.WriteLine(" = {0}", exc3.Message);
                Console.ReadLine();
                //throw;
            }
            finally
            {
                Logger.Logger.AddToLog("-------The End-------");
                Debug.WriteLine("Debug: Good luck!");
            }
        }