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(); }
private void createButton() { var query = (from s in db.tbl_Schedules join p in db.tbl_Planes on s.id_plane equals p.id_plane where s.id_schedule == idSchedule select p).FirstOrDefault(); seat = query.seat_plane / 5; //seat2 = Math.Sqrt(seat); Button[,] btnArray = new Button[5, seat]; String[] huruf = new String[] { "A", "B", "C", "D", "E", "F", "G", "H", "I", "J" }; for (int i = 0; i < 5; i++) { FlowLayoutPanel pnl = new FlowLayoutPanel(); //pnl.Anchor = AnchorStyles.Top | AnchorStyles.Right | AnchorStyles.Left; pnl.Dock = DockStyle.Top; pnl.Width = this.flowLayoutPanel1.Width - 5; pnl.Height = 40; this.flowLayoutPanel1.Controls.Add(pnl); for (int j = 0; j < seat; j++) { btnArray[i, j] = new Button(); btnArray[i, j].Name = huruf[i] + "" + (j + 1); btnArray[i, j].Text = huruf[i] + "" + (j + 1); btnArray[i, j].Width = 40; btnArray[i, j].Height = 40; btnArray[i, j].FlatStyle = FlatStyle.Flat; btnArray[i, j].FlatAppearance.BorderSize = 0; btnArray[i, j].Tag = i + "," + j; bkd = db.tbl_BookingDetails.FirstOrDefault(x => x.no_seat == btnArray[i, j].Name); if (bkd == null) { for (int h = 0; h < dgvBookingdetail.RowCount; h++) { if (dgvBookingdetail[5, h].Value.ToString() != btnArray[i, j].Name) { btnArray[i, j].Enabled = true; btnArray[i, j].BackColor = Color.Green; } } btnArray[i, j].BackColor = Color.Green; } else { btnArray[i, j].BackColor = Color.Red; btnArray[i, j].Enabled = false; } pnl.Controls.Add(btnArray[i, j]); btnArray[i, j].Click += new EventHandler(btnArray_Click); } } }
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); } } }
private void btnArray_Click(object sender, EventArgs e) { Button current = sender as Button; String pos = current.Tag.ToString().Split(',')[0]; bkd = db.tbl_BookingDetails.FirstOrDefault(i => i.no_seat == current.Name); if (bkd != null) { current.BackColor = Color.Red; current.Enabled = false; } else { if (current.BackColor == Color.Yellow) { current.Enabled = false; } else { current.BackColor = Color.Yellow; if (new DataLookUpBooking(tbIdbooking.Text, tbIdschedule.Text, idPlane).ShowDialog() == DialogResult.OK) { dgvBookingdetail.Rows.Add(session.idCustomer, session.customerName, session.idConsumption, session.consumptionName, session.quantity, session.quantity * session.priceConsumption, current.Name); harga = (int)hargatot; for (int i = 0; i < dgvBookingdetail.RowCount; i++) { harga += int.Parse(dgvBookingdetail[5, i].Value.ToString()); } lblTotal.Text = String.Format("{0:C}", harga); price = harga; } else { current.BackColor = Color.Green; } } } }
public bool BookingDetails(int selectedVendorId, string custname, string custemail, string custcontact) { bool _isBooked = false; try { tbl_BookingDetail BookingObj = new tbl_BookingDetail(); BookingObj.VendorID = selectedVendorId; BookingObj.CustName = custname; BookingObj.CustEmail = custemail; BookingObj.CustContact = custcontact; dbContext.tbl_BookingDetails.InsertOnSubmit(BookingObj); dbContext.SubmitChanges(); _isBooked = true; } catch (Exception ex) { } return(_isBooked); }
public List <Booking> showBooking(int vid) { tbl_BookingDetail BObj = new tbl_BookingDetail(); var obj = (from r in dbContext.tbl_BookingDetails where r.VendorID == vid select r); foreach (var Booking in obj) { Booking b = new Booking(); if (Booking != null) { b.CustName = Booking.CustName; b.CustEmail = Booking.CustEmail; b.CustContact = Booking.CustContact; b.VendorId = (int)Booking.VendorID; vname.Add(b); } } return(vname); }
partial void Deletetbl_BookingDetail(tbl_BookingDetail instance);
partial void Updatetbl_BookingDetail(tbl_BookingDetail instance);
partial void Inserttbl_BookingDetail(tbl_BookingDetail instance);