public bool ReserveRoom(RoomReservation roomReservation) { var data = new RoomReservationData(); data.ReserveRoom(roomReservation); return(true); }
public MainWindow() { InitializeComponent(); _reservation = new RoomReservation { StartTime = DateTime.Now, EndTime = DateTime.Now.AddHours(1) }; this.DataContext = _reservation; }
public void ReserveRoom(RoomReservation roomReservation) { using (var data = new RoomReservationsEntities()) { data.RoomReservations.AddObject(roomReservation); data.SaveChanges(); } }
/// <summary> /// Create a new RoomReservation object. /// </summary> /// <param name="id">Initial value of the Id property.</param> /// <param name="roomName">Initial value of the RoomName property.</param> /// <param name="startDate">Initial value of the StartDate property.</param> /// <param name="endDate">Initial value of the EndDate property.</param> /// <param name="contact">Initial value of the Contact property.</param> public static RoomReservation CreateRoomReservation(global::System.Int32 id, global::System.String roomName, global::System.DateTime startDate, global::System.DateTime endDate, global::System.String contact) { RoomReservation roomReservation = new RoomReservation(); roomReservation.Id = id; roomReservation.RoomName = roomName; roomReservation.StartDate = startDate; roomReservation.EndDate = endDate; roomReservation.Contact = contact; return(roomReservation); }
public bool ReserveRoom(RoomReservation roomReservation) { try { var data = new RoomReservationRepository(); data.ReserveRoom(roomReservation); } catch (Exception ex) { RoomReservationFault fault = new RoomReservationFault { Message = ex.Message }; throw new FaultException <RoomReservationFault>(fault); } return(true); }
public bool ReserveRoom(RoomReservation roomReservation) { try { WriteLine($"received room reservation for room {roomReservation.RoomName}"); var data = new RoomReservationRepository(); data.ReserveRoom(roomReservation); } catch (Exception ex) { WriteLine($"error {ex.Message}"); RoomReservationFault fault = new RoomReservationFault { Message = ex.Message }; throw new FaultException <RoomReservationFault>(fault); } return(true); }
private void OnReserveRoom(object sender, RoutedEventArgs e) { var reservation = new RoomReservation() { RoomName = textRoom.Text, Event = textEvent.Text, Contact = textContact.Text, StartDate = DateTime.Parse(textStartTime.Text), EndDate = DateTime.Parse(textEndTime.Text) }; var client = new RoomServiceClient(); bool reserved = client.ReserveRoom(reservation); client.Close(); if (reserved) { MessageBox.Show("reservation ok"); } }
/// <summary> /// Deprecated Method for adding a new object to the RoomReservations EntitySet. Consider using the .Add method of the associated ObjectSet<T> property instead. /// </summary> public void AddToRoomReservations(RoomReservation roomReservation) { base.AddObject("RoomReservations", roomReservation); }