예제 #1
0
        private void btnChangeSeat_Click(object sender, EventArgs e)
        {
            //ArrayList FlightList = new ArrayList();
            string seat          = null;
            int    num_of_ticket = 0;
            string seat_code1    = "";

            for (int r = 0; r < 30; r++)
            {
                for (int c = 0; c < 6; c++)
                {
                    while (picBox[r, c].Image == your_seat_icon)
                    {
                        seat_status[r, c]  = true;
                        picBox[r, c].Image = sold_icon;
                        if (r >= 12)        // skip 13A and 13F as 13th row
                        {
                            seat_code1 = Convert.ToString(r + 2);
                        }
                        else
                        {
                            seat_code1 = Convert.ToString(r + 1);
                        }
                        string seat_code2 = (Convert.ToChar(c + 65)).ToString();
                        seat += (seat_code1 + seat_code2) + " ";
                        num_of_ticket++;
                    }
                }
            }

            memberwithoutpurchased.Points = 0;

            ArrayList flightlist = new ArrayList();
            ArrayList memberlist = new ArrayList();

            memberlist.Add(memberwithoutpurchased);

            flightlist.Add(new MemberWithPurchased(memberwithoutpurchased.Name, memberwithoutpurchased.Ic,
                                                   memberwithoutpurchased.Email, memberwithoutpurchased.Gender,
                                                   memberwithoutpurchased.Id, memberwithoutpurchased.Password,
                                                   "KLIA2 - KUCHING (SARAWAK)", seat,
                                                   (20 * num_of_ticket), DateTime.Now.ToString("hh:mm:ss tt"),
                                                   DateTime.Now.ToShortDateString(), memberwithoutpurchased.Points));
            int        i      = 1;
            TicketForm ticket = new TicketForm();

            ticket.receive_info(flightlist);
            ticket.receive_info2(memberlist);
            ticket.receive_point(i);
            ticket.Show();
        }
예제 #2
0
        private void btnRedeem_Click(object sender, EventArgs e)
        {
            //ArrayList flightList = new ArrayList();
            string seat = null;
            int    num_of_ticket = 0, numOfTicketAvailable = 0;
            string seat_code1 = "";

            numOfTicketAvailable = memberwithoutpurchased.Points / 20;
            int count = 0;

            for (int r = 0; r < 30; r++)
            {
                for (int c = 0; c < 6; c++)
                {
                    if (picBox[r, c].Image == your_seat_icon)
                    {
                        count++;
                    }
                }
            }
            if (numOfTicketAvailable >= count)
            {
                for (int r = 0; r < 30; r++)
                {
                    for (int c = 0; c < 6; c++)
                    {
                        while (picBox[r, c].Image == your_seat_icon)
                        {
                            seat_status[r, c]  = true;
                            picBox[r, c].Image = sold_icon;
                            if (r >= 12)        // skip 13A and 13F as 13th row
                            {
                                seat_code1 = Convert.ToString(r + 2);
                            }
                            else
                            {
                                seat_code1 = Convert.ToString(r + 1);
                            }
                            string seat_code2 = (Convert.ToChar(c + 65)).ToString();
                            seat += (seat_code1 + seat_code2) + " ";
                            num_of_ticket++;
                            memberwithoutpurchased.Points -= num_of_ticket * 400;
                        }
                    }
                }

                ArrayList flightlist = new ArrayList();
                flightlist.Add(new MemberWithPurchased(memberwithoutpurchased.Name, memberwithoutpurchased.Ic,
                                                       memberwithoutpurchased.Email, memberwithoutpurchased.Gender,
                                                       memberwithoutpurchased.Id, memberwithoutpurchased.Password,
                                                       "KLIA2 - KUCHING (SARAWAK)", seat,
                                                       0, DateTime.Now.ToShortDateString(),
                                                       DateTime.Now.ToString("hh:mm:ss tt"), memberwithoutpurchased.Points));
                TicketForm ticket = new TicketForm();
                ticket.receive_info(flightlist);
                ticket.Show();
            }
            else
            {
                MessageBox.Show("You are not enough bonus points!");
            }
        }