Exemplo n.º 1
0
        /// <summary>
        /// To map booking and contact records
        /// </summary>
        /// <param name="surveyResponse"></param>
        /// <param name="answers"></param>
        private void MapBookingContact(Entity surveyResponse, Response response)
        {
            trace.Trace("Processing MapBookingContact - start");
            var bookingNumber = AnswerHelper.GetBookingNumber(response.Answers, trace);
            var sourceMarket  = AnswerHelper.GetSourceMarket(response.Answers, trace);
            var tourOperator  = AnswerHelper.GetTourOperator(response.Answers, trace);
            var brand         = AnswerHelper.GetBrand(response.Answers, trace);
            var lastName      = ContactHelper.GetLastName(response.Contact, trace);

            if (string.IsNullOrWhiteSpace(bookingNumber))
            {
                return;
            }
            if (string.IsNullOrWhiteSpace(sourceMarket))
            {
                return;
            }
            if (string.IsNullOrWhiteSpace(tourOperator))
            {
                return;
            }
            if (string.IsNullOrWhiteSpace(brand))
            {
                return;
            }

            FetchBookingContact(bookingNumber, sourceMarket, tourOperator, brand, lastName, surveyResponse);

            trace.Trace("Processing MapBookingContact - end");
        }
Exemplo n.º 2
0
        /// <summary>
        /// To prepare survey response entity from payload
        /// </summary>
        /// <param name="response"></param>
        /// <param name="trace"></param>
        /// <returns></returns>
        public static Entity GetResponseEntityFromPayload(Response response, ITracingService trace)
        {
            if (trace == null)
            {
                throw new InvalidPluginExecutionException("trace is null");
            }
            trace.Trace("Processing GetResponseEntityFromPayLoad - start");
            if (response == null)
            {
                throw new InvalidPluginExecutionException("Response in Json is null");
            }
            var surveyResponse = new Entity(EntityName.SurveyResponse);

            surveyResponse[Attributes.SurveyResponse.ResponseId] = response.Id.ToString();

            if (response.SurveyId != null)
            {
                surveyResponse[Attributes.SurveyResponse.SurveyId] = response.SurveyId.Value.ToString();
            }

            if (!string.IsNullOrWhiteSpace(response.SurveyName))
            {
                surveyResponse[Attributes.SurveyResponse.Subject] = response.SurveyName;
            }

            if (!string.IsNullOrWhiteSpace(response.SurveyDescription))
            {
                surveyResponse[Attributes.SurveyResponse.SurveyDescription] = response.SurveyDescription;
            }

            if (!string.IsNullOrWhiteSpace(response.Mode))
            {
                surveyResponse[Attributes.SurveyResponse.Mode] = response.Mode;
            }

            if (!string.IsNullOrWhiteSpace(response.BeginTime))
            {
                surveyResponse[Attributes.SurveyResponse.BeginTime] = DateTime.Parse(response.BeginTime);
            }

            var customerFirstName = ContactHelper.GetFirstName(response.Contact, trace);

            if (!string.IsNullOrWhiteSpace(customerFirstName))
            {
                surveyResponse[Attributes.SurveyResponse.CustomerFirstName] = customerFirstName;
            }

            var customerLastName = ContactHelper.GetLastName(response.Contact, trace);

            if (!string.IsNullOrWhiteSpace(customerLastName))
            {
                surveyResponse[Attributes.SurveyResponse.CustomerLastName] = customerLastName;
            }

            var customerEmail = ContactHelper.GetEmail(response.Contact, trace);

            if (!string.IsNullOrWhiteSpace(customerEmail))
            {
                surveyResponse[Attributes.SurveyResponse.CustomerEmail] = customerEmail;
            }

            var customerPhone = ContactHelper.GetPhone(response.Contact, trace);

            if (!string.IsNullOrWhiteSpace(customerPhone))
            {
                surveyResponse[Attributes.SurveyResponse.CustomerPhone] = customerPhone;
            }

            surveyResponse[Attributes.SurveyResponse.ActivityAdditionalParams] = PrepareAdditionalParameters(response, trace);
            trace.Trace("Processing GetResponseEntityFromPayLoad - end");
            return(surveyResponse);
        }