// private readonly IApprovableDomainService _approvableDomainService; // private readonly IGoodPartyAssignmentDomainService _goodPartyAssignmentDomainService; public OrderApplicationService(IOrderRepository orderRepository, IUnitOfWorkScope unitOfWorkScope, // IGoodPartyAssignmentDomainService goodPartyAssignmentDomainService, //IFuelUserRepository userRepository, IVesselInCompanyDomainService vesselDomainService, IGoodDomainService goodDomainService, IOrderFactory iOrderFactory, ICompanyDomainService companyDomainService, IOrderItemDomainService orderItemDomainService, IEntityConfigurator<Order> orderConfigurator //,IApprovableDomainService approvableDomainService ) { this.orderRepository = orderRepository; this.vesselDomainService = vesselDomainService; this.goodDomainService = goodDomainService; this.iOrderFactory = iOrderFactory; this.unitOfWorkScope = unitOfWorkScope; this.companyDomainService = companyDomainService; this.orderItemDomainService = orderItemDomainService; this.orderConfigurator = orderConfigurator; // _approvableDomainService = approvableDomainService; // _goodPartyAssignmentDomainService = goodPartyAssignmentDomainService; }
public void Update(string description, OrderTypes orderType, long ownerId, long? transporterId, long? supplierId, long? receiverId, VesselInCompany fromVesselInCompany, VesselInCompany toVesselInCompany, IEntityConfigurator<Order> orderConfigurator, IOrderItemDomainService orderItemDomainService) { if (OrderType != orderType) { foreach (var orderItem in OrderItems.ToList()) { orderItemDomainService.DeleteOrderItem(orderItem); } } OrderType = orderType; Description = description; OwnerId = ownerId; TransporterId = transporterId; ReceiverId = receiverId; SupplierId = supplierId; FromVesselInCompanyId = fromVesselInCompany == null ? (long?)null : fromVesselInCompany.Id; ToVesselInCompanyId = toVesselInCompany == null ? (long?)null : toVesselInCompany.Id; orderConfigurator.Configure(this); IsOnOpenState(); _orderBaseType.Update(this, fromVesselInCompany, toVesselInCompany); }
public void DeleteItem(OrderItem item, IOrderItemDomainService orderItemDomainService) { // Bussuiness Rules IsOnOpenState(); var orderItem = OrderItems.FirstOrDefault(c => c.Id == item.Id); if (orderItem == null) throw new ObjectNotFound("OrderItem", item.Id); orderItemDomainService.DeleteOrderItem(orderItem); }