Ejemplo n.º 1
0
        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);
        }
Ejemplo n.º 2
0
        private void Button1_Click(object sender, EventArgs e)
        {
            EscapeRoomCtr erc = new EscapeRoomCtr();

            foreach (EscapeRoom er in erc.GetAllForOwner())
            {
                listBox1.Items.Add(er.Name);
            }
        }
Ejemplo n.º 3
0
        /// <summary>
        /// Gets all the escaperooms from the database and places them in the combo box
        /// </summary>
        private void CreateBooking_Load()
        {
            escapeRooms = ERCtr.GetAllForOwner();
            cobNameER.Items.Clear();

            foreach (EscapeRoom er in escapeRooms)
            {
                cobNameER.Items.Add(er.Name);
            }
        }
Ejemplo n.º 4
0
        /// <summary>
        /// Fills combobox with Ecaperooms
        /// </summary>
        private void LoadCBEscapeRoom()
        {
            EscapeRoomCtr erCtr = new EscapeRoomCtr();

            escapeRooms = new List <EscapeRoom>();
            escapeRooms = erCtr.GetAllForOwner();
            cbEscaperoom.Items.Clear();

            foreach (EscapeRoom er in escapeRooms)
            {
                cbEscaperoom.Items.Add(er.Name);
            }
            cbEscaperoom.SelectedItem = book.Er.Name;
        }
Ejemplo n.º 5
0
        /// <summary>
        /// Finds all the bookings from all the escaperooms and adds them to datasource
        /// </summary>
        private void FillDataSource()
        {
            List <Model.EscapeRoom> escapeRooms;
            List <int> escapeRoomId = new List <int>();

            escapeRooms = erc.GetAllForOwner();

            foreach (Model.EscapeRoom er in escapeRooms)
            {
                escapeRoomId.Add(er.EscapeRoomID);
            }

            foreach (int id in escapeRoomId)
            {
                List <Model.Booking> books = bc.GetAllOneRoom(id);
                if (books.Count() != 0)
                {
                    dt.Rows.Add(books[0].Er.Name, books.Count(), books[0].Er.Rating);
                }
            }
        }
Ejemplo n.º 6
0
        /// <summary>
        /// Updates the dataGridView so new escaperooms will be insertet
        /// </summary>
        private void UpdateEscapeRoomList( )
        {
            EscapeRoomCtr esc = new EscapeRoomCtr();
            DataTable     dt  = new DataTable();
            BindingSource bs  = new BindingSource();

            escapeRooms = esc.GetAllForOwner();

            dt.Columns.Add("Escaperoom", typeof(string));
            dt.Columns.Add("Pris", typeof(decimal));
            dt.Columns.Add("Medarbejder", typeof(string));
            dt.Columns.Add("Max Gennemførsels tid", typeof(decimal));
            dt.Columns.Add("Klargøringstid", typeof(decimal));
            dt.Columns.Add("id", typeof(int));

            foreach (var EscapeRoom in escapeRooms)
            {
                dt.Rows.Add(EscapeRoom.Name, EscapeRoom.Price, EscapeRoom.Emp.FirstName + " " + EscapeRoom.Emp.LastName, EscapeRoom.MaxClearTime, EscapeRoom.CleanTime, EscapeRoom.EscapeRoomID);
            }

            bs.DataSource                       = dt;
            dataGridView1.DataSource            = bs;
            dataGridView1.Columns["id"].Visible = false;
        }