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

@ -182,6 +182,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) public static void DeletePatient(string Patient_id)
{ {

View File

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

View File

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