using System; using System.Collections.Generic; using System.ComponentModel.DataAnnotations; using System.Linq; using System.Text; using System.Threading.Tasks; using FrameworkDAL.CustomCode.EntityAddOnSet; using FrameworkDAL.DTO.EntityAddOnSet; using FrameworkDAL.Query.EntityAddOnSet; using GB5Shared.DTO.Framework.AutoNumber; using GB5Shared.DTO.Framework.Login; using GB5Shared.GenerateAutoNumber; using GB5Shared.Resource.Response; using GB5Shared.Validation; namespace FrameworkBLL.EntityAddOnSet { public class EntityAddOnSetBLL : IEntityAddOnSetBLL { private readonly IEntityAddOnSetDAL _EntityAddOnSetDAL; private readonly AutoNumber _AutoNumber; private readonly IValidation _Validation; public EntityAddOnSetBLL(IEntityAddOnSetDAL IEntityAddOnSetDAL, AutoNumber AutoNumber, IValidation Validation) { _EntityAddOnSetDAL = IEntityAddOnSetDAL; _AutoNumber = AutoNumber; _Validation = Validation; } public async Task GetEntityAddOnSet(int EntityId, LoginDTO LoginDTO) { try { return await _EntityAddOnSetDAL.GetEntityAddOnSet(EntityId, LoginDTO); } catch (Exception) { throw; } } public async Task SaveEntityAddOnSet(EntityAddOnSetDTO EntityAddOnSetDTO, LoginDTO LoginDTO) { if (EntityAddOnSetDTO == null) throw new ArgumentNullException(nameof(EntityAddOnSetDTO)); try { await _EntityAddOnSetDAL.SaveEntityAddOnSet(EntityAddOnSetDTO, LoginDTO); return $"{SuccessResponse.SaveSuccessMessage} {EntityAddOnSetDTO.EntityId} & {EntityAddOnSetDTO.ParameterSetId}"; } catch (ValidationException vex) { throw new Exception(vex.Message); } catch (Exception) { throw; } } public async Task DeleteEntityAddOnSet(int EntityId, LoginDTO LoginDTO) { try { return await _EntityAddOnSetDAL.DeleteEntityAddOnSet(EntityId, LoginDTO); } catch (Exception) { throw; } } } }