Exemple #1
0
        //Зміна камери
        public void ChangeRoom(Prisoner prisoner, int n)
        {
            var currentRoom = Rooms.Find(r => r.Number == prisoner.RoomNumber);

            currentRoom.Free++;
            var tempRoom = Rooms.Find(r => r.Number == n);

            prisoner.RoomNumber = tempRoom.Number;
            tempRoom.Free--;
        }
Exemple #2
0
 //Додавання нового в'язня
 public void Add(string name, string surname, string patronymic, DateTime birth, string stateNumber, DateTime guardDate, int years, int months, int days)
 {
     if (Prisoners.Count < MaxPrisoners)
     {
         var prisoner = new Prisoner(name, surname, patronymic, Prisoners.Count);
         prisoner.BirthDate = birth;
         prisoner.State     = new State(stateNumber, guardDate, years, months, days);
         var tempRoom = Rooms.First(r => r.Free != 0);
         prisoner.RoomNumber = tempRoom.Number;
         tempRoom.Free--;
         Prisoners.Add(prisoner);
     }
     else
     {
         throw new ArgumentException();
     }
 }