HI,
i have the following code and i am getting the error
private Reservation getReservationDetails()
{
Customer c = GetCustomerDetails();
ManagerCustomers mgrCustomer = new ManagerCustomers();
int customerID = mgrCustomer.SearchCustomerByIDCardNumber(c.IDCardNumber);
DateTime reservationAdded = DateTime.Now;
int numberOfPeople = Convert.ToInt32(nudNumberOfPeople.Value.ToString());
string dateOfEvent = dtpReservationDate.Value.ToLongDateString();
string timeOfEvent = dtpEventTime.Value.ToLongTimeString();
DateTime dateTimeOfEvent = Convert.ToDateTime(dateOfEvent + " " + timeOfEvent);
int eventTypeID = Convert.ToInt32(cmbEventType.SelectedValue.ToString());
bool done = Convert.ToBoolean(cbReservationComplete.Checked.ToString());
bool cancelled = Convert.ToBoolean(cbCanceled.Checked.ToString());
int staffSelected = selectedStaff(dateTimeOfEvent);
int staffID = selectedStaff(dateTimeOfEvent);
Reservation res = new Reservation(reservationAdded, numberOfPeople, dateTimeOfEvent, eventTypeID, done, customerID, staffID, cancelled);
return res;
}
public bool AddReservation(Reservation r)
{
bool reservationIdUnique = IsUnique(r);
if (reservationIdUnique)
{
try
{
conn.Open();
SqlCommand comm = new SqlCommand("INSERT INTO tblReservation VALUES ('" + r.DateTimeReservation.ToString("MM/dd/yyyy") + "','" + r.NumberOfPeople + "','" + r.DateTimeOfEvent.ToString("MM/dd/yyyy") + "','" + r.EventTypeID + "','" + r.Done + "','" + r.CustomerID + "','" + r.StaffID + "','" + r.Cancelled + "')", conn);
comm.ExecuteNonQuery();
return true;
}
catch (Exception e)
{
MessageBox.Show(e.Message.ToString());
return false;
}
finally
{
conn.Close();
}
}
else
{
return false;
}
}