示例#1
0
        public EscapeRoom Add(EscapeRoom room)
        {
            _context.EscapeRooms.Add(room);
            _context.SaveChanges();

            return(room);
        }
        public void TestUpdate()
        {
            //Arrange
            EscapeRoomCtr esrCtr = new EscapeRoomCtr();
            EmployeeCtr   empCtr = new EmployeeCtr();
            EscapeRoom    Er     = new EscapeRoom()
            {
                Description  = "You know I Know I Still got it",
                MaxClearTime = 90,
                CleanTime    = 30,
                Name         = "The best",
                Price        = 300,
                Rating       = 5,
                Emp          = empCtr.Get(2)
            };

            //Act
            esrCtr.CreateEscapeRoom(Er.Name, Er.Description, Er.MaxClearTime, Er.CleanTime, Er.Price, Er.Rating, Er.Emp.EmployeeID, Er.Image);
            EscapeRoom TestEr = esrCtr.GetForOwner(esrCtr.GetAllForOwner().Count);

            esrCtr.UpdateEscapeRoom("The best", "I am the best", 200, 20, 500, 5, Er.Emp.EmployeeID, TestEr.EscapeRoomID, TestEr.Image);
            TestEr = esrCtr.GetForOwner(esrCtr.GetAllForOwner().Count);

            //Assert
            Assert.AreEqual(Er.Name, TestEr.Name);
            Assert.AreNotEqual(Er.Description, TestEr.Description);
        }
        public void TestMethod1( )
        {
            //Arrange
            BookingCtr    bc       = new BookingCtr();
            CustomerCtr   cc       = new CustomerCtr();
            EscapeRoomCtr esrCtr   = new EscapeRoomCtr();
            EmployeeCtr   empCtr   = new EmployeeCtr();
            EscapeRoom    Er       = esrCtr.GetForOwner(2);
            Customer      cus      = cc.Get("Anorak");
            Employee      em       = empCtr.Get(1);
            TimeSpan      bookTime = new TimeSpan(16, 00, 00);
            Booking       book     = new Booking()
            {
                AmountOfPeople = 10,
                BookingTime    = bookTime,
                Cus            = cus,
                Date           = DateTime.Now.AddDays(7.0).Date,
                Emp            = em,
                Er             = Er
            };

            //Act
            bc.Create(book.Emp, book.Cus, book.Er, book.BookingTime, book.AmountOfPeople, book.Date);
            Booking TestBook = bc.Get(cus, Er, book.Date);

            bc.Update(book.Cus, book.Er, book.Date, book.Emp, 100, book.BookingTime, TestBook.Id);
            TestBook = bc.Get(cus, Er, book.Date);

            //Assert
            Assert.AreEqual(book.Er.Name, TestBook.Er.Name);
            Assert.AreNotEqual(book.AmountOfPeople, TestBook.AmountOfPeople);

            bc.Delete(cus, Er, book.Date, em, TestBook.AmountOfPeople, TestBook.BookingTime);
        }
示例#4
0
        public override void OnRoomStateChanged(EscapeRoom <IEtsInterface> sender, RoomStateChangedEventArgs e)
        {
            if (e.NewState == RoomState.Uninitialized)
            {
                Debug.Assert(writer == null);
                //if (writer != null)
                //    endRecord();
                StartRecord();
            }

            Record(new RoomStateTransition(e.OldState, e.NewState));

            if (e.NewState == RoomState.Initialized && e.DiagnosticsReport.FailuresDetected)
            {
                Record(new TechnicalFailuresNotification(e.DiagnosticsReport));
            }

            if (e.NewState == RoomState.Completed || e.NewState == RoomState.Aborted)
            {
                EndRecord();
            }

            if (e.NewState == RoomState.Error)
            {
                Record(new TechnicalFailuresNotification(e.DiagnosticsReport));
                EndRecord();
            }
        }
示例#5
0
        public IEnumerable <EscapeRoom> GetAllForOwner()
        {
            IEscapeRoom_Services Service = new MAPMAServiceLayers.EscRef.EscapeRoom_ServicesClient();
            List <EscapeRoom>    ERList  = new List <EscapeRoom>();
            EscapeRoom           tempER;

            foreach (var ER in Service.GetAllForOwner())
            {
                tempER = new EscapeRoom
                {
                    cleanTime    = ER.cleanTime,
                    description  = ER.description,
                    emp          = ER.emp,
                    escapeRoomID = ER.escapeRoomID,
                    checkList    = ER.checkList,
                    maxClearTime = ER.maxClearTime,
                    name         = ER.name,
                    price        = ER.price,
                    rating       = ER.rating
                };

                ERList.Add(tempER);
            }
            return(ERList);
        }
示例#6
0
        public ActionResult GetEscapeRoom(int id)
        {
            EscapeRoomService ecss = new EscapeRoomService();
            EscapeRoom        escr = ecss.GetEscapeRoom(id);

            return(View(escr));
        }
示例#7
0
        private void secondBooking()
        {
            //Arrange
            CustomerController   cusctr2  = new CustomerController();
            EmployeeController   empctr2  = new EmployeeController();
            EscapeRoomController escctr2  = new EscapeRoomController();
            BookingController    bookctr2 = new BookingController();
            Customer             cus2     = cusctr2.Get("Anorak");
            Employee             emp2     = empctr2.Get(1);
            EscapeRoom           er2      = escctr2.GetForOwner(3);
            Booking checkBook2;
            Booking book2 = new Booking {
                amountOfPeople = 2,
                bookingTime    = new TimeSpan(16, 00, 0000),
                cus            = cus2,
                date           = DateTime.Now.AddDays(14).Date,
                emp            = emp2,
                er             = er2,
            };

            //Act
            bookctr2.Create(book2.emp.employeeID, book2.cus.username, book2.er.escapeRoomID, book2.bookingTime, book2.amountOfPeople, book2.date);
            checkBook2 = bookctr2.Get(er2.escapeRoomID, cus2.username, book2.date);

            //Assert
            Assert.AreEqual(book2.amountOfPeople, checkBook2.amountOfPeople);
            autoEvent.Set();
            autoEvent.WaitOne();
            bookctr2.Delete(book2.emp.employeeID, book2.cus.username, book2.er.escapeRoomID, book2.bookingTime, book2.amountOfPeople, book2.date);
        }
示例#8
0
        private void firstBooking()
        {
            //Arrange
            CustomerController   cusctr  = new CustomerController();
            EmployeeController   empctr  = new EmployeeController();
            EscapeRoomController escctr  = new EscapeRoomController();
            BookingController    bookctr = new BookingController();
            Customer             cus     = cusctr.Get("SirLol");
            Employee             emp     = empctr.Get(1);
            EscapeRoom           er      = escctr.GetForOwner(3);
            Booking checkBook;
            Booking book = new Booking
            {
                amountOfPeople = 5,
                bookingTime    = new TimeSpan(16, 00, 0000),
                cus            = cus,
                date           = DateTime.Now.AddDays(14).Date,
                emp            = emp,
                er             = er,
            };

            //Act
            autoEvent.WaitOne();
            bookctr.Create(book.emp.employeeID, book.cus.username, book.er.escapeRoomID, book.bookingTime, book.amountOfPeople, book.date);
            checkBook = bookctr.Get(er.escapeRoomID, cus.username, book.date);

            //Assert
            Assert.AreNotEqual(book.amountOfPeople, checkBook.amountOfPeople);
            autoEvent.Set();
        }
示例#9
0
        public EscapeRoom Update(EscapeRoom room)
        {
            var old = _escapeRooms.SingleOrDefault(x => x.Id == room.Id);

            _escapeRooms.Remove(old);
            _escapeRooms.Add(room);

            return(room);
        }
示例#10
0
 public IActionResult OnPost()
 {
     if (ModelState.IsValid)
     {
         Room = _escapeRoomData.Update(Room);
         return(RedirectToPage("/Rooms/Details", new { id = Room.Id }));
     }
     return(Page());
 }
示例#11
0
 /// <summary>
 /// Opens Update_Room and runs FillTextBoxEscapeRoom(ER), FillLabelsEmployee(ER.Emp) and cobEmployeeLoad()
 /// </summary>
 /// <param name="esr"></param>
 public Update_Room(EscapeRoom esr)
 {
     InitializeComponent();
     EmpCtr = new EmployeeCtr();
     ERctr  = new EscapeRoomCtr();
     ER     = esr;
     FillTextBoxEscapeRoom(ER);
     FillLabelsEmployee(ER.Emp);
     cobEmployeeLoad();
 }
示例#12
0
 public void OnRoomStateChanged(EscapeRoom <IEtsInterface> sender, RoomStateChangedEventArgs e)
 {
     if (e.NewState == RoomState.Completed || e.NewState == RoomState.Initialized)
     {
         foreach (Camera cam in craneCameras)
         {
             ;
         }
     }
     // cam.enabled = false;
 }
示例#13
0
 public void OnRoomStateChanged(EscapeRoom <IEtsInterface> sender, RoomStateChangedEventArgs e)
 {
     lblRoomState.text        = e.NewState.ToString();
     lblRoomState.color       = ColorCode(room.State);
     btnStart.interactable    = room.State.CanTransition(RoomState.Running);
     btnComplete.interactable = room.State.CanTransition(RoomState.Completed);
     btnAbort.interactable    = room.State.CanTransition(RoomState.Aborted);
     btnReset.interactable    = room.State.CanTransition(RoomState.Initialized);
     chkMaintenance.isOn      = maintenanceMode.enabled;
     chkLighting.isOn         = room.Physical.OverrideLighting;
 }
        public void Add(NewEscapeRoomDto escapeRoom)
        {
            var newEscapeRoom = new EscapeRoom
            {
                Category = escapeRoom.Category, Description = escapeRoom.Description, Email = escapeRoom.Email,
                ForAdult = escapeRoom.ForAdult, MaxPeopleNumber = escapeRoom.MaxPeopleNumber,
                Name     = escapeRoom.Name, PhoneNumber = escapeRoom.PhoneNumber, Price = escapeRoom.Price,
                Time     = escapeRoom.Time, BuildingNumber = escapeRoom.BuildingNumber, Street = escapeRoom.Street, City = escapeRoom.City
            };

            _escapeRoomRepository.Add(newEscapeRoom);
        }
示例#15
0
 public void Add(EscapeRoom escapeRoom)
 {
     using (var context = _dbContext)
     {
         if (context.EscapeRooms.Any(e => e.Name == escapeRoom.Name))
         {
             throw new ValueAlreadyExistException("There is already escape room with that name");
         }
         context.Add(escapeRoom);
         context.SaveChanges();
     }
 }
示例#16
0
        public override void OnRoomStateChanged(EscapeRoom <IEtsInterface> sender, RoomStateChangedEventArgs e)
        {
            if (e.NewState == RoomState.Initialized)
            {
                audio.PlaySound(ConfirmationSound);
            }

            if (e.NewState == RoomState.Error)
            {
                audio.PlaySound(ErrorSound);
            }
        }
示例#17
0
        public override void OnRoomStateChanged(EscapeRoom <IEtsInterface> sender, RoomStateChangedEventArgs e)
        {
            if (e.NewState == RoomState.Uninitialized)
            {
                // start a new record
                Scores = new Scores();
            }

            if (e.NewState == RoomState.Completed || e.NewState == RoomState.Aborted)
            {
                Scores.WriteTXT(Ets.AnalyticsPath + filename);
            }
        }
示例#18
0
        /// <summary>
        /// a method to give all the time not tacking in that day in that escape-room
        /// </summary>
        /// <param name="ER_ID">escape-rooms id</param>
        /// <param name="Bdate">the date of a day</param>
        /// <returns>a list of the times a customer can chose from an book the time</returns>
        public List <TimeSpan> FreeTimes(int ER_ID, DateTime Bdate)
        {
            List <Booking>    bkl = new List <Booking>();
            EscapeRoom        est = new EscapeRoom();
            BookingController bc  = new BookingController();

            bkl = bc.CheckBooking(ER_ID, Bdate);
            TimeSpan time1, time2, time3, time4, time5;

            time1 = new TimeSpan(16, 00, 00);
            time2 = new TimeSpan(18, 00, 00);
            time3 = new TimeSpan(20, 00, 00);
            time4 = new TimeSpan(22, 00, 00);
            time5 = new TimeSpan(00, 00, 00);
            List <TimeSpan> newTimes = new List <TimeSpan>()
            {
                time1,
                time2,
                time3,
                time4,
                time5
            };

            foreach (var time in bkl)
            {
                if (time.bookingTime == time1)
                {
                    newTimes.Remove(time1);
                }
                else if (time.bookingTime == time2)
                {
                    newTimes.Remove(time2);
                }
                else if (time.bookingTime == time3)
                {
                    newTimes.Remove(time3);
                }
                else if (time.bookingTime == time4)
                {
                    newTimes.Remove(time4);
                }
                else if (time.bookingTime == time5)
                {
                    newTimes.Remove(time5);
                }
                else
                {
                }
            }
            return(newTimes);
        }
示例#19
0
        /// <summary>
        /// Deletes a booking from the database
        /// </summary>
        /// <param name="cus"></param>
        /// <param name="esr"></param>
        /// <param name="date"></param>
        /// <param name="emp"></param>
        /// <param name="aop"></param>
        /// <param name="bookTime"></param>
        public void Delete(Customer cus, EscapeRoom esr, DateTime date, Employee emp, int aop, TimeSpan bookTime)
        {
            Booking book = new Booking()
            {
                Cus            = cus,
                Er             = esr,
                Date           = date,
                Emp            = emp,
                AmountOfPeople = aop,
                BookingTime    = bookTime
            };

            BOOKS.Delete(book);
        }
示例#20
0
        /// <summary>
        /// Creates a booking and saves it in the database
        /// </summary>
        /// <param name="Emp"></param>
        /// <param name="Cus"></param>
        /// <param name="ER"></param>
        /// <param name="BookingTime"></param>
        /// <param name="AmountOfPeople"></param>
        /// <param name="Date"></param>
        /// <returns> The booking just made (book) </returns>
        public int Create(Employee Emp, Customer Cus, EscapeRoom ER, TimeSpan BookingTime, int AmountOfPeople, DateTime Date)
        {
            Booking book = new Booking()
            {
                AmountOfPeople = AmountOfPeople,
                BookingTime    = BookingTime,
                Cus            = Cus,
                Date           = Date,
                Emp            = Emp,
                Er             = ER
            };

            return(BOOKS.Create(book));
        }
示例#21
0
        public override void OnRoomStateChanged(EscapeRoom <IEtsInterface> sender, RoomStateChangedEventArgs e)
        {
            if (e.NewState == RoomState.Initialized)
            {
                SwitchAllLights(LightSetting.Off);

                foreach (Fan fan in Room.GetGame <PipesGame>().Fans())
                {
                    Physical.SetFanState(fan.Row, fan.PositionInRow, false);
                }

                Color[] ledsOff = new Color[TriggersGame.LedCount];
                Physical.SetLEDColors(ledsOff);
            }
        }
示例#22
0
        /// <summary>
        /// Updates a booking and saves it in the database
        /// </summary>
        /// <param name="cus"></param>
        /// <param name="esr"></param>
        /// <param name="date"></param>
        /// <param name="emp"></param>
        /// <param name="aop"></param>
        /// <param name="bookTime"></param>
        /// <param name="id"></param>
        public void Update(Customer cus, EscapeRoom esr, DateTime date, Employee emp, int aop, TimeSpan bookTime, int id)
        {
            Booking book = new Booking()
            {
                AmountOfPeople = aop,
                BookingTime    = bookTime,
                Cus            = cus,
                Date           = date,
                Emp            = emp,
                Er             = esr,
                Id             = id
            };

            BOOKS.Update(book);
        }
示例#23
0
        // Use this for initialization
        void Awake()
        {
            btnStart    = transform.Find("btnStart").GetComponent <Button>();
            btnComplete = transform.Find("btnComplete").GetComponent <Button>();
            btnAbort    = transform.Find("btnAbort").GetComponent <Button>();
            btnReset    = transform.Find("btnReset").GetComponent <Button>();
            btnShutdown = transform.Find("btnShutdown").GetComponent <Button>();

            lblRoomState   = transform.Find("pnlRoomSettings").Find("lblRoomState").GetComponent <Text>();
            chkLighting    = transform.Find("pnlRoomSettings").Find("chkLighting").GetComponent <Toggle>();
            chkMaintenance = transform.Find("pnlRoomSettings").Find("chkMaintenance").GetComponent <Toggle>();

            room = Ets.Room;
            room.OnRoomStateChanged += OnRoomStateChanged;
        }
示例#24
0
        /// <summary>
        /// Fills all the textboxes for escaperoom, with the escaperoom it has
        /// </summary>
        /// <param name="esr"></param>
        private void FillTextBoxEscapeRoom(EscapeRoom esr)
        {
            string cleanTime = Convert.ToString(esr.CleanTime);

            txbCleanTime.Text = cleanTime;
            string clearTime = Convert.ToString(esr.MaxClearTime);

            txbMaxClearTime.Text = clearTime;
            txbDescription.Text  = esr.Description;
            txbName.Text         = esr.Name;
            string price = Convert.ToString(esr.Price);

            txbPrice.Text      = price;
            pbEscapeRoom.Image = ByteArrayToImage(esr.Image);
        }
示例#25
0
文件: Ets.cs 项目: hbksaar/EscapeRoom
        private void Awake()
        {
            // instantiate room
            if (useMockupInterface)
            {
                Room = new EscapeRoom <IEtsInterface>(physicalInterfaceMockup);
            }
            else
            {
                Room = new EscapeRoom <IEtsInterface>(physicalInterface);
            }

            // register games
            Room.RegisterGame(new PipesGame());
            Room.RegisterGame(new CratesGame(craneScene));
            Room.RegisterGame(new DynamiteGame());
            Room.RegisterGame(new TriggersGame());

            // register modules (order of registration is order of execution)
            if (enableSoundDirector)
            {
                Room.RegisterModule(soundDirector);
            }
            if (enableLightingDirector)
            {
                Room.RegisterModule(lightingDirector);
            }
            if (enableActionsLog)
            {
                Room.RegisterModule(new ActionsLog());
            }
            if (enableStatistics)
            {
                Room.RegisterModule(new StatisticsModule());
            }
            if (enableScoring)
            {
                Room.RegisterModule(new ScoringModule());
            }
            if (enableGameMasters)
            {
                Room.RegisterModule(roomMaster);
                Room.RegisterModule(pipesMaster);
                Room.RegisterModule(cratesMaster);
                Room.RegisterModule(dynamiteMaster);
                Room.RegisterModule(triggerMaster);
            }
        }
示例#26
0
        private EscapeRoom GetClientsideOneEscapeRoom(ServiceLayer.EscRef.EscapeRoom escapeRoom)
        {
            EscapeRoom es;

            es = new EscapeRoom {
                CleanTime    = escapeRoom.cleanTime,
                Description  = escapeRoom.description,
                EscapeRoomID = escapeRoom.escapeRoomID,
                MaxClearTime = escapeRoom.maxClearTime,
                Name         = escapeRoom.name,
                Price        = escapeRoom.price,
                Rating       = escapeRoom.rating
            };

            return(es);
        }
示例#27
0
        public void OnRoomStateChanged(EscapeRoom <IEtsInterface> sender, RoomStateChangedEventArgs e)
        {
            roomRunning = e.NewState == RoomState.Running;
            //Debug.Log("GCP.OnRoomStateChanged: " + state);

            if (!roomRunning)
            {
                lblState.text  = "Room not running";
                lblState.color = RoomControlPanel.TextUninitialized;
                DisableButtons();
            }
            else
            {
                UpdateUI(game.State);
            }
        }
示例#28
0
        public void OnRoomStateChanged(EscapeRoom <IEtsInterface> sender, RoomStateChangedEventArgs e)
        {
            if (e.NewState == RoomState.Initialized)
            {
                float maxTimeInGames = RoomMaster.MaxTimePipes + RoomMaster.MaxTimeCrates + RoomMaster.MaxTimeDynamite + RoomMaster.MaxTimeTriggers;

                float totalAudioTime = 0;
                foreach (int voiceNumber in betweenGamesVoiceNumbers)
                {
                    totalAudioTime += audio.GetVoiceLength(voiceNumber);
                }

                timeLeft         = maxTimeInGames + totalAudioTime;
                failuresDetected = e.DiagnosticsReport.FailuresDetected;
            }

            if (e.NewState == RoomState.Running)
            {
                //lblTime.gameObject.SetActive(true);
                lblDoNotEnter.SetActive(true);
                lblGameInProgress.SetActive(true);
                lblPleaseWait.SetActive(false);
                lblComing.SetActive(false);
                lblScoreCaptionPrevious.SetActive(false);
                lblScoreCaptionCurrent.SetActive(true);
                lblScorePipes.text    = "-";
                lblScoreCrane.text    = "-";
                lblScoreDynamite.text = "-";
                lblScoreTrigger.text  = "-";
            }

            if (e.NewState != RoomState.Running)
            {
                lblScoreCaptionPrevious.SetActive(true);
                lblScoreCaptionCurrent.SetActive(false);
            }

            if (e.NewState == RoomState.Initialized)
            {
                //lblTime.gameObject.SetActive(false);
                lblTime.text = "00:00";
                lblDoNotEnter.SetActive(false);
                lblGameInProgress.SetActive(false);
                lblPleaseWait.SetActive(true);
                lblComing.SetActive(true);
            }
        }
示例#29
0
        /// <summary>
        /// Converts the escaperooms from the WCF into MAPMAClient.Model.EscapeRoom
        /// </summary>
        /// <param name="escapeRoom"></param>
        /// <returns>MAPMAClient.Model.EscapeRoom</returns>
        private MAPMAClient.Model.EscapeRoom GetClientsideOneEscapeRoom(EscapeRoom escapeRoom)
        {
            MAPMAClient.Model.EscapeRoom es;

            es = new MAPMAClient.Model.EscapeRoom {
                CleanTime    = escapeRoom.cleanTime,
                Description  = escapeRoom.description,
                EscapeRoomID = escapeRoom.escapeRoomID,
                MaxClearTime = escapeRoom.maxClearTime,
                Name         = escapeRoom.name,
                Price        = escapeRoom.price,
                Rating       = escapeRoom.rating,
                Image        = escapeRoom.Image
            };

            return(es);
        }
示例#30
0
        /// <summary>
        /// the method to update the escape-rooms parameters
        /// </summary>
        /// <param name="name">the name off the escape-room</param>
        /// <param name="description">the description of the escape-room</param>
        /// <param name="maxClearTime">the time for how long the customer have the room</param>
        /// <param name="cleanTime">the time for preparing the room to a new customer</param>
        /// <param name="price"> the price</param>
        /// <param name="rating"> the rating there is set to 0 at start</param>
        /// <param name="empId">Employees id</param>
        /// <param name="escId">escape-rooms id</param>
        /// <param name="img"> a image</param>
        public void UpdateRoom(string name, string description, decimal maxClearTime, decimal cleanTime, decimal price, decimal rating, int empId, int escId, byte[] img)
        {
            EmployeeController ec = new EmployeeController();
            EscapeRoom         ER = new EscapeRoom()
            {
                escapeRoomID = escId,
                name         = name,
                description  = description,
                maxClearTime = maxClearTime,
                cleanTime    = cleanTime,
                price        = price,
                rating       = rating,
                emp          = ec.Get(empId),
                Image        = img
            };

            DBER.Update(ER);
        }