private void button1_Click(object sender, EventArgs e) { BLLBooking booking = new BLLBooking(); int i = 0; DateTime test = DateTime.Now.AddHours(1); DateTime btime = Convert.ToDateTime(txtBTime.Text); int amount = int.Parse(cmbAmount.Text); string SDate = Convert.ToString(btime); ///txtBTime DateTime etime = DateTime.Now; if (booking.IsValidBooking(btime) && btime >= test) { MessageBox.Show("Invalid Booking time."); ClearControls(); } //else if(txtReservantName.Text!=null || txtTeamName.Textbtime, txtPhone.Text, txtAddress.Text, cmbPackage.Text, etime) else { i = booking.Booking(txtReservantName.Text, txtTeamName.Text, btime, txtPhone.Text, txtAddress.Text, cmbPackage.Text, etime, amount, SDate); if (i >= 1) { MessageBox.Show("Booking has been successful."); if (MessageBox.Show("Booking has been Register. Do you want to continue", "Book Time", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes) { ClearControls(); txtReservantName.Focus(); } DataTable dt = booking.View(); dgvViewall.DataSource = dt; txtTotal.Text = Convert.ToString(dt.Rows.Count); if (dt.Rows.Count > 0) { dgvViewall.DataSource = dt; } else { MessageBox.Show("No Records Found !!!"); } } else { MessageBox.Show("Unsuccessful to book time."); } } }