private static Entity PrepareBookingExtraService(Booking bookinginfo, ExtraService extraService, Guid bookingId, ITracingService trace)
        {
            trace.Trace("Preparing Booking Transfer information - Start");
            var extraServiceEntity = new Entity(EntityName.BookingExtraService);

            if (!string.IsNullOrWhiteSpace(extraService.ExtraServiceCode))
            {
                extraServiceEntity[Attributes.BookingExtraService.ExtraServiceCode] = extraService.ExtraServiceCode;
            }

            SetNameFor(extraService, bookinginfo, extraServiceEntity);

            extraServiceEntity[Attributes.BookingExtraService.Order] = extraService.Order;
            if (!string.IsNullOrWhiteSpace(extraService.StartDate))
            {
                extraServiceEntity[Attributes.BookingExtraService.StartDateAndTime] = DateTime.Parse(extraService.StartDate);
            }
            if (!string.IsNullOrWhiteSpace(extraService.EndDate))
            {
                extraServiceEntity[Attributes.BookingExtraService.EndDateTime] = DateTime.Parse(extraService.EndDate);
            }


            extraServiceEntity[Attributes.BookingExtraService.Participants] = BookingHelper.PrepareTravelParticipantsInfoForChildRecords(bookinginfo.TravelParticipant, trace, extraService.TravelParticipantAssignment);

            extraServiceEntity[Attributes.BookingExtraService.BookingId] = new EntityReference(EntityName.Booking, bookingId);
            extraServiceEntity[Attributes.Booking.Remarks] = RemarksHelper.GetRemarksTextFromPayload(extraService.Remark);
            extraServiceEntity[Attributes.BookingExtraService.ExtraServiceType]        = CommonXrm.GetExtraServiceType(extraService.ExtraServiceType);
            extraServiceEntity[Attributes.BookingExtraService.ExtraServiceDescription] = (!string.IsNullOrWhiteSpace(extraService.ExtraServiceDescription)) ?
                                                                                         extraService.ExtraServiceDescription : string.Empty;
            trace.Trace("Preparing Booking Transfer information - End");

            return(extraServiceEntity);
        }
Ejemplo n.º 2
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);
        }
Ejemplo n.º 3
0
        private static Entity PrepareBookingAccommodation(Booking bookinginfo, Accommodation accommodation, Guid bookingId, ITracingService trace)
        {
            trace.Trace("Preparing Booking Accommodation information - Start");
            var accommodationEntity = new Entity(EntityName.BookingAccommodation);

            if (accommodation.AccommodationCode != null)
            {
                accommodationEntity[Attributes.BookingAccommodation.SourceMarketHotelCode] = accommodation.AccommodationCode;
            }
            if (!string.IsNullOrEmpty(accommodation.GroupAccommodationCode))
            {
                accommodationEntity[Attributes.BookingAccommodation.HotelId] = new EntityReference(EntityName.Hotel, new Guid(accommodation.GroupAccommodationCode));
            }
            SetNameFor(accommodation, bookinginfo, accommodationEntity);

            accommodationEntity[Attributes.BookingAccommodation.Order] = accommodation.Order.ToString();
            if (!string.IsNullOrWhiteSpace(accommodation.StartDate))
            {
                accommodationEntity[Attributes.BookingAccommodation.StartDateAndTime] = DateTime.Parse(accommodation.StartDate);
            }
            if (!string.IsNullOrWhiteSpace(accommodation.EndDate))
            {
                accommodationEntity[Attributes.BookingAccommodation.EndDateAndTime] = DateTime.Parse(accommodation.EndDate);
            }
            if (!string.IsNullOrWhiteSpace(accommodation.RoomType))
            {
                accommodationEntity[Attributes.BookingAccommodation.RoomType] = accommodation.RoomType;
            }
            accommodationEntity[Attributes.BookingAccommodation.BoardType]               = CommonXrm.GetBoardType(accommodation.BoardType);
            accommodationEntity[Attributes.BookingAccommodation.HasSharedRoom]           = accommodation.HasSharedRoom;
            accommodationEntity[Attributes.BookingAccommodation.NumberOfParticipants]    = accommodation.NumberOfParticipants;
            accommodationEntity[Attributes.BookingAccommodation.NumberOfRooms]           = accommodation.NumberOfRooms;
            accommodationEntity[Attributes.BookingAccommodation.WithTransfer]            = accommodation.WithTransfer;
            accommodationEntity[Attributes.BookingAccommodation.IsExternalService]       = accommodation.IsExternalService;
            accommodationEntity[Attributes.BookingAccommodation.ExternalServiceCode]     = CommonXrm.GetExternalServiceCode(accommodation.ExternalServiceCode);
            accommodationEntity[Attributes.BookingAccommodation.NotificationRequired]    = accommodation.NotificationRequired;
            accommodationEntity[Attributes.BookingAccommodation.NeedTourGuideAssignment] = accommodation.NeedsTourGuideAssignment;
            accommodationEntity[Attributes.BookingAccommodation.ExternalTransfer]        = accommodation.IsExternalTransfer;
            accommodationEntity[Attributes.BookingAccommodation.TransferServiceLevel]    = CommonXrm.GetTransferServiceLevel(accommodation.TransferServiceLevel);
            if (!string.IsNullOrWhiteSpace(accommodation.AccommodationDescription))
            {
                accommodationEntity[Attributes.BookingAccommodation.SourceMarketHotelName] = accommodation.AccommodationDescription;
            }
            accommodationEntity[Attributes.BookingAccommodation.BookingId]    = new EntityReference(EntityName.Booking, bookingId);
            accommodationEntity[Attributes.BookingAccommodation.Participants] = BookingHelper.PrepareTravelParticipantsInfoForChildRecords(bookinginfo.TravelParticipant, trace, accommodation.TravelParticipantAssignment);
            accommodationEntity[Attributes.Booking.StateCode]  = new OptionSetValue((int)Statecode.Active);
            accommodationEntity[Attributes.Booking.StatusCode] = CommonXrm.GetAccommodationStatus(accommodation.Status);
            accommodationEntity[Attributes.Booking.Remarks]    = RemarksHelper.GetRemarksTextFromPayload(accommodation.Remark);
            trace.Trace("Preparing Booking Transport information - End");

            return(accommodationEntity);
        }
Ejemplo n.º 4
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);
        }