private void btn_save_supply_Click(object sender, EventArgs e) { int isDrug = (tb_dosage.Text == "") ? 0 : 1; DB = new FinalSanitariumMIS.Helpers.DatabaseHelper(); DB2ResultSet rs = DB.QueryWithResultSet("SELECT ITEM_NUMBER FROM SUPPLY WHERE ITEM_NUMBER = " + tb_supply_no.Text); if (!rs.Read()) { DB.Query("INSERT INTO SUPPLY VALUES (" + tb_supply_no.Text + "," + tb_supplier.Text + ",'" + tb_supply_name.Text + "','" + tb_description.Text + "',0," + tb_reorder_level.Text + ",'" + tb_unit.Text + "'," + tb_cost_per_unit.Text + "," + isDrug + ",'" + tb_dosage.Text + "','" + cb_method_administration.Text + "')"); } else { DB.Query("UPDATE SUPPLY SET " + "SUPPLIER_NUMBER = " + tb_supplier.Text + ", ITEM_NAME = '" + tb_supply_name.Text + "', DESCRIPTION = '" + tb_description.Text + "', REORDER_LEVEL = " + tb_reorder_level.Text + ", UNIT = '" + tb_unit.Text + "', COST_PER_UNIT = " + tb_cost_per_unit.Text + ", ITEM_TYPE = " + isDrug + ", DOSAGE = '" + tb_dosage.Text + "', METHOD_OF_ADMINISTRATION = '" + cb_method_administration.Text + "' WHERE ITEM_NUMBER = " + dgv_inventory.CurrentRow.Cells[0].Value.ToString()); } RefreshMasterList(); ClearAllFields(); }
private void btn_add_stock_Click(object sender, EventArgs e) { DB = new FinalSanitariumMIS.Helpers.DatabaseHelper(); DB.Query("UPDATE SUPPLY SET QUANTITY = QUANTITY + " + tb_stock_quantity.Text + " WHERE ITEM_NUMBER = " + dgv_inventory.CurrentRow.Cells[0].Value.ToString()); RefreshMasterList(); tb_stock_quantity.Text = ""; panel_add_stock.Visible = false; }
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 btnlogin_Click(object sender, EventArgs e) { DB = new FinalSanitariumMIS.Helpers.DatabaseHelper(); DB2ResultSet rs = DB.QueryWithResultSet("SELECT * FROM VW_ACCOUNT WHERE USERNAME = '******' AND PASSCODE = '" + txtpassword.Text + "'"); if (rs.Read()) { Models.SessionMeta session = new Models.SessionMeta(); this.Visible = false; new MedDirMainMenu().Visible = true; } else { MessageBox.Show("Incorrect Login Credentials!"); } }
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 btnsave_Click(object sender, EventArgs e) { DB = new FinalSanitariumMIS.Helpers.DatabaseHelper(); DB2ResultSet rs = DB.QueryWithResultSet("SELECT * FROM SUPPLIER WHERE supplier_number = '" + tb_supplier_number.Text + "'"); if (rs.Read()) { DB.Query("UPDATE SUPPLIER SET " + "SUPPLIER_NUMBER = " + tb_supplier_number.Text + "," + "SUPPLIER_NAME = '" + tb_supplier_name.Text + "'," + "ADDRESS = '" + tb_address.Text + "'," + "TELNUMBER = " + tb_tel_no.Text + "," + "FAXNUMBER = " + tb_fax_no.Text + " WHERE SUPPLIER_NUMBER = " + dgv_masterlist.CurrentRow.Cells[0].Value.ToString()); } else { DB.Query("INSERT INTO SUPPLIER VALUES (" + tb_supplier_number.Text + ",'" + tb_supplier_name.Text + "','" + tb_address.Text + "'," + tb_tel_no.Text + "," + tb_fax_no.Text + ")"); } }
public StaffRegistration() { InitializeComponent(); emptyAllInputFields(); DB = new FinalSanitariumMIS.Helpers.DatabaseHelper("127.0.0.1", "50000", "Nicksplat93", "ANGELIE BUEN", "sanita"); }
private void RefreshListofRequesitions() { DB = new FinalSanitariumMIS.Helpers.DatabaseHelper(); DB2ResultSet rs = DB.QueryWithResultSet("SELECT * FROM REQUESITION"); }
public HRMainMenu() { InitializeComponent(); DB = new FinalSanitariumMIS.Helpers.DatabaseHelper("127.0.0.1", "50000", "Rheamaesabas12", "BILL-LAWRENCE", "sanita"); }