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 treatmentInfo(Treatment treatment) { try{ string tcode = treatment.getTreatmentCode(); string ttype = treatment.getTreatmentType(); string tdetails = treatment.getTreatmentDetails(); string tdid = treatment.getDoctorID(); string tpid = treatment.getPatientID(); int tstdfee = treatment.getStandardFee(); int tdocfee = treatment.getDoctorsCharge(); conn.Open(); SqlCommand cmd = new SqlCommand("insert into dental_treatment values('" + tcode + "','" + ttype + "','" + tdetails + "','" + tdid + "','" + tpid + "','" + tstdfee + "','" + tdocfee + "')", 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 deleteTreatmentInfo(Treatment treatment) { string tcode = treatment.getTreatmentCode(); string ttype = treatment.getTreatmentType(); string tdetails = treatment.getTreatmentDetails(); string tdid = treatment.getDoctorID(); string tpid = treatment.getPatientID(); int tstdfee = treatment.getStandardFee(); int tdocfee = treatment.getDoctorsCharge(); conn.Open(); SqlCommand cmd = new SqlCommand("delete from dental_treatment where treatmentcode='" + tcode + "'", conn); cmd.ExecuteNonQuery(); conn.Close(); }
public void updateTreatmentInfo(Treatment treatment) { string tcode = treatment.getTreatmentCode(); string ttype = treatment.getTreatmentType(); string tdetails = treatment.getTreatmentDetails(); string tdid = treatment.getDoctorID(); string tpid = treatment.getPatientID(); int tstdfee = treatment.getStandardFee(); int tdocfee = treatment.getDoctorsCharge(); conn.Open(); SqlCommand cmd = new SqlCommand("update dental_treatment set treatmentcode='" + tcode + "',treatmenttype='" + ttype + "',treatmentdetails='" + tdetails + "',doctorid='" + tdid + "',patientid='" + tpid + "',standardfee='" + tstdfee + "',doctorscharge='" + tdocfee + "' where treatmentcode='" + tcode + "'", conn); cmd.ExecuteNonQuery(); conn.Close(); }
private void btnDentalTreatmentSearch_Click(object sender, EventArgs e) { try { string treatmentcode = txtDentalTreatmentTreatmentCode.Text; TreatmentDBO tdbo = new TreatmentDBO(); Treatment treatment = tdbo.findTreatment(treatmentcode); txtDentalTreatmentTreatmentCode.Text = treatment.getTreatmentCode(); txtDentalTreatmentTreatmentType.Text = treatment.getTreatmentType(); txtDentalTreatmentTreatmentDetails.Text = treatment.getTreatmentDetails(); txtDentalTreatmentDoctorID.Text = treatment.getDoctorID(); txtDentalTreatmentPatientID.Text = treatment.getPatientID(); txtDentalTreatmentStandardFee.Text = treatment.getStandardFee().ToString(); txtDentalTreatmentDoctorsCharge.Text = treatment.getDoctorsCharge().ToString(); } catch (Exception ex) { MessageBox.Show("Couldn't find any matching dental treatment records.", "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); } } }