public void loadChuyenBayData() { // Load dữ liệu cho bản chuyến bay FlightData = FlightMngController.LoadFlightData(); dataChuyenBay.ItemsSource = null; dataChuyenBay.ItemsSource = FlightData; soChuyenBay = FlightMngController.getLightIDAutomatic(); lblSo_chuyen_bay.Content = soChuyenBay; }
private void UserControl_IsVisibleChanged(object sender, DependencyPropertyChangedEventArgs e) { DependencyObject ucParent = this.Parent; while (!(ucParent is UserControl)) { ucParent = LogicalTreeHelper.GetParent(ucParent); } parentWind = (flightMng)ucParent; if (this.Visibility == Visibility.Visible) { lstCB = FlightMngController.LoadFlightData(); cmbMaCB.ItemsSource = lstCB; cmbSBTrungGian.ItemsSource = FlightMngController.LoadAirportData(); if (parentWind.IsSheduleEdit == true) {// Xem - sữa lblScheTitle.Content = "CHI TIẾT LỊCH BAY"; selected = FlightMngController.getLBByID(GlobalItem.FlightOfSelectedShedule, GlobalItem.DateOfSelectedShedule); selectedCB = FlightMngController.getCBByID(GlobalItem.FlightOfSelectedShedule); cmbMaCB.IsEnabled = false; txtSBDi.IsEnabled = false; txtSBDen.IsEnabled = false; dp_ngaybay.IsEnabled = false; txtNormalSeats.IsEnabled = false; txtVIPSeats.IsEnabled = false; int index = GlobalItem.FlightOfSelectedShedule - 1; cmbMaCB.SelectedItem = selectedCB; txtSBDi.Text = selectedCB.SBDi; txtSBDen.Text = selectedCB.SBDen; txtDefaultHrs.Text = selectedCB.ThoiGianBay.Value.Hours.ToString(); txtDefaultMins.Text = selectedCB.ThoiGianBay.Value.Minutes.ToString(); txtMins.Text = selected.GioDi.Value.Minutes.ToString(); txtHrs.Text = selected.GioDi.Value.Hours.ToString(); dp_ngaybay.SelectedDate = selected.NgayDi; txtNormalSeats.Text = selected.SoGheThuong.ToString(); txtVIPSeats.Text = selected.SoGheVip.ToString(); FlightMngController.loadSBTGList(selected.MaCB, selected.NgayDi, ref lstSBTG, ref lstNote, ref lstStop); listView_SBTG.ItemsSource = lstSBTG; AddCombo.Visibility = Visibility.Hidden; EditCombo.Visibility = Visibility.Visible; SeatCombo.Visibility = Visibility.Visible; } else {// Them mới lblScheTitle.Content = "THÊM MỚI LỊCH BAY"; cmbMaCB.SelectedIndex = 0; txtSBDen.IsEnabled = false; txtSBDi.IsEnabled = false; txtSBDi.Text = lstCB.ElementAt(0).SBDi; txtSBDen.Text = lstCB.ElementAt(0).SBDen; txtDefaultHrs.Text = lstCB.ElementAt(0).ThoiGianBay.Value.Hours.ToString(); txtDefaultMins.Text = lstCB.ElementAt(0).ThoiGianBay.Value.Minutes.ToString(); AddCombo.Visibility = Visibility.Visible; EditCombo.Visibility = Visibility.Hidden; SeatCombo.Visibility = Visibility.Hidden; } } else { cmbMaCB.IsEnabled = true; txtSBDi.IsEnabled = true; txtSBDen.IsEnabled = true; dp_ngaybay.IsEnabled = true; parentWind.loadLichBayData(); } }