//[OutputCache(Duration = int.MaxValue, VaryByParam = "roomId")] public ActionResult ExpressCheckout(int?roomId) { var id = Person.PersonID; var guest = _guestService.GetAll(HotelID).FirstOrDefault(x => x.PersonId == id); GuestRoom mainGuestRoom = null; if (roomId.HasValue) { mainGuestRoom = guest.GuestRooms.FirstOrDefault(x => x.RoomId == roomId); } if (mainGuestRoom == null) { mainGuestRoom = guest.GuestRooms.FirstOrDefault(x => x.GroupBookingMainRoom) ?? guest.GuestRooms.FirstOrDefault(); } var gravm = new GuestRoomAccountViewModel { Room = mainGuestRoom.Room, Guest = guest, RoomId = mainGuestRoom.Room.Id, PaymentTypeId = 0, Rooms = guest.GuestRooms.Select(x => x.Room).ToList(), GuestRoomAccount = new GuestRoomAccount { Amount = decimal.Zero } }; return(View(gravm)); }
public static int GetNumberOfNights(this GuestRoom guestRoom) { var hotelAccountsTime = 14; int.TryParse(ConfigurationManager.AppSettings["HotelAccountsTime"].ToString(CultureInfo.InvariantCulture), out hotelAccountsTime); var dtCheckoutDate = DateTime.Now; if (!guestRoom.IsActive) { dtCheckoutDate = guestRoom.CheckoutDate; } var extraDay = 0; if (DateTime.Now.Hour > hotelAccountsTime) { extraDay = 1; } //Use Exact Times to Calculate exact lenght of stay var exactCheckingDate = new DateTime(guestRoom.CheckinDate.Year, guestRoom.CheckinDate.Month, guestRoom.CheckinDate.Day, hotelAccountsTime, 0, 0); var exactCheckoutDate = new DateTime(dtCheckoutDate.Year, dtCheckoutDate.Month, dtCheckoutDate.Day, hotelAccountsTime, 0, 0); var totalNumberOfDays = exactCheckoutDate.Subtract(exactCheckingDate).Days + extraDay; totalNumberOfDays = (totalNumberOfDays == 0) ? 1 : totalNumberOfDays; return(totalNumberOfDays); }
public Entity(Node node, int id, GuestRoom room, ENTITY_TYPE etype = ENTITY_TYPE.GUEST) { MyRoom = room; MyNode = node; ID = id; EType = etype; Moving = false; //An entity only moves after it is given a destination. Checked_Out = false; //An entity only checks out when when the event is triggered or during evacuation. //If the Entity type is a "MAID" it is given the image of a maid, otherwise the default image is that of a guest and the room the guest is assigned to is set to reserved. switch (etype) { case ENTITY_TYPE.MAID: MyImage = Image.FromFile(@"..\..\Images\maid.png"); break; default: MyImage = Image.FromFile(@"..\..\Images\TempGuest4.png"); MyRoom.Reserved_room(); break; } //New picturebox created for the entity to be drawn on. panelPb = new PictureBox { Size = MyImage.Size, BackgroundImageLayout = ImageLayout.None, Parent = node.panelPb, BackColor = Color.Transparent }; node.panelPb.Controls.Add(panelPb); panelPb.BackgroundImage = MyImage; panelPb.BringToFront(); Redraw(); }
public void RemoveGuestFromLobbyQueue() { Lobby lobby = new Lobby(1, new Point(0, 0), new Point(1, 1)); GuestRoom room = new GuestRoom(2, new Point(1, 0), new Point(1, 1), 1); lobby.Neighbors.Add(Direction.East, room); room.Neighbors.Add(Direction.West, lobby); Receptionist receptionist = new Receptionist(lobby, new List <Room>() { lobby, room }); Guest guest = new Guest(lobby); guest.Classification = 1; lobby.CheckIn(guest); lobby.RemoveFromQueues(guest); for (int i = 0; i < 10; i++) { receptionist.Update(1); } Assert.IsTrue(guest.Room == null); }
public void GuestRoomDirty() { GuestRoom room = new GuestRoom(1, new Point(0, 0), new Point(1, 1), 2); room.State = RoomState.Dirty; Assert.IsTrue(room.State == RoomState.Dirty); }
public void UpdateSpriteTestGuestRoom() { GuestRoom room = new GuestRoom(1, new Point(1, 1), new Point(1, 1), 1); room.Update(1); Assert.IsNull(room.Sprite.Texture); }
public void AddGuestToCheckOut() { Lobby lobby = new Lobby(1, new Point(0, 0), new Point(1, 1)); GuestRoom room = new GuestRoom(2, new Point(1, 0), new Point(1, 1), 1); lobby.Neighbors.Add(Direction.East, room); room.Neighbors.Add(Direction.West, lobby); Receptionist receptionist = new Receptionist(lobby, new List <Room>() { lobby, room }); Guest guest = new Guest(lobby); guest.Classification = 1; lobby.CheckIn(guest); for (int i = 0; i < 10; i++) { receptionist.Update(1); } guest.FindAndTargetRoom(x => x is Lobby && (x as Lobby).Receptionist != null); guest.StayState = StayState.CheckOut; for (int i = 0; i < 10; i++) { guest.Update(1); receptionist.Update(1); } Assert.IsTrue(guest.Room == null); }
public void ShowInfo() { GuestRoom aGuestRoom = new GuestRoom(0, new Point(1, 1), new Point(1, 1), 1); InformationWindow window = new InformationWindow(); window.ShowInformation(aGuestRoom); Assert.IsTrue(window.IsShowingInfo); }
public void GuestConstructor() { GuestRoom room = new GuestRoom(1, new Microsoft.Xna.Framework.Point(0, 0), new Microsoft.Xna.Framework.Point(1, 1), 1); Guest guest = new Guest(room); Assert.IsNotNull(guest); }
public void CleanerConstructor() { GuestRoom room = new GuestRoom(1, new Microsoft.Xna.Framework.Point(0, 0), new Microsoft.Xna.Framework.Point(1, 1), 1); Cleaner cleaner = new Cleaner(room); Assert.IsNotNull(cleaner); }
public void RoomNeighbourNotNeighbor() { Room guestroom00 = new GuestRoom(1, new Point(0, 0), new Point(1, 1), 1); Room guestroom01 = new GuestRoom(2, new Point(0, 1), new Point(1, 1), 1); Direction dir = guestroom00.IsNeighbor(guestroom01); Assert.IsTrue(dir == Direction.None); }
public void ReceptionistConstructor() { GuestRoom room = new GuestRoom(1, new Point(0, 0), new Point(1, 1), 1); Receptionist receptionist = new Receptionist(room, new List <Room>() { room }); Assert.IsNotNull(receptionist); }
private void 客房BindingSource_DataSourceChanged(object sender, EventArgs e) { GuestRoom kf = 客房BindingSource.DataSource as GuestRoom; //临时Detach现有的所有GuestRoomRentalDetail本地对象 foreach (var o in parentContext.GuestRoomRentalDetail.Local.ToList()) { parentContext.Entry(o).State = System.Data.EntityState.Detached; } kf.GuestRoomRentalDetail.OrderByDescending(m => m.起付日期).AsQueryable().Load(); 客房租金明细BindingSource.DataSource = parentContext.GuestRoomRentalDetail.Local.ToBindingList(); }
public void CafeArrivalBehaviourTest() { Cafe cafe = new Cafe(1, new Microsoft.Xna.Framework.Point(0, 0), new Microsoft.Xna.Framework.Point(1, 1), 4); GuestRoom room = new GuestRoom(2, new Microsoft.Xna.Framework.Point(1, 1), new Microsoft.Xna.Framework.Point(1, 1), 4); Guest guest = new Guest(cafe); guest.Room = room; cafe.RoomBehaviour.OnArrival(cafe, guest); Assert.IsTrue(cafe.PeopleCount == 1); }
public static decimal RoomCharge(this GuestRoom guestRoom, bool guestJustCheckedOut = false) { var hotelAccountsTime = 14; int.TryParse(ConfigurationManager.AppSettings["HotelAccountsTime"].ToString(CultureInfo.InvariantCulture), out hotelAccountsTime); var dtCheckoutDate = DateTime.Now; var guestIsStillActive = true; var extraDay = 0; if (DateTime.Now.Hour > hotelAccountsTime) { extraDay = 1; } if (!guestRoom.IsActive && !guestJustCheckedOut) { dtCheckoutDate = guestRoom.CheckoutDate; guestIsStillActive = false; if (!guestRoom.GroupBooking) { extraDay = 0; } } //Use Exact Times to Calculate exact lenght of stay var exactCheckingDate = new DateTime(guestRoom.CheckinDate.Year, guestRoom.CheckinDate.Month, guestRoom.CheckinDate.Day, hotelAccountsTime, 0, 0); var exactCheckoutDate = new DateTime(dtCheckoutDate.Year, dtCheckoutDate.Month, dtCheckoutDate.Day, hotelAccountsTime, 0, 0); if (guestRoom.CheckinDate.Hour >= 0 && guestRoom.CheckinDate.Hour < hotelAccountsTime) { var hotelDayToday = DateTime.Today; if (hotelDayToday.Day == guestRoom.CheckinDate.Day && hotelDayToday.Month == guestRoom.CheckinDate.Month && hotelDayToday.Year == guestRoom.CheckinDate.Year) { extraDay++; } } var totalNumberOfDays = exactCheckoutDate.Subtract(exactCheckingDate).Days + extraDay; if (guestIsStillActive) { totalNumberOfDays = (totalNumberOfDays == 0) ? 1 : totalNumberOfDays; } return(totalNumberOfDays * guestRoom.RoomRate); }
public void CinemaBehaviourTest() { Cinema cinema = new Cinema(1, new Microsoft.Xna.Framework.Point(0, 0), new Microsoft.Xna.Framework.Point(1, 1)); GuestRoom room = new GuestRoom(2, new Microsoft.Xna.Framework.Point(1, 1), new Microsoft.Xna.Framework.Point(1, 1), 4); Guest guest = new Guest(cinema); guest.Room = room; cinema.Update(10); cinema.Update(10); cinema.RoomBehaviour.OnArrival(cinema, guest); Assert.IsTrue(cinema.PeopleCount == 1); }
public void CleanerGhostConstructor() { GuestRoom room = new GuestRoom(1, new Point(1, 0), new Point(1, 1), 1); EmptyRoom outside = new EmptyRoom(0, new Point(0, 0), new Point(1, 1)); outside.Entrance = true; room.Neighbors.Add(Direction.West, room); outside.Neighbors.Add(Direction.East, room); CleanerGhost ghost = new CleanerGhost(room); Assert.IsNotNull(ghost); }
public void OnArrival(Room room, Person person) { GuestRoom guestRoom = room as GuestRoom; if (person is Guest) { Guest guest = person as Guest; if (guest.Room == room) { room.PeopleCount++; person.Inside = true; } } }
//[OutputCache(Duration = 3600, VaryByParam = "roomId")] public ActionResult ViewAccount(int?roomId) { var id = Person.PersonID; var g = _guestService.GetAll(HotelID).FirstOrDefault(x => x.PersonId == id); if (g == null) { return(View("IncorrectGuestDetails", new HotelMenuModel())); } var guestId = g.Id; var guest = _guestService.GetById(guestId); GuestRoom mainGuestRoom = null; if (roomId.HasValue) { mainGuestRoom = guest.GuestRooms.FirstOrDefault(x => x.RoomId == roomId); } if (mainGuestRoom == null) { mainGuestRoom = guest.GuestRooms.FirstOrDefault(x => x.GroupBookingMainRoom) ?? guest.GuestRooms.FirstOrDefault(); } var allItemisedItems = guest.SoldItemsAlls.Where(x => x.PaymentMethodId == (int)PaymentMethodEnum.POSTBILL).OrderByDescending(x => x.DateSold).ToList(); var gravm = new GuestRoomAccountViewModel { Room = mainGuestRoom.Room, Guest = guest, RoomId = mainGuestRoom.Room.Id, PaymentTypeId = 0, Rooms = guest.GuestRooms.Select(x => x.Room).ToList(), GuestRoomAccount = new GuestRoomAccount { Amount = decimal.Zero }, ItemmisedItems = allItemisedItems }; return(View(gravm)); }
public void CafeFindNextCafe() { Cafe cafe = new Cafe(1, new Microsoft.Xna.Framework.Point(0, 0), new Microsoft.Xna.Framework.Point(1, 1), 0); Cafe cafe2 = new Cafe(1, new Microsoft.Xna.Framework.Point(0, 0), new Microsoft.Xna.Framework.Point(1, 1), 1); GuestRoom room = new GuestRoom(2, new Microsoft.Xna.Framework.Point(1, 1), new Microsoft.Xna.Framework.Point(1, 1), 4); room.Neighbors.Add(Direction.East, cafe); cafe.Neighbors.Add(Direction.West, room); room.Neighbors.Add(Direction.West, cafe2); cafe2.Neighbors.Add(Direction.East, room); Guest guest = new Guest(cafe); guest.Room = room; cafe.RoomBehaviour.OnArrival(cafe, guest); Assert.ReferenceEquals(guest.TargetRoom, cafe2); }
public void ElevatorshaftPass() { ElevatorShaft elevatorShaft = new ElevatorShaft(1, new Microsoft.Xna.Framework.Point(0, 0)); ElevatorShaft elevatorShaft2 = new ElevatorShaft(1, new Microsoft.Xna.Framework.Point(0, 1)); elevatorShaft.Neighbors.Add(Direction.North, elevatorShaft); elevatorShaft2.Neighbors.Add(Direction.South, elevatorShaft2); GuestRoom room = new GuestRoom(2, new Microsoft.Xna.Framework.Point(1, 1), new Microsoft.Xna.Framework.Point(1, 1), 4); Guest guest = new Guest(elevatorShaft); guest.Room = room; guest.Path.Clear(); guest.Path.Add(elevatorShaft); guest.Path.Add(elevatorShaft2); elevatorShaft.RoomBehaviour.OnPassRoom(elevatorShaft, guest); Assert.IsTrue(guest.CalledElevator); }
public void CleanerGhostArrivalOutside() { Hotel.Hotel hotel = new Hotel.Hotel(); GuestRoom room = new GuestRoom(1, new Point(1, 0), new Point(1, 1), 1); EmptyRoom outside = new EmptyRoom(0, new Point(0, 0), new Point(1, 1)); outside.Entrance = true; hotel.Rooms.Add(room); hotel.Rooms.Add(outside); room.Neighbors.Add(Direction.West, room); outside.Neighbors.Add(Direction.East, room); CleanerGhost ghost = new CleanerGhost(outside); ghost.RemoveObjectEvent += hotel.RemoveObject; hotel.Staff.Add(ghost); hotel.Update(1); ghost.OnArrival(); hotel.Update(1); Assert.IsTrue(hotel.Staff[0] is Cleaner); }
public static int GetNumberOfNightsFuture(this GuestRoom guestRoom) { var dtCheckoutDate = DateTime.Now; if (!guestRoom.IsActive) { dtCheckoutDate = guestRoom.CheckoutDate; } else { dtCheckoutDate = guestRoom.CheckoutDate; } var extraDay = 0; var exactCheckingDate = new DateTime(guestRoom.CheckinDate.Year, guestRoom.CheckinDate.Month, guestRoom.CheckinDate.Day, 12, 0, 0); var exactCheckoutDate = new DateTime(dtCheckoutDate.Year, dtCheckoutDate.Month, dtCheckoutDate.Day, 12, 0, 0); var totalNumberOfDays = exactCheckoutDate.Subtract(exactCheckingDate).Days + extraDay; totalNumberOfDays = (totalNumberOfDays == 0) ? 1 : totalNumberOfDays; return(totalNumberOfDays); }
public void Delete(GuestRoom guestRoom) { _unitOfWork.GuestRoomRepository.Delete(guestRoom); _unitOfWork.Save(); }
public void GuestRoomConstructor() { GuestRoom room = new GuestRoom(1, new Point(0, 0), new Point(1, 1), 2); Assert.IsNotNull(room); }
private void InsertGuestRoom(string hotelId, string hotelCode, IList <OTA_HotelDescriptiveInfoRS.HotelDescriptiveContentsLocalType.HotelDescriptiveContentLocalType.FacilityInfoLocalType.GuestRoomsLocalType> GuestRooms) { if (GuestRooms != null && GuestRooms.Count > 0) { using (var context = new TravelDBContext()) { // TransactionOptions transactionOption = new TransactionOptions(); // transactionOption.Timeout = new TimeSpan(0, 0, 600); // using (TransactionScope tran = new TransactionScope(TransactionScopeOption.Required, transactionOption)) { EfRepository <GuestRoom> guestRoomContext = new EfRepository <GuestRoom>(context); EfRepository <RoomExtension> roomExtensionsContext = new EfRepository <RoomExtension>(context); EfRepository <RMARoomMapping> rmaRoomMappingContext = new EfRepository <RMARoomMapping>(context); EfRepository <RMA> rmaContext = new EfRepository <RMA>(context); int Inserted = 0; var guestRoomCheck = (from r in guestRoomContext.Table where r.HotelID == hotelId select r).ToList(); if (guestRoomCheck.Count > 0) { foreach (var item in guestRoomCheck) { var roomExtensions = (from e in roomExtensionsContext.Table where e.RoomID == item.Id select e).ToList(); if (roomExtensions.Count > 0) { roomExtensionsContext.Delete(roomExtensions); LoggerHelper(hotelCode, "roomExtension " + item.Name + " deleted"); } var rmaRoomMapping = (from r in rmaRoomMappingContext.Table where r.RoomID == item.Id select r).ToList(); if (rmaRoomMapping.Count > 0) { rmaRoomMappingContext.Delete(rmaRoomMapping); LoggerHelper(hotelCode, "roomMapping " + item.Name + " deleted"); } guestRoomContext.Delete(item); LoggerHelper(hotelCode, "GuestRoom " + item.Name + " deleted"); } } foreach (var item in GuestRooms[0].GuestRoom) { string roomName = item.RoomTypeName; var typeName = item.TypeRoom; if (Check(typeName)) { var typeNameNode = typeName[0]; int StandardOccupancy = Convert.ToInt32(typeNameNode.StandardOccupancy); string Size = typeNameNode.Size; string Name = typeNameNode.Name; string RoomTypeCode = typeNameNode.RoomTypeCode; string Floor = typeNameNode.Floor; string InvBlockCode = typeNameNode.InvBlockCode; string BedTypeCode = typeNameNode.BedTypeCode; string NonSmoking = typeNameNode.NonSmoking; string HasWindow = typeNameNode.HasWindow; string Quantity = typeNameNode.Quantity; string RoomSize = typeNameNode.RoomSize; GuestRoom gr = new GuestRoom(); gr.StandardOccupancy = StandardOccupancy; gr.Size = Size; gr.Name = Name; gr.RoomTypeCode = Convert.ToInt32(RoomTypeCode); gr.Floor = Floor; gr.InvBlockCode = Convert.ToInt32(InvBlockCode); gr.BedTypeCode = Convert.ToInt32(BedTypeCode); gr.NonSmoking = NonSmoking == "false" ? 0 : 1; gr.HasWindow = Convert.ToInt32(HasWindow); gr.Quantity = Convert.ToInt32(Quantity); gr.RoomSize = RoomSize; gr.LastMofifyTime = DateTime.Now; gr.HotelID = hotelId; var feature = item.Features; if (Check(feature)) { gr.FeatureDescription = feature[0].Feature[0].DescriptiveText; } guestRoomContext.Insert(gr); Inserted = gr.Id; LoggerHelper(hotelCode, "GuestRoom " + Name + " Inserted"); } var Amenities = item.Amenities; if (Check(Amenities)) { foreach (var amentity in Amenities[0].Amenity) { int RoomAmenityCode = Convert.ToInt32(amentity.RoomAmenityCode); string DescriptiveText = amentity.DescriptiveText; var rmaCheck = (from r in rmaContext.Table where r.Id == RoomAmenityCode select r).ToList(); if (rmaCheck.Count == 0) { RMA r = new RMA(); r.Id = RoomAmenityCode; r.Name = DescriptiveText; r.LastModiyTime = DateTime.Now; rmaContext.Insert(r); } RMARoomMapping rmaRoomMapping = new RMARoomMapping(); rmaRoomMapping.RMAID = RoomAmenityCode; rmaRoomMapping.RoomID = Inserted; rmaRoomMapping.LastMofifyTime = DateTime.Now; rmaRoomMappingContext.Insert(rmaRoomMapping); LoggerHelper(hotelCode, "Guest Amentity " + RoomAmenityCode + "," + DescriptiveText + " Inserted"); } } var TPA_Extensions = item.TPA_Extensions; if (Check(TPA_Extensions)) { foreach (var extension in TPA_Extensions[0].TPA_Extension) { string FacilityName = extension.FacilityName; string FTypeName = extension.FTypeName; string FacilityValue = extension.FacilityValue; string isAvailable = extension.FacilityValue; RoomExtension re = new RoomExtension(); re.FacilityName = FacilityName; re.FaciliTypeName = FTypeName; re.LastMofifyTime = DateTime.Now; re.IsAllAvailable = Convert.ToInt32(isAvailable); re.RoomID = Inserted; roomExtensionsContext.Insert(re); LoggerHelper(hotelCode, "Room Extensions Inserted " + FacilityName + " Inserted"); } } } //tran.Complete(); } } } }
public GuestRoom Update(GuestRoom guestRoom) { _unitOfWork.GuestRoomRepository.Update(guestRoom); _unitOfWork.Save(); return(guestRoom); }
public GuestRoom Create(GuestRoom guestRoom) { _unitOfWork.GuestRoomRepository.Insert(guestRoom); _unitOfWork.Save(); return(guestRoom); }