private void btnSave_Click(object sender, EventArgs e) { try { bfc = new BookingFacilityControl(); sports = new SportsAllEntities(); book = new booking(); svf = new slotvsFacility(); book.BookingId = Convert.ToInt32(txtbookingId.Text); book.MemberId = Convert.ToInt32(txtMemId.Text); book.FacilityId = GetSelectedFacility; book.SlotID = Convert.ToInt32(HiddenSlotIdLabel.Text); book.DateOfUse = dateOfUseddtp.Value.ToShortDateString(); book.WeekdayName = dateOfUseddtp.Value.DayOfWeek.ToString(); book.confirmed = "Y"; bfc.saveBooking(book); DialogResult r = MessageBox.Show("Do you want a Booking Receipt", "Booking Receipt", MessageBoxButtons.YesNo, MessageBoxIcon.Information); if (r == System.Windows.Forms.DialogResult.Yes) { bfc.showBookingReceipt(book.BookingId); } displayControlValues(); } catch (Exception ex) { MessageBox.Show(ex.Message); } }
public void displayControlValues() { bfc = new BookingFacilityControl(); txtbookingId.Text = bfc.display(); txtMemId.Text = ""; txttimeFrom.Text = ""; txtTimeTo.Text = ""; FacilityNamecombobox.Items.Clear(); MemNamelabel.Visible = false; btnSave.Enabled = true; List <facility> facilitynames = new List <facility>(); foreach (facility f in bfc.getFacilities().ToList <facility>()) { FacilityNamecombobox.Items.Add(f.FacilityId + " " + f.FacilityName); } }