Exemplo n.º 1
0
        private void btnHawaii2_Click(object sender, EventArgs e)
        {
            string       trip = "Hawaii";
            int          airFarePrice;
            int          motelPrice;
            int          foodTour;
            int          hikingTour;
            const string FILENAME = "trips.txt";

            // Temporary file
            FileStream   outFile = new FileStream(FILENAME, FileMode.Create, FileAccess.Write);
            StreamWriter writer  = new StreamWriter(outFile);

            airFarePrice = 510;
            motelPrice   = 293;
            foodTour     = 100;
            hikingTour   = 100;


            if (rdb1.Checked == true)
            {
                // Display Book for 1 Person Form
                BookTrip1P frmBookTripFor1Person = new BookTrip1P();
                frmBookTripFor1Person.StartPosition = FormStartPosition.CenterScreen;
                frmBookTripFor1Person.Show();
                // this.Hide();
            }
            if (rdb2.Checked == true)
            {
                airFarePrice = 510 * 2;
                motelPrice   = 293 * 2;
                foodTour     = 100 * 2;
                hikingTour   = 100 * 2;

                // Display Book for Two People Form
                BookTrip2P frmBookTripFor2People = new BookTrip2P();
                frmBookTripFor2People.StartPosition = FormStartPosition.CenterScreen;
                frmBookTripFor2People.Show();
                // this.Hide();
            }
            writer.WriteLine(trip);
            writer.WriteLine(airFarePrice);
            writer.WriteLine(motelPrice);
            writer.WriteLine(foodTour);
            writer.WriteLine(hikingTour);
            // Close file
            // temp
            writer.Close();
            outFile.Close();
        }
Exemplo n.º 2
0
        private void btnCruise2_Click(object sender, EventArgs e)
        {
            string       trip = "Cruise";
            int          ticketPrice;
            const string FILENAME = "trips.txt";

            // Temporary file
            FileStream   outFile = new FileStream(FILENAME, FileMode.Create, FileAccess.Write);
            StreamWriter writer  = new StreamWriter(outFile);

            ticketPrice = 6000;


            if (rdb1.Checked == true)
            {
                // Display Book for 1 Person Form
                BookTrip1P frmBookTripFor1Person = new BookTrip1P();
                frmBookTripFor1Person.StartPosition = FormStartPosition.CenterScreen;
                frmBookTripFor1Person.Show();
                // this.Hide();
            }
            if (rdb2.Checked == true)
            {
                ticketPrice = 6000 * 2;

                // Display Book for Two People Form
                BookTrip2P frmBookTripFor2People = new BookTrip2P();
                frmBookTripFor2People.StartPosition = FormStartPosition.CenterScreen;
                frmBookTripFor2People.Show();
                // this.Hide();
            }
            writer.WriteLine(trip);
            writer.WriteLine(ticketPrice);

            // Close file
            // temp
            writer.Close();
            outFile.Close();
        }