public RoomChoiceEntity(RoomKind kind, int maxAvailable, int count = 0) { _pcs = new PropertyChangeSupport(this); _bedKind = kind.ToBedKind(); _roomKind = kind; _maxAvailable = maxAvailable; _count = count; }
public BedAllocation(BedKind kind, int quantity) { if (quantity <= 0) { throw new ArgumentException("Quantity must be greater than zero"); } Kind = kind; Quantity = quantity; }
private IList <Room> _findRooms(IEnumerable <Room> availableRooms, BedKind bedKind, int count) { List <Room> rooms = new List <Room>(count); foreach (Room room in availableRooms) { if (room.BedKind == bedKind && rooms.Count < count) { rooms.Add(room); } else if (rooms.Count == count) { break; } } return(rooms); }
public static BedKind ToBedKind(this RoomKind kind) { BedKind bedKind = BedKind.Simple; switch (kind) { case RoomKind.Simple: bedKind = BedKind.Simple; break; case RoomKind.Double: bedKind = BedKind.Double; break; case RoomKind.DoubleWithBaby: bedKind = BedKind.DoubleWithBaby; break; default: bedKind = BedKind.Simple; break; } return(bedKind); }
public static Expression<Func<Room, bool>> WithBedKind(BedKind bedKind) { return room => room.BedKind == bedKind; }
public static Expression <Func <Room, bool> > WithBedKind(BedKind bedKind) { return(room => room.BedKind == bedKind); }
public Room WithBeds(BedKind kind, int quantity) { Beds.Add(new BedAllocation(kind, quantity)); return(this); }
private IList<Room> _findRooms(IEnumerable<Room> availableRooms, BedKind bedKind, int count) { List<Room> rooms = new List<Room>(count); foreach(Room room in availableRooms) { if(room.BedKind == bedKind && rooms.Count < count) { rooms.Add(room); } else if(rooms.Count == count) { break; } } return rooms; }