Fixed update physician

This commit is contained in:
caschick221 2024-02-19 13:38:27 -05:00
parent 50fc81c1db
commit 28140548b2
3 changed files with 71 additions and 0 deletions

View File

@ -181,6 +181,58 @@ namespace Louis__Pharmacy_CNSA212_FP
}
}
public static void UpdatePhysician(
string Physician_id,
string FirstName,
string LastName,
string MiddleInit,
DateTime DOB,
string Gender,
string City,
Int16 Zip,
string UsState,
string PhoneNumber,
string Speciality)
{
try
{
myConn.Open();
cmdString.Parameters.Clear();
cmdString.Connection = myConn;
cmdString.CommandType = CommandType.StoredProcedure;
cmdString.CommandTimeout = 1500;
cmdString.CommandText = "UpdatePhysician";
cmdString.Parameters.Add("@Physician_id", SqlDbType.VarChar, 8).Value = Physician_id;
cmdString.Parameters.Add("@FirstName", SqlDbType.VarChar, 30).Value = FirstName;
cmdString.Parameters.Add("@LastName", SqlDbType.VarChar, 30).Value = LastName;
cmdString.Parameters.Add("@MiddleIntials", SqlDbType.VarChar).Value = MiddleInit;
cmdString.Parameters.Add("@DOB", SqlDbType.DateTime).Value = DOB;
cmdString.Parameters.Add("@Gender", SqlDbType.Char).Value = Gender;
cmdString.Parameters.Add("@City", SqlDbType.VarChar, 30).Value = City;
cmdString.Parameters.Add("@Zip", SqlDbType.SmallInt).Value = Zip;
cmdString.Parameters.Add("@UsState", SqlDbType.VarChar, 2).Value = UsState;
cmdString.Parameters.Add("@PhoneNumber", SqlDbType.VarChar, 14).Value = PhoneNumber;
cmdString.Parameters.Add("@Speciality", SqlDbType.VarChar, 100).Value = Speciality;
cmdString.ExecuteNonQuery();
}
catch (Exception ex)
{
throw new ArgumentException(ex.Message);
}
finally
{
myConn.Close();
}
}
public static void DeletePatient(string Patient_id)

View File

@ -23,6 +23,7 @@ namespace Louis__Pharmacy_CNSA212_FP
InitializeComponent();
dgvPatient.DoubleClick += cmuPatientEdit_Click;
dgvPhysician.DoubleClick += cmuPhysicianEdit_Click;
}

View File

@ -227,6 +227,8 @@ namespace Louis__Pharmacy_CNSA212_FP
if (!hasFailed)
{
if (isAdd)
{
PharmacyDataTier.CreatePhysician(
Physician_id,
FirstName,
@ -239,6 +241,22 @@ namespace Louis__Pharmacy_CNSA212_FP
UsState,
PhoneNumber,
Speciality);
}
else
{
PharmacyDataTier.UpdatePhysician(
Physician_id,
FirstName,
LastName,
MiddleIntials,
DOB,
Gender,
City,
Zip,
UsState,
PhoneNumber,
Speciality);
}
SourceForm.txtPhysicianID.Text = Physician_id;
SourceForm.btnPhysicianSearch_Click(sender, e);