예제 #1
0
 private void btnCreateBooking_Click(object sender, EventArgs e)
 {
     if (dtpTodaysDate.Value.Day < dtpExpiryDate.Value.Day)
     {
         if (cbAddress.Checked == true && cbCustomer.Checked == true && cbItem.Checked == true)
         {
             DialogResult dr = new DialogResult();
             dr = MessageBox.Show("Are you sure you want to add this booking?", "Are you sure?", MessageBoxButtons.YesNo, MessageBoxIcon.Question);
             if (dr == DialogResult.Yes)
             {
                 CUser    user       = CUser.GetInstance();
                 CLogin   login      = CLogin.GetInstance();
                 CBooking booking    = new CBooking();
                 int      iBookingID = booking.CreateBooking(dtpTodaysDate.Value, dtpExpiryDate.Value);
                 bookinginstance.iUserID    = user.GetUserID(login.GetUser());
                 bookinginstance.iBookingID = iBookingID;
                 bookinginstance.CreateBookingInstance();
                 MessageBox.Show("Booking has been created.", "Note", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
             }
         }
         else
         {
             MessageBox.Show("Ensure that you have selected a customer, an address and an item.", "Note", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
         }
     }
     else
     {
         MessageBox.Show("Please select a date greater than todays date.", "Note", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
     }
 }
예제 #2
0
 public static CLogin GetInstance()
 {
     if (UniqueInstance == null)
     {
         UniqueInstance = new CLogin();
     }
     return(UniqueInstance);
 }