Ejemplo n.º 1
0
        /// <summary>
        /// Calls the WCF, so the method Delete runs in the host and the choosen booking is deletet
        /// </summary>
        /// <param name="book"></param>
        public void Delete(MAPMAClient.Model.Booking book)
        {
            IBookingServices Service = new BookingServicesClient();


            Service.Delete(book.Emp.EmployeeID, book.Cus.Username, book.Er.EscapeRoomID, book.BookingTime, book.AmountOfPeople, book.Date);
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Opens Edit_Delete with the doubleclicked booking and hides itself
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void dgvAllBookings_CellDoubleClick(object sender, DataGridViewCellEventArgs e)
        {
            int  index = e.RowIndex;
            int  id    = (int)dgvAllBookings[6, index].Value;
            int  i     = 0;
            bool found = false;

            MAPMAClient.Model.Booking book = null;

            while (i < bookings.Count && !found)
            {
                if (bookings.ElementAt(i).Id == id)
                {
                    book  = bookings.ElementAt(i);
                    found = true;
                }
                else
                {
                    i++;
                }
            }

            if (book != null)
            {
                Edit_Delete ed = new Edit_Delete(book);
                ed.Show();
                this.Hide();
            }
        }
Ejemplo n.º 3
0
        /// <summary>
        /// Converts one booking into MAPMAClient.Model.Booking
        /// </summary>
        /// <param name="booking"></param>
        /// <returns> MAPMAClient.Model.Booking</returns>
        private Model.Booking GetClientsideBooking(BookRef.Booking booking)
        {
            MAPMAClient.Model.Booking    book;
            MAPMAClient.Model.Customer   cus;
            MAPMAClient.Model.Employee   emp;
            MAPMAClient.Model.EscapeRoom er;

            cus = new MAPMAClient.Model.Customer {
                CustomerNo = booking.cus.customerNo,
                FirstName  = booking.cus.firstName,
                LastName   = booking.cus.lastName,
                Mail       = booking.cus.mail,
                Phone      = booking.cus.phone,
                Username   = booking.cus.username
            };

            emp = new MAPMAClient.Model.Employee {
                Address    = booking.emp.address,
                CityName   = booking.emp.cityName,
                EmployeeID = booking.emp.employeeID,
                FirstName  = booking.emp.firstName,
                LastName   = booking.emp.lastName,
                Mail       = booking.emp.mail,
                Phone      = booking.emp.phone,
                Region     = booking.emp.region,
                Zipcode    = booking.emp.zipcode
            };

            er = new MAPMAClient.Model.EscapeRoom {
                CheckList    = booking.er.checkList,
                CleanTime    = booking.er.cleanTime,
                Description  = booking.er.description,
                EscapeRoomID = booking.er.escapeRoomID,
                MaxClearTime = booking.er.maxClearTime,
                Name         = booking.er.name,
                Price        = booking.er.price,
                Rating       = booking.er.rating
            };

            book = new MAPMAClient.Model.Booking {
                AmountOfPeople = booking.amountOfPeople,
                BookingTime    = booking.bookingTime,
                Cus            = cus,
                Date           = booking.date,
                Emp            = emp,
                Er             = er,
                Id             = booking.Id
            };

            return(book);
        }
Ejemplo n.º 4
0
        /// <summary>
        /// Calls the WCF, so the method Create runs in the host and a booking is createt and saved in the database
        /// </summary>
        /// <param name="book"></param>
        /// <returns></returns>
        public int Create(MAPMAClient.Model.Booking book)
        {
            IBookingServices Service = new BookingServicesClient();

            return(Service.Create(book.Emp.EmployeeID, book.Cus.Username, book.Er.EscapeRoomID, book.BookingTime, book.AmountOfPeople, book.Date));
        }