public static DataTable Treedata(string noreg) { var dt = new DataTable(); dt.Columns.Add("EQUID", typeof(int)); dt.Columns.Add("DESEQU", typeof(string)); var parentColumn = dt.Columns.Add("PEQUID", typeof(int)); //Data Diagnosa var dh = new dataset.yakkumdbTableAdapters.fa_rx_diagnosaTableAdapter(); var th = new dataset.yakkumdbTableAdapters.fa_rx_prosedurTableAdapter(); dt.Rows.Add(1, "Diagnosis"); DataTable ds = dh.GetDataByNoReg(noreg); foreach (DataRow r in ds.Rows) { dt.Rows.Add(r["id"], r["no_urut"].ToString() + ". " + r["icd_code"].ToString() + " | " + r["icd_desc"].ToString(), 1); } dt.Rows.Add(2, "Procedure"); DataTable ds2 = th.GetDataByNoReg(noreg); foreach (DataRow r in ds2.Rows) { dt.Rows.Add(r["id"], r["no_urut"].ToString() + ". " + r["icd_code"].ToString() + " | " + r["icd_desc"].ToString(), 2); } return(dt); }
private void insertProcedure() { var dt = new dataset.yakkumdbTableAdapters.fa_rx_prosedurTableAdapter(); for (int i = 0; i < dgvProcedure.RowCount - 1; i++) { if (!dgvProcedure.Rows[i].Cells[1].Value.Equals(null)) { dt.UpdateQueryNoUrut(i + 1, (int)dgvProcedure.Rows[i].Cells[3].Value); ////MessageBox.Show(i+1.ToString()); //dt.InsertQuery( //_noreg, //dgvProcedure.Rows[i].Cells[1].Value.ToString(), //dgvProcedure.Rows[i].Cells[2].Value.ToString(), //i+1, ////Int32.Parse(dgvProcedure.Rows[i].Cells[0].Value.ToString()), //DateTime.Now //); } } }