Beispiel #1
0
 public bool Allow(Card card)
 {
     if (DataBase.Check(card.ID.ToString()))
     {
         return true;
     }
     else
     {
         return false;
     }
 }
Beispiel #2
0
        static void Main(string[] args)
        {
            Building dvoyka = new Building("Кремлёвская 35", new Tourniquet());
            Student petya = new Student("Петя");
            Card card = new Card(1, petya.Name);

            if (petya.EnterBuilding(dvoyka, card))
            {
                Console.WriteLine("{0} успешно ушёл вошёл в здание по адресу: {1}", petya.Name, dvoyka.Address);
            }
            else
            {
                Console.WriteLine("{0} не смог войти в здание по адресу: {1}", petya.Name, dvoyka.Address);
            }
        }
Beispiel #3
0
 public bool EnterBuilding(Building building, Card card)
 {
     return UseCard(card, building.Tourniquet);
 }
Beispiel #4
0
 public bool UseCard(Card card, Tourniquet tourniquet)
 {
     return tourniquet.Allow(card);
 }
        static void Main(string[] args)
        {
            Building uv = new Building("Universiade Village", new Tourniquet());
            Student student1 = new Student("Alsy");
            Card card1 = new Card(1, student1.Name);
            Student student2 = new Student("Andrey");
            Card card2 = new Card(2, student2.Name);

            student1.Print(uv, card1);
            student2.Print(uv, card2);

            Console.ReadLine();
        }
 public bool Allow(Card card)
 {
     if (DataBase.Check(card.ID))
         return true;
     else
         return false;
 }
 public void Print(Building building, Card card)
 {
     if (Enter(building, card))
     {
         Console.WriteLine(Name + " yспешно вошёл в здание по адресу: " + building.Address);
     }
     else
     {
         Console.WriteLine(Name + " не смогла войти в здание по адресу: " + building.Address);
     }
 }
Beispiel #8
0
 public void VerifyCard(Card card)
 {
     if (card.ID % 2 != 0) {
         _state = true;
         _onGoodCard();
     } else {
         _state = false;
         _onBadCard();
     }
 }
Beispiel #9
0
 public Student(string name)
 {
     _name = name;
     _card = new Card();
 }