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 btnAdd_Click(object sender, EventArgs e) { try { EPV.SetError(cboDrug, ""); EPV.SetError(cboPhysicianID, ""); string physicianID = cboPhysicianID.SelectedValue.ToString(); try { //get the values string NDCPackageCode = cboDrug.SelectedValue.ToString(); string totalRefills = txtRefill.Text.Trim(); DateTime time = dtpDatePrescribed.Value; //Send it throug the datatier PharmacyDataTier bPharm = new PharmacyDataTier(); DataSet ds1 = new DataSet(); ds1 = bPharm.AddPrescription(NDCPackageCode, myPatientID, physicianID, totalRefills, time); MessageBox.Show("Prescription succesfully added.", "Completed", MessageBoxButtons.OK, MessageBoxIcon.Information); } catch (Exception) { EPV.SetError(cboDrug, "must select a drug from the list"); MessageBox.Show("Must select a drug in the list.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } } catch (Exception) { EPV.SetError(cboPhysicianID, "Must select a physician from the list"); MessageBox.Show("Must select a physician in the list.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
private void frmFulfillment_Load(object sender, EventArgs e) { try { myPatientID = frmPatientPrescription.myPatientID; //call combo box filling methods FillDrugCombo(); FillPhysicianCombo(); FillPatientCombo(); //Fill the refill and prescription Information myPrescriptionID = frmPatientPrescription.myPrescriptionID; PharmacyDataTier aPharm = new PharmacyDataTier(); DataSet ds = new DataSet(); ds = aPharm.GetPrescriptionPID(myPrescriptionID); if (ds.Tables[0].Rows.Count > 0) { txtPrescriptionID.Text = ds.Tables[0].Rows[0]["prescriptionID"].ToString().Trim(); cboPhysicianID.SelectedValue = ds.Tables[0].Rows[0]["physicianID"].ToString().Trim(); cboDrug.SelectedValue = ds.Tables[0].Rows[0]["NDCPackageCode"].ToString().Trim(); dtpPrescribed.Value = DateTime.Parse(ds.Tables[0].Rows[0]["Time"].ToString().Trim()); txtRefill.Text = ds.Tables[0].Rows[0]["totalRefills"].ToString().Trim(); } //Fill the data grid with refills UpdateRefillDatagrid(); } catch (Exception ex) { string myException = ex.ToString(); MessageBox.Show(myException, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
private void btnUpdateRefill_Click(object sender, EventArgs e) { var confirmResult = MessageBox.Show("Are you sure you want to update this refill?", "Confirmation", MessageBoxButtons.YesNo, MessageBoxIcon.Warning); if (confirmResult == DialogResult.Yes) { try { //get the values string prescriptionID = txtPrescriptionID.Text.Trim(); DateTime time = dtpTime.Value; //Send it throug the datatier PharmacyDataTier bPharm = new PharmacyDataTier(); DataSet ds1 = new DataSet(); ds1 = bPharm.UpdateFulfillment(myFulfillmentID, originalPrescriptionID, prescriptionID, time); MessageBox.Show("Refill updated successfully", "Completed", MessageBoxButtons.OK, MessageBoxIcon.Information); } catch (Exception ex) { string myException = ex.ToString(); if (myException.Contains("Prescription is out of refills")) { MessageBox.Show("Prescription is out of refills", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } else { MessageBox.Show(myException, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } } } else { } }
private void removeToolStripMenuItem_Click(object sender, EventArgs e) { var confirmResult = MessageBox.Show("This will also delete all fulfillments attached to this prescription. Are you sure you want to delete this prescription?", "Confirmation", MessageBoxButtons.YesNo, MessageBoxIcon.Warning); if (confirmResult == DialogResult.Yes) { try { if (dgvPrescriptions.Rows.Count > 0) { DataGridViewRow row = dgvPrescriptions.SelectedRows[0]; myPrescriptionID = row.Cells[0].Value.ToString(); //Send it throug the datatier PharmacyDataTier bPharm = new PharmacyDataTier(); DataSet ds1 = new DataSet(); ds1 = bPharm.DeletePrescription(myPrescriptionID); MessageBox.Show("Prescription deleted successfully", "Completed", MessageBoxButtons.OK, MessageBoxIcon.Information); UpdatePrescriptionDGV(); } else { MessageBox.Show("Please select a row to delete", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } } catch (Exception ex) { string myException = ex.ToString(); MessageBox.Show(myException, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } } else { } }
private void btnDelete_Click(object sender, EventArgs e) { var confirmResult = MessageBox.Show("Are you sure you want to delete this refill?", "Confirmation", MessageBoxButtons.YesNo, MessageBoxIcon.Warning); if (confirmResult == DialogResult.Yes) { try { //Send it throug the datatier PharmacyDataTier bPharm = new PharmacyDataTier(); DataSet ds1 = new DataSet(); ds1 = bPharm.DeleteRefill(myFulfillmentID); MessageBox.Show("Refill deleted successfully", "Completed", MessageBoxButtons.OK, MessageBoxIcon.Information); this.Close(); } catch (Exception ex) { string myException = ex.ToString(); MessageBox.Show(myException, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } } else { } }
private void btnUpdate_Click(object sender, EventArgs e) { try { var confirmResult = MessageBox.Show("Are you sure you want to update this physician?", "Confirmation", MessageBoxButtons.YesNo, MessageBoxIcon.Warning); if (confirmResult == DialogResult.Yes) { //get the values string fName = txtFName.Text.Trim(); string mInit = txtMInit.Text.Trim(); string lName = txtLName.Text.Trim(); string office = txtOffice.Text.Trim(); string phoneNum = txtPhoneNum.Text.Trim(); int licenseNum = int.Parse(txtLicenseNum.Text.Trim()); //Send it throug the datatier PharmacyDataTier bPharm = new PharmacyDataTier(); DataSet ds2 = new DataSet(); ds2 = bPharm.UpdatePhysicians(myPhysicianID, fName, mInit, lName, office, phoneNum, licenseNum); MessageBox.Show("Physician succesfully updated.", "Completed", MessageBoxButtons.OK, MessageBoxIcon.Information); } else { } } catch (Exception ex) { MessageBox.Show(ex.ToString(), "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
private void btnAdd_Click(object sender, EventArgs e) { try { //obtains all the necessary information from the user inputs string fName = txtFName.Text.Trim(); string lName = txtLName.Text.Trim(); string mInit = txtMInit.Text.Trim(); DateTime DOB = dtpDOB.Value; string gender = cboGender.Text.Trim(); string street1 = txtStreet1.Text.Trim(); string street2 = txtStreet2.Text.Trim(); string city = txtCity.Text.Trim(); string state = cboState.SelectedValue.ToString(); string zip = txtZip.Text.Trim(); string homePhone = txtHomePhone.Text.Trim(); string workPhone = txtWorkPhone.Text.Trim(); string cellPhone = txtCellPhone.Text.Trim(); string email = txtEmail.Text.Trim(); //sends the information to the datatier PharmacyDataTier bPharm = new PharmacyDataTier(); DataSet ds1 = new DataSet(); ds1 = bPharm.AddPatient(fName, lName, mInit, DOB, gender, street1, street2, city, state, zip, homePhone, workPhone, cellPhone, email); MessageBox.Show("Patient succesfully added.", "Completed", MessageBoxButtons.OK, MessageBoxIcon.Information); } catch (Exception ex) { MessageBox.Show(ex.ToString(), "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
private void btnDeleteRefill_Click(object sender, EventArgs e) { var confirmResult = MessageBox.Show("Are you sure you want to delete this refill?", "Confirmation", MessageBoxButtons.YesNo, MessageBoxIcon.Warning); if (confirmResult == DialogResult.Yes) { try { if (dgvRefills.Rows.Count > 0) { DataGridViewRow row = dgvRefills.SelectedRows[0]; myFulfillmentID = row.Cells[0].Value.ToString(); //Send it throug the datatier PharmacyDataTier bPharm = new PharmacyDataTier(); DataSet ds1 = new DataSet(); ds1 = bPharm.DeleteRefill(myFulfillmentID); MessageBox.Show("Refill deleted successfully", "Completed", MessageBoxButtons.OK, MessageBoxIcon.Information); UpdateRefillDatagrid(); } else { MessageBox.Show("Please select a row to delete", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } } catch (Exception ex) { string myException = ex.ToString(); MessageBox.Show(myException, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } } else { } }
private void btnUpdate_Click(object sender, EventArgs e) { //prompt var confirmResult = MessageBox.Show("Are you sure you want to update this prescription?", "Confirmation", MessageBoxButtons.YesNo, MessageBoxIcon.Warning); if (confirmResult == DialogResult.Yes) { try { string physicianID = cboPhysicianID.SelectedValue.ToString(); try { epv.SetError(cboPhysicianID, ""); epv.SetError(cboDrug, ""); epv.SetError(txtRefill, ""); string NDCPackageCode = cboDrug.SelectedValue.ToString(); string totalRefills = txtRefill.Text.Trim(); if (int.Parse(totalRefills) > 0) { DateTime time = dtpPrescribed.Value; //Send it throug the datatier PharmacyDataTier bPharm = new PharmacyDataTier(); DataSet ds1 = new DataSet(); ds1 = bPharm.UpdatePrescription(myPrescriptionID, NDCPackageCode, myPatientID, physicianID, totalRefills, time); MessageBox.Show("prescription sucesfully updated", "Completed", MessageBoxButtons.OK, MessageBoxIcon.Information); } else { epv.SetError(txtRefill, "Cannot insert a lower than 0 fulfillments"); MessageBox.Show("Cannot insert a lower than 1 fulfillments", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } } catch (Exception ex) { string myException = ex.ToString(); if (myException.Contains("Cannot insert a lower Total Refills than refills have been completed")) { epv.SetError(txtRefill, "Cannot insert a lower Total fulfillments than fulfillments have been completed"); MessageBox.Show("Cannot insert a lower Total fulfillments than fulfillments have been completed", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } else { epv.SetError(cboDrug, "Must select a drug in the list."); MessageBox.Show("Must select a drug in the list.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } } } catch (Exception) { epv.SetError(cboPhysicianID, "Must select a physician in the list."); MessageBox.Show("Must select a physician in the list.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } } else { } }
private void UpdatePrescriptionDGV() { //method that updates the datagrid PharmacyDataTier aPharm = new PharmacyDataTier(); DataSet ds1 = new DataSet(); ds1 = aPharm.GetPrescription(frmSearchPrescriptions.myID); dgvPrescriptions.DataSource = ds1.Tables[0]; }
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 frmSearchPrescriptions_Load(object sender, EventArgs e) { //Fill patient datagrid PharmacyDataTier bPharm = new PharmacyDataTier(); DataSet ds1 = new DataSet(); ds1 = bPharm.FillPatient(); dgvPatients.DataSource = ds1.Tables[0]; dgvPatients.AutoResizeColumns(); }
private void FillPatientCombo() //Method to fill the Patient Combo box { try { PharmacyDataTier bPharm = new PharmacyDataTier(); DataSet ds1 = new DataSet(); ds1 = bPharm.FillCBOPatient(myPatientID); //filling combobox txtPatientID.Text = ds1.Tables[0].Rows[0]["combo"].ToString().Trim(); } catch (Exception ex) { } }
private void frmSearchPrescriptions_Activated(object sender, EventArgs e) { //get the values string fname = txtPatientFName.Text.Trim(); string lname = txtPatientLName.Text.Trim(); string patientID = txtPatientID.Text.Trim(); //Fill patient datagrid PharmacyDataTier bPharm = new PharmacyDataTier(); DataSet ds1 = new DataSet(); ds1 = bPharm.GetPatient(fname, lname, patientID); dgvPatients.DataSource = ds1.Tables[0]; }
private void frmUpdateRefill_Load(object sender, EventArgs e) { myFulfillmentID = frmFulfillment.myFulfillmentID; originalPrescriptionID = frmFulfillment.myPrescriptionID; PharmacyDataTier aPharm = new PharmacyDataTier(); DataSet ds = new DataSet(); ds = aPharm.GetFulfillment(myFulfillmentID); if (ds.Tables[0].Rows.Count > 0) { txtFulfillmentID.Text = ds.Tables[0].Rows[0]["fulfillmentID"].ToString().Trim(); txtPrescriptionID.Text = ds.Tables[0].Rows[0]["prescriptionID"].ToString().Trim(); dtpTime.Value = DateTime.Parse(ds.Tables[0].Rows[0]["Time"].ToString().Trim()); } }
private void FillDrugCombo() //Method to fill the Drug Combo box { try { PharmacyDataTier bPharm = new PharmacyDataTier(); DataSet ds1 = new DataSet(); ds1 = bPharm.FillCBODrug(); //filling combobox cboDrug.DataSource = ds1.Tables[0]; cboDrug.DisplayMember = "combo"; cboDrug.ValueMember = "NDCPackageCode"; } catch (Exception ex) { } }
private void frmPatientPrescription_Load(object sender, EventArgs e) { try { //fills the state combo box cboState.DataSource = StateManager.getStates(); cboState.DisplayMember = "abbreviation"; cboState.ValueMember = "abbreviation"; //gets the patient ID from the previous form myPatientID = frmSearchPrescriptions.myID; //fills the boxes with current patient information PharmacyDataTier aPharm = new PharmacyDataTier(); DataSet ds = new DataSet(); ds = aPharm.GetPatient("", "", myPatientID); if (ds.Tables[0].Rows.Count > 0) { txtPatientID.Text = ds.Tables[0].Rows[0]["Patient 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(); dtpDOB.Value = DateTime.Parse(ds.Tables[0].Rows[0]["Date of Birth"].ToString().Trim()); cboGender.Text = ds.Tables[0].Rows[0]["Gender"].ToString().Trim(); txtStreet1.Text = ds.Tables[0].Rows[0]["Street 1"].ToString().Trim(); txtStreet2.Text = ds.Tables[0].Rows[0]["Street 2"].ToString().Trim(); txtCity.Text = ds.Tables[0].Rows[0]["City"].ToString().Trim(); cboState.SelectedValue = ds.Tables[0].Rows[0]["State"].ToString().Trim(); txtZip.Text = ds.Tables[0].Rows[0]["zip"].ToString().Trim(); txtHomePhone.Text = ds.Tables[0].Rows[0]["Home Phone"].ToString().Trim(); txtWorkPhone.Text = ds.Tables[0].Rows[0]["Work Phone"].ToString().Trim(); txtCellPhone.Text = ds.Tables[0].Rows[0]["Cell Phone"].ToString().Trim(); txtEmail.Text = ds.Tables[0].Rows[0]["Email"].ToString().Trim(); } //fills the datagrid UpdatePrescriptionDGV(); } catch (Exception ex) { MessageBox.Show(ex.ToString(), "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
private void UpdateRefillDatagrid() { try { //Fill the data grid with refills PharmacyDataTier aPharm = new PharmacyDataTier(); DataSet ds1 = new DataSet(); ds1 = aPharm.GetRefills(myPrescriptionID); dgvRefills.DataSource = ds1.Tables[0]; } catch (Exception ex) { string myException = ex.ToString(); MessageBox.Show(myException, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
private void FillPhysicianCombo()//Method to fill the Physician Combo box { try { PharmacyDataTier bPharm = new PharmacyDataTier(); DataSet ds1 = new DataSet(); ds1 = bPharm.FillCBOPhysician(); //filling combobox cboPhysicianID.DataSource = ds1.Tables[0]; cboPhysicianID.DisplayMember = "combo"; cboPhysicianID.ValueMember = "physicianID"; } catch (Exception ex) { } }
private void deleteToolStripMenuItem_Click(object sender, EventArgs e) { var confirmResult = MessageBox.Show("This will also delete all prescriptions and refills attached to this patient. Are you sure you want to delete this patient?", "Confirmation", MessageBoxButtons.YesNo, MessageBoxIcon.Warning); if (confirmResult == DialogResult.Yes) { try { DataGridViewRow row = dgvPatients.SelectedRows[0]; string patientID; patientID = row.Cells[0].Value.ToString(); //Send it throug the datatier PharmacyDataTier bPharm = new PharmacyDataTier(); DataSet ds1 = new DataSet(); ds1 = bPharm.DeletePatient(patientID); MessageBox.Show("Patient deleted successfully", "Completed", MessageBoxButtons.OK, MessageBoxIcon.Information); try { //get the values string fname = txtPatientFName.Text.Trim(); string lname = txtPatientLName.Text.Trim(); string patientID2 = txtPatientID.Text.Trim(); //Fill patient datagrid PharmacyDataTier cPharm = new PharmacyDataTier(); DataSet ds2 = new DataSet(); ds1 = bPharm.GetPatient(fname, lname, patientID2); dgvPatients.DataSource = ds1.Tables[0]; } catch (Exception ex) { MessageBox.Show(ex.ToString(), "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } } catch (Exception ex) { string myException = ex.ToString(); MessageBox.Show(myException, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } } else { } }
private void btnUpdate_Click(object sender, EventArgs e) { var confirmResult = MessageBox.Show("Are you sure you want to update this patient?", "Confirmation", MessageBoxButtons.YesNo, MessageBoxIcon.Warning); if (confirmResult == DialogResult.Yes) { try { //obtains information from the components string patientID = txtPatientID.Text.Trim(); string fName = txtFName.Text.Trim(); string lName = txtLName.Text.Trim(); string mInit = txtMInit.Text.Trim(); DateTime DOB = dtpDOB.Value; string gender = cboGender.Text.Trim(); string street1 = txtStreet1.Text.Trim(); string street2 = txtStreet2.Text.Trim(); string city = txtCity.Text.Trim(); string state = cboState.SelectedValue.ToString(); string zip = txtZip.Text.Trim(); string homePhone = txtHomePhone.Text.Trim(); string workPhone = txtWorkPhone.Text.Trim(); string cellPhone = txtCellPhone.Text.Trim(); string email = txtEmail.Text.Trim(); //passes the information into the data tier PharmacyDataTier bPharm = new PharmacyDataTier(); DataSet ds1 = new DataSet(); ds1 = bPharm.UpdatePatient(patientID, fName, lName, mInit, DOB, gender, street1, street2, city, state, zip, homePhone, workPhone, cellPhone, email); MessageBox.Show("Patient succesfully updated.", "Completed", MessageBoxButtons.OK, MessageBoxIcon.Information); } catch (Exception ex) { MessageBox.Show(ex.ToString(), "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } } else { } }
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); } }
private void btnDelete_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) { //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); this.Close(); } else { } } catch (Exception ex) { MessageBox.Show(ex.ToString(), "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
private void btnAddRefill_Click(object sender, EventArgs e) { var confirmResult = MessageBox.Show("Are you sure you want to add this refill?", "Confirmation", MessageBoxButtons.YesNo, MessageBoxIcon.Warning); if (confirmResult == DialogResult.Yes) { try { //get the values string prescriptionID = txtPrescriptionID.Text.Trim(); DateTime time = dtpTime.Value; //Send it throug the datatier PharmacyDataTier bPharm = new PharmacyDataTier(); DataSet ds1 = new DataSet(); ds1 = bPharm.AddRefill(prescriptionID, time); //Update DataGrid UpdateRefillDatagrid(); } catch (Exception ex) { string myException = ex.ToString(); if (myException.Contains("No refills remaining")) { MessageBox.Show("Prescription is out of refills", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } else { MessageBox.Show(myException, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } } } else { } }