private void btnAdd_Click(object sender, EventArgs e) { if (txtboxDepartureCountry.Text != "" && txtboxDepartureTown.Text != "" && txtboxDestinationCountry.Text != "" && txtboxDestinationTown.Text != "" && txtboxPrice.Text != "") { try { decimal price = decimal.Parse(txtboxPrice.Text); Route route = new Route(txtboxDepartureCountry.Text, txtboxDepartureTown.Text, txtboxDestinationCountry.Text, txtboxDestinationTown.Text, price); if (route.insertToDb()) { MessageBox.Show("Route added to system!"); WindowsHandler.getInstance().getRouteManager().refreshData(); } else { MessageBox.Show("Error occurred. Please try again!"); } } catch (FormatException fex) { MessageBox.Show("Price must be a valid value."); } } else { MessageBox.Show("All fields must be filled in. Please correct and try again."); } }
private void btnEdit_Click(object sender, EventArgs e) { if (txtboxDepartureCountry.Text != "" && txtboxDepartureTown.Text != "" && txtboxDestinationCountry.Text != "" && txtboxDestinationTown.Text != "" && txtboxPrice.Text != "") { try { decimal price = decimal.Parse(txtboxPrice.Text); route.DepartureCountry = txtboxDepartureCountry.Text; route.DepartureTown = txtboxDepartureTown.Text; route.DestinationCountry = txtboxDestinationCountry.Text; route.DestinationTown = txtboxDestinationTown.Text; route.Price = price; if (route.updateInDb()) { WindowsHandler.getInstance().getRouteManager().refreshData(); WindowsHandler.getInstance().getRouteEdit().Close(); MessageBox.Show("Edit successful!"); } else { MessageBox.Show("Error in persisting changes. Please try again."); } } catch (FormatException fex) { MessageBox.Show("Price must be a valid value."); } } else { MessageBox.Show("All fields must be filled in. Please correct and try again."); } }
private void btnCreate_Click(object sender, EventArgs e) { Journey journey = new Journey(int.Parse("" + cmbRoute.SelectedValue), int.Parse("" + cmbTime.SelectedValue), int.Parse("" + cmbCoach.SelectedValue)); if (journey.insertToDb()) { WindowsHandler.getInstance().getJourneyManager().refreshData(); MessageBox.Show("Record successfully added."); } else { MessageBox.Show("Error in creating record. Please try again later and contact an administrator if problem persists."); } }
private void btnEdit_Click(object sender, EventArgs e) { journey.RouteID = int.Parse("" + cmbRoute.SelectedValue); journey.TimeID = int.Parse("" + cmbTime.SelectedValue); journey.CoachID = int.Parse("" + cmbCoach.SelectedValue); if (journey.updateInDb()) { WindowsHandler.getInstance().getJourneyManager().refreshData(); WindowsHandler.getInstance().getJourneyEdit().Close(); MessageBox.Show("Record successfully edited."); } else { MessageBox.Show("Error in creating record. Please try again later and contact an administrator if problem persists."); } }
private void btnAdd_Click(object sender, EventArgs e) { int seats, rows; if (int.TryParse(txtboxSeatsPerRow.Text, out seats) && int.TryParse(txtboxRowsOfSeats.Text, out rows)) { Coach coach = new Coach(seats, rows); if (coach.insertToDb()) { MessageBox.Show("Coach added to system!"); WindowsHandler.getInstance().getCoachManager().refreshData(); } else { MessageBox.Show("Error occurred. Please try again!"); } } }
private void btnAdd_Click(object sender, EventArgs e) { int seats, rows; if (int.TryParse(txtboxSeatsPerRow.Text, out seats) && int.TryParse(txtboxRowsOfSeats.Text, out rows)) { coach.SeatsPerRow = seats; coach.RowOfSeats = rows; if (coach.updateInDb()) { MessageBox.Show("Coach updated in system!"); WindowsHandler.getInstance().getCoachManager().refreshData(); WindowsHandler.getInstance().getCoachEdit().Close(); } else { MessageBox.Show("Error occurred. Please try again!"); } } }
private void btnDelete_Click(object sender, EventArgs e) { DialogResult confirmDelete = MessageBox.Show("Are you sure you want to delete this record?", "Delete Warning!", MessageBoxButtons.YesNo); if (confirmDelete == DialogResult.Yes) { if (route.deleteFromDb()) { WindowsHandler.getInstance().getRouteManager().refreshData(); MessageBox.Show("Record successfully deleted."); } else { MessageBox.Show("Error in deleting record. Please try again later and contact an administrator if problem persists."); } } else { MessageBox.Show("Deletion aborted."); } }
private void btnAdd_Click(object sender, EventArgs e) { WindowsHandler.getInstance().getJourneyAdd().Show(); }
private void btnEdit_Click(object sender, EventArgs e) { WindowsHandler.getInstance().getJourneyEdit().setOriginalValues(int.Parse(routeID), int.Parse(timeID), int.Parse(coachID)); WindowsHandler.getInstance().getJourneyEdit().Show(); }
private void btnCoachLink_Click(object sender, EventArgs e) { WindowsHandler.getInstance().getCoachManager().Show(); }
private void btnJourneyLink_Click(object sender, EventArgs e) { WindowsHandler.getInstance().getJourneyManager().Show(); }
private void btnEdit_Click(object sender, EventArgs e) { WindowsHandler.getInstance().getCoachEdit().setOriginalValues(coach); WindowsHandler.getInstance().getCoachEdit().Show(); }
static void Main() { Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); Application.Run(WindowsHandler.getInstance().getMainMenu()); }
private void btnSeatAllocator_Click(object sender, EventArgs e) { WindowsHandler.getInstance().getSeatingAllocator().Show(); }