private void update_Click(object sender, EventArgs e) { if (FacilityID_textBox.Text == "") { FacilityName_textBox.Text = null; RentalCost_textBox.Text = null; Location_textBox.Text = null; StatusLabel.Text = "Updating...Please select the Facility which you want to update "; } else { RetrieveUIValues(); context.SaveChanges(); FacilityID_textBox.Text = null; FacilityName_textBox.Text = null; RentalCost_textBox.Text = null; Location_textBox.Text = null; StatusLabel.Text = "Update complete ! "; } }
private void button2_Click(object sender, EventArgs e) { Member M = new Member(); M.MemberName = Name_textBox.Text; if (rbGenderMale.Checked == true) { string m = "m"; M.Gender = m; } else { string m = "f"; M.Gender = m; } M.Address = Address_textBox.Text; M.PhoneNumber = Phone_textBox.Text; context.Members.Add(M); context.SaveChanges(); }
// this is for cancel button private void btnSubmit_Click(object sender, EventArgs e) { // it change the status in database var bookinid = Convert.ToInt32(tbBookingID.Text); book = SA46.Bookings.Where(x => x.BookingID == bookinid).First(); book.Status = "cancel"; // this is for after cancellation that slot will be to make available var available = from x in SA46.Availabilities where x.FacilityID == book.FacilityID && x.DateOfBooking == book.DateOfBooking select x; availability = available.First(); switch (book.Slot) { case 1: availability.Slot1 = true; break; case 2: availability.Slot2 = true; break; case 3: availability.Slot3 = true; break; case 4: availability.Slot4 = true; break; case 5: availability.Slot5 = true; break; case 6: availability.Slot6 = true; break; case 7: availability.Slot7 = true; break; case 8: availability.Slot8 = true; break; case 9: availability.Slot9 = true; break; case 10: availability.Slot10 = true; break; case 11: availability.Slot11 = true; break; case 12: availability.Slot12 = true; break; } MessageBox.Show("cancel successfully..."); SA46.SaveChanges(); // now change the status in textbox into cancel tbStatus.Text = "cancel"; // after cancellation, cancel button disabled. cancelDis(); }