Example #1
0
        private void checkout_btn_Click(object sender, EventArgs e)
        {
            bool confirmed = false;

            if (return_rBtn.Checked == true)
            {
                confirmed = onewayConfirm_checkbox.Checked && return_confirm_checkBox.Checked;
            }
            else
            {
                confirmed = onewayConfirm_checkbox.Checked;
            }

            if (confirmed)
            {
                Console.WriteLine("one way ids" + oneway_leg1 + " &" + oneway_leg2);
                Console.WriteLine("one way ids" + return_leg1 + " &" + return_leg2);
                UserFlightHistory ticket1 = new UserFlightHistory(USER.id, oneway_leg1, oneway_leg2);
                if (return_rBtn.Checked == true)
                {
                    UserFlightHistory ticket2  = new UserFlightHistory(USER.id, return_leg1, return_leg2);
                    Checkout          checkout = new Checkout(true, USER, ticket1, ticket2);
                    checkout.Show();
                }
                else
                {
                    Checkout checkout = new Checkout(false, USER, ticket1, null);
                    checkout.Show();
                }
            }
            else
            {
                Console.WriteLine("Confirm both flight");
            }
        }
Example #2
0
        public BoardingPass(User user, int ufh_id)
        {
            UserFlightHistory ticket = FormDatabaseHelper.GetUserFlightHistory(ufh_id);

            InitializeComponent();

            name_value_label.Text    = user.lastName + " , " + user.firstName;
            account_value_label.Text = user.id.ToString();
            leg1_groupbox.Show();
            leg2_groupbox.Hide();
            layover_label.Hide();
            String fullflight = "";

            String leg1ID        = "";
            String leg1_flight   = "";
            String leg1departure = "";
            String leg1Arrival   = "";

            String layover = "";

            String leg2ID        = "";
            String leg2_flight   = "";
            String leg2departure = "";
            String leg2Arrival   = "";


            leg1ID        = ticket.leg1bookingId.ToString();
            leg2ID        = ticket.leg2bookingId.ToString();
            leg1departure = ticket.departureDate.ToString();

            if (ticket.leg2bookingId == 0)
            {
                fullflight  = ticket.originAbv + " ----> " + ticket.finaldestAbv;
                leg1Arrival = ticket.arrivalDate.ToString();
                leg1_flight = ticket.originAbv + " ----> " + ticket.finaldestAbv;
            }
            else
            {
                fullflight    = ticket.originAbv + " ----> " + ticket.connectionAbv + " ---- >" + ticket.finaldestAbv;
                leg1_flight   = ticket.originAbv + " ----> " + ticket.connectionAbv;
                leg1Arrival   = ticket.leg1ArrivalDate.ToString();
                leg2departure = ticket.leg2deptDate.ToString();
                leg2Arrival   = ticket.arrivalDate.ToString();
                leg2_flight   = ticket.connectionAbv + " ---- >" + ticket.finaldestAbv;

                TimeSpan diff = ticket.leg2deptDate - ticket.leg1ArrivalDate;

                layover = diff.Hours.ToString() + "Hrs " + diff.Minutes + " min " + "Layover ";

                layover_label.Show();
                leg2_groupbox.Show();
            }

            fullflight_value_label.Text = fullflight;

            leg1_flightid_label.Text      = leg1ID;
            leg1_dept_value_label.Text    = leg1departure;
            leg1_arrival_value_label.Text = leg1Arrival;
            leg1_flight_label.Text        = leg1_flight;

            layover_label.Text = layover;

            leg2_flightid_label.Text      = leg2ID;
            leg2_dept_value_label.Text    = leg2departure;
            leg2_arrival_value_label.Text = leg2Arrival;
            leg2_flight_label.Text        = leg2_flight;
        }
Example #3
0
        public Checkout(bool tripTypeisReturn, User user, UserFlightHistory fh1, UserFlightHistory fh2)
        {
            USER      = user;
            ticket1   = fh1;
            ticket2   = fh2;
            ROUNDTRIP = tripTypeisReturn;
            InitializeComponent();
            userid_label.Text             = user.id.ToString();
            userreward_balance_label.Text = user.rewardBalance.ToString();

            double totalcost = fh1.paymentAmount;
            String fh1_str   = "";

            fh1.userID = user.id;


            if (fh1.leg2bookingId == 0)
            {
                fh1_str = fh1.originAbv + "--->" + fh1.finaldestAbv + " | " + fh1.departureDate.ToString() + " | " + fh1.arrivalDate.ToString();
            }
            else
            {
                fh1_str = fh1.originAbv + "-->" + fh1.connectionAbv + "-->" + fh1.finaldestAbv + " | " + fh1.departureDate.ToString() + " | " + fh1.arrivalDate.ToString();
            }
            flight1_value_label.Text = fh1_str;

            if (tripTypeisReturn)
            {
                fh2.userID = user.id;
                flight2_value_label.Show();
                flight2_label.Show();
                String fh2_str = "";
                totalcost += fh2.paymentAmount;
                if (fh2.leg2bookingId == 0)
                {
                    fh2_str = fh2.originAbv + "--->" + fh2.finaldestAbv + " | " + fh2.departureDate.ToString() + " | " + fh2.arrivalDate.ToString();
                }
                else
                {
                    fh2_str = fh2.originAbv + "-->" + fh2.connectionAbv + "-->" + fh2.finaldestAbv + " | " + fh2.departureDate.ToString() + " | " + fh2.arrivalDate.ToString();
                }
                flight2_value_label.Text = fh2_str;
            }
            else
            {
                flight2_value_label.Hide();
                flight2_label.Hide();
            }

            int pointsReq = FormDatabaseHelper.getPointsNeededForCost(totalcost);

            if (pointsReq > user.rewardBalance)
            {
                point_payment_rbtn.Hide();
                notenoughpoints_label.Show();
            }
            else
            {
                point_payment_rbtn.Show();
                notenoughpoints_label.Hide();
            }
        }