private void frm_Assesment_Load(object sender, EventArgs e) { dc = new DatabaseConnector(); dictionary = new Dictionary <string, string>(); // patId = int.Parse(); dictionary.Add("@patientId", patId.ToString()); dtPatient = dc.getData("GetPatient", dictionary); label11.Text = dtPatient.Rows[0][0].ToString(); label13.Text = dtPatient.Rows[0][1].ToString(); label5.Text = dtPatient.Rows[0][2].ToString(); label4.Text = dtPatient.Rows[0][3].ToString(); label8.Text = dtPatient.Rows[0][4].ToString(); label9.Text = dtPatient.Rows[0][5].ToString(); label1.Text = patId.ToString(); }
private void frm_Assesment_Load(object sender, EventArgs e) { dc = new DatabaseConnector(); dictionary = new Dictionary<string, string>(); // patId = int.Parse(); dictionary.Add("@patientId", patId.ToString()); dtPatient = dc.getData("GetPatient", dictionary); label11.Text = dtPatient.Rows[0][0].ToString(); label13.Text = dtPatient.Rows[0][1].ToString(); label5.Text = dtPatient.Rows[0][2].ToString(); label4.Text = dtPatient.Rows[0][3].ToString(); label8.Text = dtPatient.Rows[0][4].ToString(); label9.Text = dtPatient.Rows[0][5].ToString(); label1.Text = patId.ToString(); }
private void btnSelect_Click(object sender, EventArgs e) { dictionary = new Dictionary <string, string>(); dictionary.Add("@patientId", patientSearch.Text); dc = new DatabaseConnector(); dtPatient = dc.getData("auspCheckPatientExists", dictionary); if (int.Parse(dtPatient.Rows[0][0].ToString()) > 0) { UpdatePatientDemography cd = new UpdatePatientDemography(); cd.patientId = int.Parse(patientSearch.Text); patientSearch.Clear(); cd.Show(); } else { MessageBox.Show("Patient does not exist."); } }
private void btnSelect_Click(object sender, EventArgs e) { dictionary = new Dictionary<string, string>(); dictionary.Add("@patientId", patientSearch.Text); dc = new DatabaseConnector(); dtPatient = dc.getData("auspCheckPatientExists", dictionary); if (int.Parse(dtPatient.Rows[0][0].ToString()) > 0) { UpdatePatientDemography cd = new UpdatePatientDemography(); cd.patientId = int.Parse(patientSearch.Text); patientSearch.Clear(); cd.Show(); } else { MessageBox.Show("Patient does not exist."); } }
private void CreateDemForm_Load(object sender, EventArgs e) { dictionary = new Dictionary<string, string>(); dictionary.Add("@patientId", patientId.ToString()); dc = new DatabaseConnector(); dtPatient = dc.getData("auspGetPatient", dictionary); dtReferenceDoctor = dc.getData("auspGetReferenceDoctor", dictionary); dtAllergy = dc.getData("auspGetAllery", dictionary); dtPatientContact = dc.getData("auspGetPatientContact", dictionary); dtInsurance = dc.getData("auspGetInsurance", dictionary); txtLname.Text = dtPatient.Rows[0][1].ToString(); txtFname.Text = dtPatient.Rows[0][2].ToString(); patDob.Text = dtPatient.Rows[0][3].ToString(); cmbGender.SelectedIndex = int.Parse(dtPatient.Rows[0][4].ToString()); txtRefDoctor.Text = dtReferenceDoctor.Rows[0][2].ToString(); txtBillingCode.Text = dtReferenceDoctor.Rows[0][3].ToString(); txtAlergyName.Text = dtAllergy.Rows[0][2].ToString(); txtAlergyCategory.Text = dtAllergy.Rows[0][3].ToString(); txtInsNum.Text = dtInsurance.Rows[0][3].ToString(); txtExpDate.Text = dtInsurance.Rows[0][4].ToString(); cmbInsType.SelectedIndex=int.Parse(dtInsurance.Rows[0][2].ToString()); txtPhone.Text=dtPatientContact.Rows[0][2].ToString(); cmbPhoneType.SelectedIndex = int.Parse(dtPatientContact.Rows[0][3].ToString()); txtEmail.Text=dtPatientContact.Rows[0][4].ToString(); txtAdd.Text = dtPatientContact.Rows[0][6].ToString(); cmbAddType.SelectedIndex = int.Parse(dtPatientContact.Rows[0][7].ToString()); cmbEmailType.SelectedIndex = int.Parse(dtPatientContact.Rows[0][5].ToString()); }
private int getAllergyIdfromAllergyTbl() { try { dictionary = new Dictionary<string, string>(); dictionary.Add("@allergyName", txtAllergyName.Text); dc = new DatabaseConnector(); dtAllergy = dc.getData("GetAllergyID1", dictionary); int allergyID = int.Parse(dtAllergy.Rows[0][0].ToString()); return allergyID; } catch { int allergyID = 0; return allergyID; } }
private void btnAddRecord_Click(object sender, EventArgs e) { bool DOB_valid; bool exp_valid; bool pass=false; //check whether Insurance numer exits dictionary = new Dictionary<string, string>(); dictionary.Add("@insuranceNumber", txtInsuranceNumber.Text); dc = new DatabaseConnector(); dtInsurance = dc.getData("CheckInsuranceExists", dictionary); int ins_exist = int.Parse(dtInsurance.Rows[0][0].ToString()); //create new patient Patient patient = new Patient(); patient.firstName = txtFirstName.Text; patient.lastName = txtLastName.Text; patient.dob = txtDOB.Text; patient.gender = cmbxGender.GetItemText(cmbxGender.SelectedItem); //create new insurance Insurance insurance = new Insurance(); insurance.timestamp = (DateTime.Now).ToString(); insurance.insNumber = txtInsuranceNumber.Text; insurance.versionCode = txtVersionCode.Text; insurance.expDate = txtInsuranceExpDate.Text; //create new allergy Allergy allergy = new Allergy(); allergy.name = txtAllergyName.Text; allergy.category = txtAllergyCatergory.Text; //create new allergy-patient PatientAllergy ptAllgergy = new PatientAllergy(); //ins number : number only //ins vc : character only //no blank: name, dob Phone phone = new Phone(); phone.type = cmbxPhoneType.GetItemText(cmbxPhoneType.SelectedItem); phone.phoneNumber = txtPhoneNumber.Text; Email email = new Email(); email.type = cmbxEmailType.GetItemText(cmbxEmailType.SelectedItem); email.email = txtEmail.Text; Address address = new Address(); address.type = cmbxAddressType.GetItemText(cmbxAddressType.SelectedItem); address.address = txtAddress.Text; address.city = txtCity.Text; address.province = txtProvince.Text; address.postalCode = txtPostalCode.Text; DOB_valid = DOB_validation(); exp_valid = exp_validation(); if (DOB_valid == true && exp_valid == true && ins_exist == 0 && txtInsuranceNumber.TextLength == 10) { pass = true; } if (pass == true ) { insertPatient(patient); patient.patientID = getPtIdfromPatienTbl(); insurance.patientID = patient.patientID; phone.patientID = patient.patientID; email.patientID = patient.patientID; address.patientID = patient.patientID; insertInsurance(insurance); if (getAllergyIdfromAllergyTbl() != 0) { ptAllgergy.patientId = patient.patientID; ptAllgergy.allergyId = getAllergyIdfromAllergyTbl(); insertPatientAllergy(ptAllgergy); } else { insertAllergy(allergy); ptAllgergy.patientId = patient.patientID; ptAllgergy.allergyId = getAllergyIdfromAllergyTbl2(); insertPatientAllergy(ptAllgergy); } insertPhone(phone); insertAdress(address); insertEmail(email); clearText(); MessageBox.Show("Patient was registed"); } else if (txtInsuranceNumber.TextLength != 10) //number incorrect of left blank { MessageBox.Show("Please insert correct insurance number"); } else if (ins_exist != 0) { MessageBox.Show("Insurance Number already exists"); } else if (DOB_valid == false) { MessageBox.Show("D.O.B not valid"); } else if (exp_valid == false) { MessageBox.Show("Insurance Expiry Date not valid"); } }
private void btn_SearchPatient_Click(object sender, EventArgs e) { dictionary = new Dictionary <string, string>(); dc = new DatabaseConnector(); if (txt_Output.Text != "") { bool temp = false; int temp1; try { temp1 = Convert.ToInt32(txt_Output.Text); temp = true; } catch (Exception ex) { temp = false; } if (cm_Options.SelectedIndex == 1 && temp == true) { dictionary.Add("@patientId", txt_Output.Text); dtPatient = dc.getData("CheckPatientExists", dictionary); if (dtPatient.Rows.Count != 0) { dataGridView2.Hide(); dataGridView1.Show(); this.getPatientByIdTableAdapter.Fill(searchPatientByIdDataSet.GetPatientById, txt_Output.Text); } else { MessageBox.Show("Patient does not exist."); DialogResult result = MessageBox.Show("Create New Patient Demography?", "New Demography", MessageBoxButtons.OKCancel, MessageBoxIcon.Question); if (result == DialogResult.OK) { this.Hide(); CreateDemForm create = new CreateDemForm(); create.Show(); } } } else if (cm_Options.SelectedIndex == 2) { dictionary.Add("@patientName", txt_Output.Text); dtPatient = dc.getData("CheckPatientExistsByName", dictionary); if (dtPatient.Rows.Count != 0) { dataGridView1.Hide(); dataGridView2.Show(); this.getPatientByNameTableAdapter.Fill(searchPatientByNameDataSet.GetPatientByName, txt_Output.Text.ToString()); } else { MessageBox.Show("Patient does not exist."); DialogResult result = MessageBox.Show("Create New Patient Demography?", "New Demography", MessageBoxButtons.OKCancel, MessageBoxIcon.Question); if (result == DialogResult.OK) { this.Hide(); CreateDemForm create = new CreateDemForm(); create.Show(); } } } else { MessageBox.Show("Please proper search text!"); txt_Output.Focus(); } } }
private void btn_SearchPatient_Click(object sender, EventArgs e) { dictionary = new Dictionary<string, string>(); dc = new DatabaseConnector(); if (txt_Output.Text != "") { bool temp = false; int temp1; try { temp1 = Convert.ToInt32(txt_Output.Text); temp = true; } catch (Exception ex) { temp = false; } if (cm_Options.SelectedIndex == 1 && temp == true) { dictionary.Add("@patientId", txt_Output.Text); dtPatient = dc.getData("CheckPatientExists", dictionary); if (dtPatient.Rows.Count != 0) { dataGridView2.Hide(); dataGridView1.Show(); this.getPatientByIdTableAdapter.Fill(searchPatientByIdDataSet.GetPatientById, txt_Output.Text); } else { MessageBox.Show("Patient does not exist."); DialogResult result = MessageBox.Show("Create New Patient Demography?", "New Demography", MessageBoxButtons.OKCancel, MessageBoxIcon.Question); if (result == DialogResult.OK) { this.Hide(); CreateDemForm create = new CreateDemForm(); create.Show(); } } } else if (cm_Options.SelectedIndex == 2) { dictionary.Add("@patientName", txt_Output.Text); dtPatient = dc.getData("CheckPatientExistsByName", dictionary); if (dtPatient.Rows.Count != 0) { dataGridView1.Hide(); dataGridView2.Show(); this.getPatientByNameTableAdapter.Fill(searchPatientByNameDataSet.GetPatientByName, txt_Output.Text.ToString()); } else { MessageBox.Show("Patient does not exist."); DialogResult result = MessageBox.Show("Create New Patient Demography?", "New Demography", MessageBoxButtons.OKCancel, MessageBoxIcon.Question); if (result == DialogResult.OK) { this.Hide(); CreateDemForm create = new CreateDemForm(); create.Show(); } } } else { MessageBox.Show("Please proper search text!"); txt_Output.Focus(); } } }