Exemplo n.º 1
0
 public Form2(Form1 fr1, Autopark autopark, List<AbstractTransport> transport, int selectedIndex)
 {
     InitializeComponent();
     this.Text = "Редактирование маршрута";
     form1 = fr1;
     transport1 = transport;
     autopark1 = autopark;
     button1.Visible = false;
     comboBox1.Visible = false;
     label1.Visible = false;
     Label[] labelBox = { label2, label3, label4, label5, label6, label7, label8, label9, label10, label11, label12, label13 };
     TextBox[] textBoxBox = { textBox1, textBox2, textBox3, textBox4, textBox5, textBox6, textBox7, textBox8, textBox9, textBox10, textBox11, textBox12 };
     for (int i = 0; i < 12; i++)
     {
         labelBox[i].Visible = false;
         textBoxBox[i].Visible = false;
     }
     route = transport[selectedIndex];
     if (route != null)
     {
         label2.Visible = true;
         label3.Visible = true;
         label4.Visible = true;
         textBox1.Visible = true;
         textBox2.Visible = true;
         textBox3.Visible = true;
         textBox1.Text = route.Name;
         textBox2.Text = route.Way;
         textBox3.Text = Convert.ToString(route.Price);
     }
 }
Exemplo n.º 2
0
        public static int CalculatePrice(Autopark autopark)
        {
            int totalPrice = 0;

            List<AbstractTransport> transport = autopark.Transport;

            foreach (AbstractTransport route in transport)
            {
                if (route.Price != null)
                    totalPrice = totalPrice + route.Price;
            }

            return totalPrice;
        }
Exemplo n.º 3
0
        public static void Print(Autopark autopark, int totalPrice)
        {
            List<AbstractTransport> transport = autopark.Transport;

            foreach (AbstractTransport route in transport)
            {
                Console.WriteLine("Название: " + route.Name);
                Console.WriteLine("Цена проезда: " + route.Price);
                Console.WriteLine("Путь: " + route.Way);
                Console.WriteLine();
            }

            Console.WriteLine("Общая стоимость поездки: " + totalPrice);
            Console.ReadKey();
        }
Exemplo n.º 4
0
 public Form2(Form1 fr1, Autopark autopark, List<AbstractTransport> transport)
 {
     InitializeComponent();
     this.Text = "Добавление маршрута";
     form1 = fr1;
     transport1 = transport;
     autopark1 = autopark;
     button3.Visible = false;
     comboBox1.Items.Add("Автобусы");
     comboBox1.Items.Add("Маршрутные такси");
     comboBox1.Items.Add("Такси");
     comboBox1.Items.Add("Трамваи");
     Label[] labelBox = { label2, label3, label4, label5, label6, label7, label8, label9, label10, label11, label12, label13 };
     TextBox[] textBoxBox = { textBox1, textBox2, textBox3, textBox4, textBox5, textBox6, textBox7, textBox8, textBox9, textBox10, textBox11, textBox12 };
     for (int i = 0; i < 12; i++)
     {
         labelBox[i].Visible = false;
         textBoxBox[i].Visible = false;
     }
 }
Exemplo n.º 5
0
        public static Autopark CreateAutopark()
        {
            Minibuses minibuses1 = new Minibuses();
            minibuses1.Name = "Mercedes-Benz V250";
            minibuses1.Price = 2452;
            minibuses1.Way = "Москва - Санкт-Петербург";
            minibuses1.Company = "ПАТП";
            minibuses1.Fuelconsumption = 12;
            minibuses1.Gradyear = 1998;

            Taxi taxi1 = new Taxi();
            taxi1.Name = "BMW M5";
            taxi1.Price = 300;
            taxi1.Way = "Вокзал - Киевская 23";
            taxi1.Company = "Лидер";
            taxi1.Color = "Синий";
            taxi1.Speed = 60;

            Autopark autopark = new Autopark();
            autopark.AddTransport(minibuses1);
            autopark.AddTransport(taxi1);

            return autopark;
        }