public void DeleteSoftware(SoftwareItem itemToDelete) { using (SQLiteCommand com = new SQLiteCommand(con)) { com.CommandText = "DELETE FROM Software WHERE itemID = '" + itemToDelete.ItemID + "';"; com.ExecuteNonQuery(); } }
public void EditSoftwareItem(SoftwareItem itemToEdit) { using (SQLiteCommand com = new SQLiteCommand(con)) { com.CommandText = "UPDATE Software SET itemName = '" + itemToEdit.ItemName + "', price = '" + itemToEdit.ItemPrice + "', licenceKey = '" + itemToEdit.LicenceKey + "', sizeInMB = '" + itemToEdit.SizeInMB + "' WHERE itemID = '" + itemToEdit.ItemID + "';"; com.ExecuteNonQuery(); } }
public void SaveItemSoftware(SoftwareItem itemToSave) { using (SQLiteCommand com = new SQLiteCommand(con)) { com.CommandText = "INSERT INTO Software (itemID, itemName, price, licenceKey, sizeInMB) VALUES ('" + itemToSave.ItemID + "', '" + itemToSave.ItemName + "', '" + itemToSave.ItemPrice + "', '" + itemToSave.LicenceKey + "', '" + itemToSave.SizeInMB + "');"; com.ExecuteNonQuery(); com.Dispose(); } }
public List <SoftwareItem> ReadSoftwareItems() { List <SoftwareItem> seznam = new List <SoftwareItem>(); using (SQLiteCommand com = new SQLiteCommand(con)) { com.CommandText = "SELECT * FROM Software"; SQLiteDataReader reader = null; reader = com.ExecuteReader(); while (reader.Read()) { SoftwareItem item = new SoftwareItem(Convert.ToString(reader["itemID"]), Convert.ToString(reader["itemName"]), Convert.ToDouble(reader["price"]), Convert.ToString(reader["licenceKey"]), Convert.ToDouble(reader["sizeInMB"])); seznam.Add(item); } } return(seznam); }