public bool Allow(Card card) { if (DataBase.Check(card.ID.ToString())) { return true; } else { return false; } }
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); } }
public bool EnterBuilding(Building building, Card card) { return UseCard(card, building.Tourniquet); }
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); } }
public void VerifyCard(Card card) { if (card.ID % 2 != 0) { _state = true; _onGoodCard(); } else { _state = false; _onBadCard(); } }
public Student(string name) { _name = name; _card = new Card(); }