private void btnDeserializeJourney_Click(object sender, EventArgs e) { string filePath = @"C:\Users\Серий\source\copies\FlightRecord\objects\Journey.xml"; Journey[] journeys = new Journey[Journey.Items.Count]; for (int i = 0; i < journeys.Count(); i++) { journeys[i] = Journey.Items[i]; } XmlSerializer xmlSerializer = new XmlSerializer(typeof(Journey[])); WorkFile(xmlSerializer, filePath, journeys, false, typeof(Journey)); }
public void AddJourney(string fromCity, string toCity, string date) { if (JourneysManager.FindJourney(fromCity, toCity, date)) { string timeAndPrice = JourneysManager.FindJourneyTimeAndPrice(fromCity, toCity, date); string[] ArrTimeAndPrice = timeAndPrice.Split(' '); string time = ArrTimeAndPrice[0]; string price = ArrTimeAndPrice[1]; Journey journeyAdd = new Journey(fromCity, toCity, date, time, price); journeysInPannier.Add(journeyAdd); MessageBox.Show("You have added journey to your list in pannier"); } else { MessageBox.Show("Such journey is not available"); } }
private void btnReWrite_Click(object sender, EventArgs e) { Journey findJourney = JourneysManager.FindJourney(textBoxIdOfJourneyToFind.Text); comboBoxFromCity.Items.Remove(findJourney.FromCity); comboBoxToCity.Items.Remove(findJourney.ToCity); comboBoxDateTime.Items.Remove(findJourney.Date); findJourney.ToCity = textBoxRewToCity.Text; findJourney.FromCity = textBoxRewFromCity.Text; findJourney.Date = dateTimePickerRewDate.Text; comboBoxFromCity.Items.Add(findJourney.FromCity); comboBoxToCity.Items.Add(findJourney.ToCity); comboBoxDateTime.Items.Add(findJourney.Date); textBoxRewFromCity.Text = ""; textBoxRewToCity.Text = ""; dateTimePickerRewDate.Text = ""; textBoxIdOfJourneyToFind.Text = ""; }
public static void AddJourney(string fromCity, string toCity, string date, string time, string price, List <Plane> planes) { Journey journey = new Journey(fromCity, toCity, date, time, price); journey.Planes = planes; }
private void lbJourneys_SelectedIndexChanged(object sender, EventArgs e) { Journey journey = (Journey)lbJourneys.SelectedItem; SetListBox <Client>(lbClientsOfSelectedJourney, journey.clients); }