mirror of
https://github.com/stokebob/bnhtrade.git
synced 2026-03-20 06:57:15 +00:00
wip, this turned into a maaaaaahooosive job
This commit is contained in:
45
src/bnhtrade.Core/Logic/Inventory/StockJournalService.cs
Normal file
45
src/bnhtrade.Core/Logic/Inventory/StockJournalService.cs
Normal file
@@ -0,0 +1,45 @@
|
||||
using bnhtrade.Core.Data.Database.UnitOfWork;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace bnhtrade.Core.Logic.Inventory
|
||||
{
|
||||
public class StockJournalService : UnitOfWorkBase
|
||||
{
|
||||
public StockJournalService() { }
|
||||
|
||||
internal StockJournalService(IUnitOfWork unitOfWork) : base(unitOfWork) { }
|
||||
|
||||
public void StockJournalDelete(int stockJournalId)
|
||||
{
|
||||
WithUnitOfWork(uow =>
|
||||
{
|
||||
if (stockJournalId <= 0)
|
||||
{
|
||||
throw new ArgumentException("Stock journal ID must be greater than zero", nameof(stockJournalId));
|
||||
}
|
||||
bool result = uow.StockJournalRepository.DeleteStockJournal(stockJournalId);
|
||||
CommitIfOwned(uow);
|
||||
if (!result)
|
||||
{
|
||||
throw new InvalidOperationException($"Failed to delete stock journal with ID {stockJournalId}");
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public bool WIP_StockJournalConsistencyCheck(int stockId, List<int> statusIdEffected = null)
|
||||
{
|
||||
return WithUnitOfWork(uow =>
|
||||
{
|
||||
if (stockId <= 0)
|
||||
{
|
||||
throw new ArgumentException("Stock ID must be greater than zero", nameof(stockId));
|
||||
}
|
||||
return uow.StockJournalRepository.WIP_StockJournalConsistencyCheck(stockId, statusIdEffected);
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user