Made Physician edit pull info

This commit is contained in:
EggMan20339 2024-02-19 10:47:16 -05:00
parent 6b0ffde53e
commit e972237938
6 changed files with 309 additions and 179 deletions

View File

@ -280,42 +280,84 @@ namespace Louis__Pharmacy_CNSA212_FP
{ {
try try
{ {
// open connection // open connection
myConn.Open(); myConn.Open();
//clear any parameters //clear any parameters
cmdString.Parameters.Clear(); cmdString.Parameters.Clear();
// command // command
cmdString.Connection = myConn; cmdString.Connection = myConn;
cmdString.CommandType = CommandType.StoredProcedure; cmdString.CommandType = CommandType.StoredProcedure;
cmdString.CommandTimeout = 1500; cmdString.CommandTimeout = 1500;
cmdString.CommandText = "PhysicianInfoSearch"; cmdString.CommandText = "PhysicianInfoSearch";
// Define input parameter // Define input parameter
cmdString.Parameters.Add("@fname", SqlDbType.VarChar, 11).Value = fname; cmdString.Parameters.Add("@fname", SqlDbType.VarChar, 11).Value = fname;
cmdString.Parameters.Add("@lname", SqlDbType.VarChar, 8).Value = lname; cmdString.Parameters.Add("@lname", SqlDbType.VarChar, 8).Value = lname;
cmdString.Parameters.Add("@phyID", SqlDbType.VarChar, 8).Value = phyID; cmdString.Parameters.Add("@phyID", SqlDbType.VarChar, 8).Value = phyID;
// adapter and dataset // adapter and dataset
SqlDataAdapter aAdapter = new SqlDataAdapter(); SqlDataAdapter aAdapter = new SqlDataAdapter();
aAdapter.SelectCommand = cmdString; aAdapter.SelectCommand = cmdString;
DataSet aDataSet = new DataSet(); DataSet aDataSet = new DataSet();
// fill adapter // fill adapter
aAdapter.Fill(aDataSet); aAdapter.Fill(aDataSet);
// return dataSet // return dataSet
return aDataSet; return aDataSet;
} }
catch (Exception ex) catch (Exception ex)
{ {
throw new ArgumentException(ex.Message); throw new ArgumentException(ex.Message);
} }
finally finally
{ {
myConn.Close(); myConn.Close();
} }
} }
public static DataSet PhysicianInfoSearch(string phyID)
{
try
{
// open connection
myConn.Open();
//clear any parameters
cmdString.Parameters.Clear();
// command
cmdString.Connection = myConn;
cmdString.CommandType = CommandType.StoredProcedure;
cmdString.CommandTimeout = 1500;
cmdString.CommandText = "PhysicianInfoSearch";
// Define input parameter
cmdString.Parameters.Add("@fname", SqlDbType.VarChar, 11).Value = "";
cmdString.Parameters.Add("@lname", SqlDbType.VarChar, 8).Value = "";
cmdString.Parameters.Add("@phyID", SqlDbType.VarChar, 8).Value = phyID;
// adapter and dataset
SqlDataAdapter aAdapter = new SqlDataAdapter();
aAdapter.SelectCommand = cmdString;
DataSet aDataSet = new DataSet();
// fill adapter
aAdapter.Fill(aDataSet);
// return dataSet
return aDataSet;
}
catch (Exception ex)
{
throw new ArgumentException(ex.Message);
}
finally
{
myConn.Close();
}
}
public static double GetNextPatientID() public static double GetNextPatientID()
{ {
try try
@ -357,6 +399,47 @@ namespace Louis__Pharmacy_CNSA212_FP
myConn.Close(); myConn.Close();
} }
} }
public static double GetNextPhysicianID()
{
try
{
// open connection
myConn.Open();
//clear any parameters
cmdString.Parameters.Clear();
// command
cmdString.Connection = myConn;
cmdString.CommandType = CommandType.StoredProcedure;
cmdString.CommandTimeout = 1500;
cmdString.CommandText = "GetNextPhysicianID";
object result = cmdString.ExecuteScalar();
double value = 0;
try
{
value = Convert.ToDouble(result);
}
catch(Exception e)
{
MessageBox.Show("Error Getting next Patient ID","ERROR",MessageBoxButtons.OK);
}
// return dataSet
return value;
}
catch (Exception ex)
{
throw new ArgumentException(ex.Message);
}
finally
{
myConn.Close();
}
}
public static DataSet RefillSearch(DateTime date, string id) public static DataSet RefillSearch(DateTime date, string id)
{ {

View File

@ -140,7 +140,7 @@ namespace Louis__Pharmacy_CNSA212_FP
lblPatientFirst.AutoSize = true; lblPatientFirst.AutoSize = true;
lblPatientFirst.Location = new System.Drawing.Point(20, 28); lblPatientFirst.Location = new System.Drawing.Point(20, 28);
lblPatientFirst.Name = "lblPatientFirst"; lblPatientFirst.Name = "lblPatientFirst";
lblPatientFirst.Size = new System.Drawing.Size(70, 15); lblPatientFirst.Size = new System.Drawing.Size(60, 13);
lblPatientFirst.TabIndex = 4; lblPatientFirst.TabIndex = 4;
lblPatientFirst.Text = "First Name:"; lblPatientFirst.Text = "First Name:";
// //
@ -149,7 +149,7 @@ namespace Louis__Pharmacy_CNSA212_FP
lblPatientLast.AutoSize = true; lblPatientLast.AutoSize = true;
lblPatientLast.Location = new System.Drawing.Point(20, 69); lblPatientLast.Location = new System.Drawing.Point(20, 69);
lblPatientLast.Name = "lblPatientLast"; lblPatientLast.Name = "lblPatientLast";
lblPatientLast.Size = new System.Drawing.Size(70, 15); lblPatientLast.Size = new System.Drawing.Size(61, 13);
lblPatientLast.TabIndex = 5; lblPatientLast.TabIndex = 5;
lblPatientLast.Text = "Last Name:"; lblPatientLast.Text = "Last Name:";
// //
@ -158,7 +158,7 @@ namespace Louis__Pharmacy_CNSA212_FP
lblPhysicianFirst.AutoSize = true; lblPhysicianFirst.AutoSize = true;
lblPhysicianFirst.Location = new System.Drawing.Point(24, 26); lblPhysicianFirst.Location = new System.Drawing.Point(24, 26);
lblPhysicianFirst.Name = "lblPhysicianFirst"; lblPhysicianFirst.Name = "lblPhysicianFirst";
lblPhysicianFirst.Size = new System.Drawing.Size(70, 15); lblPhysicianFirst.Size = new System.Drawing.Size(60, 13);
lblPhysicianFirst.TabIndex = 4; lblPhysicianFirst.TabIndex = 4;
lblPhysicianFirst.Text = "First Name:"; lblPhysicianFirst.Text = "First Name:";
// //
@ -167,7 +167,7 @@ namespace Louis__Pharmacy_CNSA212_FP
lblPhysicianLast.AutoSize = true; lblPhysicianLast.AutoSize = true;
lblPhysicianLast.Location = new System.Drawing.Point(23, 70); lblPhysicianLast.Location = new System.Drawing.Point(23, 70);
lblPhysicianLast.Name = "lblPhysicianLast"; lblPhysicianLast.Name = "lblPhysicianLast";
lblPhysicianLast.Size = new System.Drawing.Size(70, 15); lblPhysicianLast.Size = new System.Drawing.Size(61, 13);
lblPhysicianLast.TabIndex = 5; lblPhysicianLast.TabIndex = 5;
lblPhysicianLast.Text = "Last Name:"; lblPhysicianLast.Text = "Last Name:";
// //
@ -230,7 +230,7 @@ namespace Louis__Pharmacy_CNSA212_FP
this.lblPatientID.AutoSize = true; this.lblPatientID.AutoSize = true;
this.lblPatientID.Location = new System.Drawing.Point(23, 109); this.lblPatientID.Location = new System.Drawing.Point(23, 109);
this.lblPatientID.Name = "lblPatientID"; this.lblPatientID.Name = "lblPatientID";
this.lblPatientID.Size = new System.Drawing.Size(63, 15); this.lblPatientID.Size = new System.Drawing.Size(57, 13);
this.lblPatientID.TabIndex = 7; this.lblPatientID.TabIndex = 7;
this.lblPatientID.Text = "Patient ID:"; this.lblPatientID.Text = "Patient ID:";
// //
@ -420,26 +420,26 @@ namespace Louis__Pharmacy_CNSA212_FP
this.cmuPatient.ImageScalingSize = new System.Drawing.Size(20, 20); this.cmuPatient.ImageScalingSize = new System.Drawing.Size(20, 20);
this.cmuPatient.Items.AddRange(new System.Windows.Forms.ToolStripItem[] { this.cmuPatientNew, this.cmuPatientEdit, this.cmuPatientDelete }); this.cmuPatient.Items.AddRange(new System.Windows.Forms.ToolStripItem[] { this.cmuPatientNew, this.cmuPatientEdit, this.cmuPatientDelete });
this.cmuPatient.Name = "contextMenuStrip1"; this.cmuPatient.Name = "contextMenuStrip1";
this.cmuPatient.Size = new System.Drawing.Size(123, 76); this.cmuPatient.Size = new System.Drawing.Size(108, 70);
// //
// cmuPatientNew // cmuPatientNew
// //
this.cmuPatientNew.Name = "cmuPatientNew"; this.cmuPatientNew.Name = "cmuPatientNew";
this.cmuPatientNew.Size = new System.Drawing.Size(122, 24); this.cmuPatientNew.Size = new System.Drawing.Size(107, 22);
this.cmuPatientNew.Text = "New"; this.cmuPatientNew.Text = "New";
this.cmuPatientNew.Click += new System.EventHandler(this.cmuPatientNew_Click); this.cmuPatientNew.Click += new System.EventHandler(this.cmuPatientNew_Click);
// //
// cmuPatientEdit // cmuPatientEdit
// //
this.cmuPatientEdit.Name = "cmuPatientEdit"; this.cmuPatientEdit.Name = "cmuPatientEdit";
this.cmuPatientEdit.Size = new System.Drawing.Size(122, 24); this.cmuPatientEdit.Size = new System.Drawing.Size(107, 22);
this.cmuPatientEdit.Text = "Edit"; this.cmuPatientEdit.Text = "Edit";
this.cmuPatientEdit.Click += new System.EventHandler(this.cmuPatientEdit_Click); this.cmuPatientEdit.Click += new System.EventHandler(this.cmuPatientEdit_Click);
// //
// cmuPatientDelete // cmuPatientDelete
// //
this.cmuPatientDelete.Name = "cmuPatientDelete"; this.cmuPatientDelete.Name = "cmuPatientDelete";
this.cmuPatientDelete.Size = new System.Drawing.Size(122, 24); this.cmuPatientDelete.Size = new System.Drawing.Size(107, 22);
this.cmuPatientDelete.Text = "Delete"; this.cmuPatientDelete.Text = "Delete";
this.cmuPatientDelete.Click += new System.EventHandler(this.cmuPatientDelete_Click); this.cmuPatientDelete.Click += new System.EventHandler(this.cmuPatientDelete_Click);
// //
@ -504,7 +504,7 @@ namespace Louis__Pharmacy_CNSA212_FP
this.lblPrescriptionPatID.AutoSize = true; this.lblPrescriptionPatID.AutoSize = true;
this.lblPrescriptionPatID.Location = new System.Drawing.Point(61, 74); this.lblPrescriptionPatID.Location = new System.Drawing.Point(61, 74);
this.lblPrescriptionPatID.Name = "lblPrescriptionPatID"; this.lblPrescriptionPatID.Name = "lblPrescriptionPatID";
this.lblPrescriptionPatID.Size = new System.Drawing.Size(63, 15); this.lblPrescriptionPatID.Size = new System.Drawing.Size(57, 13);
this.lblPrescriptionPatID.TabIndex = 1; this.lblPrescriptionPatID.TabIndex = 1;
this.lblPrescriptionPatID.Text = "Patient ID:"; this.lblPrescriptionPatID.Text = "Patient ID:";
// //
@ -514,7 +514,7 @@ namespace Louis__Pharmacy_CNSA212_FP
this.lblRxNumber.Location = new System.Drawing.Point(61, 25); this.lblRxNumber.Location = new System.Drawing.Point(61, 25);
this.lblRxNumber.Margin = new System.Windows.Forms.Padding(2, 0, 2, 0); this.lblRxNumber.Margin = new System.Windows.Forms.Padding(2, 0, 2, 0);
this.lblRxNumber.Name = "lblRxNumber"; this.lblRxNumber.Name = "lblRxNumber";
this.lblRxNumber.Size = new System.Drawing.Size(73, 15); this.lblRxNumber.Size = new System.Drawing.Size(63, 13);
this.lblRxNumber.TabIndex = 0; this.lblRxNumber.TabIndex = 0;
this.lblRxNumber.Text = "Rx Number:"; this.lblRxNumber.Text = "Rx Number:";
// //
@ -592,24 +592,24 @@ namespace Louis__Pharmacy_CNSA212_FP
this.cmuRx.ImageScalingSize = new System.Drawing.Size(20, 20); this.cmuRx.ImageScalingSize = new System.Drawing.Size(20, 20);
this.cmuRx.Items.AddRange(new System.Windows.Forms.ToolStripItem[] { this.cmuRxNew, this.cmuRxEdit, this.cmuRxDelete }); this.cmuRx.Items.AddRange(new System.Windows.Forms.ToolStripItem[] { this.cmuRxNew, this.cmuRxEdit, this.cmuRxDelete });
this.cmuRx.Name = "cmuRx"; this.cmuRx.Name = "cmuRx";
this.cmuRx.Size = new System.Drawing.Size(123, 76); this.cmuRx.Size = new System.Drawing.Size(108, 70);
// //
// cmuRxNew // cmuRxNew
// //
this.cmuRxNew.Name = "cmuRxNew"; this.cmuRxNew.Name = "cmuRxNew";
this.cmuRxNew.Size = new System.Drawing.Size(122, 24); this.cmuRxNew.Size = new System.Drawing.Size(107, 22);
this.cmuRxNew.Text = "New"; this.cmuRxNew.Text = "New";
// //
// cmuRxEdit // cmuRxEdit
// //
this.cmuRxEdit.Name = "cmuRxEdit"; this.cmuRxEdit.Name = "cmuRxEdit";
this.cmuRxEdit.Size = new System.Drawing.Size(122, 24); this.cmuRxEdit.Size = new System.Drawing.Size(107, 22);
this.cmuRxEdit.Text = "Edit"; this.cmuRxEdit.Text = "Edit";
// //
// cmuRxDelete // cmuRxDelete
// //
this.cmuRxDelete.Name = "cmuRxDelete"; this.cmuRxDelete.Name = "cmuRxDelete";
this.cmuRxDelete.Size = new System.Drawing.Size(122, 24); this.cmuRxDelete.Size = new System.Drawing.Size(107, 22);
this.cmuRxDelete.Text = "Delete"; this.cmuRxDelete.Text = "Delete";
// //
// tbpPhysician // tbpPhysician
@ -662,7 +662,7 @@ namespace Louis__Pharmacy_CNSA212_FP
this.lblPhysicianID.AutoSize = true; this.lblPhysicianID.AutoSize = true;
this.lblPhysicianID.Location = new System.Drawing.Point(24, 111); this.lblPhysicianID.Location = new System.Drawing.Point(24, 111);
this.lblPhysicianID.Name = "lblPhysicianID"; this.lblPhysicianID.Name = "lblPhysicianID";
this.lblPhysicianID.Size = new System.Drawing.Size(77, 15); this.lblPhysicianID.Size = new System.Drawing.Size(69, 13);
this.lblPhysicianID.TabIndex = 7; this.lblPhysicianID.TabIndex = 7;
this.lblPhysicianID.Text = "Physician ID:"; this.lblPhysicianID.Text = "Physician ID:";
// //
@ -701,6 +701,7 @@ namespace Louis__Pharmacy_CNSA212_FP
this.dgvPhysician.Name = "dgvPhysician"; this.dgvPhysician.Name = "dgvPhysician";
this.dgvPhysician.ReadOnly = true; this.dgvPhysician.ReadOnly = true;
this.dgvPhysician.RowHeadersWidth = 51; this.dgvPhysician.RowHeadersWidth = 51;
this.dgvPhysician.SelectionMode = System.Windows.Forms.DataGridViewSelectionMode.FullRowSelect;
this.dgvPhysician.Size = new System.Drawing.Size(646, 216); this.dgvPhysician.Size = new System.Drawing.Size(646, 216);
this.dgvPhysician.TabIndex = 0; this.dgvPhysician.TabIndex = 0;
// //
@ -811,26 +812,26 @@ namespace Louis__Pharmacy_CNSA212_FP
this.cmuPhysician.ImageScalingSize = new System.Drawing.Size(20, 20); this.cmuPhysician.ImageScalingSize = new System.Drawing.Size(20, 20);
this.cmuPhysician.Items.AddRange(new System.Windows.Forms.ToolStripItem[] { this.cmuPhysicianNew, this.cmuPhysicianEdit, this.cmuPhysicianDelete }); this.cmuPhysician.Items.AddRange(new System.Windows.Forms.ToolStripItem[] { this.cmuPhysicianNew, this.cmuPhysicianEdit, this.cmuPhysicianDelete });
this.cmuPhysician.Name = "cmuPhysician"; this.cmuPhysician.Name = "cmuPhysician";
this.cmuPhysician.Size = new System.Drawing.Size(123, 76); this.cmuPhysician.Size = new System.Drawing.Size(108, 70);
// //
// cmuPhysicianNew // cmuPhysicianNew
// //
this.cmuPhysicianNew.Name = "cmuPhysicianNew"; this.cmuPhysicianNew.Name = "cmuPhysicianNew";
this.cmuPhysicianNew.Size = new System.Drawing.Size(122, 24); this.cmuPhysicianNew.Size = new System.Drawing.Size(107, 22);
this.cmuPhysicianNew.Text = "New"; this.cmuPhysicianNew.Text = "New";
this.cmuPhysicianNew.Click += new System.EventHandler(this.cmuPhysicianNew_Click); this.cmuPhysicianNew.Click += new System.EventHandler(this.cmuPhysicianNew_Click);
// //
// cmuPhysicianEdit // cmuPhysicianEdit
// //
this.cmuPhysicianEdit.Name = "cmuPhysicianEdit"; this.cmuPhysicianEdit.Name = "cmuPhysicianEdit";
this.cmuPhysicianEdit.Size = new System.Drawing.Size(122, 24); this.cmuPhysicianEdit.Size = new System.Drawing.Size(107, 22);
this.cmuPhysicianEdit.Text = "Edit"; this.cmuPhysicianEdit.Text = "Edit";
this.cmuPhysicianEdit.Click += new System.EventHandler(this.cmuPhysicianEdit_Click); this.cmuPhysicianEdit.Click += new System.EventHandler(this.cmuPhysicianEdit_Click);
// //
// cmuPhysicianDelete // cmuPhysicianDelete
// //
this.cmuPhysicianDelete.Name = "cmuPhysicianDelete"; this.cmuPhysicianDelete.Name = "cmuPhysicianDelete";
this.cmuPhysicianDelete.Size = new System.Drawing.Size(122, 24); this.cmuPhysicianDelete.Size = new System.Drawing.Size(107, 22);
this.cmuPhysicianDelete.Text = "Delete"; this.cmuPhysicianDelete.Text = "Delete";
// //
// frmInfo // frmInfo

View File

@ -49,6 +49,7 @@ namespace Louis__Pharmacy_CNSA212_FP
if (e.KeyCode == Keys.Enter){ if (e.KeyCode == Keys.Enter){
btnPatientSearch_Click(sender, e); btnPatientSearch_Click(sender, e);
btnPhysicianSearch_Click(sender, e);
} }
} }
@ -389,11 +390,23 @@ namespace Louis__Pharmacy_CNSA212_FP
private void cmuPhysicianEdit_Click(object sender, EventArgs e) private void cmuPhysicianEdit_Click(object sender, EventArgs e)
{ {
frmPhysician physicianAdd = new frmPhysician(this, false);
physicianAdd.MdiParent = MdiParent; if (dgvPhysician.Rows.Count > 0)
physicianAdd.StartPosition = FormStartPosition.CenterScreen; {
physicianAdd.Show();
physicianAdd.Focus(); dgvPhysician.DataSource = ds.Tables[0];
DataGridViewRow row = new DataGridViewRow();
row = dgvPhysician.SelectedRows[0];
string phyID = "";
// phyID = (row.Cells[4].Value).ToString();
frmPhysician PhysicianAdd = new frmPhysician(this, false);
PhysicianAdd.MdiParent = MdiParent;
PhysicianAdd.StartPosition = FormStartPosition.CenterScreen;
PhysicianAdd.Show();
PhysicianAdd.Focus();
PhysicianAdd.FillPhysician(phyID);
}
} }
} }
} }

View File

@ -94,190 +94,190 @@ namespace Louis__Pharmacy_CNSA212_FP
if (!isAdd) if (!isAdd)
{ {
try
{
lbs = int.Parse(txtWeight.Text);
try try
{ {
Height_feet = int.Parse(txtHeightFt.Text); lbs = int.Parse(txtWeight.Text);
try try
{ {
Height_inches = int.Parse(txtHeightIn.Text); Height_feet = int.Parse(txtHeightFt.Text);
try try
{ {
DOB = DateTime.Parse(txtDOB.Text); Height_inches = int.Parse(txtHeightIn.Text);
try try
{ {
Gender = txtGender.Text; DOB = DateTime.Parse(txtDOB.Text);
try try
{ {
Zip = short.Parse(txtZip.Text); Gender = txtGender.Text;
try try
{ {
UsState = txtState.Text; Zip = short.Parse(txtZip.Text);
try try
{ {
PhoneNumber = txtPhone.Text; UsState = txtState.Text;
try try
{ {
if (Patient_id.Length > 8) PhoneNumber = txtPhone.Text;
try
{ {
epLocal.SetError(txtPatientID, "Error"); if (Patient_id.Length > 8)
throw new Exception();
}
else
{
while (Patient_id.Length < 8)
{ {
Patient_id = "0" + Patient_id; epLocal.SetError(txtPatientID, "Error");
throw new Exception();
}
else
{
while (Patient_id.Length < 8)
{
Patient_id = "0" + Patient_id;
}
} }
}
if (FirstName.Length > 30) if (FirstName.Length > 30)
{ {
epLocal.SetError(txtFname, "Error"); epLocal.SetError(txtFname, "Error");
throw new Exception(); throw new Exception();
} }
if (LastName.Length > 30) if (LastName.Length > 30)
{ {
epLocal.SetError(txtLname, "Error"); epLocal.SetError(txtLname, "Error");
throw new Exception(); throw new Exception();
} }
if (MiddleIntials.Length > 1) if (MiddleIntials.Length > 1)
{ {
epLocal.SetError(txtMidInit, "Error"); epLocal.SetError(txtMidInit, "Error");
throw new Exception(); throw new Exception();
} }
else else
{ {
MiddleIntials = MiddleIntials.ToUpper(); MiddleIntials = MiddleIntials.ToUpper();
} }
if (Zip > 65535) if (Zip > 65535)
{ {
epLocal.SetError(txtZip, "Error"); epLocal.SetError(txtZip, "Error");
throw new Exception(); throw new Exception();
} }
if (City.Length > 30) if (City.Length > 30)
{ {
epLocal.SetError(txtCity, "Error"); epLocal.SetError(txtCity, "Error");
throw new Exception(); throw new Exception();
} }
if (UsState.Length > 2) if (UsState.Length > 2)
{ {
epLocal.SetError(txtState, "Error"); epLocal.SetError(txtState, "Error");
throw new Exception(); throw new Exception();
} }
else else
{ {
UsState = UsState.ToUpper(); UsState = UsState.ToUpper();
} }
if (lbs > 2147483647) if (lbs > 2147483647)
{ {
epLocal.SetError(txtWeight, "Error"); epLocal.SetError(txtWeight, "Error");
throw new Exception(); throw new Exception();
} }
if (Height_feet > 2147483647) if (Height_feet > 2147483647)
{ {
epLocal.SetError(txtHeightFt, "Error"); epLocal.SetError(txtHeightFt, "Error");
throw new Exception(); throw new Exception();
} }
if (Height_inches > 2147483647) if (Height_inches > 2147483647)
{ {
epLocal.SetError(txtHeightIn, "Error"); epLocal.SetError(txtHeightIn, "Error");
throw new Exception(); throw new Exception();
} }
if (PhoneNumber.Length > 14) if (PhoneNumber.Length > 14)
{ {
epLocal.SetError(txtPhone, "Error"); epLocal.SetError(txtPhone, "Error");
throw new Exception(); throw new Exception();
} }
if (Gender.Length > 1) if (Gender.Length > 1)
{ {
epLocal.SetError(txtGender, "Error"); epLocal.SetError(txtGender, "Error");
throw new Exception(); throw new Exception();
} }
else else
{ {
Gender = Gender.ToUpper(); Gender = Gender.ToUpper();
} }
PharmacyDataTier.UpdatePatient( PharmacyDataTier.UpdatePatient(
Patient_id, Patient_id,
FirstName, FirstName,
LastName, LastName,
MiddleIntials, MiddleIntials,
lbs, lbs,
Height_feet, Height_feet,
Height_inches, Height_inches,
DOB, DOB,
Gender, Gender,
City, City,
Zip, Zip,
UsState, UsState,
PhoneNumber); PhoneNumber);
SourceForm.txtPatientID.Text = Patient_id.ToString(); SourceForm.txtPatientID.Text = Patient_id.ToString();
SourceForm.btnPatientSearch_Click(SourceForm, e); SourceForm.btnPatientSearch_Click(SourceForm, e);
Close(); Close();
}
catch (Exception exception)
{
epLocal.SetError(btnGO, "Error Creating Patient");
}
} }
catch (Exception exception) catch (Exception ex)
{ {
epLocal.SetError(btnGO, "Error Creating Patient"); epLocal.SetError(txtPhone, "Invalid Value");
} }
} }
catch (Exception ex) catch (Exception ex)
{ {
epLocal.SetError(txtPhone, "Invalid Value"); epLocal.SetError(txtState, "Invalid Value");
} }
} }
catch (Exception ex) catch (Exception ex)
{ {
epLocal.SetError(txtState, "Invalid Value"); epLocal.SetError(txtZip, "Invalid Value");
} }
} }
catch (Exception ex) catch (Exception ex)
{ {
epLocal.SetError(txtZip, "Invalid Value"); epLocal.SetError(txtGender, "Invalid Value");
} }
} }
catch (Exception ex) catch (Exception ex)
{ {
epLocal.SetError(txtGender, "Invalid Value"); epLocal.SetError(txtDOB, "Invalid Value");
} }
} }
catch (Exception ex) catch (Exception ex)
{ {
epLocal.SetError(txtDOB, "Invalid Value"); epLocal.SetError(txtHeightIn, "Invalid Value");
} }
} }
catch (Exception ex) catch (Exception ex)
{ {
epLocal.SetError(txtHeightIn, "Invalid Value"); epLocal.SetError(txtHeightFt, "Invalid Value");
} }
} }
catch (Exception ex) catch (Exception ex)
{ {
epLocal.SetError(txtHeightFt, "Invalid Value"); epLocal.SetError(txtWeight, "Invalid Value");
} }
}
catch (Exception ex)
{
epLocal.SetError(txtWeight, "Invalid Value");
}
}else if (isAdd) }else if (isAdd)
{ {
try try

View File

@ -294,6 +294,7 @@ namespace Louis__Pharmacy_CNSA212_FP
this.Controls.Add(this.lblDisPurpose); this.Controls.Add(this.lblDisPurpose);
this.Name = "frmPhysician"; this.Name = "frmPhysician";
this.Text = "frmPhysician"; this.Text = "frmPhysician";
this.Load += new System.EventHandler(this.frmPhysician_Load);
this.ResumeLayout(false); this.ResumeLayout(false);
this.PerformLayout(); this.PerformLayout();
} }

View File

@ -1,5 +1,6 @@
using System; using System;
using System.Windows.Forms; using System.Windows.Forms;
using System.Data;
namespace Louis__Pharmacy_CNSA212_FP namespace Louis__Pharmacy_CNSA212_FP
{ {
@ -21,13 +22,13 @@ namespace Louis__Pharmacy_CNSA212_FP
if (isNew) if (isNew)
{ {
lblDisPurpose.Text = @"Add Physician"; lblDisPurpose.Text = "Add Physician";
btnGO.Text = @"Create"; btnGO.Text = "Create";
} }
else else
{ {
lblDisPurpose.Text = @"Edit Physician"; lblDisPurpose.Text = "Edit Physician";
btnGO.Text = @"Update"; btnGO.Text = "Update";
} }
} }
@ -41,5 +42,36 @@ namespace Louis__Pharmacy_CNSA212_FP
{ {
} }
private void frmPhysician_Load(object sender, EventArgs e)
{
txtPhyID.Enabled = false;
if (isAdd)
{
var nextID = PharmacyDataTier.GetNextPhysicianID();
txtPhyID.Text = nextID.ToString();
}
}
public void FillPhysician(string phyID)
{
var ds = new DataSet();
var data = new PharmacyDataTier();
ds = PharmacyDataTier.PhysicianInfoSearch(phyID);
txtPhyID.Text = ds.Tables[0].Rows[0]["Physician_id"].ToString();
txtFirstName.Text = ds.Tables[0].Rows[0]["FirstName"].ToString();
txtLastName.Text = ds.Tables[0].Rows[0]["LastName"].ToString();
txtMiddleInit.Text = ds.Tables[0].Rows[0]["MiddleIntials"].ToString();
txtDOB.Text = ds.Tables[0].Rows[0]["DOB"].ToString();
txtGender.Text = ds.Tables[0].Rows[0]["Gender"].ToString();
txtCity.Text = ds.Tables[0].Rows[0]["City"].ToString();
txtZip.Text = ds.Tables[0].Rows[0]["Zip"].ToString();
txtState.Text = ds.Tables[0].Rows[0]["UsState"].ToString();
txtPhone.Text = ds.Tables[0].Rows[0]["PhoneNumber"].ToString();
txtSpeciality.Text = ds.Tables[0].Rows[0]["Specialty"].ToString();
}
} }
} }