Ejemplo n.º 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);
        }
Ejemplo n.º 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();
        }
Ejemplo n.º 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();
        }
Ejemplo n.º 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();
        }
Ejemplo n.º 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();
        }
Ejemplo n.º 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();
        }
Ejemplo n.º 7
0
        public void CameInOffice(DateTime time)
        {
            Office office = new Office();

            office.CameInOffice(this, time);
        }
Ejemplo n.º 8
0
        public void LeftFromOffice()
        {
            Office office = new Office();

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