public void patientInfo(Patient patient) { try{ string pid = patient.getPatientID(); string pfname = patient.getFirstName(); string psurname = patient.getSurname(); string paddress = patient.getAddress(); string pnic = patient.getNIC(); int pcontactno = patient.getContactNo(); int pregistrationfee = patient.getRegistrationFee(); conn.Open(); SqlCommand cmd = new SqlCommand("insert into patient_registration values('" + pid + "','" + pfname + "','" + psurname + "','" + paddress + "','" + pnic + "','" + pcontactno + "','" + pregistrationfee + "')", conn); cmd.ExecuteNonQuery(); } catch (Exception ex) { var sqlException = ex.InnerException as System.Data.SqlClient.SqlException; if (sqlException.Number == 2601 || sqlException.Number == 2627) { } conn.Close(); } }
private void fillCells(String nameQueryS, String cfQueryS) { int indexRow = 0;//just to know at which row we must write this.Patients.Rows.Clear(); //for each patient, for each visit, write information for (int i = 0; i < ps.Count; i++) { Patient thisP = ps[i]; String thisName = thisP.getName() + " " + thisP.getSurname(); String thisCf = thisP.getCF(); //MessageBox.Show("thisName: |" + thisName + "| vs |" + nameQueryS + "|" ); if (cfQueryS.ToUpper() == thisCf.ToUpper() || strContains(nameQueryS.ToUpper(), thisName.ToUpper()) || strContains(thisName.ToUpper(), nameQueryS.ToUpper()) || (nameQueryS == "" && cfQueryS == "")) { this.Patients.Rows.Add();//add a row this.Patients.Rows[indexRow].Cells[1].Value = thisP.getId(); this.Patients.Rows[indexRow].Cells[2].Value = thisName; this.Patients.Rows[indexRow].Cells[3].Value = thisCf; indexRow++; } } }
private void fillPatient() { nameText.Text = thisP.getName(); surnameText.Text = thisP.getSurname(); dateText.Text = thisP.getDate(); sexText.Text = thisP.getSex(); }
private void txtDentalTreatmentPatientID_TextChanged(object sender, EventArgs e) { try { string patientid = txtPaymentPatientID.Text; PatientDBO pdbo = new PatientDBO(); Patient patient = pdbo.findPatient(patientid); lblPaymentPatientName.ForeColor = Color.Black; lblPaymentPatientName.Text = patient.getFirstName() + " " + patient.getSurname(); } catch { lblPaymentPatientName.ForeColor = Color.Red; lblPaymentPatientName.Text = "Invalid Patient ID"; } }
private void fillCommons() { if (thisP != null)//if the patient is already existent { String thisName = thisP.getName(); nameText.Text = thisName; String thisSurname = thisP.getSurname(); surnameText.Text = thisSurname; String thisDate = thisP.getDate(); dateText.Text = thisDate; String thisSex = thisP.getSex(); sexText.Text = thisSex; String thisNotes = thisP.getNotes(); notesText.Text = thisNotes; } }
//create a grid with all the patients, and each patient all the visits public void fillIndexFile() { for (int i = 0; i < patients.Count; i++) { Patient thisPatient = patients[i]; string toAdd = thisPatient.getSurname() + " --> "; List <Visit> visitsThisPatient = thisPatient.getVisits(); for (int a = 0; a < visitsThisPatient.Count; a++) { Visit v = visitsThisPatient[a]; toAdd = toAdd + " visit: " + v.getDate() + ";"; } toAdd = toAdd + "\n"; Global.addIndex(toAdd); } //Global.writeToFile(); }
public void deletePatientInfo(Patient patient) { string pid = patient.getPatientID(); string pfname = patient.getFirstName(); string psurname = patient.getSurname(); string paddress = patient.getAddress(); string pnic = patient.getNIC(); int pcontactno = patient.getContactNo(); int pregistrationfee = patient.getRegistrationFee(); conn.Open(); SqlCommand cmd = new SqlCommand("delete from patient_registration where patientid='" + pid + "'", conn); cmd.ExecuteNonQuery(); conn.Close(); }
public void updatePatientInfo(Patient patient) { string pid = patient.getPatientID(); string pfname = patient.getFirstName(); string psurname = patient.getSurname(); string paddress = patient.getAddress(); string pnic = patient.getNIC(); int pcontactno = patient.getContactNo(); int pregistrationfee = patient.getRegistrationFee(); conn.Open(); SqlCommand cmd = new SqlCommand("update patient_registration set patientid='" + pid + "',fname='" + pfname + "',surname='" + psurname + "',address='" + paddress + "',nic='" + pnic + "',contactno='" + pcontactno + "',registrationfee='" + pregistrationfee + "' where patientid='" + pid + "'", conn); cmd.ExecuteNonQuery(); conn.Close(); }
private void btnPatientRegistrationSearchPatient_Click(object sender, EventArgs e) { try { string patientid = txtPatientRegistrationPatientID.Text; PatientDBO pdbo = new PatientDBO(); Patient patient = pdbo.findPatient(patientid); txtPatientRegistrationPatientID.Text = patient.getPatientID(); txtPatientRegistrationFirstName.Text = patient.getFirstName(); txtPatientRegistrationSurname.Text = patient.getSurname(); txtPatientRegistrationAddress.Text = patient.getAddress(); txtPatientRegistrationNIC.Text = patient.getNIC(); txtPatientRegistrationContactNo.Text = patient.getContactNo().ToString(); txtPatientRegistrationRegistrationFee.Text = patient.getRegistrationFee().ToString(); } catch (Exception ex) { MessageBox.Show("Couldn't find any records or details of such a Patient.", "Incorrect Entry", MessageBoxButtons.OK, MessageBoxIcon.Error); } }