public static void saveWarehouse(WarehouseModel warehouse) { using (IDbConnection cnn = new SQLiteConnection(loadConnectionString())) { cnn.Execute("insert into Warehouse (partName, producent, price, stockQuantity) values (@partName, @producent, @price, @stockQuantity)", warehouse); } }
public static void deleteWarehouse(WarehouseModel warehouse) { using (IDbConnection cnn = new SQLiteConnection(loadConnectionString())) { cnn.Execute("delete from Warehouse where idParts=@idParts", warehouse); } }
public static void updateWarehouse(WarehouseModel warehouse) { using (IDbConnection cnn = new SQLiteConnection(loadConnectionString())) { cnn.Execute("update Warehouse set partName = @partName, producent = @producent, price = @price, stockQuantity = @stockQuantity where idParts = @idParts", warehouse); } }
public static void updateOrders(OrdersModel orders, WarehouseModel warehouse) { if (orders.status != "zrealizowane") { using (IDbConnection cnn = new SQLiteConnection(loadConnectionString())) { cnn.Execute("update Orders set status = 'zrealizowane' where idOrder = @idOrder", orders); } using (IDbConnection cnn = new SQLiteConnection(loadConnectionString())) { cnn.Execute("update Warehouse set stockQuantity = stockQuantity + @amount - @bookedAmount where idParts = @idParts", orders); } } }