From 70cde05d55da3c37784b63ec301a9af8d592d6ce Mon Sep 17 00:00:00 2001 From: EggMan20339 <99349302+EggMan20339@users.noreply.github.com> Date: Wed, 21 Feb 2024 08:13:43 -0500 Subject: [PATCH] finished adding required fields to all the add funtions --- Louis'-Pharmacy_CNSA212-FP/frmMedication.cs | 6 ++++++ Louis'-Pharmacy_CNSA212-FP/frmPrescription.cs | 3 +-- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/Louis'-Pharmacy_CNSA212-FP/frmMedication.cs b/Louis'-Pharmacy_CNSA212-FP/frmMedication.cs index 13b0482..18babd7 100644 --- a/Louis'-Pharmacy_CNSA212-FP/frmMedication.cs +++ b/Louis'-Pharmacy_CNSA212-FP/frmMedication.cs @@ -120,6 +120,9 @@ namespace Louis__Pharmacy_CNSA212_FP Dosage = txtDosage.Text; if (Dosage.Length > 30) + { + throw new Exception(); + } else if (Dosage.Length < 1) { throw new Exception(); } @@ -162,6 +165,9 @@ namespace Louis__Pharmacy_CNSA212_FP { MedicationName = txtName.Text; if (MedicationName.Length>60) + { + throw new Exception(); + }else if (MedicationName.Length < 1) { throw new Exception(); } diff --git a/Louis'-Pharmacy_CNSA212-FP/frmPrescription.cs b/Louis'-Pharmacy_CNSA212-FP/frmPrescription.cs index cbc9da8..9327efa 100644 --- a/Louis'-Pharmacy_CNSA212-FP/frmPrescription.cs +++ b/Louis'-Pharmacy_CNSA212-FP/frmPrescription.cs @@ -420,8 +420,7 @@ namespace Louis__Pharmacy_CNSA212_FP if (txtMaxRefills.Text.Length > 0) { numRefills = int.Parse(txtMaxRefills.Text); - } - if (numRefills < 0) + }else { throw new Exception(); }