예제 #1
0
        private void book_btn_Click(object sender, EventArgs e)
        {
            bool cardpayment = card_payment_rbtn.Checked == true;

            if (cardpayment)
            {
                ticket1.paymentType = 1;
                int pointsEarned = FormDatabaseHelper.getPointsEarnedFromCost(ticket1.paymentAmount);
                FormDatabaseHelper.updateUserReward(USER.id, pointsEarned);
            }
            else
            {
                ticket1.paymentType = 2;
                int pointsRedeem = FormDatabaseHelper.getPointsNeededForCost(ticket1.paymentAmount) * -1;
                FormDatabaseHelper.updateUserReward(USER.id, pointsRedeem);
            }

            // FormDatabaseHelper.insert_UserFlightHistory(ticket1);
            FormDatabaseHelper.createBooking(ticket1, USER);

            if (ROUNDTRIP)
            {
                if (cardpayment)
                {
                    ticket2.paymentType = 1;
                    int pointsEarned = FormDatabaseHelper.getPointsEarnedFromCost(ticket2.paymentAmount);
                    FormDatabaseHelper.updateUserReward(USER.id, pointsEarned);
                }
                else
                {
                    ticket2.paymentType = 1;
                    int pointsRedeem = FormDatabaseHelper.getPointsNeededForCost(ticket1.paymentAmount) * -1;
                    FormDatabaseHelper.updateUserReward(USER.id, pointsRedeem);
                }


                FormDatabaseHelper.createBooking(ticket2, USER);
            }

            this.Visible = false;
            this.Dispose();
        }