finished adding required fields to all the add funtions

This commit is contained in:
EggMan20339 2024-02-21 08:13:43 -05:00
parent 63be4b124d
commit 70cde05d55
2 changed files with 7 additions and 2 deletions

View File

@ -120,6 +120,9 @@ namespace Louis__Pharmacy_CNSA212_FP
Dosage = txtDosage.Text; Dosage = txtDosage.Text;
if (Dosage.Length > 30) if (Dosage.Length > 30)
{
throw new Exception();
} else if (Dosage.Length < 1)
{ {
throw new Exception(); throw new Exception();
} }
@ -162,6 +165,9 @@ namespace Louis__Pharmacy_CNSA212_FP
{ {
MedicationName = txtName.Text; MedicationName = txtName.Text;
if (MedicationName.Length>60) if (MedicationName.Length>60)
{
throw new Exception();
}else if (MedicationName.Length < 1)
{ {
throw new Exception(); throw new Exception();
} }

View File

@ -420,8 +420,7 @@ namespace Louis__Pharmacy_CNSA212_FP
if (txtMaxRefills.Text.Length > 0) if (txtMaxRefills.Text.Length > 0)
{ {
numRefills = int.Parse(txtMaxRefills.Text); numRefills = int.Parse(txtMaxRefills.Text);
} }else
if (numRefills < 0)
{ {
throw new Exception(); throw new Exception();
} }