예제 #1
0
        /// <summary>
        /// Приветствие в зависимости от текущего времени.
        /// </summary>
        public void Greeting(Office anotherPerson)
        {
            string greet;
            if (DateTime.Now.Hour < 12)
                greet = "Доброе утро";
            else if (DateTime.Now.Hour < 17)
                greet = "Добрый день";
            else greet = "Добрый вечер";

            Console.WriteLine("''{0}, {1}!'', - сказал {2}.", greet, anotherPerson, this);
        }
예제 #2
0
        /// <summary>
        /// Сотрудник уходит домой
        /// </summary>
        public static void GoHome(Office name)
        {
            Console.WriteLine("[{0} ушёл домой.]", name);

            OnCameToWork -= name.Greeting;
            OnGoHome -= name.Farewell;

            if (OnGoHome != null)
                OnGoHome(name);

            Console.WriteLine();
        }
예제 #3
0
        /// <summary>
        /// Сотрудник приходит на работу
        /// </summary>
        public static void CameToWork(Office name)
        {
            Console.WriteLine("[На работу пришёл {0}]", name);

            if (OnCameToWork != null)
                OnCameToWork(name);

            OnCameToWork += name.Greeting;
            OnGoHome += name.Farewell;

            Console.WriteLine();
        }
예제 #4
0
		static void Main(string[] args)
        {
			Office jhon = new Office("Джон");
			Office hugo = new Office("Хьюго");
			Office bill = new Office("Билл");

			Office.CameToWork(jhon);
			Office.CameToWork(hugo);
			Office.CameToWork(bill);
			Office.GoHome(jhon);
			Office.GoHome(hugo);
			Office.GoHome(bill);

			Console.Write("Нажмите любую клавишу для закрытия программы.");
            Console.ReadKey();
        }
예제 #5
0
        static void Main(string[] args)
        {
            Office jhon = new Office("Джон");
            Office hugo = new Office("Хьюго");
            Office bill = new Office("Билл");

            Office.CameToWork(jhon);
            Office.CameToWork(hugo);
            Office.CameToWork(bill);
            Office.GoHome(jhon);
            Office.GoHome(hugo);
            Office.GoHome(bill);

            
            Console.ReadKey();
        }
예제 #6
0
        static void Main(string[] args)
        {
            var office = new Office();
            Person.CameEvent += office.OnCame;
            Person.LeftEvent += office.OnLeft;

            var john = new Person("Джон");
            john.Came(10.05);

            var bill = new Person("Билл");
            bill.Came(12.50);

            var hugo = new Person("Хьюго");
            hugo.Came(17.10);

            john.Left();
            bill.Left();
            hugo.Left();

            Console.ReadKey();
        }
예제 #7
0
        public void CameInOffice(DateTime time)
        {
            Office office = new Office();

            office.CameInOffice(this, time);
        }
예제 #8
0
        public void LeftFromOffice()
        {
            Office office = new Office();

            office.LeftFromOffice(this);
        }
예제 #9
0
 /// <summary>
 ///  Прощание
 /// </summary>
 public void Farewell(Office anotherPerson)
 {
     Console.WriteLine("''До свидания, {0}!'', - сказал {1}.", anotherPerson, this);
 }
예제 #10
0
 /// <summary>
 ///  Прощание
 /// </summary>
 public void Farewell(Office anotherPerson)
 {
     Console.WriteLine("'До свидания, {0}!', - сказал {1}.", anotherPerson, this);
 }