little fixes

This commit is contained in:
caschick221 2024-02-20 14:50:47 -05:00
parent 545cd84540
commit ce58723152

View File

@ -1,6 +1,7 @@
using System;
using System.Data;
using System.Windows.Forms;
using DateTime = System.DateTime;
namespace Louis__Pharmacy_CNSA212_FP
{
@ -60,7 +61,7 @@ namespace Louis__Pharmacy_CNSA212_FP
var City = "";
short Zip = 0;
var UsState = "";
var DOB = new DateTime(1753, 1, 1);
DateTime DOB = new DateTime(1753, 1, 1);
var PhoneNumber = "";
var Gender = "";
var Speciality = "";
@ -142,7 +143,7 @@ namespace Louis__Pharmacy_CNSA212_FP
try
{
if (txtZip.Text.Length <= 5)
if (txtZip.Text.Length <= 5 && txtZip.Text.Length > 0)
Zip = short.Parse(txtZip.Text);
else if (txtZip.Text.Length == 0)
Zip = 0;
@ -181,31 +182,38 @@ namespace Louis__Pharmacy_CNSA212_FP
hasFailed = true;
}
try
if (txtLastName.Text.Length <= 30 && txtLastName.Text.Length>=1)
{
if (txtLastName.Text.Length <= 30)
LastName = txtLastName.Text;
else
throw new Exception();
LastName = txtLastName.Text;
}else if (txtLastName.Text.Length < 1)
{
epLocal.SetError(txtLastName, "Must Provide a Last Name");
hasFailed = true;
}
catch (Exception exception)
else
{
epLocal.SetError(txtLastName, "Invalid Value");
hasFailed = true;
}
try
if (txtFirstName.Text.Length <= 30 && txtFirstName.Text.Length>=1)
{
if (txtFirstName.Text.Length <= 30)
FirstName = txtFirstName.Text;
else
throw new Exception();
FirstName = txtFirstName.Text;
}else if (txtFirstName.Text.Length < 1)
{
epLocal.SetError(txtFirstName, "Must Provide a First Name");
hasFailed = true;
}
catch (Exception exception)
else
{
epLocal.SetError(txtFirstName, "Invalid Value");
hasFailed = true;
}
try
{
@ -222,16 +230,6 @@ namespace Louis__Pharmacy_CNSA212_FP
hasFailed = true;
}
try
{
Zip = short.Parse(txtZip.Text);
}
catch (Exception exception)
{
epLocal.SetError(txtZip, "Invalid Value");
hasFailed = true;
}
try
{
}
@ -281,6 +279,10 @@ namespace Louis__Pharmacy_CNSA212_FP
}
}
else
{
MessageBox.Show("You Must Enter Some Information!", "", MessageBoxButtons.OK);
}
}
private void frmPhysician_Load(object sender, EventArgs e)