public void EditHardware(HardwareItem hardwareItem) { using (SQLiteCommand com = new SQLiteCommand(con)) { com.CommandText = "UPDATE hardware_items SET itemID = '" + hardwareItem.itemID + "', itemName = '" + hardwareItem.itemName + "', price = '" + hardwareItem.price + "', weight = '" + hardwareItem.Weight + "' WHERE itemID = '" + hardwareItem.itemID + "' ;"; com.ExecuteNonQuery(); } }
public void SaveHardwareItem(HardwareItem hardwareItemToSave) { using (SQLiteCommand com = new SQLiteCommand(con)) { com.CommandText = "INSERT INTO hardware_items (itemID, itemName, price, weight) VALUES ('" + hardwareItemToSave.itemID + "','" + hardwareItemToSave.itemName + "', '" + hardwareItemToSave.price + "', '" + hardwareItemToSave.Weight + "')"; com.ExecuteNonQuery(); com.Dispose(); } }
public void DeleteHardwareItem(HardwareItem hardwareitemToDelete) { itemsBaza db1 = new itemsBaza(); db1.ReadItems(); using (SQLiteCommand com = new SQLiteCommand(con)) { com.CommandText = "DELETE FROM hardware_items WHERE (itemID ='" + hardwareitemToDelete.itemID + "');"; com.ExecuteNonQuery(); com.Dispose(); } }
public List <HardwareItem> ReadItemsH() { List <HardwareItem> seznam = new List <HardwareItem>(); using (SQLiteCommand com = new SQLiteCommand(con)) { com.CommandText = "SELECT * FROM hardware_items"; SQLiteDataReader reader = com.ExecuteReader(); while (reader.Read()) { HardwareItem Item = new HardwareItem(Convert.ToString(reader.GetInt32(1)), reader.GetString(2), reader.GetDouble(3), reader.GetDouble(4)); seznam.Add(Item); } } return(seznam); }