/// <summary> /// /// </summary> public void ProcessTransport() { if (payloadBooking.BookingInfo.Services == null) { return; } if (payloadBooking.BookingInfo.Services.Transport == null) { return; } if (payloadBooking.BookingInfo.Services != null && payloadBooking.BookingInfo.Services.Transport != null) { if (payloadBooking.DeleteChildRecords) { trace.Trace("Delete Transport information - start"); ProcessRecordsToDelete(EntityName.BookingTransport, new string[] { Attributes.BookingTransport.BookingTransportId }, new string[] { Attributes.BookingAccommodation.BookingId }, new string[] { payloadBooking.BookingId }); trace.Trace("Delete Transport information - end"); } trace.Trace("Transport information - start"); var bookinginfo = payloadBooking.BookingInfo; var entityCollectionTransport = BookingTransportHelper.GetTransportEntityForBookingPayload(bookinginfo, Guid.Parse(payloadBooking.BookingId), trace); CommonXrm.BulkCreate(entityCollectionTransport, crmService); trace.Trace("Transport information - end"); } }
/// <summary> /// /// </summary> public void ProcessBookingRole() { if (payloadBooking.DeleteBookingRole) { trace.Trace("Delete Booking Roles information - start"); ProcessRecordsToDelete(EntityName.CustomerBookingRole, new string[] { Attributes.CustomerBookingRole.CustomerBookingRoleId }, new string[] { Attributes.CustomerBookingRole.BookingId }, new string[] { payloadBooking.BookingId }); trace.Trace("Delete Booking Roles information - end"); } trace.Trace("Booking Roles information - start"); if (string.IsNullOrWhiteSpace(payloadBooking.CustomerId)) { return; } if (payloadBooking.BookingInfo.Customer.CustomerGeneral.CustomerType == CustomerType.NotSpecified) { trace.Trace("Customer type has not been specified."); return; } if (payloadBooking.Response.Created || payloadBooking.DeleteBookingRole) { Entity entityBookingRole = new Entity(EntityName.CustomerBookingRole); entityBookingRole[Attributes.CustomerBookingRole.BookingId] = new EntityReference(EntityName.Booking, new Guid(payloadBooking.BookingId)); if (payloadBooking.BookingInfo.Customer.CustomerGeneral.CustomerType == CustomerType.Company) { entityBookingRole[Attributes.CustomerBookingRole.Customer] = new EntityReference(EntityName.Account, new Guid(payloadBooking.CustomerId)); } else { entityBookingRole[Attributes.CustomerBookingRole.Customer] = new EntityReference(EntityName.Contact, new Guid(payloadBooking.CustomerId)); } EntityCollection entityCollection = new EntityCollection(); entityCollection.Entities.Add(entityBookingRole); CommonXrm.BulkCreate(entityCollection, crmService); } trace.Trace("Booking Roles information - end"); }
public void ProcessTransfers() { if (payloadBooking.DeleteChildRecords) { trace.Trace("Delete Transfer information - start"); ProcessRecordsToDelete(EntityName.BookingTransfer, new string[] { Attributes.BookingTransfer.BookingTransferId }, new string[] { Attributes.BookingTransfer.BookingId }, new string[] { payloadBooking.BookingId }); trace.Trace("Delete Transfer information - end"); } if (payloadBooking.BookingInfo.Services != null && payloadBooking.BookingInfo.Services.Transfer != null) { trace.Trace("Booking Transfer information - start"); var bookinginfo = payloadBooking.BookingInfo; var entityCollectionTransfer = BookingTransferHelper.GetBookingTransferEntityFromPayload(bookinginfo, Guid.Parse(payloadBooking.BookingId), trace); CommonXrm.BulkCreate(entityCollectionTransfer, crmService); trace.Trace("Booking Transfer information - end"); } }
public void ProcessExtraServices() { if (payloadBooking.DeleteChildRecords) { trace.Trace("Delete Extra Service information - start"); ProcessRecordsToDelete(EntityName.BookingExtraService, new string[] { Attributes.BookingExtraService.BookingExtraServiceId }, new string[] { Attributes.BookingExtraService.BookingId }, new string[] { payloadBooking.BookingId }); trace.Trace("Delete Extra Service information - end"); } if (payloadBooking.BookingInfo.Services != null && payloadBooking.BookingInfo.Services.ExtraService != null) { trace.Trace("Booking ExtraService information - start"); //string bookingNumber = payloadBooking.BookingInfo.BookingIdentifier.BookingNumber; var bookinginfo = payloadBooking.BookingInfo; var entityCollectionExtraService = BookingExtraServiceHelper.GetBookingExtraServicerEntityFromPayload(bookinginfo, Guid.Parse(payloadBooking.BookingId), trace); CommonXrm.BulkCreate(entityCollectionExtraService, crmService); trace.Trace("Booking Transfer information - end"); } }
public void ProcessAccommodation() { if (payloadBooking.BookingInfo.Services == null || payloadBooking.BookingInfo.Services.Accommodation == null) { return; } if (payloadBooking.DeleteChildRecords) { trace.Trace("Delete Accommodation information - start"); ProcessRecordsToDelete(EntityName.BookingAccommodation, new string[] { Attributes.BookingAccommodation.BookingAccommodationId }, new string[] { Attributes.BookingAccommodation.BookingId }, new string[] { payloadBooking.BookingId }); trace.Trace("Delete Accommodation information - end"); } trace.Trace("Booking Accommodation information - start"); var bookinginfo = payloadBooking.BookingInfo; var entityCollectionAccommodation = BookingAccommodationHelper.GetBookingAccommodationEntityFromPayload(bookinginfo, Guid.Parse(payloadBooking.BookingId), trace); CommonXrm.BulkCreate(entityCollectionAccommodation, crmService); trace.Trace("Booking Accommodation information - end"); }