private void dgvList_CellContentClick(object sender, DataGridViewCellEventArgs e) { try { switch (dgvList.Columns[e.ColumnIndex].Name) { case "bBtnBill": if (dgvList.Rows[e.RowIndex].Cells["bTypeID"].Value.ToString() == "1") { frmConsultationBill frm = new frmConsultationBill(Int32.Parse(dgvList.Rows[e.RowIndex].Cells["bID"].Value.ToString())); frm.ShowDialog(); } else if (dgvList.Rows[e.RowIndex].Cells["bTypeID"].Value.ToString() == "2") { frmProceduresBill frm = new frmProceduresBill(Int32.Parse(dgvList.Rows[e.RowIndex].Cells["bID"].Value.ToString())); frm.ShowDialog(); } else if (dgvList.Rows[e.RowIndex].Cells["bTypeID"].Value.ToString() == "3") { frmOneTimeBill frm = new frmOneTimeBill(Int32.Parse(dgvList.Rows[e.RowIndex].Cells["bID"].Value.ToString())); frm.ShowDialog(); } break; } } catch (Exception ex) { CommonLogger.Info(ex.ToString()); } }
private void btnGenerateBill_Click(object sender, EventArgs e) { try { switch (cmbBillType.SelectedValue.ToString()) { case "0": MessageBox.Show("Please choose a bill type!"); break; case "1": frmConsultationBill frm = new frmConsultationBill(appointment_id, patient_id); frm.ShowDialog(); ListBills(); break; case "2": int count = 0; using (ConsultationDetails cdet = new ConsultationDetails()) { DataTable dtProcedures = cdet.getProceduresFromApptID(appointment_id); count = dtProcedures.Rows.Count; } if (count > 0) { frmProceduresBill frm1 = new frmProceduresBill(appointment_id, patient_id); frm1.ShowDialog(); ListBills(); } else { MessageBox.Show("Cannot Generate Bill as Procedures have not been added to this appointment!"); } break; case "3": frmOneTimeBill frm2 = new frmOneTimeBill(appointment_id, patient_id); frm2.ShowDialog(); ListBills(); break; } } catch (Exception ex) { CommonLogger.Info(ex.ToString()); } }