private void btnDelete_Click(object sender, RoutedEventArgs e) { FacilityHelper client = new FacilityHelper(); try { client.RemoveFacility(user, txtVenue.Text.Trim(), (Faculty)cboFaculty.SelectedIndex); MessageBox.Show("Facility successfully deleted", "Delete Success", MessageBoxButton.OK, MessageBoxImage.Information); lstVenue.ItemsSource = client.GetVenuesByFaculty((Faculty)cboFaculty.SelectedIndex); clearAllTextBoxes(); } catch (Exception ex) { MessageBox.Show("An error have occured: " + ex.Message, "Error", MessageBoxButton.OK, MessageBoxImage.Error); } client.Close(); }
private void btnSave_Click(object sender, RoutedEventArgs e) { int cap; bool parseSuccess = Int32.TryParse(txtSeatCapacity1.Text.Trim(), out cap); if (cboFacAdmin.SelectedIndex == -1) { MessageBox.Show("Please select the facility admin!", "Error", MessageBoxButton.OK, MessageBoxImage.Error); } FacilityHelper client = new FacilityHelper(); if (parseSuccess) { try { client.UpdateFacility(user, txtVenue.Text.Trim(), (Faculty)cboEditFac.SelectedIndex, txtLocation.Text.Trim(), cboFacAdmin.SelectedValue.ToString(), txtTechContact.Text.Trim(), cap,(RoomTypes)cboEditFacType.SelectedIndex,(bool)chkRecordFacility.IsChecked,(bool)chkFlexibleSeating.IsChecked, (bool)chkVideoConference.IsChecked,(bool)chkMicrophone.IsChecked,(bool)chkProjector.IsChecked,(bool)chkVisualizer.IsChecked); MessageBox.Show("Facility successfully updated", "Update Success", MessageBoxButton.OK, MessageBoxImage.Information); lstVenue.ItemsSource = client.GetVenuesByFaculty((Faculty)cboFaculty.SelectedIndex); clearAllTextBoxes(); } catch (Exception ex) { MessageBox.Show("An error have occured: " + ex.Message, "Error", MessageBoxButton.OK, MessageBoxImage.Error); } client.Close(); } else { MessageBox.Show("Seat Capacity must be a numeric value!", "Invalid input", MessageBoxButton.OK, MessageBoxImage.Exclamation); } }
private void cboFaculty_SelectionChanged(object sender, System.Windows.Controls.SelectionChangedEventArgs e) { FacilityHelper client = new FacilityHelper(); lstVenue.ItemsSource = client.GetVenuesByFaculty((Faculty)cboFaculty.SelectedIndex); client.Close(); cboEditFac.SelectedIndex = cboFaculty.SelectedIndex; clearAllTextBoxes(); if (user.isSystemAdmin) { cboFacAdmin.SelectedValue = -1; } }