//================================================================================ public void SetFuelReportInventoryResults(InventoryResultCommand resultBag) { var fuelReport = GetById(resultBag.FuelReportId); this.fuelReportDomainService.SetFuelReportInventoryResults(resultBag, fuelReport); try { this.unitOfWorkScope.Commit(); } catch (OptimisticConcurrencyException ex) { throw new ConcurencyException("SetFuelReportInventoryResults"); } }
private InventoryResultCommand mapInventoryResultDtoToResultBag(Presentation.Contracts.DTOs.FuelReportInventoryResultDto dto) { InventoryResultCommand bag = new InventoryResultCommand(); bag.FuelReportId = dto.FuelReportId; bag.Items = new List<InventoryResultCommandItem>(); bag.Items.AddRange( dto.Items.Select( i => new InventoryResultCommandItem { FuelReportDetailId = i.FuelReportDetailId, ActionNumber = i.ActionNumber, ActionType = (Domain.Model.Enums.InventoryActionType)i.ActionType, ActionDate = i.ActionDate })); return bag; }
//================================================================================ public void SetInventoryResults(InventoryResultCommand resultCommand, Scrap scrap) { }
//================================================================================ public void SetFuelReportInventoryResults(InventoryResultCommand resultCommand, FuelReport fuelReport) { foreach (var item in resultCommand.Items) { var fuelReportDetail = fuelReport.FuelReportDetails.FirstOrDefault(frd => frd.Id == item.FuelReportDetailId); if (fuelReportDetail == null) { throw new ObjectNotFound("resultBag.Item.DetailId"); } var inventoryOperationToPersist = inventoryOperationFactory.Create(fuelReportDetail, item.OperationId, item.ActionNumber, item.ActionType, item.ActionDate); inventoryOperationRepository.Add(inventoryOperationToPersist); //if (fuelReportDetail.TransferReferenceOrderId.HasValue) //{ // orderDomainService.CloseOrder(fuelReportDetail.TransferReferenceOrderId.Value); //} //if (fuelReportDetail.ReceiveReferenceOrderId.HasValue) //{ // orderDomainService.CloseOrder(fuelReportDetail.ReceiveReferenceOrderId.Value); //} } //IFuelReportStateFactory stateFactory = ServiceLocator.Current.GetInstance<IFuelReportStateFactory>(); //fuelReport.Close(stateFactory.CreateClosedState()); }