private void frmUpdatePhysician_Load(object sender, EventArgs e) { try { myPhysicianID = frmSearchPhysician.myPhysicianID; PharmacyDataTier aPharm = new PharmacyDataTier(); DataSet ds = new DataSet(); ds = aPharm.GetPhysician("", "", myPhysicianID); if (ds.Tables[0].Rows.Count > 0) { txtPhysicianID.Text = ds.Tables[0].Rows[0]["Physician ID"].ToString().Trim(); txtFName.Text = ds.Tables[0].Rows[0]["First Name"].ToString().Trim(); txtMInit.Text = ds.Tables[0].Rows[0]["Middle Initial"].ToString().Trim(); txtLName.Text = ds.Tables[0].Rows[0]["Last Name"].ToString().Trim(); txtOffice.Text = ds.Tables[0].Rows[0]["Office"].ToString().Trim(); txtPhoneNum.Text = ds.Tables[0].Rows[0]["Phone Number"].ToString().Trim(); txtLicenseNum.Text = ds.Tables[0].Rows[0]["License Number"].ToString().Trim(); } } catch (Exception ex) { MessageBox.Show(ex.ToString(), "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
private void frmSearchPhysician_Load(object sender, EventArgs e) { //fill the data grid with all of the physicians PharmacyDataTier bPharm = new PharmacyDataTier(); DataSet ds1 = new DataSet(); ds1 = bPharm.GetPhysician("", "", ""); dgvPatients.DataSource = ds1.Tables[0]; dgvPatients.AutoResizeColumns(); }
private void deleteToolStripMenuItem_Click(object sender, EventArgs e) { try { var confirmResult = MessageBox.Show("This will also delete all prescriptions and refills attached to this physician. Are you sure you want to delete this physician?", "Confirmation", MessageBoxButtons.YesNo, MessageBoxIcon.Warning); if (confirmResult == DialogResult.Yes) { DataGridViewRow row = dgvPatients.SelectedRows[0]; myPhysicianID = row.Cells[0].Value.ToString(); //Send it throug the datatier PharmacyDataTier bPharm = new PharmacyDataTier(); DataSet ds2 = new DataSet(); ds2 = bPharm.DeletePhysician(myPhysicianID); MessageBox.Show("Physician succesfully deleted.", "Completed", MessageBoxButtons.OK, MessageBoxIcon.Information); try { //get the values string fname = txtPhysicianFName.Text.Trim(); string lname = txtPhysicianLName.Text.Trim(); string physicianID = txtPhysicianID.Text.Trim(); //Fill patient datagrid DataSet ds1 = new DataSet(); ds1 = bPharm.GetPhysician(fname, lname, physicianID); dgvPatients.DataSource = ds1.Tables[0]; } catch (Exception ex) { MessageBox.Show(ex.ToString(), "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } } else { } } catch (Exception ex) { MessageBox.Show(ex.ToString(), "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
private void frmSearchPhysician_Activated(object sender, EventArgs e) { try { //get the values string fname = txtPhysicianFName.Text.Trim(); string lname = txtPhysicianLName.Text.Trim(); string physicianID = txtPhysicianID.Text.Trim(); //Fill patient datagrid PharmacyDataTier bPharm = new PharmacyDataTier(); DataSet ds1 = new DataSet(); ds1 = bPharm.GetPhysician(fname, lname, physicianID); dgvPatients.DataSource = ds1.Tables[0]; } catch (Exception ex) { MessageBox.Show(ex.ToString(), "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } }