示例#1
0
 public RoomChoiceEntity(RoomKind kind, int maxAvailable, int count = 0)
 {
     _pcs = new PropertyChangeSupport(this);
     _bedKind = kind.ToBedKind();
     _roomKind = kind;
     _maxAvailable = maxAvailable;
     _count = count;
 }
示例#2
0
 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;
        }
示例#4
0
        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);
        }
示例#5
0
        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);
        }
示例#6
0
文件: Room.cs 项目: yves982/Resotel
 public static Expression<Func<Room, bool>> WithBedKind(BedKind bedKind)
 {
     return room => room.BedKind == bedKind;
 }
示例#7
0
文件: Room.cs 项目: yves982/Resotel
 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);
 }
示例#9
0
        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;
        }