fixed delete for physician and patient

This commit is contained in:
caschick221 2024-02-19 14:37:25 -05:00
parent b8830b843d
commit 9748456039
3 changed files with 88 additions and 5 deletions

View File

@ -412,7 +412,7 @@ namespace Louis__Pharmacy_CNSA212_FP
DataGridViewRow row = new DataGridViewRow();
row = dgvPatient.SelectedRows[0];
string patid = "";
patid = (row.Cells[4].Value).ToString();
patid = (row.Cells[3].Value).ToString();
PharmacyDataTier.DeletePatient(patid);
btnPatientSearch_Click(sender, e);
}
@ -461,7 +461,7 @@ namespace Louis__Pharmacy_CNSA212_FP
DataGridViewRow row = new DataGridViewRow();
row = dgvPhysician.SelectedRows[0];
string phyID = "";
phyID = (row.Cells[1].Value).ToString();
phyID = (row.Cells[0].Value).ToString();
PharmacyDataTier.DeletePhysician(phyID);
btnPhysicianSearch_Click(sender, e);
}

View File

@ -206,6 +206,7 @@ namespace Louis__Pharmacy_CNSA212_FP
this.txtPhyID.Name = "txtPhyID";
this.txtPhyID.Size = new System.Drawing.Size(148, 26);
this.txtPhyID.TabIndex = 1;
this.txtPhyID.TextChanged += new System.EventHandler(this.txtPhyID_TextChanged);
//
// txtFirstName
//
@ -214,6 +215,7 @@ namespace Louis__Pharmacy_CNSA212_FP
this.txtFirstName.Name = "txtFirstName";
this.txtFirstName.Size = new System.Drawing.Size(148, 26);
this.txtFirstName.TabIndex = 2;
this.txtFirstName.TextChanged += new System.EventHandler(this.txtFirstName_TextChanged);
//
// txtLastName
//
@ -222,6 +224,7 @@ namespace Louis__Pharmacy_CNSA212_FP
this.txtLastName.Name = "txtLastName";
this.txtLastName.Size = new System.Drawing.Size(148, 26);
this.txtLastName.TabIndex = 3;
this.txtLastName.TextChanged += new System.EventHandler(this.txtLastName_TextChanged);
//
// txtMiddleInit
//
@ -230,6 +233,7 @@ namespace Louis__Pharmacy_CNSA212_FP
this.txtMiddleInit.Name = "txtMiddleInit";
this.txtMiddleInit.Size = new System.Drawing.Size(148, 26);
this.txtMiddleInit.TabIndex = 4;
this.txtMiddleInit.TextChanged += new System.EventHandler(this.txtMiddleInit_TextChanged);
//
// txtDOB
//
@ -238,6 +242,7 @@ namespace Louis__Pharmacy_CNSA212_FP
this.txtDOB.Name = "txtDOB";
this.txtDOB.Size = new System.Drawing.Size(148, 26);
this.txtDOB.TabIndex = 5;
this.txtDOB.TextChanged += new System.EventHandler(this.txtDOB_TextChanged);
//
// txtGender
//
@ -246,6 +251,7 @@ namespace Louis__Pharmacy_CNSA212_FP
this.txtGender.Name = "txtGender";
this.txtGender.Size = new System.Drawing.Size(148, 26);
this.txtGender.TabIndex = 6;
this.txtGender.TextChanged += new System.EventHandler(this.txtGender_TextChanged);
//
// txtSpeciality
//
@ -254,6 +260,7 @@ namespace Louis__Pharmacy_CNSA212_FP
this.txtSpeciality.Name = "txtSpeciality";
this.txtSpeciality.Size = new System.Drawing.Size(148, 26);
this.txtSpeciality.TabIndex = 7;
this.txtSpeciality.TextChanged += new System.EventHandler(this.txtSpeciality_TextChanged);
//
// txtCity
//
@ -262,6 +269,7 @@ namespace Louis__Pharmacy_CNSA212_FP
this.txtCity.Name = "txtCity";
this.txtCity.Size = new System.Drawing.Size(148, 26);
this.txtCity.TabIndex = 8;
this.txtCity.TextChanged += new System.EventHandler(this.txtCity_TextChanged);
//
// txtState
//
@ -270,6 +278,7 @@ namespace Louis__Pharmacy_CNSA212_FP
this.txtState.Name = "txtState";
this.txtState.Size = new System.Drawing.Size(148, 26);
this.txtState.TabIndex = 9;
this.txtState.TextChanged += new System.EventHandler(this.txtState_TextChanged);
//
// txtZip
//
@ -278,6 +287,7 @@ namespace Louis__Pharmacy_CNSA212_FP
this.txtZip.Name = "txtZip";
this.txtZip.Size = new System.Drawing.Size(148, 26);
this.txtZip.TabIndex = 10;
this.txtZip.TextChanged += new System.EventHandler(this.txtZip_TextChanged);
//
// txtPhone
//
@ -286,12 +296,13 @@ namespace Louis__Pharmacy_CNSA212_FP
this.txtPhone.Name = "txtPhone";
this.txtPhone.Size = new System.Drawing.Size(148, 26);
this.txtPhone.TabIndex = 11;
this.txtPhone.TextChanged += new System.EventHandler(this.txtPhone_TextChanged);
//
// frmPhysician
//
this.AutoScaleDimensions = new System.Drawing.SizeF(9F, 20F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(1200, 692);
this.ClientSize = new System.Drawing.Size(1266, 879);
this.Controls.Add(this.txtPhone);
this.Controls.Add(this.txtZip);
this.Controls.Add(this.txtState);

View File

@ -32,13 +32,14 @@ namespace Louis__Pharmacy_CNSA212_FP
KeyDown += frmPhysician_KeyDown;
}
ErrorProvider epLocal = new ErrorProvider();
private void frmPhysician_KeyDown(object sender, KeyEventArgs e)
{
if (e.KeyCode == Keys.Escape)
Close();
if (e.KeyCode == Keys.Enter) btnGO_Click(sender, e);
}
private void btnClose_Click(object sender, EventArgs e)
@ -48,7 +49,7 @@ namespace Louis__Pharmacy_CNSA212_FP
private void btnGO_Click(object sender, EventArgs e)
{
var epLocal = new ErrorProvider();
var hasFailed = false;
@ -113,6 +114,10 @@ namespace Louis__Pharmacy_CNSA212_FP
{
if (txtDOB.Text.Length > 0)
DOB = DateTime.Parse(txtDOB.Text);
if (DOB < new DateTime(1753,1,1))
{
throw new Exception();
}
else
DOB = new DateTime(1753, 1, 1);
}
@ -307,5 +312,72 @@ namespace Louis__Pharmacy_CNSA212_FP
txtPhone.Text = ds.Tables[0].Rows[0]["PhoneNumber"].ToString();
txtSpeciality.Text = ds.Tables[0].Rows[0]["Specialty"].ToString();
}
private void txtPhyID_TextChanged(object sender, EventArgs e)
{
epLocal.SetError(txtPhyID, "");
}
private void txtFirstName_TextChanged(object sender, EventArgs e)
{
epLocal.SetError(txtFirstName, "");
}
private void txtLastName_TextChanged(object sender, EventArgs e)
{
epLocal.SetError(txtLastName, "");
}
private void txtMiddleInit_TextChanged(object sender, EventArgs e)
{
epLocal.SetError(txtMiddleInit, "");
}
private void txtDOB_TextChanged(object sender, EventArgs e)
{
epLocal.SetError(txtDOB, "");
}
private void txtGender_TextChanged(object sender, EventArgs e)
{
epLocal.SetError(txtGender, "");
}
private void txtSpeciality_TextChanged(object sender, EventArgs e)
{
epLocal.SetError(txtSpeciality, "");
}
private void txtCity_TextChanged(object sender, EventArgs e)
{
epLocal.SetError(txtCity, "");
}
private void txtState_TextChanged(object sender, EventArgs e)
{
epLocal.SetError(txtState, "");
}
private void txtZip_TextChanged(object sender, EventArgs e)
{
epLocal.SetError(txtZip, "");
}
private void txtPhone_TextChanged(object sender, EventArgs e)
{
epLocal.SetError(txtPhone, "");
}
}
}