//View Refill Request button click event private void viewRefillRequestsButton_Click(object sender, EventArgs e) { if (!(newRefillRequestsListView.SelectedIndices.Count == 0)) { selectedRefillRequest = (RefillRequest)RefillRequest.displayRefillRequests()[newRefillRequestsListView.SelectedIndices[0]]; //get the selected refill request listView1.Items.Clear(); listView2.Items.Clear(); selectedRefillRequest.Prescription.retrieveMedicines(); //retrieve all medicines of the requested prescription Patient patient = selectedRefillRequest.Prescription.retrievePatientDetails(); //retrieve the details of the patient who requested the refill int i = 0; foreach (Medicine medicine in patient.MedicineHistory) { listView1.Items.Add(medicine.Date); listView1.Items[i].SubItems.Add(medicine.Name); listView1.Items[i].SubItems.Add("" + medicine.Quantity); listView1.Items[i].SubItems.Add(medicine.Dosage); i++; } i = 0; foreach (Medicine medicine in selectedRefillRequest.Prescription.Medicines) { listView2.Items.Add(medicine.Name); listView2.Items[i].SubItems.Add("" + medicine.Quantity); listView2.Items[i].SubItems.Add(medicine.Dosage); listView2.Items[i].SubItems.Add(medicine.Route); listView2.Items[i].SubItems.Add(medicine.Instructions); i++; } //Display patient information generalListView.Items.Clear(); generalListView.Items.Add("Name: " + patient.Name); generalListView.Items.Add("Date of Birth: " + patient.BirthDate); generalListView.Items.Add("Height: " + patient.Height); generalListView.Items.Add("Weight: " + patient.Weight); generalListView.Items.Add("Body Mass Index: " + patient.BodyMassIndex); dateLabel.Text = selectedRefillRequest.Date; statusLabel.Text = selectedRefillRequest.Status; refillsLabel.Text = "" + selectedRefillRequest.Prescription.Refills; remainingLabel.Text = "" + selectedRefillRequest.Prescription.RemainingRefills; allergyTextBox.Text = patient.Allergies; //Disable or enable Accept and Deny buttons depending on RefillRequest status if (selectedRefillRequest.Status.ToLower().Equals("new")) { acceptButton.Enabled = true; rejectButton.Enabled = true; } else { acceptButton.Enabled = false; rejectButton.Enabled = false; } newRefillRequestsPanel.Hide(); prescriptionDetailPanel.Show(); } }
//display refill requests in the refill requests listview public void populateList() { newRefillRequestsListView.Items.Clear(); int i = 0; foreach (RefillRequest request in RefillRequest.displayRefillRequests()) { newRefillRequestsListView.Items.Add(request.Status); newRefillRequestsListView.Items[i].SubItems.Add(request.Date); newRefillRequestsListView.Items[i].SubItems.Add(request.Prescription.PatientName); newRefillRequestsListView.Items[i].SubItems.Add(request.Prescription.PrescriberName); newRefillRequestsListView.Items[i].SubItems.Add(request.Prescription.Refills.ToString()); newRefillRequestsListView.Items[i].SubItems.Add(request.Prescription.RemainingRefills.ToString()); i++; } }