Beispiel #1
0
 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);
     }
 }
Beispiel #2
0
 public static void deleteWarehouse(WarehouseModel warehouse)
 {
     using (IDbConnection cnn = new SQLiteConnection(loadConnectionString()))
     {
         cnn.Execute("delete from Warehouse where idParts=@idParts", warehouse);
     }
 }
Beispiel #3
0
 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);
     }
 }
Beispiel #4
0
 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);
         }
     }
 }