dodanie testowe
This commit is contained in:
parent
567c3539ad
commit
490f915ec7
@ -42,7 +42,7 @@ namespace FirmTracker_Server.Controllers
|
||||
[HttpPost]
|
||||
[ProducesResponseType(200)] // Created
|
||||
[ProducesResponseType(400)] // Bad Request
|
||||
[Authorize(Roles = Roles.Admin)]
|
||||
[Authorize(Roles = Roles.Admin + "," + Roles.User)]
|
||||
public IActionResult CreateProduct([FromBody] Product product)
|
||||
{
|
||||
try
|
||||
@ -153,7 +153,7 @@ namespace FirmTracker_Server.Controllers
|
||||
[HttpDelete("{id}")]
|
||||
[ProducesResponseType(200)] // Created
|
||||
[ProducesResponseType(400)] // Bad Request
|
||||
[Authorize(Roles = Roles.Admin)]
|
||||
[Authorize(Roles = Roles.Admin + "," + Roles.User)]
|
||||
public IActionResult DeleteProduct(int id)
|
||||
{
|
||||
try
|
||||
|
@ -119,7 +119,6 @@ namespace FirmTracker_Server.Controllers
|
||||
return BadRequest(new { message = "User email must be provided." });
|
||||
}
|
||||
|
||||
// Fetch the userId based on the provided email
|
||||
int userId;
|
||||
using (var session = SessionFactory.OpenSession())
|
||||
{
|
||||
@ -131,7 +130,6 @@ namespace FirmTracker_Server.Controllers
|
||||
userId = user.UserId;
|
||||
}
|
||||
|
||||
// Add the absence for the retrieved userId
|
||||
_workdayCRUD.AddAbsence(userId, dto.AbsenceType, dto.StartTime, dto.EndTime);
|
||||
|
||||
return Ok(new { status = "added", userId, dto.userEmail, absenceType = dto.AbsenceType });
|
||||
|
@ -19,7 +19,7 @@ namespace FirmTracker_Server.Models
|
||||
public class AddAbsenceDto
|
||||
{
|
||||
public string userEmail { get; set; }
|
||||
public string AbsenceType { get; set; } // e.g., "Sick", "Vacation", etc.
|
||||
public string AbsenceType { get; set; }
|
||||
public DateTime StartTime { get; set; }
|
||||
public DateTime EndTime { get; set; }
|
||||
|
||||
|
429
TestClass.cs
429
TestClass.cs
@ -60,22 +60,22 @@ namespace FirmTracker_Server
|
||||
|
||||
var products = new List<Product>
|
||||
{
|
||||
CreateProduct("Tarta_truskawka", "produkt", 31.99m, 1, 10),
|
||||
CreateProduct("Tarta_czekolada", "produkt", 30.99m, 1, 10),
|
||||
CreateProduct("Tarta_agrest", "produkt", 32.90m, 1, 8),
|
||||
CreateProduct("Tarta_pistacja", "produkt", 35.99m, 1, 12),
|
||||
CreateProduct("Tarta_karmel", "produkt", 32.00m, 1, 12),
|
||||
CreateProduct("Rolada_beza", "produkt", 21.00m, 1, 5),
|
||||
CreateProduct("Tarta_truskawka", "produkt", 31.99m, 1, 20),
|
||||
CreateProduct("Tarta_czekolada", "produkt", 30.99m, 1, 20),
|
||||
CreateProduct("Tarta_agrest", "produkt", 32.90m, 1, 10),
|
||||
CreateProduct("Tarta_pistacja", "produkt", 35.99m, 1, 15),
|
||||
CreateProduct("Tarta_karmel", "produkt", 32.00m, 1, 15),
|
||||
CreateProduct("Rolada_beza", "produkt", 21.00m, 1, 12),
|
||||
CreateProduct("Rolada_róża", "produkt", 21.90m, 1, 10),
|
||||
CreateProduct("Kostka_truskawka", "produkt", 12.00m, 1, 11),
|
||||
CreateProduct("Kostka_lemonCurd", "produkt", 13.99m, 1, 13),
|
||||
CreateProduct("Kostka_hiszpańska", "produkt", 11.99m, 1, 8),
|
||||
CreateProduct("Kostka_wiosenna", "produkt", 11.99m, 1, 5),
|
||||
CreateProduct("Kostka_jabłka", "produkt", 12.00m, 1, 5),
|
||||
CreateProduct("Kostka_porzeczka", "produkt", 12.99m, 1, 5),
|
||||
CreateProduct("Kostka_królewska", "produkt", 13.50m, 1, 5),
|
||||
CreateProduct("Kostka_czekolada", "produkt", 14.50m, 1, 10),
|
||||
CreateProduct("Kostka_wiśnia", "produkt", 12.50m, 1, 5),
|
||||
CreateProduct("Kostka_truskawka", "produkt", 12.00m, 1, 15),
|
||||
CreateProduct("Kostka_lemonCurd", "produkt", 13.99m, 1, 15),
|
||||
CreateProduct("Kostka_hiszpańska", "produkt", 11.99m, 1, 10),
|
||||
CreateProduct("Kostka_wiosenna", "produkt", 11.99m, 1, 10),
|
||||
CreateProduct("Kostka_jabłka", "produkt", 12.00m, 1, 15),
|
||||
CreateProduct("Kostka_porzeczka", "produkt", 12.99m, 1, 10),
|
||||
CreateProduct("Kostka_królewska", "produkt", 13.50m, 1, 20),
|
||||
CreateProduct("Kostka_czekolada", "produkt", 14.50m, 1, 12),
|
||||
CreateProduct("Kostka_wiśnia", "produkt", 12.50m, 1, 10),
|
||||
CreateProduct("Kostka_beza", "produkt", 13.50m, 1, 20),
|
||||
CreateProduct("Kostka_leśna", "produkt", 12.00m, 1, 20),
|
||||
CreateProduct("Kostka_kawowa", "produkt", 12.00m, 1, 10),
|
||||
@ -116,38 +116,7 @@ namespace FirmTracker_Server
|
||||
|
||||
};
|
||||
|
||||
var transaction1 = new Transaction
|
||||
{
|
||||
Date = DateTime.Now.AddDays(-2),
|
||||
Description = "zamówienie telefon",
|
||||
Discount = 5,
|
||||
EmployeeId = 1,
|
||||
PaymentType = "Karta kredytowa",
|
||||
};
|
||||
var transaction2 = new Transaction
|
||||
{
|
||||
Date = DateTime.Now.AddDays(-3),
|
||||
Description = "sprzedaż - kasa",
|
||||
Discount = 30,
|
||||
EmployeeId = 2,
|
||||
PaymentType = "Gotówka",
|
||||
};
|
||||
var transaction3 = new Transaction
|
||||
{
|
||||
Date = DateTime.Now,
|
||||
Description = "sprzedaż - kasa",
|
||||
Discount = 15,
|
||||
EmployeeId = 1,
|
||||
PaymentType = "BLIK",
|
||||
};
|
||||
var transaction4 = new Transaction
|
||||
{
|
||||
Date = DateTime.Now,
|
||||
Description = "zamówienie",
|
||||
Discount = 15,
|
||||
EmployeeId = 1,
|
||||
PaymentType = "BLIK",
|
||||
};
|
||||
|
||||
|
||||
var expense1 = new Expense
|
||||
{
|
||||
@ -186,10 +155,14 @@ namespace FirmTracker_Server
|
||||
|
||||
//SessionFactory.Init(connectionString);
|
||||
|
||||
string queryUser = "insert into Users(Email,PassHash,Role) select '123@wp.pl', 'AQAAAAIAAYagAAAAEMQUuFPUNAddMmuZpCUAZpaDR31+BqMJhnamIAllDi+aTBJQ7tEtLuEMppgz0oLYyw==','User'";
|
||||
string queryAdmin = "insert into Users(Email,PassHash,Role) select '321@wp.pl', 'AQAAAAIAAYagAAAAEMQUuFPUNAddMmuZpCUAZpaDR31+BqMJhnamIAllDi+aTBJQ7tEtLuEMppgz0oLYyw==','Admin'";
|
||||
string queryAdmin = "insert into Users(Email,PassHash,Role) select 'julia.c03@wp.pl', 'AQAAAAIAAYagAAAAEMQUuFPUNAddMmuZpCUAZpaDR31+BqMJhnamIAllDi+aTBJQ7tEtLuEMppgz0oLYyw==','Admin'";
|
||||
string queryUser = "insert into Users(Email,PassHash,Role) select 'sylwia1972@gmail.com', 'AQAAAAIAAYagAAAAEMQUuFPUNAddMmuZpCUAZpaDR31+BqMJhnamIAllDi+aTBJQ7tEtLuEMppgz0oLYyw==','User'";
|
||||
string queryUser2 = "insert into Users(Email,PassHash,Role) select '123@wp.pl', 'AQAAAAIAAYagAAAAEMQUuFPUNAddMmuZpCUAZpaDR31+BqMJhnamIAllDi+aTBJQ7tEtLuEMppgz0oLYyw==','User'";
|
||||
string queryUser3 = "insert into Users(Email,PassHash,Role) select '321@wp.pl', 'AQAAAAIAAYagAAAAEMQUuFPUNAddMmuZpCUAZpaDR31+BqMJhnamIAllDi+aTBJQ7tEtLuEMppgz0oLYyw==','User'";
|
||||
string queryUser4 = "insert into Users(Email,PassHash,Role) select 'magdalena.szwarc75@wp.pl', 'AQAAAAIAAYagAAAAEMQUuFPUNAddMmuZpCUAZpaDR31+BqMJhnamIAllDi+aTBJQ7tEtLuEMppgz0oLYyw==','User'";
|
||||
string queryUser5 = "insert into Users(Email,PassHash,Role) select 'jac.ziel@gmail.com', 'AQAAAAIAAYagAAAAEMQUuFPUNAddMmuZpCUAZpaDR31+BqMJhnamIAllDi+aTBJQ7tEtLuEMppgz0oLYyw==','User'";
|
||||
string queryUser6 = "insert into Users(Email,PassHash,Role) select 'renata.zielonka@wp.com', 'AQAAAAIAAYagAAAAEMQUuFPUNAddMmuZpCUAZpaDR31+BqMJhnamIAllDi+aTBJQ7tEtLuEMppgz0oLYyw==','User'";
|
||||
|
||||
|
||||
SqlConnection connection = new SqlConnection(connectionString);
|
||||
connection.Open();
|
||||
|
||||
@ -207,6 +180,44 @@ namespace FirmTracker_Server
|
||||
command2.ExecuteNonQuery();
|
||||
connection2.Close();
|
||||
|
||||
SqlConnection connection3 = new SqlConnection(connectionString);
|
||||
connection.Open();
|
||||
|
||||
SqlCommand command3 = new SqlCommand(queryUser2, connection);
|
||||
command2.CommandTimeout = 200;
|
||||
command2.ExecuteNonQuery();
|
||||
connection2.Close();
|
||||
SqlConnection connection4 = new SqlConnection(connectionString);
|
||||
connection.Open();
|
||||
|
||||
SqlCommand command4 = new SqlCommand(queryUser3, connection);
|
||||
command2.CommandTimeout = 200;
|
||||
command2.ExecuteNonQuery();
|
||||
connection2.Close();
|
||||
|
||||
SqlConnection connection5 = new SqlConnection(connectionString);
|
||||
connection.Open();
|
||||
|
||||
SqlCommand command5 = new SqlCommand(queryUser4, connection);
|
||||
command2.CommandTimeout = 200;
|
||||
command2.ExecuteNonQuery();
|
||||
connection2.Close();
|
||||
|
||||
SqlConnection connection6 = new SqlConnection(connectionString);
|
||||
connection.Open();
|
||||
|
||||
SqlCommand command6 = new SqlCommand(queryUser6, connection);
|
||||
command2.CommandTimeout = 200;
|
||||
command2.ExecuteNonQuery();
|
||||
connection2.Close();
|
||||
|
||||
SqlConnection connection7 = new SqlConnection(connectionString);
|
||||
connection.Open();
|
||||
|
||||
SqlCommand command7 = new SqlCommand(queryUser5, connection);
|
||||
command2.CommandTimeout = 200;
|
||||
command2.ExecuteNonQuery();
|
||||
connection2.Close();
|
||||
}
|
||||
|
||||
}
|
||||
@ -230,61 +241,307 @@ namespace FirmTracker_Server
|
||||
{
|
||||
productCrud.AddProduct(clientProduct);
|
||||
}
|
||||
transactionCrud.AddTransaction(transaction1);
|
||||
/*transactionCrud.AddTransaction(transaction1);
|
||||
transactionCrud.AddTransaction(transaction2);
|
||||
transactionCrud.AddTransaction(transaction3);
|
||||
transactionCrud.AddTransaction(transaction4);
|
||||
transactionCrud.AddTransaction(transaction5);
|
||||
transactionCrud.AddTransaction(transaction6);
|
||||
transactionCrud.AddTransaction(transaction7);
|
||||
transactionCrud.AddTransaction(transaction8);
|
||||
transactionCrud.AddTransaction(transaction9);
|
||||
transactionCrud.AddTransaction(transaction10);
|
||||
transactionCrud.AddTransaction(transaction11);
|
||||
transactionCrud.AddTransaction(transaction12);
|
||||
transactionCrud.AddTransaction(transaction13);
|
||||
transactionCrud.AddTransaction(transaction14);
|
||||
transactionCrud.AddTransaction(transaction15);
|
||||
transactionCrud.AddTransaction(transaction16);
|
||||
transactionCrud.AddTransaction(transaction17);
|
||||
transactionCrud.AddTransaction(transaction18);
|
||||
transactionCrud.AddTransaction(transaction19);
|
||||
transactionCrud.AddTransaction(transaction20);*/
|
||||
expenseCrud.AddExpense(expense1);
|
||||
expenseCrud.AddExpense(expense2);
|
||||
expenseCrud.AddExpense(expense3);
|
||||
|
||||
var transactions = new List<Transaction>
|
||||
{
|
||||
new Transaction
|
||||
{
|
||||
Date = DateTime.Now.AddDays(-1),
|
||||
Description = "zamówienie",
|
||||
Discount = 5,
|
||||
EmployeeId = 1,
|
||||
PaymentType = "Gotówka"
|
||||
},
|
||||
new Transaction
|
||||
{
|
||||
Date = DateTime.Now.AddDays(-2),
|
||||
Description = "sprzedaż",
|
||||
Discount = 10,
|
||||
EmployeeId = 2,
|
||||
PaymentType = "Karta kredytowa"
|
||||
},
|
||||
new Transaction
|
||||
{
|
||||
Date = DateTime.Now.AddDays(-3),
|
||||
Description = "sprzedaż",
|
||||
Discount = 15,
|
||||
EmployeeId = 3,
|
||||
PaymentType = "BLIK"
|
||||
},
|
||||
new Transaction
|
||||
{
|
||||
Date = DateTime.Now,
|
||||
Description = "sprzedaż",
|
||||
Discount = 20,
|
||||
EmployeeId = 4,
|
||||
PaymentType = "Gotówka"
|
||||
},
|
||||
new Transaction
|
||||
{
|
||||
Date = DateTime.Now.AddDays(-5),
|
||||
Description = "sprzedaż",
|
||||
Discount = 8,
|
||||
EmployeeId = 1,
|
||||
PaymentType = "Gotówka"
|
||||
},
|
||||
new Transaction
|
||||
{
|
||||
Date = DateTime.Now.AddDays(-6),
|
||||
Description = "na telefon",
|
||||
Discount = 12,
|
||||
EmployeeId = 2,
|
||||
PaymentType = "Karta kredytowa"
|
||||
},
|
||||
new Transaction
|
||||
{
|
||||
Date = DateTime.Now.AddDays(-7),
|
||||
Description = "sprzedaż",
|
||||
Discount = 18,
|
||||
EmployeeId = 3,
|
||||
PaymentType = "BLIK"
|
||||
},
|
||||
new Transaction
|
||||
{
|
||||
Date = DateTime.Now.AddDays(-8),
|
||||
Description = "rezerwacja",
|
||||
Discount = 25,
|
||||
EmployeeId = 4,
|
||||
PaymentType = "Gotówka"
|
||||
},
|
||||
new Transaction
|
||||
{
|
||||
Date = DateTime.Now.AddDays(-10),
|
||||
Description = "sprzedaż",
|
||||
Discount = 9,
|
||||
EmployeeId = 1,
|
||||
PaymentType = "Gotówka"
|
||||
},
|
||||
new Transaction
|
||||
{
|
||||
Date = DateTime.Now.AddDays(-11),
|
||||
Description = "zamówienie telefoniczne",
|
||||
Discount = 14,
|
||||
EmployeeId = 2,
|
||||
PaymentType = "Karta kredytowa"
|
||||
},
|
||||
new Transaction
|
||||
{
|
||||
Date = DateTime.Now.AddDays(-12),
|
||||
Description = "sprzedaż w punkcie",
|
||||
Discount = 17,
|
||||
EmployeeId = 3,
|
||||
PaymentType = "BLIK"
|
||||
},
|
||||
new Transaction
|
||||
{
|
||||
Date = DateTime.Now.AddDays(-13),
|
||||
Description = "zamówienie",
|
||||
Discount = 22,
|
||||
EmployeeId = 4,
|
||||
PaymentType = "Gotówka"
|
||||
},
|
||||
new Transaction
|
||||
{
|
||||
Date = DateTime.Now.AddDays(-15),
|
||||
Description = "sprzedaż",
|
||||
Discount = 7,
|
||||
EmployeeId = 1,
|
||||
PaymentType = "Gotówka"
|
||||
},
|
||||
new Transaction
|
||||
{
|
||||
Date = DateTime.Now.AddDays(-16),
|
||||
Description = "zamówienie",
|
||||
Discount = 13,
|
||||
EmployeeId = 2,
|
||||
PaymentType = "Karta kredytowa"
|
||||
},
|
||||
new Transaction
|
||||
{
|
||||
Date = DateTime.Now.AddDays(-17),
|
||||
Description = "sprzedaż",
|
||||
Discount = 16,
|
||||
EmployeeId = 3,
|
||||
PaymentType = "BLIK"
|
||||
},
|
||||
new Transaction
|
||||
{
|
||||
Date = DateTime.Now.AddDays(-18),
|
||||
Description = "na telefon",
|
||||
Discount = 21,
|
||||
EmployeeId = 4,
|
||||
PaymentType = "Gotówka"
|
||||
},
|
||||
new Transaction
|
||||
{
|
||||
Date = DateTime.Now.AddDays(-20),
|
||||
Description = "sprzedaż",
|
||||
Discount = 10,
|
||||
EmployeeId = 1,
|
||||
PaymentType = "Gotówka"
|
||||
},
|
||||
new Transaction
|
||||
{
|
||||
Date = DateTime.Now.AddDays(-21),
|
||||
Description = "zamówienie telefoniczne",
|
||||
Discount = 12,
|
||||
EmployeeId = 2,
|
||||
PaymentType = "Karta kredytowa"
|
||||
},
|
||||
new Transaction
|
||||
{
|
||||
Date = DateTime.Now.AddDays(-22),
|
||||
Description = "sprzedaż w punkcie",
|
||||
Discount = 14,
|
||||
EmployeeId = 3,
|
||||
PaymentType = "BLIK"
|
||||
},
|
||||
new Transaction
|
||||
{
|
||||
Date = DateTime.Now.AddDays(-23),
|
||||
Description = "zamówienie online",
|
||||
Discount = 18,
|
||||
EmployeeId = 4,
|
||||
PaymentType = "Gotówka"
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
List<TransactionProduct> testTransactionProducts = new List<TransactionProduct> {
|
||||
new TransactionProduct { ProductID =17, Quantity = 3 },
|
||||
new TransactionProduct { ProductID = 14, Quantity = 1 },
|
||||
new TransactionProduct { ProductID = 1, Quantity = 1 },
|
||||
};
|
||||
foreach (var transactionProduct in testTransactionProducts)
|
||||
var transactionProducts = new List<(int TransactionIndex, int ProductID, int Quantity)>
|
||||
{
|
||||
(0, 1, 1), // Transaction 1: Product 1 with quantity 1
|
||||
(0, 2, 3), // Transaction 1: Product 2 with quantity 3
|
||||
(1, 3, 4), // Transaction 2: Product 3 with quantity 4
|
||||
(1, 4, 2), // Transaction 2: Product 4 with quantity 2
|
||||
(2, 5, 3), // Transaction 3: Product 5 with quantity 3
|
||||
(2, 6, 1), // Transaction 3: Product 6 with quantity 1
|
||||
(3, 7, 5), // Transaction 4: Product 7 with quantity 5
|
||||
(3, 8, 2), // Transaction 4: Product 8 with quantity 2
|
||||
(4, 9, 3), // Transaction 5: Product 9 with quantity 3
|
||||
(4, 10, 2), // Transaction 5: Product 10 with quantity 2
|
||||
(5, 11, 4), // Transaction 6: Product 11 with quantity 4
|
||||
(5, 12, 1), // Transaction 6: Product 12 with quantity 1
|
||||
(6, 13, 3), // Transaction 7: Product 13 with quantity 3
|
||||
(6, 14, 2), // Transaction 7: Product 14 with quantity 2
|
||||
(7, 15, 5), // Transaction 8: Product 15 with quantity 5
|
||||
(7, 16, 2), // Transaction 8: Product 16 with quantity 2
|
||||
(8, 17, 3), // Transaction 9: Product 17 with quantity 3
|
||||
(8, 18, 4), // Transaction 9: Product 18 with quantity 4
|
||||
(9, 19, 2), // Transaction 10: Product 19 with quantity 2
|
||||
(9, 20, 3), // Transaction 10: Product 20 with quantity 3
|
||||
(10, 1, 1), // Transaction 11: Product 1 with quantity 1
|
||||
(10, 2, 5), // Transaction 11: Product 2 with quantity 5
|
||||
(11, 3, 2), // Transaction 12: Product 3 with quantity 2
|
||||
(11, 4, 3), // Transaction 12: Product 4 with quantity 3
|
||||
(12, 5, 1), // Transaction 13: Product 5 with quantity 1
|
||||
(12, 6, 4), // Transaction 13: Product 6 with quantity 4
|
||||
(13, 7, 2), // Transaction 14: Product 7 with quantity 2
|
||||
(13, 8, 3), // Transaction 14: Product 8 with quantity 3
|
||||
(14, 9, 3), // Transaction 15: Product 9 with quantity 3
|
||||
(14, 10, 1), // Transaction 15: Product 10 with quantity 1
|
||||
(15, 11, 2), // Transaction 16: Product 11 with quantity 2
|
||||
(15, 12, 3), // Transaction 16: Product 12 with quantity 3
|
||||
(16, 13, 3), // Transaction 17: Product 13 with quantity 3
|
||||
(16, 14, 1), // Transaction 17: Product 14 with quantity 1
|
||||
(17, 15, 4), // Transaction 18: Product 15 with quantity 4
|
||||
(17, 16, 1), // Transaction 18: Product 16 with quantity 1
|
||||
(18, 17, 2), // Transaction 19: Product 17 with quantity 2
|
||||
(18, 18, 3), // Transaction 19: Product 18 with quantity 3
|
||||
(19, 19, 1), // Transaction 20: Product 19 with quantity 1
|
||||
(19, 20, 2), // Transaction 20: Product 20 with quantity 2
|
||||
};
|
||||
|
||||
|
||||
// Add transactions
|
||||
foreach (var transaction in transactions)
|
||||
{
|
||||
transactionCrud.AddTransactionProductToTransaction(transaction1.Id, transactionProduct);
|
||||
|
||||
transactionCrud.AddTransaction(transaction);
|
||||
}
|
||||
|
||||
List<TransactionProduct> testTransactionProducts2 = new List<TransactionProduct>
|
||||
// Add transaction products
|
||||
foreach (var transactionProduct in transactionProducts)
|
||||
{
|
||||
new TransactionProduct { ProductID = 28, Quantity=5},
|
||||
new TransactionProduct { ProductID = 22, Quantity=5}
|
||||
};
|
||||
foreach (var transactionProduct in testTransactionProducts2)
|
||||
{
|
||||
transactionCrud.AddTransactionProductToTransaction(transaction2.Id, transactionProduct);
|
||||
|
||||
var transactionId = transactions[transactionProduct.TransactionIndex].Id;
|
||||
transactionCrud.AddTransactionProductToTransaction(
|
||||
transactionId,
|
||||
new TransactionProduct
|
||||
{
|
||||
ProductID = transactionProduct.ProductID,
|
||||
Quantity = transactionProduct.Quantity
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
List<TransactionProduct> testTransactionProducts3 = new List<TransactionProduct>
|
||||
{
|
||||
new TransactionProduct { ProductID = 3, Quantity=9},
|
||||
new TransactionProduct { ProductID = 2, Quantity=1}
|
||||
};
|
||||
foreach (var transactionProduct in testTransactionProducts3)
|
||||
{
|
||||
transactionCrud.AddTransactionProductToTransaction(transaction3.Id, transactionProduct);
|
||||
|
||||
}
|
||||
List<TransactionProduct> testTransactionProducts4 = new List<TransactionProduct>
|
||||
{
|
||||
new TransactionProduct { ProductID = 33, Quantity=12},
|
||||
new TransactionProduct { ProductID = 12, Quantity=1}
|
||||
};
|
||||
foreach (var transactionProduct in testTransactionProducts4)
|
||||
{
|
||||
transactionCrud.AddTransactionProductToTransaction(transaction4.Id, transactionProduct);
|
||||
|
||||
}
|
||||
/* List<TransactionProduct> testTransactionProducts = new List<TransactionProduct> {
|
||||
new TransactionProduct { ProductID =17, Quantity = 3 },
|
||||
new TransactionProduct { ProductID = 14, Quantity = 1 },
|
||||
new TransactionProduct { ProductID = 1, Quantity = 1 },
|
||||
};
|
||||
foreach (var transactionProduct in testTransactionProducts)
|
||||
{
|
||||
transactionCrud.AddTransactionProductToTransaction(transaction1.Id, transactionProduct);
|
||||
|
||||
}
|
||||
|
||||
List<TransactionProduct> testTransactionProducts2 = new List<TransactionProduct>
|
||||
{
|
||||
new TransactionProduct { ProductID = 28, Quantity=5},
|
||||
new TransactionProduct { ProductID = 22, Quantity=5}
|
||||
};
|
||||
foreach (var transactionProduct in testTransactionProducts2)
|
||||
{
|
||||
transactionCrud.AddTransactionProductToTransaction(transaction2.Id, transactionProduct);
|
||||
|
||||
}
|
||||
|
||||
List<TransactionProduct> testTransactionProducts3 = new List<TransactionProduct>
|
||||
{
|
||||
new TransactionProduct { ProductID = 3, Quantity=9},
|
||||
new TransactionProduct { ProductID = 2, Quantity=1}
|
||||
};
|
||||
foreach (var transactionProduct in testTransactionProducts3)
|
||||
{
|
||||
transactionCrud.AddTransactionProductToTransaction(transaction3.Id, transactionProduct);
|
||||
|
||||
}
|
||||
List<TransactionProduct> testTransactionProducts4 = new List<TransactionProduct>
|
||||
{
|
||||
new TransactionProduct { ProductID = 33, Quantity=12},
|
||||
new TransactionProduct { ProductID = 12, Quantity=1}
|
||||
};
|
||||
foreach (var transactionProduct in testTransactionProducts4)
|
||||
{
|
||||
transactionCrud.AddTransactionProductToTransaction(transaction4.Id, transactionProduct);
|
||||
|
||||
}*/
|
||||
|
||||
}
|
||||
catch(Exception ex)
|
||||
catch (Exception ex)
|
||||
{
|
||||
Console.WriteLine(ex.ToString());
|
||||
throw;
|
||||
|
Loading…
Reference in New Issue
Block a user