private void btn_add_patient_Click(object sender, EventArgs e) { if (validate()) { DataRowView dataRowView = (DataRowView)list_dept.SelectedItem; String dept = dataRowView["DEPTNAME"].ToString(); int insertPatientSuccess = DBhelper.insert("insert into patient values('" + tb_pid.Text + "'," + "'" + tb_name.Text + "'" + "," + tb_age.Text + "," + "'" + tb_symptom.Text + "'," + "'" + tb_occupation.Text + "'," + "0, 'admitted'," + "'" + dept + "')"); int insertFamilySuccess = DBhelper.insert("insert into family_members values('" + tb_pid.Text + "'," + "'" + tb_family.Text + "'," + "'" + tb_relation.Text + "')"); int insertAppointmentSuccess = DBhelper.insert("insert into appointment values ('" + tb_pid.Text + "'," + "'" + r_id + "'," + "date '" + DateTime.Now.ToString("yyyy-MM-dd") + "')"); int assignDocSuccess = DBhelper.assign_doc(tb_pid.Text); int addpatientSuccess = DBhelper.execute("add_patient_queue"); if (insertPatientSuccess == 0 && insertFamilySuccess == 0 && insertAppointmentSuccess == 0 && assignDocSuccess == 0 && addpatientSuccess == 0) { this.Close(); } } }
private void btn_avail_doc_Click(object sender, EventArgs e) { DBhelper.execute("display_available_doctor"); dataTable = DBhelper.read("select d_id,deptname from doctor where d_id not in (select d_id from doc_patient)"); string res = string.Join(Environment.NewLine, dataTable.Rows.OfType <DataRow>().Select(x => string.Join(" ; ", x.ItemArray))); MessageBox.Show(res); }