//constructor, is used to register new booking. public BookingUpdateV(string adminName) { InitializeComponent(); //fill Room CombBox with active rooms from DB _rooms = _roomSrv.getActiveRooms(); cboxRoom.ItemsSource = _rooms; cboxRoom.DisplayMemberPath = Name; //limit DatePicker choice to "starting from Today" only txtDate.DisplayDateStart = DateTime.Today; _admin = (AdministratorBO)_adminSrv.getAdminByName(adminName); listCustomers.ItemsSource = _custSrv.getAllFromTable(); }
////constructor, is used to update existing booking details. public BookingUpdateV(BookingBO selectedBooking, string adminName) { InitializeComponent(); this._selectedBooking = selectedBooking; // pre-fill text boxes with booking data txtCustomer.Text = selectedBooking.CustomerCompany; txtParticipants.Text = selectedBooking.Participants.ToString(); txtAdditionalInfo.Text = selectedBooking.AdditionalInfo; txtDate.SelectedDate = selectedBooking.Date; //searches List<CustomersBO> by Customer Name listCustomers.ItemsSource = _custSrv.searchCustomerByCompany(txtCustomer.Text); listCustomers.SelectAll(); //limit DatePicker choice to "starting from Today" only txtDate.DisplayDateStart = DateTime.Today; //fill combobox with active rooms from DB _rooms = _roomSrv.getActiveRooms(); cboxRoom.ItemsSource = _rooms; // in case room is inactive leave combobox empty if (_roomSrv.getRoomIndexFromList(_rooms, selectedBooking.Room) != -1) { cboxRoom.SelectedValue = selectedBooking.Room; cboxRoom.SelectedIndex = _roomSrv.getRoomIndexFromList(_rooms, selectedBooking.Room); } _admin = (AdministratorBO)_adminSrv.getAdminByName(adminName); }