private void ConfirmAppButton_Click(object sender, EventArgs e) { Appointment app = new Appointment(); try { app.UserId = log.Id; app.DocId = this.DocIdTB.Text; app.DocName = this.DocNameTB.Text; app.Time = this.TimeTB.Text; if (pr.MakeAppointment(app)) { MessageBox.Show("Appointment made successfully"); } else { MessageBox.Show("Unsuccessfull,Try again"); } } catch (Exception exp) { MessageBox.Show("Invalid Data"); } }