예제 #1
0
        //[MultipleButton(Name = "action", Argument = "GetBookingDetail")]
        public ActionResult GetBookingDetail(FormCollection collection)
        {
            var Rgid = collection["productId"];

            Common.Tourflowsvc.ActivityBookFlowClient client         = new Common.Tourflowsvc.ActivityBookFlowClient();
            Common.Tourflowsvc.AuthenticationHeader   authentication = new Common.Tourflowsvc.AuthenticationHeader();
            authentication.LoginName = "Tra105";
            authentication.Password  = "******";
            var getRGInfoRequest = new GetRGInfoRequest();

            getRGInfoRequest.RGInfoRequestMessage = new Common.Tourflowsvc.RGInfoRequest();
            RGInfoRequest rGInfoRequest = new RGInfoRequest();

            rGInfoRequest.RGId = int.Parse(Rgid);
            var response = client.GetRGInfo(authentication, rGInfoRequest);

            Session["GetRGInfo"] = response.ResGroup;
            return(View(response));
        }
예제 #2
0
        //[MultipleButton(Name = "action", Argument = "BookActivity")]
        public ActionResult BookActivity()
        {
            var preBookResult = (ActivitiesSelectedOptionsResponse)Session["preBookResponse"];

            //call the web service
            BookActivityRequest request = new BookActivityRequest();

            Common.Tourflowsvc.AuthenticationHeader authentication = new Common.Tourflowsvc.AuthenticationHeader();
            authentication.LoginName = "Tra105";
            authentication.Password  = "******";

            BookRequest bookRequest = new BookRequest();


            OrderInfo orderInfo = new OrderInfo();

            orderInfo.DeltaPrice = new Common.Tourflowsvc.DeltaPrice()
            {
                value = 200, basisType = BasisType.Percent
            };
            orderInfo.rgRefNum          = "0";
            orderInfo.requestedPrice    = preBookResult.totalPrice;
            orderInfo.currency          = preBookResult.currency;
            orderInfo.paymentType       = WSPaymentType.Obligo;
            orderInfo.recordLocatorId   = 0;
            orderInfo.confirmationEmail = null;
            orderInfo.agentRefNumber    = "12345";
            bookRequest.orderInfo       = orderInfo;

            var activitySelectedOptions = new Common.Tourflowsvc.ActivitiesSelectedOptions();
            var activityInfoFirst       = new Common.Tourflowsvc.ActivityInfo();

            if (preBookResult.ActivitiesInfo.First().ActivityPricing.PriceBreakdown.Adult != null && (preBookResult.ActivitiesInfo.First().ActivityPricing.PriceBreakdown.Child != null))
            {
                activityInfoFirst.ActivityPricing = new Common.Tourflowsvc.ActivityPrice()
                {
                    PriceBreakdown = new Common.Tourflowsvc.ActivityPriceBreakdown()
                    {
                        Adult = new Common.Tourflowsvc.AdultPriceBreakdown()
                        {
                            numbers = preBookResult.ActivitiesInfo.First().ActivityPricing.PriceBreakdown.Adult.numbers,
                            amount  = preBookResult.ActivitiesInfo.First().ActivityPricing.PriceBreakdown.Adult.amount,
                        },
                        Child = new Common.Tourflowsvc.ChildPriceBreakdown()
                        {
                            numbers = preBookResult.ActivitiesInfo.First().ActivityPricing.PriceBreakdown.Child.numbers,
                            amount  = preBookResult.ActivitiesInfo.First().ActivityPricing.PriceBreakdown.Child.amount,
                        },
                        Unit = new Common.Tourflowsvc.UnitPriceBreakdown()
                        {
                            numbers = 0,
                            amount  = 0,
                        },
                    },
                    price    = preBookResult.ActivitiesInfo.First().ActivityPricing.price,
                    currency = preBookResult.ActivitiesInfo.First().ActivityPricing.currency,
                    tax      = preBookResult.ActivitiesInfo.First().ActivityPricing.tax
                };
            }
            else if (preBookResult.ActivitiesInfo.First().ActivityPricing.PriceBreakdown.Unit != null)
            {
                activityInfoFirst.ActivityPricing = new Common.Tourflowsvc.ActivityPrice()
                {
                    PriceBreakdown = new Common.Tourflowsvc.ActivityPriceBreakdown()
                    {
                        Adult = new Common.Tourflowsvc.AdultPriceBreakdown()
                        {
                            numbers = 0,
                            amount  = 0,
                        },
                        Child = new Common.Tourflowsvc.ChildPriceBreakdown()
                        {
                            numbers = 0,
                            amount  = 0,
                        },
                        Unit = new Common.Tourflowsvc.UnitPriceBreakdown()
                        {
                            numbers = preBookResult.ActivitiesInfo.First().ActivityPricing.PriceBreakdown.Unit.numbers,
                            amount  = preBookResult.ActivitiesInfo.First().ActivityPricing.PriceBreakdown.Unit.amount,
                        },
                    },
                    price    = preBookResult.ActivitiesInfo.First().ActivityPricing.price,
                    currency = preBookResult.ActivitiesInfo.First().ActivityPricing.currency,
                    tax      = preBookResult.ActivitiesInfo.First().ActivityPricing.tax
                };
            }

            activityInfoFirst.CancellationPolicy = new Common.Tourflowsvc.CancellationPolicy()
            {
                CancellationPenalties = new Common.Tourflowsvc.CancellationPenalty[]
                {
                    new Common.Tourflowsvc.CancellationPenalty()
                    {
                        Deadline = new Common.Tourflowsvc.ClxDeadline()
                        {
                            offsetUnit       = preBookResult.ActivitiesInfo.First().CancellationPolicy.CancellationPenalties.First().Deadline.offsetUnit,
                            unitsFromCheckIn = preBookResult.ActivitiesInfo.First().CancellationPolicy.CancellationPenalties.First().Deadline.unitsFromCheckIn,
                        },
                        Penalty = new Common.Tourflowsvc.PricePenalty()
                        {
                            basisType = preBookResult.ActivitiesInfo.First().CancellationPolicy.CancellationPenalties.First().Penalty.basisType,
                            value     = preBookResult.ActivitiesInfo.First().CancellationPolicy.CancellationPenalties.First().Penalty.value,
                        }
                    }
                }
            };
            var activityAddition = preBookResult.ActivitiesInfo.First().ActivityAdditions;
            //activityInfoFirst.ActivityAdditions = new Common.Tourflowsvc.OrderAddition();
            OrderAddition       orderAddition    = new OrderAddition();
            List <TextAddition> textAdditionList = new List <TextAddition>();

            foreach (var item in activityAddition.TextAdditions)
            {
                textAdditionList.Add(new Common.Tourflowsvc.TextAddition()
                {
                    value = string.IsNullOrEmpty(item.value) ? "ABC" : item.value, additionTypeID = item.additionTypeID, additionType = item.additionType
                });
            }
            orderAddition.TextAdditions         = textAdditionList.ToArray();
            activityInfoFirst.ActivityAdditions = orderAddition;

            activityInfoFirst.Passengers = new Common.Tourflowsvc.PassengerInfo[]
            {
                new Common.Tourflowsvc.PassengerInfo()
                {
                    mobilePhone = "+1 765873839", isMainContact = true, lastName = "sh", type = PassengerType.Adult, seqNumber = 1, firstName = "sa"
                },
                new Common.Tourflowsvc.PassengerInfo()
                {
                    mobilePhone = "+1 765873830", isMainContact = false, lastName = "pi", type = PassengerType.Child, seqNumber = 2, firstName = "Bi"
                },
            };

            activityInfoFirst.activityId = preBookResult.ActivitiesInfo.First().activityId;
            activityInfoFirst.date       = preBookResult.ActivitiesInfo.First().date;
            activityInfoFirst.optionId   = preBookResult.ActivitiesInfo.First().optionId;
            Common.Tourflowsvc.ActivityInfo[] activityInfos = new Common.Tourflowsvc.ActivityInfo[] { activityInfoFirst };
            activitySelectedOptions.ActivitiesInfo = activityInfos;
            bookRequest.reservations = activitySelectedOptions;

            Common.Tourflowsvc.ActivityBookFlowClient client = new Common.Tourflowsvc.ActivityBookFlowClient();
            var    response = client.BookActivity(authentication, bookRequest);
            string fileLoc  = @"C:\Temp\TourBookingHistory.txt";

            System.IO.File.AppendAllText(fileLoc, (response.ResGroup.rgId + "," + response.ResGroup.Reservations[0].date + "," + "," + response.ResGroup.Reservations[0].status + ";"));
            Session["BookActivity"] = response.ResGroup;
            return(View(response));
        }