/// <summary> /// Creator: Chuck Baxter /// Created: 3/18/2020 /// Approver: Carl Davis, 3/18/2020 /// Approver: /// /// The method when the submit add new species button is clicked, calls the animal manager /// to add it to the database /// <remarks> /// Updater: /// Updated: /// Update: /// </remarks> /// <param name="sender"></param> /// <param name="e"></param> private void BtnSubmitAnimalAddSpecies_Click(object sender, RoutedEventArgs e) { if (String.IsNullOrEmpty(txtNewAnimalSpecies.Text)) { MessageBox.Show("Please enter the new animal species"); return; } if (String.IsNullOrEmpty(txtNewAnimalSpeciesDescription.Text)) { MessageBox.Show("Please enter the animal species description"); return; } try { if (_animalManager.AddNewAnimalSpecies(txtNewAnimalSpecies.Text, txtNewAnimalSpeciesDescription.Text)) { WPFErrorHandler.SuccessMessage("Animal Species Successfully Added"); canEditAnimalSpecies.Visibility = Visibility.Hidden; } } catch (Exception ex) { WPFErrorHandler.ErrorMessage(ex.Message + "\n\n" + ex.InnerException.Message); canEditAnimalSpecies.Visibility = Visibility.Hidden; } }
/// <summary> /// Creator: Lane Sandburg /// Created: 04/09/2020 /// Approver: Jordan Lindo /// /// save button creates availbilities from lasi of availabilites /// </summary> /// <remarks> /// Updater: /// Updated: /// Update: /// <param name="sender"></param> /// <param name="e"></param> private void btnSaveAvail_Click(object sender, RoutedEventArgs e) { bool isCreated = false; foreach (EmployeeAvailability availability in availabilities) { try { isCreated = _employeeAvailabilityManager.CreateNewEmployeeAvailability(availability); } catch (Exception ex) { WPFErrorHandler.ErrorMessage(ex.Message, "Validation"); } } if (isCreated) { WPFErrorHandler.SuccessMessage("Create new user availability was successful"); } canAddAvailability.Visibility = Visibility.Hidden; canUserView.Visibility = Visibility.Visible; btnViewUserRoles.IsEnabled = true; }
/// <summary> /// Creator: Chuck Baxter /// Created: 3/12/2020 /// Approver: Austin Gee, 3/12/2020 /// Approver: /// /// The method that saves the edits to the animal /// </summary> /// <remarks> /// /// Updater: /// Updated: /// Update: /// </remarks> private void BtnSubmitAnimalEdit_Click(object sender, RoutedEventArgs e) { string arrival = cndEditArrivalDate.SelectedDate.ToString(); string dob = cndEditDob.SelectedDate.ToString(); if (String.IsNullOrEmpty(txtEditAnimalName.Text)) { MessageBox.Show("Please enter the animal's name"); return; } if (String.IsNullOrEmpty(txtEditAnimalBreed.Text)) { MessageBox.Show("Please enter the animal's breed"); return; } if (String.IsNullOrEmpty(cmbEditAnimalSpecies.Text)) { MessageBox.Show("Please enter the animal's species"); return; } if (String.IsNullOrEmpty(arrival)) { MessageBox.Show("Please enter the animal's arrival date"); return; } if (String.IsNullOrEmpty(dob)) { cndDob.SelectedDate = DateTime.Parse("01/01/2000"); return; } Animal newAnimal = new Animal(); newAnimal.AnimalName = txtEditAnimalName.Text; newAnimal.AnimalSpeciesID = cmbEditAnimalSpecies.Text; newAnimal.AnimalBreed = txtEditAnimalBreed.Text; newAnimal.ArrivalDate = (DateTime)cndEditArrivalDate.SelectedDate; newAnimal.Dob = (DateTime)cndEditDob.SelectedDate; try { if (_animalManager.EditAnimal(selectedAnimal, newAnimal)) { WPFErrorHandler.SuccessMessage("Animal Successfully Updated"); canViewAnimalList.Visibility = Visibility.Visible; canEditAnimal.Visibility = Visibility.Hidden; refreshActiveData(); chkActive.IsChecked = false; } } catch (Exception ex) { WPFErrorHandler.ErrorMessage(ex.Message + "\n\n" + ex.InnerException.Message); canIndividualAnimal.Visibility = Visibility.Visible; canEditAnimal.Visibility = Visibility.Hidden; refreshActiveData(); chkActive.IsChecked = false; } }
/// <summary> /// Creator: Rasha Mohammed /// Created: 4/8/2020 /// Approver: Ethan Holmes /// /// /// This method shows the list of picture when the window loads /// </summary> /// <remarks> /// Updater: Robert Holmes /// Updated: 04/30/2020 /// Update: Made compatible with byte[] storage. /// /// </remarks> /// <param name="sender"></param> /// <param name="e"></param> private void dgPictureList_Loaded(object sender, RoutedEventArgs e) { List <Picture> pictures = _pictureManager.RetrieveAllPictures(); BitmapImage bitmap = new BitmapImage(); Image image; List <Image> ListPictures = new List <Image>(); foreach (var picture in pictures) { image = new Image(); try { using (var stream = new MemoryStream(picture.ImageData)) { image.Source = BitmapFrame.Create(stream, BitmapCreateOptions.None, BitmapCacheOption.OnLoad); } } catch (Exception ex) { WPFErrorHandler.ErrorMessage("There was a problem loading the picture.\n\n" + ex.Message); } ListPictures.Add(image); } listImage.ItemsSource = ListPictures; }
/// <summary> /// Creator: Chase Schulte /// Created: 02/13/2020 /// Approver: Jordan Lindo /// /// Delete a role /// </summary> /// /// <remarks> /// Updater: Chaser Schulte /// Updated: 02/28/2020 /// Update: Delete can only occur on in-active roles /// </remarks> /// <param name="sender"></param> /// <param name="e"></param> private void BtnDeleteERole_Click(object sender, RoutedEventArgs e) { if (dgERoleList.SelectedItem != null) { ERole selectedERole = (ERole)dgERoleList.SelectedItem; if (selectedERole.EActive == true) { WPFErrorHandler.ErrorMessage("Can't delete an active Role"); return; } var deleteERole = MessageBox.Show("Are you sure you want to delete " + selectedERole.ERoleID, "Confirm Delete", MessageBoxButton.YesNo, MessageBoxImage.Warning); if (deleteERole == MessageBoxResult.Yes) { try { _eRoleManager.DeleteERole(selectedERole.ERoleID); RefreshERole(); } catch (Exception ex) { WPFErrorHandler.ErrorMessage(ex.Message); } } } else { WPFErrorHandler.ErrorMessage("Please select a role"); } }
/// <summary> /// Creator: Carl Davis /// Created: 4/2/2020 /// Approver: Ethan Murphy 4/3/2020 /// /// brings up update window /// </summary> /// <remarks> /// Updater: /// Updated: /// Update: /// </remarks> /// <param name="sender"></param> /// <param name="e"></param> private void dgFacilityInspectionItem_MouseDoubleClick(object sender, MouseButtonEventArgs e) { txtUserID.Text = _user.PUUserID.ToString(); selectedFacilityInspectionItem = (FacilityInspectionItem)dgFacilityInspectionItem.SelectedItem; List <FacilityInspection> facilityInspections = new List <FacilityInspection>(); try { facilityInspections = _facilityInspectionManager.RetrieveAllFacilityInspection(false); List <string> inspectionIDs = new List <string>(); foreach (var item in facilityInspections) { inspectionIDs.Add(item.FacilityInspectionID.ToString()); } cmbFacilityInspectionID.ItemsSource = inspectionIDs; } catch (Exception ex) { WPFErrorHandler.ErrorMessage(ex.Message, "Retrieve"); } if (selectedFacilityInspectionItem != null) { canAddFacilityInspectionItem.Visibility = Visibility.Visible; canView.Visibility = Visibility.Hidden; btnAddFacilityInspectionItem.Visibility = Visibility.Hidden; BtnSubmitInspectionItemRecord.Visibility = Visibility.Hidden; btnUpdateInspectionItemRecord.Visibility = Visibility.Visible; lblFacilityInspectionItem.Content = "Update Facility Inspection Item Record"; txtItemName.Text = selectedFacilityInspectionItem.ItemName; txtUserID.Text = selectedFacilityInspectionItem.UserID.ToString(); txtItemDescription.Text = selectedFacilityInspectionItem.ItemDescription; } }
/// <summary> /// Creator: Lane Sandburg /// Created: 04/09/2020 /// Approver: Jordan Lindo /// /// click handler for viewing employee availabilities /// </summary> /// <remarks> /// Updater: /// Updated: /// Update: /// <param name="sender"></param> /// <param name="e"></param> private void btnViewUserAvailability_Click(object sender, RoutedEventArgs e) { if (dgUserList.SelectedItem != null) { try { canUserView.Visibility = Visibility.Hidden; canAddUser.Visibility = Visibility.Hidden; canViewUserERoles.Visibility = Visibility.Hidden; canViewAvailability.Visibility = Visibility.Visible; btnCreateUser.IsEnabled = false; //Prepare canvas functionality _employeeAvailabilityManager = new EmployeeAvailabilityManager(); _petUniverseUser = (PetUniverseUser)dgUserList.SelectedItem; updateDgViewAvailability(); lblHeader.Content = "Availabilities for: " + _petUniverseUser.LastName + ", " + _petUniverseUser.FirstName; } catch (Exception ex) { WPFErrorHandler.ErrorMessage(ex.Message); } } else { WPFErrorHandler.ErrorMessage("Please select a valid user"); } }
/// <summary> /// NAME: Robert Holmes /// DATE: 2/18/2020 /// CHECKED BY: Cash Carlson /// /// Loads products into the data grid. /// </summary> /// <remarks> /// UPDATED BY: /// UPDATED DATE: /// CHANGES: /// /// </remarks> private void loadProducts() { try { _allProducts = _productManager.RetrieveAllProductsByType(); } catch (Exception) { WPFErrorHandler.ErrorMessage("There was an issue loading Products"); } List <ProductVM> dgItems = new List <ProductVM>(); if (_transaction.ProductAmounts.Count > 0) { foreach (Product p in _transaction.ProductAmounts.Keys) { _transaction.ProductAmounts.TryGetValue(p, out int qty); dgItems.Add(new ProductVM() { Name = p.Name, Price = p.Price, ProductID = p.ProductID, Quantity = qty }); } } dgTransactionItems.ItemsSource = dgItems; }
/// <summary> /// Creator: Tener Karar /// Created: 2020/02/7 /// Approver: Steven Cardona /// /// this event for main window class /// desplay the item in the screen item /// </summary> /// /// <remarks> /// Updater: Zach Behrensmeyer /// Updated: 4/13/2020 /// Update: Added if item = null logic /// </remarks> private void btnUpdateItem_Click(object sender, RoutedEventArgs e) { item = (Item)DGViewDatat.SelectedItem; List <int> locations = null; if (item != null) { try { locations = StockManger.getItemLocations(item.ItemID); txtItemID.Text = item.ItemID.ToString(); txtItemName.Text = item.ItemName; txtItemLocation.Text = locations[0].ToString(); txtNewItemLocation.Text = ""; txtItemDescription.Text = item.Description; txtItemCount.Text = locations.Count.ToString(); } catch (Exception) { locations = new List <int>(); } canViewItems.Visibility = Visibility.Hidden; canEditItemsLocation.Visibility = Visibility.Visible; } else { WPFErrorHandler.ErrorMessage("No Item Selected. Please select one."); } }
/// <summary> /// Creator: Chuck Baxter /// Created: 3/18/2020 /// Approver: Carl Davis, 3/18/2020 /// Approver: /// /// The method when the submit update species button is clicked, calls the animal manager /// to update it in the database /// <remarks> /// Updater: /// Updated: /// Update: /// </remarks> /// <param name="sender"></param> /// <param name="e"></param> private void BtnSubmitAnimalEditSpecies_Click(object sender, RoutedEventArgs e) { if (String.IsNullOrEmpty(cmbEditSpecies.Text)) { MessageBox.Show("Please enter the animal species that you wish to update"); return; } if (String.IsNullOrEmpty(txtEditAnimalSpecies.Text)) { MessageBox.Show("Please enter the animal species that you wish to update"); return; } if (String.IsNullOrEmpty(txtEditAnimalSpeciesDescription.Text)) { MessageBox.Show("Please enter the animal species' description that you wish to update"); return; } try { if (_animalManager.EditAnimalSpecies(cmbEditSpecies.Text, txtEditAnimalSpecies.Text, txtEditAnimalSpeciesDescription.Text)) { WPFErrorHandler.SuccessMessage("Animal Species Successfully Updated"); canEditAnimalSpecies.Visibility = Visibility.Hidden; } } catch (Exception ex) { WPFErrorHandler.ErrorMessage(ex.Message + "\n\n" + ex.InnerException.Message); canEditAnimalSpecies.Visibility = Visibility.Hidden; txtEditAnimalSpecies.Text = ""; } }
/// <summary> /// Creator: Austin Gee /// Created On: 5/1/2020 /// /// Auto generates columns /// </summary> /// <remarks> /// Updater Name /// Updated: /// Update: /// </remarks> /// <param name="sender"></param> /// <param name="e"></param> private void CancelApplication_Click(object sender, RoutedEventArgs e) { IAdoptionAppointmentManager adoptionAppointmentManager = new AdoptionAppointmentManager(); if (DGViewData.SelectedItem == null) { WPFErrorHandler.ErrorMessage("Please select an adoption application."); } else { System.Windows.Forms.DialogResult dialogResult = System.Windows.Forms.MessageBox.Show("Are you sure you want to cancel the Adoption Application?", "Cancel Application", System.Windows.Forms.MessageBoxButtons.YesNo); if (dialogResult == System.Windows.Forms.DialogResult.Yes) { var appointments = adoptionAppointmentManager.RetrieveAdoptionAppointmentsByCustomerEmailAndActive(((ApplicationVM)DGViewData.SelectedItem).CustomerEmail); foreach (var a in appointments) { adoptionAppointmentManager.EditAdoptionAppointmentActive(a.AppointmentID, false); } IAdoptionAnimalManager adoptionAnimalManager = new AdoptionAnimalManager(); adoptionAnimalManager.EditAnimalAdoptable(((ApplicationVM)DGViewData.SelectedItem).AnimalID, true); _adoptionApplicationManager.DeactivateAdoptionApplication(((ApplicationVM)DGViewData.SelectedItem).AdoptionApplicationID); } else if (dialogResult == System.Windows.Forms.DialogResult.No) { } } DGViewData.ItemsSource = _adoptionApplicationManager.RetrieveAdoptionApplicationsByActiveWithName(true); }
/// <summary> /// NAME: Jesse Tomash /// DATE: 3/30/2020 /// /// Approver: Brandyn T. Coverdill /// Approver: /// /// action to save new order /// </summary> /// /// <remarks> /// UPDATED BY: Brandyn T. Coverdill /// UPDATE DATE: 4/28/2020 /// WHAT WAS CHANGED: Made it check to see if the User ID entered by the user was a real number. /// </remarks> /// <returns></returns> private void btnSaveOrder_Click(object sender, RoutedEventArgs e) { if (txtUserID.Text == "") { "You must fill out all the Fields.".ErrorMessage(); return; } // Checking to validate the text entered by the user is a number. int userIdIsANumber; if (Int32.TryParse(txtUserID.Text, out userIdIsANumber)) { SpecialOrder _newOrder = new SpecialOrder() { UserID = userIdIsANumber }; try { var result = _orderManager.AddSpecialOrder(_newOrder); "Add Succesful".SuccessMessage(); } catch (Exception ex) { WPFErrorHandler.ErrorMessage(ex.Message, "Add Order Failed: You Must Enter a Valid Existing User ID"); } this.NavigationService?.Navigate(new ViewSpecialOrders()); } else { "Please enter a number for the User ID.".ErrorMessage(); } }
/************************************ View User's ERole ********************************************/ /// <summary> /// Creator: Chase Schutle /// Created: 03/01/2020 /// Approver: Jordan Lindo /// /// Allows a user to view a specific user's Eroles /// </summary> /// <remarks> /// Updater: Chase Schulte /// Updated: 04/10/2020 /// Update: Restored functionality /// <param name="sender"></param> /// <param name="e"></param> private void BtnViewUserRoles_Click(object sender, RoutedEventArgs e) { if (dgUserList.SelectedItem != null) { try { //Prepare canvas canUserView.Visibility = Visibility.Hidden; canAddUser.Visibility = Visibility.Hidden; canViewUserERoles.Visibility = Visibility.Visible; btnCreateUser.IsEnabled = false; //Prepare canvas functionality _eRoleManager = new ERoleManager(); _petUniverseUserERolesManager = new PetUniverseUserERolesManager(); _petUniverseUser = (PetUniverseUser)dgUserList.SelectedItem; refreshListBox(); lblUserID.Content = _petUniverseUser.PUUserID.ToString(); } catch (Exception ex) { WPFErrorHandler.ErrorMessage(ex.Message); } } else { WPFErrorHandler.ErrorMessage("Please select a valid user"); } }
/// <summary> /// Creator : Jaeho Kim /// Created: 3/08/2020 /// Approver: Rasha Mohammed /// /// Search Button for transaction by employee name /// </summary> /// <remarks> /// Updater: NA /// Updated: NA /// Update: NA /// </remarks> /// <param name="sender"></param> /// <param name="e"></param> private void btnTransactionSearchByEmployeeName_Click(object sender, RoutedEventArgs e) { try { string firstName = txtEmployeeFirstName.Text.ToString(); string lastName = txtEmployeeLastName.Text.ToString(); if (firstName.Equals("") || firstName == null) { WPFErrorHandler.ErrorMessage("Enter a first name."); txtEmployeeFirstName.Focus(); } else if (lastName.Equals("") || lastName == null) { WPFErrorHandler.ErrorMessage("Enter a last name."); } else { // Retrieve transactions dgTransactionsList.ItemsSource = _transactionManager.RetrieveTransactionByEmployeeName(firstName, lastName); } } catch (Exception ex) { MessageBox.Show(ex.Message + "\n\n" + ex.InnerException.Message); } }
/// <summary> /// NAME: Austin Gee /// DATE: 2/17/2020 /// CHECKED BY: Thomas Dupuy /// /// This private method displays all of the relevent AppointmentVM data in the /// respective text boxes. /// </summary> /// <remarks> /// UPDATED BY: NA /// UPDATE DATE: NA /// WHAT WAS CHANGED: NA /// /// /// </remarks> private void populateTextBoxes() { try { txtAppointmentID.Text = _adoptionAppointment.AppointmentID.ToString(); txtAppointmentType.Text = _adoptionAppointment.AppointmentTypeID; dpAppointmentDate.SelectedDate = _adoptionAppointment.AppointmentDateTime; txtAppointmentTime.Text = _adoptionAppointment.AppointmentDateTime.ToShortTimeString(); txtDecision.Text = _adoptionAppointment.Decision; txtLocationName.Text = _adoptionAppointment.LocationName; txtLocationAddress1.Text = _adoptionAppointment.LocationAddress1; txtLocationAddress2.Text = _adoptionAppointment.LocationAddress2; txtLocationCity.Text = _adoptionAppointment.LocationCity; txtLocationState.Text = _adoptionAppointment.LocationState; txtLocationZip.Text = _adoptionAppointment.LocationZip; txtCustomerFirstName.Text = _adoptionAppointment.CustomerFirstName; txtCustomerLastName.Text = _adoptionAppointment.CustomerLastName; txtCustomerPhoneNumber.Text = _adoptionAppointment.CustomerPhoneNumber; txtCustomerEmail.Text = _adoptionAppointment.CustomerEmail; txtAnimalName.Text = _adoptionAppointment.AnimalName; txtAnimalDob.Text = _adoptionAppointment.AnimalDob.ToShortDateString(); txtAnimalSpecies.Text = _adoptionAppointment.AnimalSpeciesID; txtAnimalBreed.Text = _adoptionAppointment.AnimalBreed; if (txtDecision.Text == "") { txtDecision.Text = "Undecided"; } } catch (Exception) { WPFErrorHandler.ErrorMessage("You must select an item from the list"); } }
/// <summary> /// Creator: Austin Gee /// Created: 3/11/2020 /// Approver: Thomas Dupuy /// /// Makes the Animal details page visible /// </summary> /// <remarks> /// Updated BY: N/A /// Updated N/A /// Update: N/A /// </remarks> private void ViewAnimalDetails() { if (null != _adoptionAnimalVM) { txtAnimalBreed.Text = _adoptionAnimalVM.AnimalBreed; txtAnimalID.Text = _adoptionAnimalVM.AnimalID.ToString(); txtAnimalName.Text = _adoptionAnimalVM.AnimalName; txtAnimalSpecies.Text = _adoptionAnimalVM.AnimalSpeciesID; //txtHandlingNotes.Text = _adoptionAnimalVM.AnimalHandlingNotes; //txtKennelInfo.Text = _adoptionAnimalVM.AnimalKennelInfo; //txtTemepermentWarning.Text = _adoptionAnimalVM.TempermentWarning; dpAnimalDob.SelectedDate = _adoptionAnimalVM.Dob; dpArrivalDate.SelectedDate = _adoptionAnimalVM.ArrivalDate; chkActive.IsChecked = _adoptionAnimalVM.Active; chkAdoptable.IsChecked = _adoptionAnimalVM.Adoptable; chkCurrentlyHoused.IsChecked = _adoptionAnimalVM.CurrentlyHoused; //chkSpayedNuetered.IsChecked = _adoptionAnimalVM.IsSpayedorNuetered; canAnimalList.Visibility = Visibility.Hidden; canAnimalDetails.Visibility = Visibility.Visible; populateAnimalStatusesListBox(); } else { WPFErrorHandler.ErrorMessage("Please choose an animal."); } }
/// <summary> /// Creator: Zach Behrensmeyer /// Created: 4/01/2020 /// Appover: Steven Cardona /// /// Logic to get messages for current user and build a data table /// </summary> /// <remarks> /// Updater: NA /// Updated: NA /// Update: NA /// </remarks> /// <returns></returns> private DataTable getMessages() { messageTable.Rows.Clear(); List <Messages> messages = new List <Messages>(); if (!messageTable.Columns.Contains("Sender")) { messageTable.Columns.Add(new DataColumn() { ColumnName = "Sender", DataType = typeof(string) }); messageTable.Columns.Add(new DataColumn() { ColumnName = "Subject", DataType = typeof(string) }); messageTable.Columns.Add(new DataColumn() { ColumnName = "MessageBody", DataType = typeof(string) }); messageTable.Columns.Add(new DataColumn() { ColumnName = "MessageID", DataType = typeof(int) }); messageTable.Columns.Add(new DataColumn() { ColumnName = "SenderID", DataType = typeof(int) }); messageTable.Columns.Add(new DataColumn() { ColumnName = "Seen", DataType = typeof(bool) }); } //Fill table data try { if (_messagesManager != null) { messages = _messagesManager.GetMessagesByRecipient(_user.PUUserID); } } catch (Exception ex) { WPFErrorHandler.ErrorMessage(ex.InnerException.Message, ex.Message); } foreach (var m in messages) { PetUniverseUser Sender = _userManager.getUserByUserID(m.SenderID); messageTable.Rows.Add(Sender.Email.ToString(), m.MessageSubject, m.MessageBody, m.MessageID, m.SenderID, m.Seen); } return(messageTable); }
/// <summary> /// Creator: Chuck Baxter /// Created: 4/16/2020 /// Approver: Ethan Murphy, 4/16/2020 /// /// Saving a new animal activity type /// </summary> /// <remarks> /// Updater: /// Updated: /// Update: /// </remarks> /// <param name="sender"></param> /// <param name="e"></param> private void btnCreateActivtyTypeSave_Click(object sender, RoutedEventArgs e) { if (String.IsNullOrEmpty(txtActivityName.Text)) { MessageBox.Show("Please enter the name of the new activity type."); return; } if (String.IsNullOrEmpty(txtActivityNotes.Text)) { MessageBox.Show("Please enter the description of the new activity type."); return; } AnimalActivityType animalActivityType = new AnimalActivityType(); animalActivityType.ActivityTypeId = txtActivityName.Text; animalActivityType.Description = txtActivityNotes.Text; try { if (_activityManager.AddAnimalActivityType(animalActivityType)) { WPFErrorHandler.SuccessMessage("Activity Type Successfully Added"); cmbActivityType.ItemsSource = _activityManager.RetrieveAllAnimalActivityTypes().Select(a => a.ActivityTypeId); cmbActivityType.SelectedIndex = 0; canActivityTypes.Visibility = Visibility.Hidden; } } catch (Exception ex) { WPFErrorHandler.ErrorMessage(ex.Message + "\n\n" + ex.InnerException.Message); canActivityTypes.Visibility = Visibility.Hidden; } }
/// <summary> /// Creator: Carl Davis /// Created: 4/9/2020 /// Approver: Ben Hanna, 4/10/20 /// /// creates a new facility task record the user has entered if validated /// </summary> /// <remarks> /// Updater: /// Updated: /// Update: /// </remarks> /// <param name="sender"></param> /// <param name="e"></param> private void BtnSubmitTaskRecord_Click(object sender, RoutedEventArgs e) { if (string.IsNullOrEmpty(txtTaskName.Text)) { MessageBox.Show("Please enter the facility task name"); return; } if (string.IsNullOrEmpty(txtUserID.Text) || !long.TryParse(txtUserID.Text, out long num)) { MessageBox.Show("Please enter a valid user id"); return; } if (string.IsNullOrEmpty(cndStartDate.SelectedDate.ToString())) { MessageBox.Show("Please enter the start date"); return; } if (string.IsNullOrEmpty(cndCompletionDate.SelectedDate.ToString())) { MessageBox.Show("Please enter the completion date"); return; } if (string.IsNullOrEmpty(txtTaskNotes.Text)) { MessageBox.Show("Please enter the task notes"); return; } try { FacilityTask facilityTask = new FacilityTask { FacilityTaskName = txtTaskName.Text, UserID = Int32.Parse(txtUserID.Text), StartDate = (DateTime)cndStartDate.SelectedDate, CompletionDate = (DateTime)cndStartDate.SelectedDate, FacilityTaskNotes = txtTaskNotes.Text }; if (_facilityTaskManager.AddFacilityTaskRecord(facilityTask)) { MessageBox.Show("Facility Task record successfully added."); canAddFacilityTask.Visibility = Visibility.Hidden; canViewFacilityTask.Visibility = Visibility.Visible; RefreshViewAllList(); txtUserID.Text = ""; txtTaskName.Text = ""; txtTaskNotes.Text = ""; } else { MessageBox.Show("Facility Task record was not added."); } } catch (Exception ex) { WPFErrorHandler.ErrorMessage(ex.Message, "Save"); } }
/// <summary> /// Creator: Carl Davis /// Created: 3/18/2020 /// Approver: Chuck Baxter, 3/18/2020 /// /// Submits the updated information to the database /// </summary> /// <remarks> /// Updater: /// Updated: /// Update: /// </remarks> /// <param name="sender"></param> /// <param name="e"></param> private void btnUpdateBuildingInspectionRecord_Click(object sender, RoutedEventArgs e) { if (string.IsNullOrEmpty(txtUserID.Text) || !long.TryParse(txtUserID.Text, out long num)) { MessageBox.Show("Please enter a valid user id"); return; } if (string.IsNullOrEmpty(txtInspectorName.Text)) { MessageBox.Show("Please enter the inspector name"); return; } if (string.IsNullOrEmpty(cndInspectionDate.SelectedDate.ToString())) { MessageBox.Show("Please enter the inspection date"); return; } if (string.IsNullOrEmpty(txtInspectionDescription.Text)) { MessageBox.Show("Please enter the inspection description"); return; } try { FacilityInspection facilityInspection = new FacilityInspection { UserID = Int32.Parse(txtUserID.Text), InspectorName = txtInspectorName.Text, InspectionDate = (DateTime)cndInspectionDate.SelectedDate, InspectionDescription = txtInspectionDescription.Text, InspectionCompleted = (bool)chkInspectionCompleted.IsChecked }; if (_facilityInspectionManager.EditFacilityInspection(selectedFacilityInspection, facilityInspection)) { MessageBox.Show("Inspection record successfully updated."); canAddFacilityInspection.Visibility = Visibility.Hidden; canView.Visibility = Visibility.Visible; BtnSubmitInspectionRecord.Visibility = Visibility.Visible; btnUpdateBuildingInspectionRecord.Visibility = Visibility.Hidden; lblInspectionCompleted.Visibility = Visibility.Hidden; chkInspectionCompleted.Visibility = Visibility.Hidden; RefreshViewAllList(); txtUserID.Text = ""; txtInspectorName.Text = ""; txtInspectionDescription.Text = ""; } else { MessageBox.Show("Inspection record was not updated."); } } catch (Exception ex) { WPFErrorHandler.ErrorMessage(ex.Message, "Save"); } }
/// <summary> /// Creator: Carl Davis /// Created: 2/21/2020 /// Approver: Steven Cardona /// /// Submits the updated information to the database /// </summary> /// <remarks> /// Updater: /// Updated: /// Update: /// </remarks> /// <param name="sender"></param> /// <param name="e"></param> private void btnUpdateBuildingMaintenanceRecord_Click(object sender, RoutedEventArgs e) { if (string.IsNullOrEmpty(txtUserID.Text) || !long.TryParse(txtUserID.Text, out long num)) { MessageBox.Show("Please enter a valid user id"); return; } if (string.IsNullOrEmpty(txtMaintenanceName.Text)) { MessageBox.Show("Please enter the maintenance name"); return; } if (string.IsNullOrEmpty(txtMaintenanceInterval.Text)) { MessageBox.Show("Please enter the maintenance interval"); return; } if (string.IsNullOrEmpty(txtMaintenanceDescription.Text)) { MessageBox.Show("Please enter the maintenance description"); return; } try { FacilityMaintenance facilityMaintenance = new FacilityMaintenance { UserID = Int32.Parse(txtUserID.Text), MaintenanceName = txtMaintenanceName.Text, MaintenanceInterval = txtMaintenanceInterval.Text, MaintenanceDescription = txtMaintenanceDescription.Text }; if (_facilityMaintenanceManager.EditFacilityMaintenance(selectedFacilityMaintenance, facilityMaintenance)) { MessageBox.Show("Maintenance record successfully updated."); BtnSubmitMaintenanceRecord.Visibility = Visibility.Visible; btnUpdateBuildingMaintenanceRecord.Visibility = Visibility.Hidden; canAddFacilityMaintenance.Visibility = Visibility.Hidden; canView.Visibility = Visibility.Visible; RefreshViewAllList(); txtUserID.Text = ""; txtMaintenanceName.Text = ""; txtMaintenanceInterval.Text = ""; txtMaintenanceDescription.Text = ""; lblFacilityMaintenance.Content = "Enter Facility Maintenance Record"; } else { MessageBox.Show("Maintenance record was not updated."); } } catch (Exception ex) { WPFErrorHandler.ErrorMessage(ex.Message, "Update"); } }
/// <summary> /// Creator: Carl Davis /// Created: 4/2/2020 /// Approver: Ethan Murphy 4/3/2020 /// /// Submits the updated information to the database /// </summary> /// <remarks> /// Updater: /// Updated: /// Update: /// </remarks> /// <param name="sender"></param> /// <param name="e"></param> private void btnUpdateInspectionItemRecord_Click(object sender, RoutedEventArgs e) { if (string.IsNullOrEmpty(txtItemName.Text)) { MessageBox.Show("Please enter the item name"); return; } if (string.IsNullOrEmpty(txtUserID.Text) || !long.TryParse(txtUserID.Text, out long num)) { MessageBox.Show("Please enter a valid user id"); return; } if (cmbFacilityInspectionID.SelectedItem == null) { MessageBox.Show("Please select a facility inspection id"); return; } if (string.IsNullOrEmpty(txtItemDescription.Text)) { MessageBox.Show("Please enter the inspection item description"); return; } try { FacilityInspectionItem facilityInspectionItem = new FacilityInspectionItem { ItemName = txtItemName.Text, UserID = Int32.Parse(txtUserID.Text), FacilityInpectionID = Int32.Parse(cmbFacilityInspectionID.SelectedItem.ToString()), ItemDescription = txtItemDescription.Text }; if (_facilityInspectionItemManager.EditFacilityInspectionItem(selectedFacilityInspectionItem, facilityInspectionItem)) { MessageBox.Show("Inspection record successfully updated."); canAddFacilityInspectionItem.Visibility = Visibility.Hidden; canView.Visibility = Visibility.Visible; btnUpdateInspectionItemRecord.Visibility = Visibility.Hidden; RefreshViewAllList(); txtUserID.Text = ""; txtItemName.Text = ""; txtItemDescription.Text = ""; canView.Visibility = Visibility.Visible; } else { MessageBox.Show("Inspection Item record was not updated."); } } catch (Exception ex) { WPFErrorHandler.ErrorMessage(ex.Message, "Save"); } }
/// <summary> /// Creator: Austin Gee /// Created: 3/11/2020 /// Approver: Thomas Dupuy /// /// populates the animal statuses list box with the animals current statuses /// </summary> /// <remarks> /// Updated BY: N/A /// Updated N/A /// Update: N/A /// </remarks> private void populateAnimalStatusesListBox() { try { lbAnimalCurrentStatuses.ItemsSource = _animalStatusManager.RetrieveAnimalStatusesByAnimalID(_adoptionAnimalVM.AnimalID); } catch (Exception ex) { WPFErrorHandler.ErrorMessage(ex.Message); } }
/// <summary> /// Creator: Michael Thompson /// Created: 2/19/2020 /// Approver: Austin Gee /// Method to refresh the data grid /// </summary> /// <remarks> /// Updater: /// Updated: /// Update: /// </remarks> private void refreshData() { try { dgAnimalProfiles.ItemsSource = _animalManager.RetrieveAllAnimalProfiles(); } catch (Exception ex) { WPFErrorHandler.ErrorMessage(ex.Message + "\n\n" + ex.InnerException.Message); } }
/// <summary> /// Creator: Chase Schulte /// Created: 02/13/2020 /// Approver: Kaleb Bachert /// /// Populate the role list upon selecting view roles tab /// </summary> /// /// <remarks> /// Updater /// Updated: /// Update: /// </remarks> /// <param name="sender"></param> /// <param name="e"></param> private void RefreshERole() { try { dgERoleList.ItemsSource = _eRoleManager.RetrieveERolesByActive((bool)chkRoleActive.IsChecked); } catch (Exception ex) { WPFErrorHandler.ErrorMessage(ex.Message); } }
/// <summary> /// Creator: Carl Davis /// Created: 3/12/2020 /// Approver: Ethan Murphy 3/13/2020 /// /// searches the item inputed by the user and displays it on the screen /// </summary> /// <remarks> /// Updater: /// Updated: /// Update: /// </remarks> /// <param name="sender"></param> /// <param name="e"></param> private void btnSearch_Click(object sender, RoutedEventArgs e) { if (cmbFacilityInspectionFields.Text == inspectionItems[0]) { try { int inspectionID = Int32.Parse(txtSearchItem.Text); dgFacilityInspection.ItemsSource = _facilityInspectionManager.RetrieveFacilityInspectionByID(inspectionID, (bool)chkInspected.IsChecked); dgFacilityInspection.Columns[0].Header = "Facility Inspection ID"; dgFacilityInspection.Columns[1].Header = "User ID"; dgFacilityInspection.Columns[2].Header = "Inspector Name"; dgFacilityInspection.Columns[3].Header = "Inspection Date"; dgFacilityInspection.Columns[4].Header = "Inspection Description"; } catch (Exception ex) { WPFErrorHandler.ErrorMessage(ex.Message, "Retrieve"); } } else if (cmbFacilityInspectionFields.Text == inspectionItems[1]) { try { int userID = Int32.Parse(txtSearchItem.Text); dgFacilityInspection.ItemsSource = _facilityInspectionManager.RetrieveFacilityInspectionByUserID(userID, (bool)chkInspected.IsChecked); dgFacilityInspection.Columns[0].Header = "Facility Inspection ID"; dgFacilityInspection.Columns[1].Header = "User ID"; dgFacilityInspection.Columns[2].Header = "Inspector Name"; dgFacilityInspection.Columns[3].Header = "Inspection Date"; dgFacilityInspection.Columns[4].Header = "Inspection Description"; } catch (Exception ex) { WPFErrorHandler.ErrorMessage(ex.Message, "Retrieve"); } } else if (cmbFacilityInspectionFields.Text == inspectionItems[2]) { try { string inspectorName = txtSearchItem.Text; dgFacilityInspection.ItemsSource = _facilityInspectionManager.RetrieveFacilityInspectionByInspectorName(inspectorName, (bool)chkInspected.IsChecked); dgFacilityInspection.Columns[0].Header = "Facility Inspection ID"; dgFacilityInspection.Columns[1].Header = "User ID"; dgFacilityInspection.Columns[2].Header = "Inspector Name"; dgFacilityInspection.Columns[3].Header = "Inspection Date"; dgFacilityInspection.Columns[4].Header = "Inspection Description"; } catch (Exception ex) { WPFErrorHandler.ErrorMessage(ex.Message, "Retrieve"); } } }
/// <summary> /// Creator: Ben Hanna /// Created: 4/8/2020 /// Approver: Carl Davis 4/10/2020 /// /// Retrieves all of the kennel cleaning records from the database /// </summary> /// <remarks> /// Updater: /// Updated: /// Update: /// </remarks> private void RefreshData() { try { dgKennelCleaning.ItemsSource = _cleaningManager.RetrieveAllKennelCleaningRecords(); } catch (Exception ex) { WPFErrorHandler.ErrorMessage(ex.Message + "\n\n" + ex.InnerException); } }
/// <summary> /// Creator: Austin Gee /// Created: 3/11/2020 /// Approver: Thomas Dupuy /// /// populates the available statuses list box /// </summary> /// <remarks> /// Updated BY: N/A /// Updated N/A /// Update: N/A /// </remarks> private void populateAvailableStatuses() { try { lbAvailableStatuses.ItemsSource = _statusManager.RetriveAllStatuses(); } catch (Exception ex) { WPFErrorHandler.ErrorMessage(ex.Message); } }
/// <summary> /// Creator: Carl Davis /// Created: 4/9/2020 /// Approver: Ben Hanna, 4/10/20 /// /// method to refresh the data grid items /// </summary> /// <remarks> /// Updater: /// Updated: /// Update: /// </remarks> /// <param name="sender"></param> /// <param name="e"></param> private void RefreshViewAllList() { try { dgFacilityTask.ItemsSource = _facilityTaskManager.RetrieveAllFacilityTask((bool)chkTaskCompleted.IsChecked); } catch (Exception ex) { WPFErrorHandler.ErrorMessage(ex.Message, "Retrieve"); } }
/// <summary> /// Creator: Austin Gee /// Created: 3/11/2020 /// Approver: Thomas Dupuy /// /// Poulates the dgAnimalList Data Grid with relevant data /// </summary> /// <remarks> /// Updated BY: N/A /// Updated N/A /// Update: N/A /// </remarks> private void PopulateAnimalList() { try { dgAnimalList.ItemsSource = _adoptionAnimalManager.RetrieveAdoptionAnimalsByActiveAndAdoptable(); } catch (Exception ex) { WPFErrorHandler.ErrorMessage("Animal List Data cannot be retrieved" + "\n\n" + ex.InnerException.Message); } }