private void RefreshMasterList() { String modifier = ""; if (cb_filter.SelectedIndex == 0 || cb_filter.SelectedIndex == -1) { modifier = "WHERE " + " ITEM_NUMBER LIKE '" + tb_search.Text + "%' OR " + " SUPPLIER_NUMBER LIKE '" + tb_search.Text + "%' OR " + " ITEM_NAME LIKE '" + tb_search.Text + "%' OR " + " DESCRIPTION LIKE '" + tb_search.Text + "%' OR " + " QUANTITY LIKE '" + tb_search.Text + "%' OR " + " REORDER_LEVEL LIKE '" + tb_search.Text + "%' OR " + " UNIT LIKE '" + tb_search.Text + "%' OR " + " COST_PER_UNIT LIKE '" + tb_search.Text + "%' OR " + " ITEM_TYPE LIKE '" + tb_search.Text + "%' OR " + " DOSAGE LIKE '" + tb_search.Text + "%' OR " + " METHOD_OF_ADMINISTRATION LIKE '%" + tb_search.Text + "'"; } else { modifier = "WHERE " + cb_filter.SelectedItem.ToString() + " LIKE '" + tb_search.Text + "%'"; } DB = new FinalSanitariumMIS.Helpers.DatabaseHelper(); DB2ResultSet rs = DB.QueryWithResultSet("SELECT * FROM SUPPLY " + modifier); dgv_inventory.Rows.Clear(); while (rs.Read()) { Object[] d = new Object[11]; d[0] = rs.GetString(0); d[1] = rs.GetString(2); d[2] = rs.GetString(3); d[3] = rs.GetString(4); d[4] = rs.GetString(5); d[5] = rs.GetString(6); d[6] = rs.GetString(7); d[7] = rs.GetString(1); d[8] = (rs.GetInt32(8) == 0)? "Supply" : "Drug"; d[9] = rs.GetString(9); d[10] = rs.GetString(10); dgv_inventory.Rows.Add(d); } }
private void RefreshMasterList() { DB = new FinalSanitariumMIS.Helpers.DatabaseHelper(); DB2ResultSet rs = DB.QueryWithResultSet("SELECT * FROM SUPPLIER"); dgv_masterlist.Rows.Clear(); while (rs.Read()) { Object[] d = new Object[5]; d[0] = rs.GetString(0); d[1] = rs.GetString(1); d[2] = rs.GetString(2); d[3] = rs.GetString(3); d[4] = rs.GetString(4); dgv_masterlist.Rows.Add(d); } }
private void RefreshMasterList() { // not yet tested , requires view from db DB = new FinalSanitariumMIS.Helpers.DatabaseHelper(); DB2ResultSet rs = DB.QueryWithResultSet("SELECT * FROM VW_STAFF WHERE POSITION = 'doctor'"); dgv_masterlist.Rows.Clear(); while (rs.Read()) { Object[] d = new Object[5]; d[0] = rs.GetString(0); d[1] = rs.GetString(1); d[2] = rs.GetString(2); d[3] = rs.GetString(3); d[4] = rs.GetString(4); dgv_masterlist.Rows.Add(d); } }