Beispiel #1
0
        private static Entity PrepareBookingTransport(Booking bookinginfo, Transport transport, Guid bookingId, ITracingService trace)
        {
            trace.Trace("Transport populate fields - start");

            var transportEntity = new Entity(EntityName.BookingTransport);

            SetNameFor(transport, bookinginfo, transportEntity);

            if (!string.IsNullOrWhiteSpace(transport.TransportCode))
            {
                transportEntity[Attributes.BookingTransport.TransportCode] = transport.TransportCode;
            }
            if (!string.IsNullOrWhiteSpace(transport.TransportDescription))
            {
                transportEntity[Attributes.BookingTransport.Description] = transport.TransportDescription;
            }
            transportEntity[Attributes.BookingTransport.Order] = transport.Order;
            if (!string.IsNullOrWhiteSpace(transport.StartDate))
            {
                transportEntity[Attributes.BookingTransport.StartDateAndTime] = DateTime.Parse(transport.StartDate);
            }
            if (!string.IsNullOrWhiteSpace(transport.EndDate))
            {
                transportEntity[Attributes.BookingTransport.EndDateAndTime] = DateTime.Parse(transport.EndDate);
            }
            transportEntity[Attributes.BookingTransport.TransferType] = CommonXrm.GetTransferType(transport.TransferType);
            if (!string.IsNullOrWhiteSpace(transport.DepartureAirport))
            {
                transportEntity[Attributes.BookingTransport.DepartureGatewayId] = new EntityReference(EntityName.Gateway, new Guid(transport.DepartureAirport));
            }
            if (!string.IsNullOrWhiteSpace(transport.ArrivalAirport))
            {
                transportEntity[Attributes.BookingTransport.ArrivalGatewayId] = new EntityReference(EntityName.Gateway, new Guid(transport.ArrivalAirport));
            }
            if (!string.IsNullOrWhiteSpace(transport.CarrierCode))
            {
                transportEntity[Attributes.BookingTransport.CarrierCode] = transport.CarrierCode;
            }
            if (!string.IsNullOrWhiteSpace(transport.FlightNumber))
            {
                transportEntity[Attributes.BookingTransport.FlightNumber] = transport.FlightNumber;
            }
            if (!string.IsNullOrWhiteSpace(transport.FlightIdentifier))
            {
                transportEntity[Attributes.BookingTransport.FlightIdentifier] = transport.FlightIdentifier;
            }
            transportEntity[Attributes.BookingTransport.NumberOfParticipants] = transport.NumberOfParticipants;
            transportEntity[Attributes.BookingTransport.BookingId]            = new EntityReference(EntityName.Booking, bookingId);
            transportEntity[Attributes.BookingTransport.Participants]         = BookingHelper.PrepareTravelParticipantsInfoForChildRecords(bookinginfo.TravelParticipant, trace, transport.TravelParticipantAssignment);
            transportEntity[Attributes.Booking.Remarks] = RemarksHelper.GetRemarksTextFromPayload(transport.Remark);
            transportEntity[Attributes.BookingTransport.TransportType] = CommonXrm.GetTransportType(transport.TransportType);
            trace.Trace("Transport populate fields - end");
            return(transportEntity);
        }
Beispiel #2
0
        private static Entity PrepareBookingTransfer(Booking bookinginfo, Transfer transfer, Guid bookingId, ITracingService trace)
        {
            trace.Trace("Preparing Booking Transfer information - Start");
            var transferEntity = new Entity(EntityName.BookingTransfer);

            if (!string.IsNullOrWhiteSpace(transfer.TransferCode))
            {
                transferEntity[Attributes.BookingTransfer.TransferCode] = transfer.TransferCode;
            }

            SetNameFor(transfer, bookinginfo, transferEntity);

            transferEntity[Attributes.BookingTransfer.Order] = transfer.Order;
            if (!string.IsNullOrWhiteSpace(transfer.StartDate))
            {
                transferEntity[Attributes.BookingTransfer.StartDateAndTime] = DateTime.Parse(transfer.StartDate);
            }
            if (!string.IsNullOrWhiteSpace(transfer.EndDate))
            {
                transferEntity[Attributes.BookingTransfer.EndDateTime] = DateTime.Parse(transfer.EndDate);
            }

            transferEntity[Attributes.BookingTransfer.TransferType] = CommonXrm.GetTransferType(transfer.TransferType);
            transferEntity[Attributes.BookingTransfer.Category]     = transfer.Category;
            if (!string.IsNullOrWhiteSpace(transfer.DepartureAirport))
            {
                transferEntity[Attributes.BookingTransfer.DepartureGatewayId] = new EntityReference(EntityName.Gateway, new Guid(transfer.DepartureAirport));
            }
            if (!string.IsNullOrWhiteSpace(transfer.ArrivalAirport))
            {
                transferEntity[Attributes.BookingTransfer.ArrivalGatewayId] = new EntityReference(EntityName.Gateway, new Guid(transfer.ArrivalAirport));
            }

            transferEntity[Attributes.BookingTransfer.Participants] = BookingHelper.PrepareTravelParticipantsInfoForChildRecords(bookinginfo.TravelParticipant, trace, transfer.TravelParticipantAssignment);

            transferEntity[Attributes.BookingTransfer.BookingId]           = new EntityReference(EntityName.Booking, bookingId);
            transferEntity[Attributes.Booking.Remarks]                     = RemarksHelper.GetRemarksTextFromPayload(transfer.Remark);
            transferEntity[Attributes.BookingTransfer.TransferDescription] = (!string.IsNullOrWhiteSpace(transfer.TransferDescription)) ?
                                                                             transfer.TransferDescription : string.Empty;
            trace.Trace("Preparing Booking Transfer information - End");

            return(transferEntity);
        }