コード例 #1
0
        private void btnBook_Click(object sender, EventArgs e)
        {
            BookingConfirmationForm booking;
            FlightDetails           _o;
            FlightDetails           _r;

            var outboundCurrent = dgvOutbound.CurrentRow;

            _o = new FlightDetails
            {
                From          = outboundCurrent.Cells["From"].Value.ToString(),
                To            = outboundCurrent.Cells["To"].Value.ToString(),
                Date          = DateTime.ParseExact(outboundCurrent.Cells["Date"].Value.ToString(), @"dd-MMM-yy hh\:mm\:ss", null).Date,
                Time          = TimeSpan.ParseExact(outboundCurrent.Cells["Time"].Value.ToString(), @"hh\:mm\:ss", null),
                CabinPrice    = int.Parse(outboundCurrent.Cells["CabinPrice"].Value.ToString()),
                FlightNumber  = outboundCurrent.Cells["FlightNumber"].Value.ToString(),
                NumberOfStops = int.Parse(outboundCurrent.Cells["NumberOfStops"].Value.ToString())
            };

            if (rbReturn.Checked)
            {
                var returnCurrent = dgvReturn.CurrentRow;
                _r = new FlightDetails
                {
                    From          = returnCurrent.Cells["From"].Value.ToString(),
                    To            = returnCurrent.Cells["To"].Value.ToString(),
                    Date          = DateTime.ParseExact(returnCurrent.Cells["Date"].Value.ToString(), @"dd-MMM-yy hh\:mm\:ss", null).Date,
                    Time          = TimeSpan.ParseExact(returnCurrent.Cells["Time"].Value.ToString(), @"hh\:mm\:ss", null),
                    CabinPrice    = int.Parse(returnCurrent.Cells["CabinPrice"].Value.ToString()),
                    FlightNumber  = returnCurrent.Cells["FlightNumber"].Value.ToString(),
                    NumberOfStops = int.Parse(returnCurrent.Cells["NumberOfStops"].Value.ToString())
                };
                booking = new BookingConfirmationForm(cbCabin.Text, (int)nudPassenger.Value, _o, _r);
            }
            else
            {
                booking = new BookingConfirmationForm(cbCabin.Text, (int)nudPassenger.Value, _o);
            }

            booking.Owner = this;
            booking.ShowDialog();
        }
コード例 #2
0
 public BillingConfirmationForm(BookingConfirmationForm _booking)
 {
     InitializeComponent();
     booking = _booking;
 }