PI2024-23 #2

Merged
s464958 merged 21 commits from PI2024-23 into master 2024-06-14 14:47:25 +02:00
Showing only changes of commit 43a4cbf81e - Show all commits

View File

@ -39,21 +39,14 @@ namespace FirmTracker_Server
} }
public void AddTestProduct() public void AddTestProduct()
{ {
// SessionFactory.Init(ConnectionString); // SessionFactory.Init(ConnectionString);
var product = new nHibernate.Products.Product
{
Name = "Produkt test 1",
Description = "testowy produkt",
Price = 11.50m,
Type = 1,
Availability = 5
};
var product2 = new nHibernate.Products.Product var product2 = new nHibernate.Products.Product
{ {
Name = "Usluga 1", Name = "Dostawa",
Description = "testowa usluga", Description = "usługa dostawy",
Price = 1120.00m, Price = 7.50m,
Type = 0, Type = 0,
Availability = 0 Availability = 0
}; };
@ -96,6 +89,22 @@ namespace FirmTracker_Server
CreateProduct("Placek_jogurt", "produkt", 23.00m, 1, 13), CreateProduct("Placek_jogurt", "produkt", 23.00m, 1, 13),
CreateProduct("Placek_śliwka", "produkt", 22.00m, 1, 14), CreateProduct("Placek_śliwka", "produkt", 22.00m, 1, 14),
CreateProduct("Placek_maślany", "produkt", 18.00m, 1,11), CreateProduct("Placek_maślany", "produkt", 18.00m, 1,11),
CreateProduct("Keks", "produkt", 22.00m, 1,11),
CreateProduct("Babka_drożdżowa", "produkt", 16.00m, 1,11),
CreateProduct("Pączek_pistacja", "produkt", 8.00m, 1,11),
CreateProduct("Pączek_marmolada", "produkt", 3.00m, 1,11),
CreateProduct("Pączek_nutella", "produkt", 4.50m, 1,11),
CreateProduct("Pączek_rafaello", "produkt", 4.50m, 1,11),
CreateProduct("Pączek_róża", "produkt", 4.00m, 1,11),
CreateProduct("Ekler", "produkt", 3.00m, 1,11),
CreateProduct("Ekler_słony_karmel", "produkt", 5.00m, 1,11),
CreateProduct("Ptyś", "produkt", 4.00m, 1,11),
CreateProduct("Drożdżówka_ser", "produkt", 4.00m, 1,11),
CreateProduct("Drożdżówka_rabarbar", "produkt", 5.00m, 1,11),
CreateProduct("Drożdżówka_żurawina", "produkt", 5.00m, 1,11),
CreateProduct("Drożdżówka_kruszonka", "produkt", 4.00m, 1,11),
CreateProduct("Drożdżówka_budyń", "produkt", 5.00m, 1,11),
CreateProduct("Jagodzianka", "produkt", 6.00m, 1,11),
}; };
@ -146,9 +155,10 @@ namespace FirmTracker_Server
Description = "naprawa pieca - 25.05.2024" Description = "naprawa pieca - 25.05.2024"
}; };
var expense3 = new Expense var expense3 = new Expense
{ Date = DateTime.Now, {
Value = 1800.00m, Date = DateTime.Now,
Description = "zakup składników " Value = 1800.00m,
Description = "zakup składników "
}; };
@ -157,7 +167,7 @@ namespace FirmTracker_Server
FirmTracker_Server.nHibernate.Products.ProductCRUD productCrud = new ProductCRUD(); FirmTracker_Server.nHibernate.Products.ProductCRUD productCrud = new ProductCRUD();
FirmTracker_Server.nHibernate.Transactions.TransactionCRUD transactionCrud = new nHibernate.Transactions.TransactionCRUD(); FirmTracker_Server.nHibernate.Transactions.TransactionCRUD transactionCrud = new nHibernate.Transactions.TransactionCRUD();
ExpenseCRUD expenseCrud = new ExpenseCRUD(); ExpenseCRUD expenseCrud = new ExpenseCRUD();
productCrud.AddProduct(product); // productCrud.AddProduct(product);
productCrud.AddProduct(product2); productCrud.AddProduct(product2);
// productCrud.AddProduct(product3); // productCrud.AddProduct(product3);
foreach(var clientProduct in products) foreach(var clientProduct in products)
@ -170,11 +180,12 @@ namespace FirmTracker_Server
transactionCrud.AddTransaction(transaction4); transactionCrud.AddTransaction(transaction4);
expenseCrud.AddExpense(expense1); expenseCrud.AddExpense(expense1);
expenseCrud.AddExpense(expense2); expenseCrud.AddExpense(expense2);
expenseCrud.AddExpense(expense3);
List<TransactionProduct> testTransactionProducts = new List<TransactionProduct> { List<TransactionProduct> testTransactionProducts = new List<TransactionProduct> {
new TransactionProduct { ProductID =17, Quantity = 10 }, new TransactionProduct { ProductID =17, Quantity = 10 },
new TransactionProduct { ProductID = 14, Quantity = 1 }, new TransactionProduct { ProductID = 14, Quantity = 1 },
new TransactionProduct { ProductID = 1, Quantity = 2 }, new TransactionProduct { ProductID = 1, Quantity = 0 },
}; };
foreach (var transactionProduct in testTransactionProducts) foreach (var transactionProduct in testTransactionProducts)
{ {
@ -195,7 +206,7 @@ namespace FirmTracker_Server
List<TransactionProduct> testTransactionProducts3 = new List<TransactionProduct> List<TransactionProduct> testTransactionProducts3 = new List<TransactionProduct>
{ {
new TransactionProduct { ProductID = 3, Quantity=12}, new TransactionProduct { ProductID = 3, Quantity=9},
new TransactionProduct { ProductID = 2, Quantity=1} new TransactionProduct { ProductID = 2, Quantity=1}
}; };
foreach (var transactionProduct in testTransactionProducts3) foreach (var transactionProduct in testTransactionProducts3)