public void CreateInboundCPM(InboundFlight inbound, CPMDTO dto)
        {
            var inboundContainerPalletMessage = this.mapper.Map <ContainerPalletMessage>(dto);

            this.dbContext.ContainerPalletMessages.Add(inboundContainerPalletMessage);
            this.dbContext.SaveChanges();

            inboundContainerPalletMessage.InboundFlight   = inbound;
            inboundContainerPalletMessage.InboundFlightId = inbound.FlightId;
        }
        public void CreateInboundLDM(InboundFlight inboundFlight, LDMDTO ldmDTO)
        {
            var loadDistributionMessage = mapper.Map <LoadDistributionMessage>(ldmDTO);

            this.dbContext.LoadDistributionMessages.Add(loadDistributionMessage);
            this.dbContext.SaveChanges();

            loadDistributionMessage.InboundFlight   = inboundFlight;
            loadDistributionMessage.InboundFlightId = inboundFlight.FlightId;
            this.dbContext.SaveChanges();
        }
        public void RegisterInboundFlight(FlightInputModel inboundFlightInputModel)
        {
            string[] splitFlightNumbers =
                inboundFlightInputModel
                .FlightNumber
                .Split("/", StringSplitOptions.RemoveEmptyEntries);

            string inboundFlightNumber = splitFlightNumbers[0];
            var    newInboundFlight    = new InboundFlight
            {
                FlightNumber = inboundFlightNumber,
                Origin       = inboundFlightInputModel.Origin,
                STA          = inboundFlightInputModel.STA,
            };

            this.dbContext.InboundFlights.Add(newInboundFlight);
            this.dbContext.SaveChanges();
        }
        public List <Container> AddContainersToInboundFlight(InboundFlight inboundFlight, int amountOfContainersToCreate)
        {
            var listOfContainers = new List <Container>();

            for (int i = 0; i < amountOfContainersToCreate; i++)
            {
                var container = new Container
                {
                    InboundFlight   = inboundFlight,
                    InboundFlightId = inboundFlight.FlightId,
                };

                listOfContainers.Add(container);
                this.dbContext.Containers.Add(container);
                this.dbContext.SaveChanges();
            }

            return(listOfContainers);
        }
예제 #5
0
        public void CreateArrivalMovement(DateTime[] dates, string supplementaryInformation, InboundFlight inboundFlight)
        {
            var arrivalMovement = new ArrivalMovement
            {
                InboundFlightId          = inboundFlight.FlightId,
                InboundFlight            = inboundFlight,
                SupplementaryInformation = supplementaryInformation,
                TouchdownTime            = dates[0],
                OnBlockTime    = dates[1],
                DateOfMovement = DateTime.UtcNow
            };

            this.dbContext.ArrivalMovements.Add(arrivalMovement);
            this.dbContext.SaveChanges();

            inboundFlight.ArrivalMovementId = arrivalMovement.Id;
            this.dbContext.SaveChanges();
        }