private void buttonTourSave_Click(object sender, EventArgs e) { if (textBoxTourFrom.Text == "") { MessageBox.Show("Please fill the required information", "Error"); } else { try { DBL.Tour tour = new DBL.Tour(); tour.Tourfrom = textBoxTourFrom.Text; tour.Tourto = textBoxTourTo.Text; tour.Tourkm = textBoxTourKM.Text; tour.Touramount = textBoxTourAmount.Text; tour.addTour(tour); MessageBox.Show("Inserted Well", "Success"); allTourTable(); textBoxTourFrom.Text = ""; textBoxTourTo.Text = ""; textBoxTourKM.Text = ""; textBoxTourAmount.Text = ""; } catch (Exception ex) { MessageBox.Show(ex.Message, "Error"); } } }
public bool foundTour(String id) { DBL.Tour tour = new DBL.Tour(); tour.Id = id; SqlDataReader rdr = tour.getTour(tour); if (rdr.Read()) { /* * string col = rdr["id"].ToString(); * MessageBox.Show(col, "Success"); */ return(true); } else { return(false); } }
private void buttonTourDelete_Click(object sender, EventArgs e) { if (textBoxTourSearch.Text == "") { MessageBox.Show("Please fill the required information", "Error"); } else { try { DBL.Tour tour = new DBL.Tour(); tour.Id = textBoxTourSearch.Text; tour.deleteTour(tour); MessageBox.Show("Deleted Well", "Success"); allTourTable(); textBoxTourSearch.Text = ""; } catch (Exception ex) { MessageBox.Show(ex.Message, "Error"); } } }