Esempio n. 1
0
        private void btnNext_Click(object sender, EventArgs e)
        {
            int    Age     = DateTime.Now.Year - Convert.ToDateTime(txtBirthDate.Text).Year;
            string Type    = null;
            bool   IsAdult = false;

            if (Age < 2)
            {
                Price = 0;
                Type  = "Бесплатный";
            }
            else if (Age >= 2 && Age <= 12)
            {
                Price = GetInfoForm.Price * 0.5;
                Type  = "Уцененный";
            }
            else if (Age > 12)
            {
                Type    = "Платный";
                Price   = GetInfoForm.Price;
                IsAdult = true;
            }

            PassengerList.Add(new Passenger($"{txtSecond.Text} {txtFirst.Text} {txtMiddle.Text}", Age, IsAdult, txtPassport.Text));
            TicketList.Add(new Ticket(PassengerList[PassengerList.Count - 1], "Пермь", GetInfoForm.ToWhere, Price, Type));

            if (PassangerCounter < Passenger.PassengerValue)
            {
                PassangerCounter++;
                Text = "Пассажир №" + (PassangerCounter);
            }
            else
            {
                Hide();
                FinalInfoForm finalInfoForm = new FinalInfoForm();
                finalInfoForm.Show();
            }
        }
Esempio n. 2
0
        private void btnNext_Click(object sender, EventArgs e)
        {
            int    Age     = DateTime.Now.Year - Convert.ToDateTime(txtBirthDate.Text).Year;
            double Price   = 0;
            bool   IsAdult = false;

            if (Age < 2)
            {
                Price = 0;
            }
            else if (Age >= 2 && Age <= 12)
            {
                Price = GetInfoForm.Price * 0.5;
            }
            else if (Age > 12)
            {
                Price   = GetInfoForm.Price;
                IsAdult = true;
            }

            Passenger.Add(new List <object> {
                txtSecond.Text, txtFirst.Text, txtMiddle.Text, Age, Price, IsAdult, txtPassport.Text
            });

            if (PassangerCounter < Passangers)
            {
                PassangerCounter++;
                Text = "Пассажир №" + (PassangerCounter);
            }
            else
            {
                Hide();
                FinalInfoForm finalInfoForm = new FinalInfoForm();
                finalInfoForm.Show();
            }
        }