/// <summary> /// Opens MainMenu and runs LoadDataGridView() /// </summary> public MainMenu() { InitializeComponent(); bc = new BookingCtr(); erc = new EscapeRoomCtr(); LoadDataGridView(); }
/// <summary> /// If tbAmountOfPeople.Visible is false then it runs UpdateFirstClick(), LoadCBEmployee and LoadCBEscapeRoom() /// Then it checks if AmountOfPeople is larger than 0 the methode Update runs and it shows ReadBooking and closes itself /// If AmountOfPeople is not larger than 0 it shows errorelabel and sets the message in the label /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void btnUpdate_Click(object sender, EventArgs e) { if (tbAmountOfPeople.Visible == false) { UpdateFirstClick(); LoadCBEmployee(); LoadCBEscapeRoom(); } else { BookingCtr bc = new BookingCtr(); if (updatetBook.AmountOfPeople > 0) { bc.Update(updatetBook.Cus, updatetBook.Er, updatetBook.Date, updatetBook.Emp, updatetBook.AmountOfPeople, updatetBook.BookingTime, updatetBook.Id); ReadBooking rb = new ReadBooking(); rb.Show(); this.Close(); } else { lblErrorAmountOfPeople.Text = "må ikke være 0"; lblErrorAmountOfPeople.Show(); } } }
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); }
/// <summary> /// Adds the columns and sets in the bookings /// </summary> private void UpdateBookingList( ) { BookingCtr book = new BookingCtr(); dt = new DataTable(); bs = new BindingSource(); bookings = book.GetAll(); dt.Columns.Add("Escaperoom", typeof(string)); dt.Columns.Add("Tidspunkt for booking", typeof(TimeSpan)); dt.Columns.Add("Dato for booking", typeof(DateTime)); dt.Columns.Add("Antal Personer", typeof(int)); dt.Columns.Add("Brugernavn", typeof(string)); dt.Columns.Add("Medarbejder", typeof(string)); dt.Columns.Add("id", typeof(int)); foreach (var Booking in bookings) { if (Booking.Date >= DateTime.Now.Date) { dt.Rows.Add(Booking.Er.Name, Booking.BookingTime, Booking.Date.ToShortDateString(), Booking.AmountOfPeople, Booking.Cus.Username, Booking.Emp.FirstName + Booking.Emp.LastName, Booking.Id); } } bs.DataSource = dt; dgvAllBookings.DataSource = bs; dgvAllBookings.Columns["id"].Visible = false; }
public List <Booking> Get(GetAllCafeBookingsRequest request) { var bookingCtr = new BookingCtr(); var cafeData = new Cafe { ID = request.CafeID, }; return(bookingCtr.GetAllCafeBookings(cafeData)); }
public List <Booking> Get(GetAllBookingsOnCustomerIDRequest request) { var bookingCtr = new BookingCtr(); var personData = new Customer { ID = request.ID }; return(bookingCtr.GetAllBookingsOnCustomerID(personData)); }
/// <summary> /// Opens "CreateBooking" and initialize the fields /// </summary> public CreateBooking() { InitializeComponent(); Cusctr = new CustomerCtr(); ERCtr = new EscapeRoomCtr(); BookCtr = new BookingCtr(); EmpCtr = new EmployeeCtr(); escapeRooms = new List <EscapeRoom>(); CreateBooking_Load(); calBookTime.MinDate = DateTime.Now.Date; }
public void ReadAllBookingTest( ) { //Arrange BookingCtr bc = new BookingCtr(); List <Booking> bookings; //Act bookings = bc.GetAll(); //Assert Assert.IsNotNull(bookings); }
public Booking Put(UpdateBookingRequest request) { var bookingCtr = new BookingCtr(); var bookingData = new Booking { ID = request.ID, StartDate = request.StartDate, EndDate = request.EndDate, }; bookingCtr.UpdateBooking(bookingData); return(bookingData); }
/// <summary> /// The Delete botton, deletes the booking then closes and shows ReadBooking, if lblAmountOFPeopleDelete.Visible == false then it runs DeleteFirstClick() /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void btnDelete_Click(object sender, EventArgs e) { if (lblAmountOfPeopleDelete.Visible == false) { DeleteFirstClick(); } else { BookingCtr bookctr = new BookingCtr(); bookctr.Delete(book.Cus, book.Er, book.Date, book.Emp, book.AmountOfPeople, book.BookingTime); ReadBooking rb = new ReadBooking(); rb.Show(); this.Close(); } }
public Booking Put(BookingRequestPP request) { var bookingCtr = new BookingCtr(); var cafeData = new Cafe { ID = request.ID }; var bookingData = new Booking { StartDate = request.StartDate, EndDate = request.EndDate, }; bookingCtr.CreateBooking(cafeData, bookingData, request.NoOfPeople); return(null); }
public void TestBookRoomOwner() { //Arrange BookingCtr bc = new BookingCtr(); CustomerCtr cc = new CustomerCtr(); EscapeRoomCtr ec = new EscapeRoomCtr(); EmployeeCtr emc = new EmployeeCtr(); MAPMAClient.Model.Customer cus = cc.Get("Anorak"); MAPMAClient.Model.EscapeRoom er = ec.GetForOwner(2); MAPMAClient.Model.Employee em = emc.Get(1); MAPMAClient.Model.Booking hostBook; MAPMAClient.Model.Booking book = new MAPMAClient.Model.Booking() { AmountOfPeople = 7, BookingTime = DateTime.Now.TimeOfDay, Cus = cus, Date = DateTime.Now.AddDays(7.0).Date, Emp = em, Er = er }; MAPMAClient.Model.Booking bookWithoutTime = new MAPMAClient.Model.Booking() { AmountOfPeople = 7, 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); hostBook = bc.Get(cus, er, book.Date); ////Assert Assert.AreEqual(bookWithoutTime.Date, hostBook.Date); Assert.AreEqual(bookWithoutTime.Emp.EmployeeID, hostBook.Emp.EmployeeID); Assert.AreEqual(bookWithoutTime.Cus.Username, hostBook.Cus.Username); bc.Delete(cus, er, book.Date, book.Emp, book.AmountOfPeople, book.BookingTime); }
public Booking Post(CreateBookingRequest request) { var bookingCtr = new BookingCtr(); var cafeData = new Cafe { ID = request.CafeID }; var customerData = new Customer { ID = request.PersonID }; var bookingData = new Booking { StartDate = request.StartDate, EndDate = request.EndDate, Customer = customerData }; bookingCtr.CreateBooking(cafeData, bookingData, request.NoOfPeople); return(bookingData); }
public void Delete(DeleteBookingRequest request) { var bookingCtr = new BookingCtr(); bookingCtr.Delete(request.ID); }
public Booking Get(GetBookingByIDRequest request) { var bookingCtr = new BookingCtr(); return(bookingCtr.GetBookingByID(request.ID)); }
public BookingService() { _bookingCtr = new BookingCtr(); }