Ejemplo n.º 1
0
        private void btnPay_Click(object sender, EventArgs e)
        {
            bkm = new tbl_BookingMaster
            {
                date_booking = DateTime.Now,
                id_schedule  = tbIdschedule.Text,
                total_price  = price
            };

            db.tbl_BookingMasters.InsertOnSubmit(bkm);
            db.SubmitChanges();

            for (int i = 0; i < dgvBookingdetail.RowCount; i++)
            {
                bkd = new tbl_BookingDetail
                {
                    id_booking     = bkm.id_booking,
                    id_customer    = int.Parse(dgvBookingdetail[0, i].Value.ToString()),
                    no_seat        = dgvBookingdetail[6, i].Value.ToString(),
                    id_consumption = int.Parse(dgvBookingdetail[2, i].Value.ToString()),
                    quantity       = int.Parse(dgvBookingdetail[4, i].Value.ToString())
                };

                db.tbl_BookingDetails.InsertOnSubmit(bkd);
                db.SubmitChanges();
            }

            MessageBox.Show("Thanks for your booking!\n Happy Fligh", Application.ProductName, MessageBoxButtons.OK, MessageBoxIcon.Information);
            this.Close();
        }
Ejemplo n.º 2
0
        private void btnSubmit_Click(object sender, EventArgs e)
        {
            if (listView1.Items.Count < 1)
            {
                MessageBox.Show("Please registered a Customer", Application.ProductName, MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }

            else
            {
                DialogResult fc = MessageBox.Show("Are you sure want to add this data?", Application.ProductName, MessageBoxButtons.YesNo, MessageBoxIcon.Information);
                if (fc == DialogResult.No)
                {
                    return;
                }
                if (total < listView1.Items.Count)
                {
                    MessageBox.Show("Stock Full", Application.ProductName, MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
                else
                {
                    bok = new tbl_BookingMaster
                    {
                        id_schedule  = int.Parse(idSchedule),
                        total_ticket = listView1.Items.Count,
                        booking_date = DateTime.Now,
                        status       = "NOT PAID"
                    };
                    db.tbl_BookingMasters.InsertOnSubmit(bok);
                    db.SubmitChanges();

                    int id = bok.id_booking;
                    for (int i = 0; i < listView1.Items.Count; i++)
                    {
                        bokd = new tbl_BookingDetail
                        {
                            id_booking  = id,
                            id_customer = int.Parse(idCustomer)
                        };
                        db.tbl_BookingDetails.InsertOnSubmit(bokd);
                        db.SubmitChanges();
                    }
                    MessageBox.Show("Booking data success!", Application.ProductName, MessageBoxButtons.OK, MessageBoxIcon.Information);
                }
            }
        }