Beispiel #1
0
 public void Setup()
 {
     _invalidPax = new Pax();
     _validPax   = new Pax
     {
         ReferenceId = "0",
         Name        = new PersonName
         {
             First = "newshore",
             Last  = "test",
             Title = TitleType.MR
         },
         Type = new PaxTypeInfo
         {
             Category = PaxCategoryType.Adult,
             Code     = "ADT"
         },
         Address = new PersonAddress
         {
             AddressLine = "AddressLine"
         },
         Documents = new List <PersonDocument>
         {
             new PersonDocument
             {
                 Number = "Number"
             }
         },
         PersonInfo = new PersonInfo
         {
             DateOfBirth = DateTime.Today,
         }
     };
 }
        /// <summary>
        ///
        /// </summary>
        /// <returns></returns>
        public CheckRateRQ toCheckRateRQ()
        {
            try
            {
                CheckRateRQ checkRateRQ = new CheckRateRQ();
                checkRateRQ.rooms = new List <hotel_api_model.auto.model.BookingRoom>();

                for (int i = 0; i < this.rooms.Count; i++)
                {
                    BookingRoom bookingRoom = new BookingRoom();
                    bookingRoom.rateKey = rooms[i].rateKey;
                    bookingRoom.paxes   = new List <Pax>();
                    Pax[] paxes = new Pax[this.rooms[i].details.Count];
                    for (int d = 0; d < this.rooms[i].details.Count; d++)
                    {
                        Pax pax = new Pax();
                        pax.type    = rooms[i].details[d].getType() == RoomDetail.GuestType.ADULT ? SimpleTypes.HotelbedsCustomerType.AD : SimpleTypes.HotelbedsCustomerType.CH;
                        pax.age     = rooms[i].details[d].getAge();
                        pax.name    = rooms[i].details[d].getName();
                        pax.surname = rooms[i].details[d].getSurname();
                        paxes[d]    = pax;
                    }
                    bookingRoom.paxes.AddRange(paxes);
                    checkRateRQ.rooms.Add(bookingRoom);
                }

                checkRateRQ.Validate();

                return(checkRateRQ);
            }
            catch (HotelSDKException e)
            {
                throw e;
            }
        }
Beispiel #3
0
        public ActionResult DeleteConfirmed(int id)
        {
            Pax pAX = db.PAX.Find(id);

            db.PAX.Remove(pAX);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
Beispiel #4
0
        public ActionResult Create([Bind(Include = "Id,First_Name,Last_Name,Birthdate,Passport,CountryId,AdressId,Gender,Email,PaxCategory,Created")] Pax pAX)
        {
            if (ModelState.IsValid)
            {
                db.PAX.Add(pAX);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            return(View(pAX));
        }
Beispiel #5
0
        public BookingRQ toBookingRQ()
        {
            BookingRQ bookingRQ = new BookingRQ();

            bookingRQ.holder          = this.holder;
            bookingRQ.clientReference = this.clientReference;
            bookingRQ.remark          = this.remark;
            if (!String.IsNullOrEmpty(cardType) && !String.IsNullOrEmpty(cardNumber) && !String.IsNullOrEmpty(cardHolderName) && !String.IsNullOrEmpty(expiryDate) && cardCVC != null ||
                !String.IsNullOrEmpty(email) && !String.IsNullOrEmpty(phoneNumber))
            {
                PaymentData paymentData = new PaymentData();
                if (!String.IsNullOrEmpty(cardType) && !String.IsNullOrEmpty(cardNumber) && !String.IsNullOrEmpty(cardHolderName) && !String.IsNullOrEmpty(expiryDate) && !String.IsNullOrEmpty(cardCVC))
                {
                    paymentData.paymentCard = new PaymentCard()
                    {
                        cardType = cardType, cardNumber = cardNumber, cardHolderName = cardHolderName, expiryDate = expiryDate, cardCVC = cardCVC
                    }
                }
                ;

                if (!String.IsNullOrEmpty(email) && !String.IsNullOrEmpty(phoneNumber))
                {
                    paymentData.contactData = new PaymentContactData()
                    {
                        email = email, phoneNumber = phoneNumber
                    }
                }
                ;

                bookingRQ.paymentData = paymentData;
            }

            for (int i = 0; i < rooms.Count; i++)
            {
                BookingRoom room = new BookingRoom();
                room.rateKey = rooms[i].rateKey;
                room.paxes   = new List <Pax>();
                for (int p = 0; p < rooms[i].details.Count; p++)
                {
                    Pax pax = new Pax();
                    pax.type    = (rooms[i].details[p].getType() == RoomDetail.GuestType.ADULT) ? SimpleTypes.HotelbedsCustomerType.AD : SimpleTypes.HotelbedsCustomerType.CH;
                    pax.age     = rooms[i].details[p].getAge();
                    pax.name    = rooms[i].details[p].getName();
                    pax.surname = rooms[i].details[p].getSurname();
                    pax.roomId  = rooms[i].details[p].getRoomId();
                    room.paxes.Add(pax);
                }
                bookingRQ.rooms.Add(room);
            }

            bookingRQ.Validate();

            return(bookingRQ);
        }
Beispiel #6
0
        public ActionResult Edit([Bind(Include = "Id,First_Name,Last_Name,Birthdate,Passport,CountryId,AdressId,Gender,Email,PaxCategory,Created")] Pax pAX)
        {
            if (ModelState.IsValid)
            {
                db.Entry(pAX).State = EntityState.Modified;

                db.SaveChanges();

                return(RedirectToAction("Index", "PRODUCT_RESERVATION", new { ProductCalenderId = Request.Params["ProductCalenderId"] }));
            }
            return(View(pAX));
        }
Beispiel #7
0
        protected void ddlCountry_SelectedIndexChanged(object sender, EventArgs e)
        {
            PaxEntryBAL paxBal      = new PaxEntryBAL();
            Pax         pax         = new Pax();
            int         MyEmbassyId = Convert.ToInt32(ddlCountry.SelectedItem.Value);

            ddlVisaType.DataSource     = paxBal.ReadVisaType(MyEmbassyId);
            ddlVisaType.DataTextField  = "DescriptionOne";
            ddlVisaType.DataValueField = "TypeOneId";
            ddlVisaType.DataBind();
            ddlVisaType.Items.Insert(0, new ListItem("--Select--", "0"));
            ddlVisaType.SelectedValue = "0";
        }
Beispiel #8
0
        public void FillDropDown()
        {
            PaxEntryBAL paxBal    = new PaxEntryBAL();
            Pax         pax       = new Pax();
            int         countryId = Convert.ToInt32(Session["CountryId"]);

            ddlCountry.DataSource     = paxBal.ReadCountry(countryId);
            ddlCountry.DataTextField  = "Country_Name";
            ddlCountry.DataValueField = "EmbsyId";
            ddlCountry.DataBind();
            ddlCountry.Items.Insert(0, new ListItem("--Select--", "0"));
            ddlCountry.SelectedValue = "0";
        }
Beispiel #9
0
        // GET: PAXes/Details/5
        public ActionResult Details(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            Pax pAX = db.PAX.Find(id);

            if (pAX == null)
            {
                return(HttpNotFound());
            }
            return(View(pAX));
        }
Beispiel #10
0
        protected void ddlVisaDuration_SelectedIndexChanged(object sender, EventArgs e)
        {
            PaxEntryBAL paxBal           = new PaxEntryBAL();
            Pax         pax              = new Pax();
            int         MyEmbassyId      = Convert.ToInt32(ddlCountry.SelectedItem.Value);
            int         MyVisaTypeId     = Convert.ToInt32(ddlVisaType.SelectedItem.Value);
            int         MyNoofEntry      = Convert.ToInt32(ddlnoofvisit.SelectedItem.Value);
            int         MyVisaDurationId = Convert.ToInt32(ddlVisaDuration.SelectedItem.Value);

            ddlprocesstime.DataSource     = paxBal.ReadProcessTime(MyVisaTypeId, MyNoofEntry, MyEmbassyId, MyVisaDurationId);
            ddlprocesstime.DataTextField  = "Description";
            ddlprocesstime.DataValueField = "ProcessTimeId";
            ddlprocesstime.DataBind();
        }
Beispiel #11
0
        protected void ddlVisaType_SelectedIndexChanged(object sender, EventArgs e)
        {
            PaxEntryBAL paxBal       = new PaxEntryBAL();
            Pax         pax          = new Pax();
            int         MyEmbassyId  = Convert.ToInt32(ddlCountry.SelectedItem.Value);
            int         MyVisaTypeId = Convert.ToInt32(ddlVisaType.SelectedItem.Value);

            ddlnoofvisit.DataSource     = paxBal.ReadNo_Of_Visit(MyEmbassyId, MyVisaTypeId);
            ddlnoofvisit.DataTextField  = "DESCRIPTION_TWO";
            ddlnoofvisit.DataValueField = "TYPE_TWO_ID";
            ddlnoofvisit.DataBind();
            ddlnoofvisit.Items.Insert(0, new ListItem("--Select--", "0"));
            ddlnoofvisit.SelectedValue = "0";
        }
Beispiel #12
0
        protected void ddlnoofvisit_SelectedIndexChanged(object sender, EventArgs e)
        {
            PaxEntryBAL paxBal       = new PaxEntryBAL();
            Pax         pax          = new Pax();
            int         MyEmbassyId  = Convert.ToInt32(ddlCountry.SelectedItem.Value);
            int         MyVisaTypeId = Convert.ToInt32(ddlVisaType.SelectedItem.Value);
            int         MyNoofEntry  = Convert.ToInt32(ddlnoofvisit.SelectedItem.Value);

            ddlVisaDuration.DataSource     = paxBal.ReadVisaDuration(MyVisaTypeId, MyNoofEntry, MyEmbassyId);
            ddlVisaDuration.DataTextField  = "VisaDescription";
            ddlVisaDuration.DataValueField = "DurationId";
            ddlVisaDuration.DataBind();
            ddlVisaDuration.Items.Insert(0, new ListItem("--Select--", "0"));
            ddlVisaDuration.SelectedValue = "0";
        }
Beispiel #13
0
        //// GET: PAXes/Edit/5
        //public ActionResult Edit(int? id)
        //{
        //    if (id == null)
        //    {
        //        return new HttpStatusCodeResult(HttpStatusCode.BadRequest);
        //    }
        //    Pax pAX = db.Pax.Find(id);
        //    if (pAX == null)
        //    {
        //        return HttpNotFound();
        //    }
        //    return View(pAX);
        //}

        public ActionResult Edit(int?ReservationId, int?ProductCalenderId, int?PaxId)
        {
            if (ReservationId == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }

            ViewBag.ProductCalenderId = ProductCalenderId;

            Pax pAX = db.PAX.Include(prp => prp.PRODUCT_RESERVATION).Where(p => p.Id == PaxId).SingleOrDefault();

            if (pAX == null)
            {
                return(HttpNotFound());
            }

            return(View(pAX));
        }
Beispiel #14
0
        protected void addpax_Click(object sender, EventArgs e)
        {
            PaxEntryBAL paxBal = new PaxEntryBAL();
            Pax         pax    = new Pax();

            pax.FKConsignmentId = Convert.ToInt32(Session["ID"]);
            pax.FkPaxId         = Convert.ToInt32(Session["PaxId"]);
            pax.CountryId       = Convert.ToInt32(Session["CountryId"]);
            pax.VisaTypeOneId   = Convert.ToInt32(ddlVisaType.SelectedItem.Value);
            pax.VisaTypeTwoId   = Convert.ToInt32(ddlnoofvisit.SelectedItem.Value);
            pax.DurationId      = Convert.ToInt32(ddlVisaDuration.SelectedItem.Value);
            pax.ProcessTimeid   = Convert.ToInt32(ddlprocesstime.SelectedItem.Value);
            //Session["ObjPaxAdditionalInfo"] = pax;
            paxBal.CreateAdditonalPax(pax);


            BindGrid();
            Response.Redirect("AddConsignment.aspx");
            ScriptManager.RegisterClientScriptBlock(addpax, GetType(), "test", "alert(' Pax Saved  successfully!!!')", true);
        }
Beispiel #15
0
 public void Setup()
 {
     _validator = new PaxValidator();
     _validPax  = new Pax
     {
         Name = new PersonName
         {
             First = "newshore",
             Last  = "test",
             Title = TitleType.MSS
         },
         Type = new PaxTypeInfo
         {
             Category = PaxCategoryType.Adult,
             Code     = "ADT"
         },
         PersonInfo = new PersonInfo
         {
             DateOfBirth = DateTime.Today,
         }
     };
 }
        public Bookingback MapResponseofBooking(dynamic OutPutData, string sessionId)
        {
            try
            {
                var BackData = new Bookingback();
                BackData.reference.client   = OutPutData.reference.client;
                BackData.reference.supplier = OutPutData.reference.supplier;
                if (OutPutData.holder == null)
                {
                    BackData.holder = null;
                }
                else
                {
                    BackData.holder.name    = OutPutData.holder.name;
                    BackData.holder.surname = OutPutData.holder.surname;
                }
                if (OutPutData.hotel == null)
                {
                    BackData.hotel = null;
                }
                else
                {
                    BackData.hotel.boardCode    = OutPutData.hotel.boardCode;
                    BackData.hotel.checkIn      = OutPutData.hotel.checkIn;
                    BackData.hotel.checkOut     = OutPutData.hotel.checkOut;
                    BackData.hotel.creationDate = OutPutData.hotel.creationDate;
                    BackData.hotel.hotelCode    = OutPutData.hotel.hotelCode;
                    BackData.hotel.hotelName    = OutPutData.hotel.hotelName;
                    if (OutPutData.hotel.rooms != null)
                    {
                        foreach (var item in OutPutData.hotel.rooms)
                        {
                            BookingRoom room = new BookingRoom();
                            room.code                    = item.code;
                            room.description             = item.description;
                            room.occupancyRefId          = item.occupancyRefId;
                            room.price.currency          = item.price.currency;
                            room.price.net               = item.price.net;
                            room.price.gross             = item.price.gross;
                            room.price.binding           = item.price.binding;
                            room.price.exchange.currency = item.price.exchange.currency;
                            room.price.exchange.rate     = item.price.exchange.rate;
                            BackData.hotel.rooms.Add(room);
                        }
                    }

                    if (OutPutData.hotel.occupancies != null)
                    {
                        foreach (var p in OutPutData.hotel.occupancies)
                        {
                            PaxBack roomPax = new PaxBack();
                            roomPax.id = p.id;
                            foreach (var x in p.paxes)
                            {
                                Pax pax = new Pax();
                                pax.age = x.age;
                                roomPax.paxes.Add(pax);
                            }
                            BackData.hotel.occupancies.Add(roomPax);
                        }
                    }
                }
                BackData.price.currency = OutPutData.price.currency;
                BackData.price.net      = OutPutData.price.net;
                BackData.price.gross    = OutPutData.price.gross;
                BackData.status         = OutPutData.status;
                BackData.remarks        = OutPutData.remarks;
                BackData.payable        = OutPutData.payable;

                if (OutPutData.cancelPolicy != null)
                {
                    BackData.cancelPolicy.refundable = OutPutData.cancelPolicy.refundable;
                    foreach (var c in OutPutData.cancelPolicy.cancelPenalties)
                    {
                        CancelPenalty cancelPenalty = new CancelPenalty();
                        cancelPenalty.currency    = c.currency;
                        cancelPenalty.hoursBefore = c.hoursBefore;
                        cancelPenalty.value       = c.value;
                        cancelPenalty.penaltyType = c.penaltyType;
                        BackData.cancelPolicy.cancelPenalties.Add(cancelPenalty);
                    }
                }


                return(BackData);
            }
            catch (Exception ex)
            {
                var requestData = JsonConvert.SerializeObject(ex);

                LoggerHelper.WriteToFile("c:/HotelsB2C/Logs/SMLogs/BookingMapException", "BookingMapException_" + sessionId, "BookingMapException", requestData);
                throw;
            }
        }
        /// <summary>
        ///
        /// </summary>
        /// <returns></returns>
        public AvailabilityRQ toAvailabilityRQ()
        {
            try
            {
                AvailabilityRQ availabilityRQ = new AvailabilityRQ();
                availabilityRQ.language = this.language;
                availabilityRQ.stay     = new Stay(checkIn, checkOut, shiftDays, true);

                if (rooms != null && rooms.Count > 0)
                {
                    availabilityRQ.occupancies = new List <Occupancy>();
                    for (int i = 0; i < rooms.Count; i++)
                    {
                        Occupancy occupancy = new Occupancy();
                        occupancy.adults   = rooms[i].adults;
                        occupancy.children = rooms[i].children;
                        occupancy.rooms    = rooms[i].numberOfRooms;

                        if (rooms[i].details != null && rooms[i].details.Count > 0)
                        {
                            occupancy.paxes = new List <Pax>();
                            Pax[] paxes = new Pax[rooms[i].details.Count];
                            for (int d = 0; d < rooms[i].details.Count; d++)
                            {
                                Pax pax = new Pax();
                                pax.type    = (rooms[i].details[d].getType() == RoomDetail.GuestType.ADULT) ? SimpleTypes.HotelbedsCustomerType.AD : SimpleTypes.HotelbedsCustomerType.CH;
                                pax.age     = rooms[i].details[d].getAge();
                                pax.name    = rooms[i].details[d].getName();
                                pax.surname = rooms[i].details[d].getSurname();
                                paxes[d]    = pax;
                            }
                            occupancy.paxes.AddRange(paxes);
                        }
                        availabilityRQ.occupancies.Add(occupancy);
                    }
                }
                // Linea 224 Availability.java
                if (withinThis != null)
                {
                    GeoLocation geolocation = new GeoLocation();
                    geolocation.unit = UnitMeasure.UnitMeasureType.km;
                    if (withinThis.GetType() == typeof(Circle))
                    {
                        Circle circle = (Circle)withinThis;
                        geolocation.latitude  = circle.latitude;
                        geolocation.longitude = circle.longitude;
                        geolocation.radius    = circle.radiusInKilometers;
                    }
                    else if (withinThis.GetType() == typeof(Square))
                    {
                        Square square = (Square)withinThis;
                        geolocation.latitude           = square.northEastLatitude;
                        geolocation.longitude          = square.northEastLongitude;
                        geolocation.secondaryLatitude  = square.southWestLatitude;
                        geolocation.secondaryLongitude = square.southWestLongitude;
                    }
                    availabilityRQ.geolocation = geolocation;
                }

                if (!String.IsNullOrEmpty(destination))
                {
                    Destination dest = new Destination();
                    dest.code = destination;
                    if (zone != null)
                    {
                        dest.zone = zone.Value;
                    }
                    availabilityRQ.destination = dest;
                }

                if (matchingKeywords != null && matchingKeywords.Count > 0)
                {
                    availabilityRQ.keywords = new KeywordsFilter(matchingKeywords.ToList <int>(), keywordsMatcher.Equals(Matcher.ALL));// matchingKeywords.ToList();
                }

                if (includeHotels != null && includeHotels.Count > 0 && excludeHotels != null && excludeHotels.Count > 0)
                {
                    foreach (int e in excludeHotels)
                    {
                        includeHotels.RemoveAll(i => i == e);
                    }
                }

                if (includeHotels != null && includeHotels.Count > 0)
                {
                    HotelsFilter hotelsFilter = new HotelsFilter();
                    hotelsFilter.included = true;
                    hotelsFilter.hotel    = includeHotels;
                    hotelsFilter.type     = (useGiataCodes) ? SimpleTypes.HotelCodeType.GIATA : SimpleTypes.HotelCodeType.HOTELBEDS;
                    availabilityRQ.hotels = hotelsFilter;
                }
                else if (excludeHotels != null && excludeHotels.Count > 0)
                {
                    HotelsFilter hotelsFilter = new HotelsFilter();
                    hotelsFilter.included = false;
                    hotelsFilter.hotel    = excludeHotels;
                    hotelsFilter.type     = (useGiataCodes) ? SimpleTypes.HotelCodeType.GIATA : SimpleTypes.HotelCodeType.HOTELBEDS;
                    availabilityRQ.hotels = hotelsFilter;
                }

                if (includeBoards != null && includeBoards.Count > 0)
                {
                    Boards boardFilter = new Boards();
                    boardFilter.included  = true;
                    boardFilter.board     = includeBoards;
                    availabilityRQ.boards = boardFilter;
                }

                else if (excludeBoards != null && excludeBoards.Count > 0)
                {
                    Boards boardFilter = new Boards();
                    boardFilter.included  = false;
                    boardFilter.board     = excludeBoards;
                    availabilityRQ.boards = boardFilter;
                }


                if (includeRoomCodes != null && includeRoomCodes.Count > 0)
                {
                    Rooms roomFilter = new Rooms();
                    roomFilter.included  = true;
                    roomFilter.room      = includeRoomCodes;
                    availabilityRQ.rooms = roomFilter;
                }
                else if (excludeRoomCodes != null && excludeRoomCodes.Count > 0)
                {
                    Rooms roomFilter = new Rooms();
                    roomFilter.included  = false;
                    roomFilter.room      = excludeRoomCodes;
                    availabilityRQ.rooms = roomFilter;
                }

                availabilityRQ.dailyRate = dailyRate;

                if (ofTypes != null && ofTypes.Count > 0)
                {
                    availabilityRQ.accommodations = new List <SimpleTypes.AccommodationType>();
                    availabilityRQ.accommodations.AddRange(ofTypes);
                }

                List <ReviewFilter> reviewsFilter = new List <ReviewFilter>();
                if (hbScoreHigherThan != null || hbScoreLowerThan != null || numberOfHBReviewsHigherThan != null)
                {
                    ReviewFilter reviewFilter = new ReviewFilter();
                    if (hbScoreLowerThan.HasValue)
                    {
                        reviewFilter.maxRate = hbScoreLowerThan.Value;
                    }
                    if (hbScoreHigherThan.HasValue)
                    {
                        reviewFilter.minRate = hbScoreHigherThan.Value;
                    }
                    if (numberOfHBReviewsHigherThan.HasValue)
                    {
                        reviewFilter.minReviewCount = numberOfHBReviewsHigherThan.Value;
                    }
                    reviewFilter.type = SimpleTypes.ReviewsType.HOTELBEDS;
                    reviewsFilter.Add(reviewFilter);
                }

                if (tripAdvisorScoreHigherThan != null || tripAdvisorScoreLowerThan != null || numberOfTripAdvisorReviewsHigherThan != null)
                {
                    ReviewFilter reviewFilter = new ReviewFilter();
                    if (tripAdvisorScoreLowerThan.HasValue)
                    {
                        reviewFilter.maxRate = tripAdvisorScoreLowerThan.Value;
                    }
                    if (tripAdvisorScoreHigherThan.HasValue)
                    {
                        reviewFilter.minRate = tripAdvisorScoreHigherThan.Value;
                    }
                    if (numberOfTripAdvisorReviewsHigherThan.HasValue)
                    {
                        reviewFilter.minReviewCount = numberOfTripAdvisorReviewsHigherThan.Value;
                    }
                    reviewFilter.type = SimpleTypes.ReviewsType.TRIPDAVISOR;
                    reviewsFilter.Add(reviewFilter);
                }

                if (reviewsFilter.Count > 1)
                {
                    availabilityRQ.reviews = reviewsFilter;
                }

                if (limitHotelsTo != null || maxCategory != null || minCategory != null || limitRoomsPerHotelTo != null || limitRatesPerRoomTo != null || ratesLowerThan != null ||
                    ratesHigherThan != null || packaging != null || payed != null)
                {
                    Filter filter = new Filter();
                    if (maxCategory.HasValue)
                    {
                        filter.maxCategory = maxCategory.Value;
                    }
                    if (minCategory.HasValue)
                    {
                        filter.minCategory = minCategory.Value;
                    }
                    if (packaging.HasValue)
                    {
                        filter.packaging = packaging.Value;
                    }
                    if (limitHotelsTo.HasValue)
                    {
                        filter.maxHotels = limitHotelsTo.Value;
                    }
                    if (limitRoomsPerHotelTo.HasValue)
                    {
                        filter.maxRooms = limitRoomsPerHotelTo.Value;
                    }
                    if (limitRatesPerRoomTo.HasValue)
                    {
                        filter.maxRatesPerRoom = limitRatesPerRoomTo.Value;
                    }
                    if (ratesLowerThan.HasValue)
                    {
                        filter.maxRate = ratesLowerThan.Value;
                    }
                    if (ratesHigherThan.HasValue)
                    {
                        filter.minRate = ratesHigherThan.Value;
                    }
                    if (payed.HasValue)
                    {
                        switch (payed.Value)
                        {
                        case Pay.AT_HOTEL:
                            filter.paymentType = SimpleTypes.ShowDirectPaymentType.AT_HOTEL;
                            break;

                        case Pay.AT_WEB:
                            filter.paymentType = SimpleTypes.ShowDirectPaymentType.AT_WEB;
                            break;

                        case Pay.INDIFFERENT:
                            filter.paymentType = SimpleTypes.ShowDirectPaymentType.BOTH;
                            break;
                        }
                    }
                    availabilityRQ.filter = filter;
                }

                availabilityRQ.Validate();

                return(availabilityRQ);
            }
            catch (Exception e)
            {
                throw e;
            }
        }
        public HotelShopRS getHoteles(VO_HotelValuedAvailRQ vo_HotelValuedAvailRQ, string strMoneda, string Ruta)
        {
            clsResultados  cResultados    = new clsResultados();
            clsParametros  cParametros    = new clsParametros();
            StringBuilder  consulta       = new StringBuilder();
            HotelShopRQ    oHotelShopRQ   = new HotelShopRQ();
            HotelShopRS    oHotelShopRS   = new HotelShopRS();
            VO_Credentials vo_Credentials = clsCredenciales.Credenciales(Enum_ProveedorWebServices.TotalTrip);

            vo_HotelValuedAvailRQ.Credentials = vo_Credentials;

            bool bSoloTT = false;

            try
            {
                bSoloTT = bool.Parse(clsValidaciones.GetKeyOrAdd("bSoloTT", "False"));
            }
            catch { }

            try
            {
                string sAdulto  = clsValidaciones.GetKeyOrAdd("AdultoHB", "AD");
                string sInfante = clsValidaciones.GetKeyOrAdd("InfanteHB", "CH");

                int    iRoom      = vo_HotelValuedAvailRQ.lHotelOccupancy.Count;
                Room[] oRoomArray = new Room[iRoom];
                for (int i = 0; i < iRoom; i++)
                {
                    Room  oRoom     = new Room();
                    int   iPax      = vo_HotelValuedAvailRQ.lHotelOccupancy[i].Occupancy.lGuestList.Count;
                    Pax[] oPaxArray = new Pax[iPax];
                    for (int j = 0; j < iPax; j++)
                    {
                        Pax oPax = new Pax();
                        oPax.Age = vo_HotelValuedAvailRQ.lHotelOccupancy[i].Occupancy.lGuestList[j].Age;
                        if (vo_HotelValuedAvailRQ.lHotelOccupancy[i].Occupancy.lGuestList[j].Type.Equals(sAdulto))
                        {
                            oPax.PaxType = PaxType.Adult;
                        }
                        else
                        {
                            oPax.PaxType = PaxType.Child;
                        }

                        oPaxArray[j] = oPax;
                    }
                    oRoom.Paxes   = oPaxArray;
                    oRoomArray[i] = oRoom;
                }

                oHotelShopRQ.CityTo   = vo_HotelValuedAvailRQ.Destination;
                oHotelShopRQ.DateFrom = DateTime.Parse(clsValidaciones.ConverFechaSinSeparadorYMD(vo_HotelValuedAvailRQ.CheckInDate));
                oHotelShopRQ.DateTo   = DateTime.Parse(clsValidaciones.ConverFechaSinSeparadorYMD(vo_HotelValuedAvailRQ.CheckOutDate));
                oHotelShopRQ.Rooms    = oRoomArray;
                oHotelShopRQ.Username = vo_Credentials.LoginUser;
                oHotelShopRQ.Password = vo_Credentials.PasswordUser;
                oHotelShopRQ.Currency = strMoneda;
                oHotelShopRQ.Language = "ES";
                int iResultados = Convert.ToInt32(clsValidaciones.GetKeyOrAdd("CantidadRHoteles", "500"));

                try
                {
                    if (HttpContext.Current.Session["$CantHoteles"] != null)
                    {
                        iResultados = Convert.ToInt32(HttpContext.Current.Session["$CantHoteles"].ToString());
                    }
                }
                catch { }

                oHotelShopRQ.MaxResults = iResultados;
                if (bSoloTT)
                {
                    oHotelShopRQ.ContentType = ContentType.Exclusive;
                }
                else
                {
                    oHotelShopRQ.ContentType = ContentType.NonExclusive;
                }

                HotelShopService oHotelShopService = new HotelShopService();
                oHotelShopService.Url = clsEsquema.setConexionWs(oHotelShopService.Url);

                string sRutaGen     = Ruta;
                string sHotelShopRQ = "HotelShopRQ";
                string sHotelShopRS = "HotelShopRS";
                try
                {
                    clsXML.ClaseXML(oHotelShopRQ, sRutaGen + sHotelShopRQ + "hilo.xml");
                }
                catch { }

                oHotelShopRS = oHotelShopService.HotelShop(oHotelShopRQ);
                try
                {
                    clsXML.ClaseXML(oHotelShopRS, sRutaGen + sHotelShopRS + "hilo.xml");
                }
                catch { }
            }
            catch (Exception Ex)
            {
                cParametros.Id          = 0;
                cParametros.Message     = Ex.Message;
                cParametros.Severity    = clsSeveridad.Alta;
                cParametros.Tipo        = clsTipoError.WebServices;
                cParametros.Metodo      = System.Reflection.MethodBase.GetCurrentMethod().Name;
                cParametros.Complemento = "Resultados de Hoteles";
                cParametros.Source      = Ex.Source;

                consulta.AppendLine("Credenciales: ");
                try
                {
                    if (vo_Credentials != null)
                    {
                        consulta.AppendLine("User: "******"Password: "******"Url: " + vo_Credentials.UrlWebServices);
                        clsCache cCache = new csCache().cCache();
                        if (cCache != null)
                        {
                            consulta.AppendLine("Sesion Local: " + cCache.SessionID.ToString());
                        }
                    }
                }
                catch { }
                cParametros.Info = consulta.ToString();

                cParametros.StackTrace = Ex.StackTrace;
                cParametros.ViewMessage.Add("No existen resultados para esta búsqueda");
                cParametros.Sugerencia.Add("Por favor intente de nuevo");
                cParametros.Code       = "501";
                cParametros.ValidaInfo = false;
                cParametros.MessageBD  = true;
                cParametros.TipoWs     = Enum_ProveedorWebServices.TotalTrip;
                cResultados.Error      = cParametros;
                ExceptionHandled.Publicar(cParametros);
            }
            return(oHotelShopRS);
        }
Beispiel #19
0
 public void UpdatePax(Pax pax, int paxId)
 {
     ConsignDal.UpdatePax(pax, paxId);
 }
Beispiel #20
0
        protected void btnPaxEntry_Save_Click(object sender, EventArgs e)
        {
            // PaxEntryBAL paxBal = new PaxEntryBAL();
            //List<Pax> pax = new List<Pax>();
            Pax pax = new Pax();

            // foreach (ListItem item in LstSelectedCountry.Items)
            // {
            // pax.ConsignmentId = Convert.ToInt32(Session["ConsignmentId"]);
            // LblRefNo.Text = Session["ConsignmentId"].ToString();
            pax.PaxVit        = txtvttNo.Text;
            pax.PaxName       = txt_paxname.Text;
            pax.DateOfBirth   = Convert.ToDateTime(txt_dob.Text);
            pax.PaxPassportNo = txt_PassportNo.Text;

            if (chktickets.Checked == true)
            {
                pax.PaxTicket = 'Y';
            }
            else
            {
                pax.PaxTicket = 'N';
            }

            if (chkMedIns.Checked == true)
            {
                pax.PaxMedInsurance = 'Y';
            }
            else
            {
                pax.PaxMedInsurance = 'N';
            }

            if (chkCreditCard.Checked == true)
            {
                pax.PaxCreditCard = 'Y';
            }
            else
            {
                pax.PaxCreditCard = 'N';
            }

            if (chkcertificate.Checked == true)
            {
                pax.PaxCertificates = 'Y';
            }
            else
            {
                pax.PaxCertificates = 'N';
            }

            if (chkItPaper.Checked == true)
            {
                pax.PaxItPaper = 'Y';
            }
            else
            {
                pax.PaxItPaper = 'N';
            }

            if (chkDraft.Checked == true)
            {
                pax.PaxDraft = 'Y';
            }
            else
            {
                pax.PaxDraft = 'N';
            }

            pax.PaxOther   = Txt_Others.Text;
            pax.PaxRemarks = txtPaxRemarks.Text;
            this.lstPax    = new List <Pax>();
            this.lstPax.Add(pax);
            Consignment consign = (Consignment)Session["listconsign"];

            consign.PaxDetails     = this.lstPax;
            Session["listconsign"] = consign;

            FillDropDown();
            DivPaxEntry.Visible   = false;
            DivAdditional.Visible = true;
        }
Beispiel #21
0
        protected void btnPaxEntry_Update_Click(object sender, EventArgs e)
        {
            int         id     = Convert.ToInt32(ViewState["PaxId"]);
            PaxEntryBAL paxBal = new PaxEntryBAL();
            Pax         pax    = new Pax();

            // pax.ConsignmentId = Convert.ToInt32(Session["ConsignmentId"]);
            pax.PaxName       = txt_paxname.Text;
            pax.DateOfBirth   = Convert.ToDateTime(txt_dob.Text);
            pax.PaxPassportNo = txt_PassportNo.Text;

            if (chktickets.Checked == true)
            {
                pax.PaxTicket = 'Y';
            }
            else
            {
                pax.PaxTicket = 'N';
            }

            if (chkMedIns.Checked == true)
            {
                pax.PaxMedInsurance = 'Y';
            }
            else
            {
                pax.PaxMedInsurance = 'N';
            }

            if (chkCreditCard.Checked == true)
            {
                pax.PaxCreditCard = 'Y';
            }
            else
            {
                pax.PaxCreditCard = 'N';
            }

            if (chkcertificate.Checked == true)
            {
                pax.PaxCertificates = 'Y';
            }
            else
            {
                pax.PaxCertificates = 'N';
            }

            if (chkItPaper.Checked == true)
            {
                pax.PaxItPaper = 'Y';
            }
            else
            {
                pax.PaxItPaper = 'N';
            }

            if (chkDraft.Checked == true)
            {
                pax.PaxDraft = 'Y';
            }
            else
            {
                pax.PaxDraft = 'N';
            }

            pax.PaxRemarks = txtPaxRemarks.Text;

            consignBal.UpdatePax(pax, id);

            ScriptManager.RegisterClientScriptBlock(btnPaxEntry_Save, GetType(), "test", "alert(' Pax updated  successfully!!!')", true);
            FillPaxGrid();
            DivPaxEntry.Visible = false;
            DivPaxGrid.Visible  = true;
        }
        public bool DbFetchSheduller()
        {
            var BaseLocation = _Configuration["LocationsList:BaseLocation"];
            var LocationList = _Configuration.GetSection("LocationsList:ToLocations").GetChildren().Select(x => x.Value).ToArray();

            foreach (var item in LocationList)
            {
                DateTime DateStart = DateTime.Now;
                DateTime DateStop  = DateStart.AddDays(330);

                for (DateTime DateRunning = DateStart; DateRunning.Date < DateStop.Date; DateRunning = DateRunning.AddDays(1))
                {
                    FlightOfferSearchRQ     FlightOfferSearchRQ     = new FlightOfferSearchRQ();
                    OriginLocationCode      OriginLocationCode      = new OriginLocationCode();
                    DestinationLocationCode DestinationLocationCode = new DestinationLocationCode();
                    Pax Pax = new Pax();

                    OriginLocationCode.DepartureDate = DateRunning;
                    OriginLocationCode.IataCode      = BaseLocation;

                    DestinationLocationCode.IataCode = item;

                    FlightOfferSearchRQ.TravelClass  = "";
                    FlightOfferSearchRQ.NonStop      = true;
                    FlightOfferSearchRQ.CurrencyCode = "";

                    Pax.Adult = 1;

                    var SearchString = "flight-offers?originLocationCode=" + OriginLocationCode.IataCode + "&destinationLocationCode=" + DestinationLocationCode.IataCode + "&departureDate=" + OriginLocationCode.DepartureDate.ToString("yyyy-MM-dd") + "&adults=" + Pax.Adult + "&nonStop=" + FlightOfferSearchRQ.NonStop.ToString().ToLower() + "&max=250";

                    FlightOffersSearchRS FlightOffersSearchRS = _ISearchConnecterCaller.FlightOffersSearch(SearchString);

                    if (FlightOffersSearchRS == null)
                    {
                        int i = 0;
                        while (FlightOffersSearchRS == null && i < 3)
                        {
                            System.Threading.Thread.Sleep(1000);
                            FlightOffersSearchRS = _ISearchConnecterCaller.FlightOffersSearch(SearchString);
                            i++;
                        }
                    }

                    try
                    {
                        FlightOffersSearchDB FlightOffersSearchDBObj = new FlightOffersSearchDB();
                        MetaDB         MetaDBObj         = new MetaDB();
                        List <DatumDB> DatumDBList       = new List <DatumDB>();
                        DictionariesDB DictionariesDBObj = new DictionariesDB();

                        MetaDBObj.links = FlightOffersSearchRS.meta.links;
                        MetaDBObj.count = FlightOffersSearchRS.meta.count;
                        FlightOffersSearchDBObj.meta = MetaDBObj;

                        foreach (var Data in FlightOffersSearchRS.data)
                        {
                            DatumDB DatumDBObj = new DatumDB();
                            DatumDBObj.type   = Data.type;
                            DatumDBObj.id     = Data.id;
                            DatumDBObj.source = Data.source;
                            DatumDBObj.instantTicketingRequired = Data.instantTicketingRequired;
                            DatumDBObj.nonHomogeneous           = Data.nonHomogeneous;
                            DatumDBObj.oneWay                = Data.oneWay;
                            DatumDBObj.lastTicketingDate     = Data.lastTicketingDate;
                            DatumDBObj.numberOfBookableSeats = Data.numberOfBookableSeats;

                            List <ItineraryDB> ItineraryDBList = new List <ItineraryDB>();
                            foreach (var Itineraries in Data.itineraries)
                            {
                                ItineraryDB ItineraryDBObj = new ItineraryDB();
                                ItineraryDBObj.duration = Itineraries.duration;
                                List <SegmentDB> SegmentDBList = new List <SegmentDB>();

                                foreach (var Segments in Itineraries.segments)
                                {
                                    SegmentDB SegmentDBObj = new SegmentDB();
                                    SegmentDBObj.carrierCode     = Segments.carrierCode;
                                    SegmentDBObj.number          = Segments.number;
                                    SegmentDBObj.duration        = Segments.duration;
                                    SegmentDBObj.id              = Segments.id;
                                    SegmentDBObj.numberOfStops   = Segments.numberOfStops;
                                    SegmentDBObj.blacklistedInEU = Segments.blacklistedInEU;

                                    DepartureDB DepartureDBObj = new DepartureDB();
                                    DepartureDBObj.iataCode = Segments.departure.iataCode;
                                    DepartureDBObj.terminal = Segments.departure.terminal;
                                    DepartureDBObj.at       = Segments.departure.at;

                                    SegmentDBObj.departure = DepartureDBObj;

                                    ArrivalDB ArrivalDBObj = new ArrivalDB();
                                    ArrivalDBObj.iataCode = Segments.arrival.iataCode;
                                    ArrivalDBObj.terminal = Segments.arrival.terminal;
                                    ArrivalDBObj.at       = Segments.arrival.at;

                                    SegmentDBObj.arrival = ArrivalDBObj;

                                    AircraftDB AircraftDBObj = new AircraftDB();
                                    AircraftDBObj.code = Segments.aircraft.code;

                                    SegmentDBObj.aircraft = AircraftDBObj;

                                    OperatingDB OperatingDBObj = new OperatingDB();
                                    OperatingDBObj.carrierCode = Segments.operating.carrierCode;

                                    SegmentDBObj.operating = OperatingDBObj;

                                    SegmentDBList.Add(SegmentDBObj);
                                }
                                ItineraryDBObj.segments = SegmentDBList;
                                ItineraryDBList.Add(ItineraryDBObj);
                            }
                            DatumDBObj.itineraries = ItineraryDBList;

                            PriceDB PriceDBObj = new PriceDB();
                            PriceDBObj.currency   = Data.price.currency;
                            PriceDBObj.total      = Data.price.total;
                            PriceDBObj.@base      = Data.price.@base;
                            PriceDBObj.grandTotal = Data.price.grandTotal;

                            List <FeeDB> FeesDBList = new List <FeeDB>();
                            foreach (var Fees in Data.price.fees)
                            {
                                FeeDB FeesDB = new FeeDB();
                                FeesDB.amount = Fees.amount;
                                FeesDB.type   = Fees.type;
                                FeesDBList.Add(FeesDB);
                            }
                            PriceDBObj.fees = FeesDBList;

                            DatumDBObj.price = PriceDBObj;

                            PricingOptionsDB PricingOptionsDBobj = new PricingOptionsDB();
                            PricingOptionsDBobj.includedCheckedBagsOnly = Data.pricingOptions.includedCheckedBagsOnly;

                            foreach (var Fare in Data.pricingOptions.fareType)
                            {
                                PricingOptionsDBobj.fareType += Fare + ",";
                            }

                            DatumDBObj.pricingOptions = PricingOptionsDBobj;

                            foreach (var validatingAirlineCodes in Data.validatingAirlineCodes)
                            {
                                DatumDBObj.validatingAirlineCodes += validatingAirlineCodes + ",";
                            }

                            List <TravelerPricingDB> TravelerPricingDBList = new List <TravelerPricingDB>();
                            foreach (var TravelerPricings in Data.travelerPricings)
                            {
                                TravelerPricingDB TravelerPricingDBObj = new TravelerPricingDB();
                                TravelerPricingDBObj.travelerId   = TravelerPricings.travelerId;
                                TravelerPricingDBObj.fareOption   = TravelerPricings.fareOption;
                                TravelerPricingDBObj.travelerType = TravelerPricings.travelerType;

                                TravelPriceDB TravelPriceDBObj = new TravelPriceDB();
                                TravelPriceDBObj.currency  = TravelerPricings.price.currency;
                                TravelPriceDBObj.total     = TravelerPricings.price.total;
                                TravelPriceDBObj.@base     = TravelerPricings.price.@base;
                                TravelerPricingDBObj.price = TravelPriceDBObj;

                                List <FareDetailsBySegmentDB> FareDetailsBySegmentDBList = new List <FareDetailsBySegmentDB>();
                                foreach (var FareDetailsBySegment in TravelerPricings.fareDetailsBySegment)
                                {
                                    FareDetailsBySegmentDB FareDetailsBySegmentDBObj = new FareDetailsBySegmentDB();
                                    FareDetailsBySegmentDBObj.cabin     = FareDetailsBySegment.cabin;
                                    FareDetailsBySegmentDBObj.segmentId = FareDetailsBySegment.segmentId;
                                    FareDetailsBySegmentDBObj.fareBasis = FareDetailsBySegment.fareBasis;
                                    FareDetailsBySegmentDBObj.@class    = FareDetailsBySegment.@class;

                                    IncludedCheckedBagsDB IncludedCheckedBagsDBObj = new IncludedCheckedBagsDB();
                                    IncludedCheckedBagsDBObj.weight     = FareDetailsBySegment.includedCheckedBags.weight;
                                    IncludedCheckedBagsDBObj.weightUnit = FareDetailsBySegment.includedCheckedBags.weightUnit;

                                    FareDetailsBySegmentDBObj.includedCheckedBags = IncludedCheckedBagsDBObj;
                                    FareDetailsBySegmentDBList.Add(FareDetailsBySegmentDBObj);
                                }

                                TravelerPricingDBObj.fareDetailsBySegment = FareDetailsBySegmentDBList;
                                TravelerPricingDBList.Add(TravelerPricingDBObj);
                            }
                            DatumDBObj.travelerPricings = TravelerPricingDBList;
                            DatumDBList.Add(DatumDBObj);
                        }

                        FlightOffersSearchDBObj.data = DatumDBList;
                        DictionariesDB     DictionariesDBObjI = new DictionariesDB();
                        List <AircraftsDB> AircraftsDBList    = new List <AircraftsDB>();
                        List <CurenciesDB> CurenciesDBList    = new List <CurenciesDB>();
                        List <CarriersDB>  CarriersDBList     = new List <CarriersDB>();

                        foreach (KeyValuePair <string, string> entry in FlightOffersSearchRS.dictionaries.Aircraft)
                        {
                            AircraftsDB AircraftsDBObj = new AircraftsDB();
                            AircraftsDBObj.Details = entry.Key + "_ " + entry.Value;
                            AircraftsDBList.Add(AircraftsDBObj);
                        }

                        DictionariesDBObjI.Aircraft = AircraftsDBList;

                        foreach (KeyValuePair <string, string> entry in FlightOffersSearchRS.dictionaries.Currencies)
                        {
                            CurenciesDB CurenciesDBObj = new CurenciesDB();
                            CurenciesDBObj.Details = entry.Key + "_ " + entry.Value;
                            CurenciesDBList.Add(CurenciesDBObj);
                        }

                        DictionariesDBObjI.Currencies = CurenciesDBList;


                        foreach (KeyValuePair <string, string> entry in FlightOffersSearchRS.dictionaries.Carriers)
                        {
                            CarriersDB CarriersDBObj = new CarriersDB();
                            CarriersDBObj.Details = entry.Key + " _ " + entry.Value;
                            CarriersDBList.Add(CarriersDBObj);
                        }
                        DictionariesDBObjI.Carriers          = CarriersDBList;
                        FlightOffersSearchDBObj.dictionaries = DictionariesDBObjI;

                        _DatabaseContext.Add <FlightOffersSearchDB>(FlightOffersSearchDBObj);
                        _DatabaseContext.SaveChanges();
                    }
                    catch (Exception)
                    {
                        throw;
                    }
                }
            }
            return(true);
        }
Beispiel #23
0
        protected void btnPaxEntry_Click(object sender, EventArgs e)
        {
            PaxEntryBAL paxBal = new PaxEntryBAL();
            Pax         pax    = new Pax();

            pax.ConsignmentId = Convert.ToInt32(Session["ID"]);
            pax.PaxName       = txt_paxname.Text;
            pax.DateOfBirth   = Convert.ToDateTime(txt_dob.Text);
            pax.PaxPassportNo = txt_PassportNo.Text;

            if (chktickets.Checked == true)
            {
                pax.PaxTicket = 'Y';
            }
            else
            {
                pax.PaxTicket = 'N';
            }

            if (chkMedIns.Checked == true)
            {
                pax.PaxMedInsurance = 'Y';
            }
            else
            {
                pax.PaxMedInsurance = 'N';
            }

            if (chkCreditCard.Checked == true)
            {
                pax.PaxCreditCard = 'Y';
            }
            else
            {
                pax.PaxCreditCard = 'N';
            }

            if (chkcertificate.Checked == true)
            {
                pax.PaxCertificates = 'Y';
            }
            else
            {
                pax.PaxCertificates = 'N';
            }

            if (chkItPaper.Checked == true)
            {
                pax.PaxItPaper = 'Y';
            }
            else
            {
                pax.PaxItPaper = 'N';
            }

            if (chkDraft.Checked == true)
            {
                pax.PaxDraft = 'Y';
            }
            else
            {
                pax.PaxDraft = 'N';
            }

            pax.PaxRemarks = txtPaxRemarks.Text;

            int paxId = paxBal.CreatePax(pax);

            Session["PaxId"] = paxId;
            FillDropDown();
            ScriptManager.RegisterClientScriptBlock(btnPaxEntry, GetType(), "test", "alert('Fill Additional Pax Info!!!')", true);
            divPax.Visible        = false;
            DivAdditional.Visible = true;
        }
Beispiel #24
0
        public static void MapResponseToDB(BookingRes value, string SessionID, string BN)
        {
            try {
                HotelBedEntity      db      = new HotelBedEntity();
                BookingConfirmation booking = new BookingConfirmation();
                booking.cancellationPolicy = value.booking.modificationPolicies.cancellation.ToString();
                booking.clientReference    = value.booking.clientReference;
                booking.CreationData       = value.booking.creationDate;
                booking.CreationUser       = value.booking.creationUser;
                booking.Currency           = value.booking.currency;
                booking.HolderName         = value.booking.holder.name;
                booking.HolderSurName      = value.booking.holder.surname;
                booking.invoiceCompany     = value.booking.invoiceCompany.company;
                booking.invoiceCompanyCode = value.booking.invoiceCompany.code;
                booking.modificationPolicy = value.booking.modificationPolicies.modification.ToString();
                booking.PendingAmount      = value.booking.pendingAmount.ToString();
                booking.Reference          = value.booking.reference;
                booking.RegistrationNumber = value.booking.invoiceCompany.registrationNumber;
                booking.SessionID          = SessionID;
                booking.Status             = value.booking.status;
                booking.supplier           = value.booking.hotel.supplier.name;
                booking.Remark             = value.booking.hotel.supplier.vatNumber;
                booking.totalAmount        = value.booking.totalNet.ToString();
                booking.response           = Newtonsoft.Json.JsonConvert.SerializeObject(value.booking);
                //  var hotel = db.SearchHotelDatas.FirstOrDefault(a => a.SessionID == SessionID);
                booking.BookingNum = BN;
                db.BookingConfirmations.Add(booking);
                db.SaveChanges();
                foreach (var item in value.booking.hotel.rooms)
                {
                    foreach (var rate in item.rates)
                    {
                        BookingRoom searchRoom = new BookingRoom();
                        searchRoom.Adult        = rate.adults;
                        searchRoom.rateComments = rate.rateComments;
                        searchRoom.boardCode    = rate.boardCode;
                        searchRoom.boardName    = rate.boardName;
                        searchRoom.Child        = rate.children;

                        searchRoom.hotelMandatory = rate.hotelMandatory.ToString();
                        searchRoom.Net            = rate.net;
                        searchRoom.packaging      = rate.packaging.ToString();
                        searchRoom.paymentType    = rate.paymentType;
                        searchRoom.rateClass      = rate.rateClass;

                        searchRoom.rooms = rate.rooms;

                        searchRoom.code        = item.code;
                        searchRoom.Name        = item.name;
                        searchRoom.rooms       = rate.rooms;
                        searchRoom.BookingID   = booking.ID;
                        searchRoom.SearchId    = SessionID;
                        searchRoom.sellingRate = rate.sellingRate;
                        db.BookingRooms.Add(searchRoom);
                        db.SaveChanges();
                        foreach (var P in item.paxes)
                        {
                            Pax pa = new Pax();
                            pa.Name    = P.name;
                            pa.RoomID  = searchRoom.ID;
                            pa.SurName = P.surname;
                            pa.type    = P.type;
                            db.Paxes.Add(pa);
                        }
                        foreach (var policy in rate.cancellationPolicies)
                        {
                            PolicyBooking policyBooking = new PolicyBooking();
                            policyBooking.Amount        = policy.amount;
                            policyBooking.BookingRoomID = searchRoom.ID;
                            policyBooking.FromDate      = policy.from.ToString();
                            db.PolicyBookings.Add(policyBooking);
                        }
                        db.SaveChanges();
                    }
                }
            }
            catch (Exception ex)
            {
                var requestData = JsonConvert.SerializeObject(ex);

                LoggingHelper.WriteToFile("HBLogs/BookingException", "BookingException_" + SessionID, "BookingException", requestData);

                throw (ex);
            }
        }