Exemplo n.º 1
0
 /// <summary>
 /// Transfer comboBox and DatePicker data from MainWindow.
 /// </summary>
 internal void TransferDataForReservation(ComboBox meeetingCombo, DatePicker reservationDatePicker)
 {
     _meetingReservationTransfer             = new MeetingReservation();
     _meetingReservationTransfer.MeetingRoom = (MeetingRoom)meeetingCombo.SelectedItem;
     _meetingCombo          = meeetingCombo;
     _reservationDatePicker = reservationDatePicker;
 }
Exemplo n.º 2
0
        private void OkButton_Click(object sender, RoutedEventArgs e)
        {
            if (PlanningFormValidation() && validateTime())
            {
                if (_meetingReservation == null)
                {
                    _meetingReservation = new MeetingReservation();

                    //transfered properties
                    _meetingReservation.Date        = (DateTime)_reservationDatePicker.SelectedDate;
                    _meetingReservation.MeetingRoom = (MeetingRoom)_meetingCombo.SelectedItem;

                    if (transformDataFromUI())
                    {
                        HandleState.ChangingData();
                        DataManager.sort();
                        ((MainWindow)Application.Current.MainWindow).showReservationsInListBox();
                        this.Close();
                    }
                }
                else
                {
                    if (CreateEditReservation())
                    {
                        updateSelectedForNew();
                        ((MainWindow)Application.Current.MainWindow).showReservationsInListBox();
                        this.Close();
                    }
                }
            }
        }
Exemplo n.º 3
0
 /// <summary>
 /// Check if meetingReservation belong to correct room
 /// </summary>
 /// <param name="meetingReservation"></param>
 private void assignReservationToCorrectRoom(MeetingReservation meetingReservation)
 {
     foreach (var room in DataManager.Rooms)
     {
         if (room == _meetingReservation.MeetingRoom)
         {
             room.MeetingReservations.Add(_meetingReservation);
         }
     }
 }
Exemplo n.º 4
0
 private void EditPlanningButton_Click(object sender, RoutedEventArgs e)
 {
     if (ReservationsListBox.SelectedItem != null)
     {
         _reservation = ReservationsListBox.SelectedItem as MeetingReservation;
         PlanningForm planningForm = new PlanningForm();
         planningForm.reservationForEdit(_reservation);
         planningForm.TransferDataForReservation(MeetingRoomCombo, ReservationDatePicker);
         planningForm.Show();
     }
 }
Exemplo n.º 5
0
 /// <summary>
 /// Validate the correct room to add the reservation
 /// </summary>
 /// <param name="meetingReservation"></param>
 /// <param name="roomName"></param>
 private static void assingEachReservationToCorrectRoom(MeetingReservation meetingReservation, string roomName)
 {
     foreach (var room in DataManager.Rooms)
     {
         if (room.Name == roomName)
         {
             _meetingReservation.MeetingRoom = room;
             DataManager.Reservation.Add(_meetingReservation);
             room.MeetingReservations.Add(_meetingReservation);
         }
     }
 }
Exemplo n.º 6
0
        /// <summary>
        /// Load data from xml after starting the application
        /// </summary>
        /// <param name="path"></param>
        public static void LoadXML(string path)
        {
            XmlDocument xmlDoc = new XmlDocument();

            xmlDoc.Load(path);
            XmlNodeList nodeList = xmlDoc.DocumentElement.SelectNodes("/Table/Reservation");

            foreach (XmlNode node in nodeList)
            {
                _meetingReservation = new MeetingReservation();
                string roomName = node.SelectSingleNode("MeetingRoomName").InnerText;
                _meetingReservation.Customer             = node.SelectSingleNode("Customer").InnerText;
                _meetingReservation.Date                 = DateTime.Parse(node.SelectSingleNode("Date").InnerText);
                _meetingReservation.TimeFrom             = TimeSpan.Parse(node.SelectSingleNode("TimeFrom").InnerText);
                _meetingReservation.TimeTo               = TimeSpan.Parse(node.SelectSingleNode("TimeTo").InnerText);
                _meetingReservation.ExpectedPersonsCount = int.Parse(node.SelectSingleNode("ExpectedPersons").InnerText);
                _meetingReservation.VideoConference      = bool.Parse(node.SelectSingleNode("VideoConference").InnerText);
                _meetingReservation.Note                 = node.SelectSingleNode("Note").InnerText;

                assingEachReservationToCorrectRoom(_meetingReservation, roomName);
            }
        }
Exemplo n.º 7
0
 /// <summary>
 /// Transfer existing reservation to edit
 /// </summary>
 /// <param name="reservation"></param>
 internal void reservationForEdit(MeetingReservation reservation)
 {
     _meetingReservation = reservation;
     showCelectedRoomInEdit();
 }