using GB5Shared.DTO.Framework.Criteria; using GB5Shared.DTO.Framework.Login; using MMDAL.CustomCode.Allocation; namespace MMBLL.Allocation { /// /// Business Logic Layer for Allocation operations. /// Delegates data access to and enforces /// database-type routing (SQL Server vs Oracle) where required. /// public class AllocationBLL : IAllocationBLL { private readonly IAllocationDAL _AllocationDAL; public AllocationBLL(IAllocationDAL AllocationDAL) { _AllocationDAL = AllocationDAL; } /// public async Task GetAllocation(int AllocationId, LoginDTO LoginDTO) { try { return await _AllocationDAL.GetAllocation(AllocationId, LoginDTO); } catch (Exception) { throw; } } /// /// /// GB4 Migration Note: /// In GB4, the BLL checked LoginDTO.DatabaseType != 1 to route between two DAL methods. /// In GB5, this routing is preserved at the BLL layer to keep DAL methods single-purpose: /// - DatabaseType != 1 (SQL Server) → /// - DatabaseType == 1 (Oracle) → /// public async Task LoadFromAllocationPicklist( int FirstNumber, int MaxResult, CriteriaDTO CriteriaDTO, LoginDTO LoginDTO) { try { // Oracle uses a separate pending allocation path because // the TPendingAllocation trigger implementation differs from SQL Server. // Once all allocations post uniformly to TPendingAllocation on Oracle, // this branch can be collapsed into a single DAL call. if (LoginDTO.DatabaseType == 1) { return await _AllocationDAL.GetPendingAllocationForOracle(CriteriaDTO, LoginDTO); } return await _AllocationDAL.LoadFromAllocationPicklist(FirstNumber, MaxResult, CriteriaDTO, LoginDTO); } catch (Exception) { throw; } } /// public async Task GetPendingNewListForProductionPlan(CriteriaDTO CriteriaDTO, LoginDTO LoginDTO) { try { return await _AllocationDAL.GetPendingNewListForProductionPlan(CriteriaDTO, LoginDTO); } catch (Exception) { throw; } } } }