/// <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); }
/// <summary> /// Converts a Customer to MAPMAClient.Model.Customer /// </summary> /// <param name="customer"></param> /// <returns> MAPMAClient.Model.Customer </returns> private Model.Customer GetCustmerClientSide(CusRef.Customer customer) { MAPMAClient.Model.Customer cus; cus = new MAPMAClient.Model.Customer { CustomerNo = customer.customerNo, FirstName = customer.firstName, LastName = customer.lastName, Mail = customer.mail, Password = customer.password, Phone = customer.phone, Username = customer.username }; return(cus); }
/// <summary> /// Search the database for one booking /// </summary> /// <param name="cus"></param> /// <param name="esr"></param> /// <param name="date"></param> /// <returns></returns> public MAPMAClient.Model.Booking Get(MAPMAClient.Model.Customer cus, MAPMAClient.Model.EscapeRoom esr, DateTime date) { IBookingServices Service = new BookingServicesClient(); try { var Booking = Service.Get(esr.EscapeRoomID, cus.Username, date); MAPMAClient.Model.Booking book; book = GetClientsideBooking(Booking); return(book); } catch (NullReferenceException NE) { Console.WriteLine(NE); Console.ReadLine(); return(null); } }