private void FillGridView(List<Passenger> ResultPas)
 {
     this.dataGridView1.Rows.Clear();
     foreach (Passenger Psg in ResultPas)
     {
         this.dataGridView1.Rows.Add(false, Psg.ID, Psg.LastName, Psg.FirstName, Psg.CountOfTickets);
     }
 }
 private void FillGridView(List<Station> stns)
 {
     this.tableStations.Rows.Clear();
     foreach (Station stn in stns)
     {
         this.tableStations.Rows.Add(false, stn.Name, stn.X, stn.Y);
     }
 }
        private void FillResultFormAndShowIt(List<Passenger> Psgs)
        {
            PsgResultByParams FormResultPasByParams = new PsgResultByParams();
            FormResultPasByParams.Owner             = this;

            foreach (Passenger Psg in Psgs)
            {
                FormResultPasByParams.TablePas.Rows.Add(Psg.ID, Psg.LastName, Psg.FirstName, Psg.CountOfTickets);
            }

            FormResultPasByParams.ShowDialog();
        }
 public void FillTable(List<Passenger> passengers)
 {
     TablePas.Rows.Clear();
     if (TablePas.Columns.Contains("PointArr"))
     {
         TablePas.Columns.Remove("PointArr");
     }
     TablePas.Columns[0].HeaderText = "Номер паспорта";
     TablePas.Columns[1].HeaderText = "Фамилия";
     TablePas.Columns[2].HeaderText = "Имя";
     TablePas.Columns[3].HeaderText = "Билет";
     foreach (Passenger Psg in passengers)
     {
         TablePas.Rows.Add(Psg.ID, Psg.LastName, Psg.FirstName, Psg.CountOfTickets);
     }
 }
 public void FillTable(List<Train> trains)
 {
     TablePas.Rows.Clear();
     if (!TablePas.Columns.Contains("PointArr"))
     {
         TablePas.Columns.Add("PointArr", "Пункт прибытия");
     }
     TablePas.Columns[0].HeaderText = "Номер поезда";
     TablePas.Columns[1].HeaderText = "Время отправления";
     TablePas.Columns[2].HeaderText = "Пункт отправления";
     TablePas.Columns[3].HeaderText = "Время прибытия";
     TablePas.Columns[4].HeaderText = "Пункт прибытия";
     foreach (Train Trn in trains)
     {
         TablePas.Rows.Add(Trn.Number, Trn.TimeOfDeparture, Trn.PointOfDeparture, Trn.TimeOfArrival, Trn.PointOfArrival);
     }
 }
 private void button1_Click(object sender, EventArgs e)
 {
     List<int> delPsgs = new List<int>();
     for (int i = 0; i < dataGridView1.RowCount; i++)
     {
         if (Convert.ToBoolean(dataGridView1.Rows[i].Cells[0].Value))
         {
             int del = Convert.ToInt32(dataGridView1.Rows[i].Cells[1].Value);
             delPsgs.Add(del);
         }
     }
     foreach (int numPsg in delPsgs)
     {
         Passenger delete = Passenger.Search(numPsg);
         List.RemoveFromAllPassengers(delete);
     }
     FormEditPassengers_Activated(sender, e);
 }
 private void button1_Click(object sender, EventArgs e)
 {
     List<string> delStns = new List<string>();
      for (int i = 0; i < tableStations.RowCount; i++)
      {
          if (Convert.ToBoolean(tableStations.Rows[i].Cells[0].Value))
          {
              string stn = Convert.ToString(tableStations.Rows[i].Cells[1].Value);
              delStns.Add(stn);
          }
      }
      foreach (string numStn in delStns)
      {
          Station delete = Station.SearchByName(numStn);
          delete.RemoveFromAllStations();
      }
      FormEditRoute_Activated(sender, e);
 }
        private void button1_Click(object sender, EventArgs e)
        {
            List<int> delTrns = new List<int>();
            for (int i = 0; i < dataGridView1.RowCount; i++)
            {
                if (Convert.ToBoolean(dataGridView1.Rows[i].Cells[0].Value))
                {
                    int del = Convert.ToInt32(dataGridView1.Rows[i].Cells[1].Value);
                    delTrns.Add(del);
                }
            }
            foreach (int numTrn in delTrns)
            {
                Train delete = Train.Search(numTrn);
                delete.RemoveFromAllTrains();

            }
            FormEditTrains_Activated(sender, e);
        }
 private void FillTreeviewTicket(List<Ticket> tkts)
 {
     treeView1.Nodes[0].Nodes[2].Nodes[0].Nodes.Clear();
     treeView1.Nodes[0].Nodes[2].Nodes[1].Nodes.Clear();
     foreach (Ticket tkt in tkts)
     {
         if (tkt.Type == "Плацкарт")
         { treeView1.Nodes[0].Nodes[2].Nodes[0].Nodes.Add(tkt.Train.Number.ToString()
             +" "+ tkt.Train.PointOfDeparture
             + " - " + tkt.Train.PointOfArrival); }
         if (tkt.Type == "Купе")
         {
             treeView1.Nodes[0].Nodes[2].Nodes[1].Nodes.Add(tkt.Train.Number.ToString()
               + " " + tkt.Train.PointOfDeparture
               + " - " + tkt.Train.PointOfArrival);
         }
     }
 }
Exemple #10
0
 /// <summary>
 /// Рисует список поездов.
 /// </summary>
 /// <param name="trains"></param>
 /// <param name="g"></param>
 private void DrawTrains(List<Train> trains, Graphics g)
 {
     foreach(Train train in trains)
     {
         DrawTrain(train, g);
     }
 }
Exemple #11
0
 /// <summary>
 /// Рисует станции из списка станций.
 /// </summary>
 /// <param name="stations">Список станций, которые нужно нарисовать.</param>
 /// <param name="e"></param>
 private void DrawStations(List<Station> stations, Graphics g)
 {
     foreach (Station station in stations)
     {
         DrawStation(station, g);
     }
 }
Exemple #12
0
 /// <summary>
 /// Рисует маршруты всех указанных поездов.
 /// </summary>
 /// <param name="trains">Список поездов, маршруты которых следует отрисовать.</param>
 /// <param name="e"></param>
 private void DrawRoutes(List<Train> trains, Graphics g)
 {
     foreach (Train train in trains)
     {
         List<RouteNode> routenodes = train.RouteNodes;
         DrawRoute(routenodes, g);
     }
 }
Exemple #13
0
 /// <summary>
 /// Рисует маршрут поезда.
 /// </summary>
 /// <param name="routenodes">Список узлов маршрута.</param>
 /// <param name="e"></param>
 private void DrawRoute(List<RouteNode> routenodes, Graphics g)
 {
     List<PointF> points = new List<PointF>();
     foreach (RouteNode routenode in routenodes)
     {
         PointF point = new PointF(routenode.Station.X + radiusStation, routenode.Station.Y + radiusStation);
         points.Add(point);
     }
     g.DrawLines(new Pen (Brushes.Black, 2), points.ToArray());
 }
 private void FillGridView(List<Train> ResultTrn)
 {
     this.dataGridView1.Rows.Clear();
     foreach (Train Trn in ResultTrn)
     {
         this.dataGridView1.Rows.Add(false, Trn.Number, Trn.PointOfDeparture, Trn.PointOfArrival);
     }
 }