示例#1
0
        private void btnFindJourney_Click(object sender, EventArgs e)
        {
            Journey findJourney = JourneysManager.FindJourney(textBoxIdOfJourneyToFind.Text);

            textBoxRewFromCity.Text    = findJourney.FromCity;
            textBoxRewToCity.Text      = findJourney.ToCity;
            dateTimePickerRewDate.Text = findJourney.Date;
        }
示例#2
0
        private void BtnChoose_Click(object sender, EventArgs e)
        {
            string fromCity = comboBoxFromCity.Text;
            string toCity   = comboBoxToCity.Text;
            string date     = comboBoxDateTime.Text;
            InitialInfoAboutClient infoClient = new InitialInfoAboutClient();

            infoClient.FromCity = fromCity;
            infoClient.ToCity   = toCity;
            infoClient.Date     = date;

            string journeyTime  = JourneysManager.GetJourney(fromCity, toCity, date).Time;
            string journeyPrice = JourneysManager.GetJourney(fromCity, toCity, date).Price;

            comboBoxFromCity.Text = "";
            comboBoxToCity.Text   = "";
            comboBoxDateTime.Text = "";
            InitialInfoAboutJourney.TemporaryJourney.Add(JourneysManager.GetJourney(fromCity, toCity, date));
            RefreshLB <Journey>(lbClientJourneys, InitialInfoAboutJourney.TemporaryJourney);
        }
示例#3
0
        private void btnRegister_Click(object sender, EventArgs e)
        {
            string FirstName = textBoxFirstNameClient.Text;
            string LastName  = textBoxLastNameClient.Text;
            string Email     = textBoxEmailClient.Text;
            string Password  = textBoxPasswordClient.Text;

            Client client = new Client(FirstName, LastName, Email, Password);

            Pannier pannier  = new Pannier();
            string  fromCity = "";
            string  toCity   = "";
            string  date     = "";


            foreach (Journey Temjourney in InitialInfoAboutJourney.TemporaryJourney)
            {
                fromCity = Temjourney.FromCity;
                toCity   = Temjourney.ToCity;
                date     = Temjourney.Date;

                JourneysManager.GetJourney(fromCity, toCity, date).clients.Add(client);
                pannier.journeysInPannier.Add(JourneysManager.GetJourney(fromCity, toCity, date));
                client.ClientPannier = pannier;
                comboBoxClientId.Items.Add(client.ID.ToString());

                List <Plane> planes = JourneysManager.GetJourney(fromCity, toCity, date).Planes;
                foreach (Plane plane in planes)
                {
                    if (plane is BigPlane)
                    {
                        if (checkBoxBig.Checked)
                        {
                            plane.SetSitsForClient(client);
                            client.Plane = plane;
                        }
                    }
                    if (plane is MediumPlane)
                    {
                        if (checkBoxMiddle.Checked)
                        {
                            plane.SetSitsForClient(client);
                            client.Plane = plane;
                        }
                    }
                    if (plane is SmallPlane)
                    {
                        if (checkBoxSmall.Checked)
                        {
                            plane.SetSitsForClient(client);
                            client.Plane = plane;
                        }
                    }
                }
            }

            textBoxFirstNameClient.Text = "";
            textBoxLastNameClient.Text  = "";
            textBoxEmailClient.Text     = "";
            textBoxPasswordClient.Text  = "";


            MessageBox.Show(client.ToString());
            MessageBox.Show("You are registered");

            lbClientJourneys.DataSource = null;
            InitialInfoAboutJourney.TemporaryJourney = new List <Journey>();
        }