void records_itemDeleted(object sender, EventArgs e) { int id = patientInfoList.getDeletedId(); if (!deleteRecord(Queries.delete_patient_info_based_id, id)) { MessageBox.Show("Couldnt delete patient...."); } List <String> teeth_ids = DatabaseHandler.getInstance().getListStringSingleData(String.Format(Queries.select_teeth_info_id_based_patient_id, id)); if (!Utils.isObjectNull(teeth_ids)) { for (int a = 0; a < teeth_ids.Count; a++) { String teeth_id = teeth_ids[a]; if (!deleteRecord(Queries.delete_teeth_task_info_based_teeth_id, Utils.toInt(teeth_id))) { // MessageBox.Show("couldnt delete teeth tasks"); } else { // MessageBox.Show(String.Format(Queries.delete_teeth_task_info_based_teeth_id, Utils.toInt(teeth_id))); } if (!deleteRecord(Queries.delete_teeth_diagram_info_based_teeth_id, Utils.toInt(teeth_id))) { // MessageBox.Show("couldnt delete teeth diagram"); } } } else { //MessageBox.Show("null"); } List <String> teeth_task_info_teeth_ids = DatabaseHandler.getInstance().getListStringSingleData(String.Format(Queries.select_teeth_task_info_teeth_id)); for (int a = 0; a < teeth_task_info_teeth_ids.Count; a++) { } if (!deleteRecord(Queries.delete_teeth_info_based_patient_id, id)) { // MessageBox.Show("couldnt delete teeths"); } if (!deleteRecord(Queries.delete_question_info_based_patient_id, id)) { //5 MessageBox.Show("couldnt delete question infos"); } if (!deleteRecord(Queries.delete_history_info_based_patient_id, id)) { // MessageBox.Show("couldnt delete history infos"); } }
public Diagram(String patient_id) { InitializeComponent(); teeths = new Teeth[] { teeth1, teeth2, teeth3, teeth4, teeth5, teeth6, teeth7, teeth8, teeth9, teeth10, teeth11, teeth12, teeth13, teeth14, teeth15, teeth16, teeth17, teeth18, teeth19, teeth20, teeth21, teeth22, teeth23, teeth24, teeth25, teeth26, teeth27, teeth28, teeth29, teeth30, teeth31, teeth32, teeth33, teeth34, teeth35, teeth36, teeth37, teeth38, teeth39, teeth40, teeth41, teeth42, teeth43, teeth44, teeth45, teeth46, teeth47, teeth48, teeth49, teeth50, teeth51, teeth52, teeth53, teeth54, teeth55, teeth56 }; List <DataRow> teeth_infos = DatabaseHandler.getInstance().getListRow(String.Format(Queries.select_teeth_info_based_patient_id, patient_id)); /////////////////unoptimized if (!Utils.isObjectNull(teeth_infos)) { for (int a = 0; a < teeth_infos.Count; a++) { for (int b = 0; b < teeths.Length; b++) { if (teeth_infos[a]["number"].ToString() == teeths[b].Number) { teeths[b].ID = (int)teeth_infos[a]["id"]; teeths[b].IsPermanent = (bool)teeth_infos[a]["is_permanent"]; teeths[b].Part = teeth_infos[a]["part"].ToString(); teeths[b].Area = teeth_infos[a]["area"].ToString(); List <DataRow> teeth_diagram_infos = DatabaseHandler.getInstance().getListRow(String.Format(Queries.select_teeth_diagram_info_path_based_teeth_id_and_is_activated, teeths[b].ID)); if (!Utils.isObjectNull(teeth_diagram_infos)) { for (int d = 0; d < teeth_diagram_infos.Count; d++) { String path = teeth_diagram_infos[d]["color"].ToString(); path = "Assets\\" + path + "\\" + path + teeth_diagram_infos[d]["diagram"].ToString() + ".png"; teeths[b].Images.Add(Utils.loadImageFromFileRelativeToCWD(path)); teeths[b].Colors.Add(Utils.strToColor(path)); teeths[b].Indexes.Add(Utils.toInt(teeth_diagram_infos[d]["diagram"].ToString()) - 1); } teeths[b].Refresh(); } break; } } } } for (int a = 0; a < teeths.Length; a++) { teeths[a].setClickHandler(clickHandler); } patientID = patient_id; }
void reScan() { analysis.TabPages.Clear(); List <DataRow> rows = DatabaseHandler.getInstance().getListRow(Queries.select_teeth_task_info_task_code_and_teeth_id); DataTable table = new DataTable(); table.Columns.Add("PATIENT ID"); table.Columns.Add("ITEM"); if (!Utils.isObjectNull(rows)) { for (int a = 0; a < rows.Count; a++) { DataRow row = rows[a]; bool found = false; String id = DatabaseHandler.getInstance().getStringData(String.Format(Queries.select_teeth_info_patient_id_based_id, row["teeth_id"])); for (int b = 0; b < table.Rows.Count; b++) { DataRow currRow = table.Rows[b]; if (currRow[0].ToString() == id) { currRow[1] = currRow[1] + "," + row["task_code"].ToString(); found = true; break; } } if (!found) { table.Rows.Add(id, row["task_code"].ToString()); } } } Set <String> rootSet = new Set <String>(); for (int a = 0; a < table.Rows.Count; a++) { Item <String> newItem = new Item <String>(); String[] items = table.Rows[a]["ITEM"].ToString().Split(','); for (int b = 0; b < items.Length; b++) { newItem.add(new Data <String>(items[b])); } rootSet.add(newItem); } Utils.fillRowListView(ref root, table); AprioriAlgorithm <String> aa = AprioriAlgorithm <String> .createInstance(rootSet, Utils.toInt(cmbSupport.Items[cmbSupport.SelectedIndex].ToString())); Set <String> next = new Set <String>(); int scanCount = 1; while (next != null) { if ((next = aa.nextScan()) != null) { TabPage newPage = new TabPage("Scan " + scanCount); analysis.TabPages.Add(newPage); ScanResultView resultView = new ScanResultView(); ListView halfResultView = resultView.View1; Utils.fillListView(ref halfResultView, mapScanResultToTable(next)); if ((next = aa.finalizeCurrentScan()) != null) { ListView finalResultView = resultView.View2; Utils.fillListView(ref finalResultView, mapScanResultToTable(next)); scanCount++; } resultView.Size = newPage.Size; newPage.Controls.Add(resultView); } } }