示例#1
0
        private void btShowRode_Click(object sender, RoutedEventArgs e)
        {
            BL.BO.Line         line   = lineDataGrid.SelectedItem as BL.BO.Line;
            ShowLineRodeWindow window = new ShowLineRodeWindow(this.bl, line);

            window.Show();
        }
示例#2
0
 public UpdateLineWindow(IBL _bl, BL.BO.Line _line)
 {
     InitializeComponent();
     this.bl   = _bl;
     this.line = _line;
     lineStationDataGrid.ItemsSource = this.bl.GetRouteLine(this.line);
     cbCode.ItemsSource       = bl.GetAllPropertyStations("Code");
     areaComboBox.ItemsSource = Enum.GetValues(typeof(BL.BO.Areas));
     codeTextBox.Text         = this.line.Code.ToString();
     this.isItemSourceChanged = false;
 }
示例#3
0
 public ShowLineRodeWindow(IBL _bl, BL.BO.Line _line)
 {
     InitializeComponent();
     this.bl   = _bl;
     this.line = _line;
     try
     {
         lineStationDataGrid.DataContext = bl.GetRouteLine(this.line);
     }
     catch (BL.BO.BadStationException ex)
     {
         MessageBox.Show("Couldn't find line station: " + ex.Code);
     }
 }
示例#4
0
        private void btnAddStation_Click(object sender, RoutedEventArgs e)
        {
            if (tbIndex.Text != string.Empty)
            {
                this.index = int.Parse(tbIndex.Text);
                if (this.index < 0)
                {
                    MessageBox.Show("Index can't be negitive");
                    tbIndex.Text            = string.Empty;
                    btnAddStation.IsEnabled = false;
                    return;
                }
                if (this.index > this.line.LastStation.LineStationIndex + 1)
                {
                    MessageBox.Show("Index can't be out of range");
                    tbIndex.Text            = string.Empty;
                    btnAddStation.IsEnabled = false;
                    return;
                }
            }
            else
            {
                return;
            }
            try
            {
                bl.AddLineStation(this.line.LineID, this.index, this.stationCode);
                lineStationDataGrid.ItemsSource = this.bl.GetRouteLine(this.line);
                this.line = bl.GetLine(this.line.LineID);
            }
            catch (BL.BO.BadLineStationException ex)
            {
                MessageBox.Show(ex.Message);
                return;
            }

            MessageBox.Show("Station added successfully");
            tbIndex.Text            = string.Empty;
            btnAddStation.IsEnabled = false;
        }
 public UpdateLineTripWindow(IBL _bl, BL.BO.LineTrip _lineTripToUpdate)
 {
     InitializeComponent();
     this.bl = _bl;
     this.lineTripToUpdate = _lineTripToUpdate;
     try
     {
         lineTripToUpdate = bl.GetLineTrip(this.lineTripToUpdate.LineID, this.lineTripToUpdate.StartAt);
     }
     catch (BL.BO.BadLineTripException ex)
     {
         MessageBox.Show(ex.Message);
         this.Close();
     }
     BL.BO.Line line = bl.GetLine(this.lineTripToUpdate.LineID);
     tbLineCode.Text = line.Code.ToString();
     tbLineID.Text   = line.LineID.ToString();
     this.settingTime();
     cbHour.ItemsSource    = this.Hours;
     cbMinutes.ItemsSource = this.Minutes;
     this.hours            = this.lineTripToUpdate.StartAt.Hours;
     this.minutes          = this.lineTripToUpdate.StartAt.Minutes;
 }
示例#6
0
        private void btnDeleteStation_Click(object sender, RoutedEventArgs e)
        {
            var result = MessageBox.Show("Are you sure you want to delete this line station?", "Delete line station", MessageBoxButton.OKCancel);

            if (result == MessageBoxResult.OK)
            {
                try
                {
                    bl.DeleteLineStation(this.line.LineID, this.lineStationToDelete);
                }
                catch (BL.BO.BadLineStationException ex)
                {
                    MessageBox.Show(ex.Message);
                }
                isItemSourceChanged             = true;
                lineStationDataGrid.ItemsSource = this.bl.GetRouteLine(this.line);
                this.line = bl.GetLine(this.line.LineID);
                if (this.line.LastStation.LineStationIndex <= 1)
                {
                    btnDeleteStation.IsEnabled = false;
                }
                MessageBox.Show("Line station deleted successfully");
            }
        }
示例#7
0
 private void lineDataGrid_SelectionChanged(object sender, SelectionChangedEventArgs e)
 {
     this.line = (sender as DataGrid).SelectedItem as BL.BO.Line;
     btnUpdateLine.IsEnabled = true;
     btnDeleteLine.IsEnabled = true;
 }