/// <summary> /// To process contact information /// </summary> /// <returns></returns> public void ProcessContact() { trace.Trace("Processing Contact information - start"); XrmResponse xrmResponse = null; if (payloadBooking.BookingInfo != null && payloadBooking.BookingInfo.Customer != null) { var customer = payloadBooking.BookingInfo.Customer; var contact = ContactHelper.GetContactEntityForBookingPayload(customer, trace); xrmResponse = CommonXrm.UpsertEntity(contact, crmService); if (xrmResponse.Create) { payloadBooking.DeleteBookingRole = true; } else { payloadBooking.DeleteBookingRole = false; } payloadBooking.CustomerId = xrmResponse.Id; trace.Trace("Processing Contact information - end"); } }
/// <summary> /// To process booking information /// </summary> /// <returns></returns> public void ProcessBookingInfo() { trace.Trace("Processing Booking - start"); XrmResponse xrmResponse = null; var bookingEntity = BookingHelper.GetBookingEntityFromPayload(payloadBooking.BookingInfo, trace); xrmResponse = CommonXrm.UpsertEntity(bookingEntity, crmService); payloadBooking.Response = new BookingResponse(); if (xrmResponse.Create) { payloadBooking.DeleteBookingRole = false; payloadBooking.DeleteChildRecords = false; payloadBooking.Response.Created = true; } payloadBooking.BookingId = xrmResponse.Id; payloadBooking.Response.Id = xrmResponse.Id; trace.Trace("Processing Booking - end"); }
/// <summary> /// To process social profile information of contact /// </summary> /// <returns></returns> public void ProcessSocialProfile() { trace.Trace("Processing Social profile information - start"); if (payloadBooking.BookingInfo != null && payloadBooking.BookingInfo.Customer != null && payloadBooking.BookingInfo.Customer.Social != null) { var entityCollectionsocialProfiles = SocialProfileHelper.GetSocialProfileEntityFromPayload(payloadBooking.BookingInfo, Guid.Parse(payloadBooking.CustomerId), trace); if (entityCollectionsocialProfiles != null && entityCollectionsocialProfiles.Entities.Count > 0) { foreach (Entity entitySocialProfile in entityCollectionsocialProfiles.Entities) { CommonXrm.UpsertEntity(entitySocialProfile, crmService); } } trace.Trace("Processing Social Profile information - end"); } }