private void btnPaymentDelete_Click(object sender, EventArgs e) { string patientid = txtPaymentPatientID.Text; int registrationfee = 0; if (chkboxPaymentNewPatient.Checked == true) { PatientDBO pdbo2 = new PatientDBO(); Patient patient = pdbo2.findPatient(patientid); lblPaymentRegistrationFee.Text = "Registration Fee:- " + patient.getRegistrationFee().ToString(); registrationfee = patient.getRegistrationFee(); } else if (chkboxPaymentNewPatient.Checked == false) { lblPaymentRegistrationFee.Text = " "; registrationfee = 0; } ; string treatmentcode = txtPaymentTreatmentCode.Text; TreatmentDBO tdbo = new TreatmentDBO(); Treatment treatment = tdbo.findCharges(treatmentcode); lblPaymentDoctorsCharge.Text = "Doctor's charge:- " + treatment.getDoctorsCharge().ToString(); lblPaymentStandardFee.Text = "Treatment Standard Fee:- " + treatment.getStandardFee().ToString(); lblPaymentTotalCharge.Text = "Total Charge:- " + (treatment.getDoctorsCharge() + registrationfee + treatment.getStandardFee()).ToString(); int doctorscharge = treatment.getDoctorsCharge(); int treatmentfee = treatment.getStandardFee(); int totalcharge = treatment.getDoctorsCharge() + treatment.getStandardFee() + registrationfee; PaymentDBO pdbo = new PaymentDBO(); string invoiceno = txtPaymentInvoiceNo.Text; //string patientid = txtPaymentPatientID.Text; (temp) string paymentmode = "None"; if (rdobtnPaymentCash.Checked == true) { paymentmode = "Cash"; } else if (rdobtnPaymentCreditCard.Checked == true) { paymentmode = "Credit Card"; } else if (rdobtnPaymentCheque.Checked == true) { paymentmode = "Cheque"; } ; Payment payment = new Payment(invoiceno, treatmentcode, patientid, paymentmode, doctorscharge, treatmentfee, totalcharge, registrationfee); pdbo.deletePaymentInfo(payment); MessageBox.Show("The invoice & it's payment information has been removed.", "Delete Success!", MessageBoxButtons.OK, MessageBoxIcon.Asterisk); txtPaymentInvoiceNo.Text = ""; txtPaymentTreatmentCode.Text = ""; txtPaymentPatientID.Text = ""; rdobtnPaymentCash.Checked = false; rdobtnPaymentCheque.Checked = false; chkboxPaymentNewPatient.Checked = false; rdoBtnsasas.Checked = false; rdobtnPaymentCreditCard.Checked = false; lblPaymentTreatmentType.Text = ""; lblPaymentPatientName.Text = ""; lblPaymentDoctorsCharge.Text = "Doctor's charge:- "; lblPaymentStandardFee.Text = "Treatment Standard Fee:- "; lblPaymentTotalCharge.Text = "Total Charge:- "; lblPaymentRegistrationFee.Text = "Registration Fee:- "; }
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(); } }
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); } }
private void btnPaymentSave_Click(object sender, EventArgs e) { if (string.IsNullOrWhiteSpace(txtPaymentInvoiceNo.Text)) { MessageBox.Show("An Invoice No should be entered.", "Warning!", MessageBoxButtons.OK, MessageBoxIcon.Warning); } else if (string.IsNullOrWhiteSpace(txtPaymentTreatmentCode.Text)) { MessageBox.Show("The treatment ID should be entered.", "Warning!", MessageBoxButtons.OK, MessageBoxIcon.Warning); } else if (string.IsNullOrWhiteSpace(txtPaymentPatientID.Text)) { MessageBox.Show("The patient's ID should be entered.", "Warning!", MessageBoxButtons.OK, MessageBoxIcon.Warning); } else { string patientid = txtPaymentPatientID.Text; int registrationfee = 0; if (chkboxPaymentNewPatient.Checked == true) { PatientDBO pdbo2 = new PatientDBO(); Patient patient = pdbo2.findPatient(patientid); lblPaymentRegistrationFee.Text = "Registration Fee:- " + patient.getRegistrationFee().ToString(); registrationfee = patient.getRegistrationFee(); } else if (chkboxPaymentNewPatient.Checked == false) { lblPaymentRegistrationFee.Text = " "; registrationfee = 0; } ; string treatmentcode = txtPaymentTreatmentCode.Text; TreatmentDBO tdbo = new TreatmentDBO(); Treatment treatment = tdbo.findCharges(treatmentcode); lblPaymentDoctorsCharge.Text = "Doctor's charge:- " + treatment.getDoctorsCharge().ToString(); lblPaymentStandardFee.Text = "Treatment Standard Fee:- " + treatment.getStandardFee().ToString(); lblPaymentTotalCharge.Text = "Total Charge:- " + (treatment.getDoctorsCharge() + registrationfee + treatment.getStandardFee()).ToString(); int doctorscharge = treatment.getDoctorsCharge(); int treatmentfee = treatment.getStandardFee(); int totalcharge = treatment.getDoctorsCharge() + treatment.getStandardFee() + registrationfee; try { PaymentDBO pdbo = new PaymentDBO(); string invoiceno = txtPaymentInvoiceNo.Text; //string patientid = txtPaymentPatientID.Text; (temp) string paymentmode = "None"; if (rdobtnPaymentCash.Checked == true) { paymentmode = "Cash"; } else if (rdobtnPaymentCreditCard.Checked == true) { paymentmode = "Credit Card"; } else if (rdobtnPaymentCheque.Checked == true) { paymentmode = "Cheque"; } ; Payment payment = new Payment(invoiceno, treatmentcode, patientid, paymentmode, doctorscharge, treatmentfee, totalcharge, registrationfee); pdbo.paymentInfo(payment); MessageBox.Show("Payment information has been recorded successfully.", "Save Success!", MessageBoxButtons.OK, MessageBoxIcon.Information); } catch (Exception ex2) { MessageBox.Show("This Invoice ID has already been generated.", "Duplicate Entry", MessageBoxButtons.OK, MessageBoxIcon.Error); } } }