public Station(BO.BusLineBO BusLine)
        {
            InitializeComponent();
            IEnumerable <BO.BusStationBO> busStationBOs = bl.ShowStation();

            StationList.ItemsSource = busStationBOs;
            BusLine1 = BusLine;
        }
        private void AddStation(object sender, RoutedEventArgs e)
        {
            BO.BusLineBO BusLineBO = new BO.BusLineBO
            {
                LineNumber   = int.Parse(lineNumberTextBox.Text),
                AreaBusUrban = (BO.Area1)areaBusUrbanComboBox.SelectedItem,
                GetUrban     = (BO.Urban)getUrbanComboBox.SelectedItem,
                GetAvailable = (BO.Available)getAvailableComboBox.SelectedItem
            };

            BusLineBO.StationLineBOs = new List <BO.StationLineBO>
            {
                new BO.StationLineBO {
                    StationNumberOnLine = ((BO.BusStationBO)firstStationComboBox.SelectedItem).StationNumber
                },
                new BO.StationLineBO {
                    StationNumberOnLine = ((BO.BusStationBO)lastStationComboBox.SelectedItem).StationNumber
                }
            };

            try
            {
                if (BusLineBO.StationLineBOs[0].StationNumberOnLine != BusLineBO.StationLineBOs[1].StationNumberOnLine)
                {
                    MessageBoxResult box = MessageBox.Show("האם אתה בטוח שברצונך להוסיף את הקו?", "ask", MessageBoxButton.OKCancel, MessageBoxImage.Question);
                    switch (box)
                    {
                    case MessageBoxResult.OK:
                        bl.AddBusLineBO(BusLineBO);
                        BO.BusLineBO busLineBO1 = bl.LineInformation(BusLineBO.BusLineID1);
                        Line         line       = new Line(bl);
                        line.Show();
                        MessageBoxResult messageBoxResult = MessageBox.Show("הקו נוסף למערכת", "Good");
                        Close();
                        break;

                    case MessageBoxResult.Cancel:
                        Close();
                        break;
                    }
                }
                else
                {
                    _ = MessageBox.Show("First station should be different from last", "error", MessageBoxButton.OK, MessageBoxImage.Error);
                }
            }
            catch (BO.BOExceptionLine ex)
            {
                _ = MessageBox.Show(ex.Message, "Error", MessageBoxButton.OKCancel,
                                    MessageBoxImage.Error);
            }
            catch (BO.BOExceptionLineStation ex)
            {
                _ = MessageBox.Show(ex.Message, "Error", MessageBoxButton.OKCancel,
                                    MessageBoxImage.Error);
            }
        }
        private void Udapting(object sender, RoutedEventArgs e)
        {
            FrameworkElement frameworkElement = sender as FrameworkElement;

            BO.BusLineBO busLineBO   = frameworkElement.DataContext as BO.BusLineBO;
            UdptingLine  udptingLine = new UdptingLine(busLineBO, bl);

            _ = udptingLine.ShowDialog();
        }
        private void Lines_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            BO.BusLineBO busLineBO = (BO.BusLineBO)lines.SelectedItem;
            ShowLine     showLine  = new ShowLine(busLineBO, bl);

            _ = showLine.ShowDialog();
            lines.Items.Refresh();
            Close();
        }
 public UdptingLine(BO.BusLineBO busLineBO1, IBL1 bl1)
 {
     busLineBO = busLineBO1;
     InitializeComponent();
     bl = bl1;
     areaBusUrbanComboBox.ItemsSource   = Enum.GetValues(typeof(BO.Area1));
     getUrbanComboBox.ItemsSource       = Enum.GetValues(typeof(BO.Urban));
     getAvailableComboBox.ItemsSource   = Enum.GetValues(typeof(BO.Available));
     getAvailableComboBox.SelectedIndex = 0;
     getUrbanComboBox.SelectedIndex     = 0;
     areaBusUrbanComboBox.SelectedIndex = 0;
     lineNumberTextBox.Text             = busLineBO1.LineNumber.ToString();
 }
 public ShowLine(BO.BusLineBO busLineBO, IBL1 bl1)
 {
     InitializeComponent();
     BusLine = busLineBO;
     bl      = bl1;
     foreach (BO.StationLineBO item in busLineBO.StationLineBOs)
     {
         busLineBOs.Add(item);
     }
     foreach (BO.LineExitBo item in busLineBO.LineExitBos1)
     {
         lineExitBos.Add(item);
     }
     BusLine = busLineBO;
     busStationBOListView.ItemsSource = busLineBOs;
     shoeLine.DataContext             = busLineBO;
     exit.ItemsSource = lineExitBos;
 }
 private void Delete(object sender, RoutedEventArgs e)
 {
     try
     {
         FrameworkElement frameworkElement = sender as FrameworkElement;
         BO.BusLineBO     busLineBO        = frameworkElement.DataContext as BO.BusLineBO;
         bl.DeleteBusLineBO(busLineBO.BusLineID1);
         busLineBOs.RemoveAt(busLineBO.BusLineID1);
         busLineBOs.Insert(busLineBO.BusLineID1, bl.LineInformation(busLineBO.BusLineID1));
         lines.Items.Refresh();
     }
     catch (BO.BOExceptionLine ex)
     {
         _ = MessageBox.Show(ex.Message, "Error", MessageBoxButton.OKCancel,
                             MessageBoxImage.Error);
     }
     catch (BO.BOExceptionLineStation ex)
     {
         _ = MessageBox.Show(ex.Message, "Error", MessageBoxButton.OKCancel,
                             MessageBoxImage.Error);
     }
 }