Exemple #1
0
        public AvailabilityRS Get(string searchid, string hcode, string checkin, string checkout, string gc, string CurrencyCode, string b2c_idn)
        {
            ManageHDetAj   mhd = new ManageHDetAj();
            AvailabilityRS hpr = mhd.GetData(searchid, hcode, CurrencyCode, b2c_idn);

            return(hpr);
        }
        public AvailabilityRS Get(string searchid, string hcode, string rooms, string checkin, string checkout, string adult, string children, string childrenage, string gc, string CurrencyCode, string b2c_idn)
        {
            ManageHDetAj mhd = new ManageHDetAj();
            //string hpr = GetDataroom(searchid, hcode, CurrencyCode, b2c_idn);
            AvailabilityRS hpr = mhd.GetDataChangedate(searchid, hcode, rooms, checkin, checkout, adult, children, childrenage, gc, CurrencyCode, b2c_idn);

            return(hpr);
        }
Exemple #3
0
    public AvailabilityRS GetDataChangedate(string SearchID, string hotelcode, string rooms, string checkin, string checkout, string adult, string children, string childrenage, string gc, string CurrencyCode, string b2c_idn)
    {
        //HotelPropertyAj hpr = null;

        AvailabilityRS objAvailabilityRS = new AvailabilityRS();

        //string filePathContext = Path.Combine(HttpRuntime.AppDomainAppPath, "HotelXML/" + SearchID + "_ContextChange-RS.xml");
        //if (File.Exists(filePathContext))
        //{
        //    ContextResult = File.ReadAllText(filePathContext);
        //}
        //else
        //{
        //    ContextResult = XMLRead.ContextChange(searchid);
        //}


        try
        {
            searchid    = SearchID;
            objfavicons = new ClsFevicons();
            CultureInfo cultureInfo = Thread.CurrentThread.CurrentCulture;
            TextInfo = cultureInfo.TextInfo;
            //string filePathRQ = Path.Combine(HttpRuntime.AppDomainAppPath, "HotelXML/" + searchid + "_propertydesc_" + hotelcode + "_" + CurrencyCode + "-RS.xml");
            string          filePathRQ = Path.Combine(HttpRuntime.AppDomainAppPath, "HotelXML/" + searchid + "_propertydesc_" + hotelcode + "_" + CurrencyCode + "_hotelsAvail-RS.xml");
            XmlDataDocument xmldoc     = new XmlDataDocument();
            if (File.Exists(filePathRQ))
            {
                FileStream fs = new FileStream(filePathRQ, FileMode.Open, FileAccess.Read);
                xmldoc.Load(fs);
                fs.Close();
                XmlNode       xnod         = xmldoc.DocumentElement;
                XmlSerializer deserializer = new XmlSerializer(typeof(AvailabilityRS));
                StreamReader  reader       = new StreamReader(filePathRQ);
                objAvailabilityRS = (AvailabilityRS)deserializer.Deserialize(reader);
            }
            else
            {
                DataTable    dssearch = HotelDBLayer.GetSearch(searchid);
                HPDCondition Hapc     = GetCondition(searchid, hotelcode, CurrencyCode);
                result     = gethdata(Hapc, ContextResult, searchid, CurrencyCode, b2c_idn);
                filePathRQ = Path.Combine(HttpRuntime.AppDomainAppPath, "HotelXML/" + searchid + "_propertydesc_" + hotelcode + "_" + CurrencyCode + "_hotelsAvail-RS.xml");
                FileStream fs = new FileStream(filePathRQ, FileMode.Open, FileAccess.Read);
                xmldoc.Load(fs);
                fs.Close();
                XmlNode       xnod         = xmldoc.DocumentElement;
                XmlSerializer deserializer = new XmlSerializer(typeof(AvailabilityRS));
                StreamReader  reader       = new StreamReader(filePathRQ);
                objAvailabilityRS = (AvailabilityRS)deserializer.Deserialize(reader);
                if (!File.Exists(filePathRQ))
                {
                    File.WriteAllText(filePathRQ, objAvailabilityRS.Xmlns);
                }
            }
        }
        catch { }
        return(objAvailabilityRS);
    }
Exemple #4
0
        public List <Hotel> Search(BedBankSearchDto searchCriteria)
        {
            HotelApiClient client = new HotelApiClient();
            StatusRS       status = client.status();

            List <Hotel> hotels = new List <Hotel>();

            if (status != null && status.error == null)
            {
                //List<Tuple<string, string>> param;

                Availability avail = new Availability();
                avail.checkIn  = searchCriteria.StartDate;
                avail.checkOut = searchCriteria.EndDate;
                if (searchCriteria.Address != null && searchCriteria.Address != string.Empty)
                {
                    avail.destination = searchCriteria.Address;
                }
                avail.zone      = 90;
                avail.language  = "CAS";
                avail.shiftDays = 2;
                AvailRoom room = new AvailRoom();
                room.adults   = Convert.ToInt32(searchCriteria.TotalGuest);
                room.children = 0;
                room.details  = new List <RoomDetail>();
                room.adultOf(30);
                room.adultOf(30);
                avail.rooms.Add(room);
                room          = new AvailRoom();
                room.adults   = 2;
                room.children = 0;
                room.details  = new List <RoomDetail>();
                room.adultOf(30);
                room.adultOf(30);
                avail.rooms.Add(room);
                //AT_WEB = 0,
                //AT_HOTEL = 1,
                //INDIFFERENT = 2
                avail.payed = Availability.Pay.AT_WEB;
                AvailabilityRQ availabilityRQ = avail.toAvailabilityRQ();
                if (availabilityRQ != null)
                {
                    AvailabilityRS responseAvail = client.doAvailability(availabilityRQ);

                    if (responseAvail != null && responseAvail.hotels != null && responseAvail.hotels.hotels != null && responseAvail.hotels.hotels.Count > 0)
                    {
                        int hotelsAvailable = responseAvail.hotels.hotels.Count;
                        hotels = responseAvail.hotels.hotels;
                        //var abc = JsonConvert.SerializeObject(responseAvail, Formatting.Indented, new JsonSerializerSettings() { DefaultValueHandling = DefaultValueHandling.Ignore });
                    }
                }
            }
            return(hotels);
        }
Exemple #5
0
 /// <summary>
 ///
 /// </summary>
 /// <param name="request"></param>
 /// <returns></returns>
 public AvailabilityRS doAvailability(AvailabilityRQ request)
 {
     try
     {
         HotelApiPaths.AVAILABILITY avail    = new HotelApiPaths.AVAILABILITY();
         AvailabilityRS             response = callRemoteApi <AvailabilityRS, AvailabilityRQ>(request, avail, null, this.version);
         return(response);
     } catch (HotelSDKException e)
     {
         throw e;
     }
 }
        private HotelAvailabilityProviderRes ConvertToProviderResponse(AvailabilityRS request)
        {
            Logger.Instance.LogFunctionEntry(this.GetType().Name, "ConvertToProviderResponse");
            HotelAvailabilityProviderRes hotelResultRS = new HotelAvailabilityProviderRes();

            //if (request.hotels != null)
            //    hotelResultRS.Hotels = request.hotels.hotels;
            //else
            //    hotelResultRS.Hotels = null;
            //Logger.Instance.LogFunctionExit(this.GetType().Name, "ConvertToProviderResponse");
            return(hotelResultRS);
        }
        public static string GetDataroom(string SearchID, string hotelcode, string CurrencyCode, string b2c_idn)
        {
            string         filePathRQ        = string.Empty;
            AvailabilityRS objAvailabilityRS = new AvailabilityRS();
            ManageHDetAj   objManageHDetAj   = new ManageHDetAj();
            string         result            = string.Empty;


            try
            {
                string      searchid = SearchID;
                ClsFevicons objfavicons;
                objfavicons = new ClsFevicons();
                CultureInfo cultureInfo = Thread.CurrentThread.CurrentCulture;
                // TextInfo = cultureInfo.TextInfo;
                //string filePathRQ = Path.Combine(HttpRuntime.AppDomainAppPath, "HotelXML/" + searchid + "_propertydesc_" + hotelcode + "_" + CurrencyCode + "-RS.xml");
                filePathRQ = Path.Combine(HttpRuntime.AppDomainAppPath, "HotelXML/" + searchid + "_" + CurrencyCode + "_hotelsAvail-RS.xml");
                XmlDataDocument xmldoc = new XmlDataDocument();
                if (File.Exists(filePathRQ))
                {
                    FileStream fs = new FileStream(filePathRQ, FileMode.Open, FileAccess.Read);
                    xmldoc.Load(fs);
                    fs.Close();
                    XmlNode       xnod         = xmldoc.DocumentElement;
                    XmlSerializer deserializer = new XmlSerializer(typeof(AvailabilityRS));
                    StreamReader  reader       = new StreamReader(filePathRQ);
                    result            = File.ReadAllText(filePathRQ);
                    objAvailabilityRS = (AvailabilityRS)deserializer.Deserialize(reader);
                }
                else
                {
                    DataTable    dssearch = HotelDBLayer.GetSearch(searchid);
                    HPDCondition Hapc     = objManageHDetAj.GetCondition(searchid, hotelcode, CurrencyCode);
                    result     = objManageHDetAj.gethdata(Hapc, ContextResult, searchid, CurrencyCode, b2c_idn);
                    filePathRQ = Path.Combine(HttpRuntime.AppDomainAppPath, "HotelXML/" + searchid + "_propertydesc_" + hotelcode + "_" + CurrencyCode + "_hotelsAvail-RS.xml");
                    FileStream fs = new FileStream(filePathRQ, FileMode.Open, FileAccess.Read);
                    xmldoc.Load(fs);
                    fs.Close();
                    XmlNode       xnod         = xmldoc.DocumentElement;
                    XmlSerializer deserializer = new XmlSerializer(typeof(AvailabilityRS));
                    StreamReader  reader       = new StreamReader(filePathRQ);
                    objAvailabilityRS = (AvailabilityRS)deserializer.Deserialize(reader);

                    result = File.ReadAllText(filePathRQ);
                    if (!File.Exists(filePathRQ))
                    {
                        File.WriteAllText(filePathRQ, objAvailabilityRS.Xmlns);
                    }
                }
            }
            catch { }
            return(result);
        }
Exemple #8
0
        public AvailabilityRS GetHotelDetails(AvailabilityRQ request)
        {
            //Logger.Instance.LogFunctionEntry(this.GetType().Name, "GetHotelDetails");
            AvailabilityRS responseHotelDetail = new AvailabilityRS();
            List <Hotel>   hotels        = new List <Hotel>();
            HotelApiClient client        = new HotelApiClient();
            StatusRS       status        = client.status();
            AvailabilityRS responseAvail = null;

            try
            {
                if (status != null && status.error == null)
                {
                    Availability avail = new Availability();
                    avail.checkIn       = Convert.ToDateTime(request.stay.checkIn);
                    avail.checkOut      = Convert.ToDateTime(request.stay.checkOut);
                    avail.includeHotels = new List <int>();
                    foreach (var item in request.hotels.hotel)
                    {
                        avail.includeHotels.Add(item);
                    }
                    AvailRoom room = new AvailRoom();
                    foreach (var occupant in request.occupancies)
                    {
                        room.adults        = Convert.ToInt32(occupant.adults);
                        room.numberOfRooms = Convert.ToInt32(occupant.rooms);
                    }
                    room.details = new List <RoomDetail>();
                    for (int i = 0; i < room.adults; i++)
                    {
                        room.adultOf(30);
                    }

                    avail.rooms.Add(room);
                    AvailabilityRQ availabilityRQ = avail.toAvailabilityRQ();
                    if (availabilityRQ == null)
                    {
                        throw new Exception("Availability RQ can't be null", new ArgumentNullException());
                    }
                    responseAvail = client.doAvailability(availabilityRQ);
                    return(responseAvail);
                }
            }
            catch (Exception)
            {
                throw;
            }

            //Logger.Instance.LogFunctionExit(this.GetType().Name, "GetHotelDetails");
            return(responseHotelDetail);
        }
Exemple #9
0
        public string Get(string searchid, string city, string checkind, string checkoutd, string guestscount, string selroom, string selaudults, string selchilds, string sortby, string pageno, string starfilter, string amenities, string Hotelname, string Hotelchain, string lprice, string hprice, string curcode, string b2c_idn)
        {
            AvailabilityRS objAvailabilityRS = new AvailabilityRS();

            vcity    = city;
            vpageno  = Convert.ToInt16(pageno);
            vcurcode = curcode;
            string rvalue = "";
            // string HLFPath = Path.Combine(HttpRuntime.AppDomainAppPath, "HotelAvail/" + searchid + "_" + vcurcode + "_HotelList.xml");
            // string HLFPath = Path.Combine(HttpRuntime.AppDomainAppPath, "HotelAvail/" + b2c_idn + "_" + searchid + "_" + curcode + "_HotelList.xml");
            string  HLFPath = Path.Combine(HttpRuntime.AppDomainAppPath, "HotelXML/" + searchid + "_" + curcode + "_hotelsAvail-RS.xml"); //HotelXML/" + searchid + "_" + curcode + "_hotelsAvail-RS.xml
            DataSet dsHL    = new DataSet();

            if (File.Exists(HLFPath))
            {
                XmlDataDocument xmldoc = new XmlDataDocument();
                FileStream      fs     = new FileStream(HLFPath, FileMode.Open, FileAccess.Read);
                xmldoc.Load(fs);
                fs.Close();
                XmlNode xnod = xmldoc.DocumentElement;
                //HotelListGenerate.CreateTables(dtBPIadd);
                //HotelListGenerate.FillHStable(xnod, dtBPIadd);
                XmlSerializer deserializer = new XmlSerializer(typeof(AvailabilityRS));
                StreamReader  reader       = new StreamReader(HLFPath);
                objAvailabilityRS = (AvailabilityRS)deserializer.Deserialize(reader);
                string pricerangecond = HotelListGenerate.GetPricrangecondzero();
                //AvailabilityRS dtPricingzero = HotelListGenerate.FilterTable(objAvailabilityRS, pricerangecond);
                int totalhotels = 0;
                if (objAvailabilityRS.Hotels.Hotel.Count >= 350)
                {
                    totalhotels = 350;
                }
                else
                {
                    totalhotels = objAvailabilityRS.Hotels.Hotel.Count;
                }


                vtotpages = Convert.ToInt16(Math.Ceiling(Convert.ToDecimal(totalhotels) / 20));

                AvailabilityRS dtFilterHotels = HotelListGenerate.GetFilteredDataList(objAvailabilityRS, Hotelname, Hotelchain, sortby, starfilter, amenities, lprice, hprice);
                //DataTable dtSortedHotels = HotelListGenerate.GetSortedData(dtFilterHotels, sortby);
                rvalue += GetHotellistPG(dtFilterHotels, searchid, checkind, checkoutd, guestscount, selaudults, selchilds, sortby, totalhotels, curcode, b2c_idn);
            }
            else
            {
            }
            return(rvalue);
        }
Exemple #10
0
        private HotelAvailabilityProviderRes ConvertToProviderResponse(AvailabilityRS request)
        {
            HotelAvailabilityProviderRes hotelResultRS = new HotelAvailabilityProviderRes();

            var hotels = new List <HotelSearchResultItem>();

            if (request?.hotels?.hotels != null && request.hotels.hotels.Any())
            {
                foreach (var htl in request.hotels.hotels)
                {
                    var searchResult = new HotelSearchResultItem()
                    {
                        HotelInfo = new HotelInfo()
                        {
                            HotelName           = htl.name,
                            HotelCode           = htl.code.ToString(),
                            Description         = htl.zoneCode + ", " + htl.zoneName,
                            Rating              = Convert.ToInt16(htl.categoryName.Split(HotelBedsConstants.SpaceSeperator)[0]),
                            PropertyInformation = new HotelPropertyDetail()
                            {
                                Latitude  = Convert.ToDecimal(htl.latitude),
                                Longitude = Convert.ToDecimal(htl.longitude)
                            },
                        },
                        Price = new TE.DataAccessLayer.Models.TMoney()
                        {
                            Amount   = htl.minRate,
                            Currency = new TE.DataAccessLayer.Models.TCurrency()
                            {
                                CurrencyCode = htl.currency
                            }
                        }
                    };
                    hotels.Add(searchResult);
                }
                hotelResultRS.Hotels = hotels;
            }
            else
            {
                hotelResultRS.Hotels = null;
            }

            return(hotelResultRS);
        }
Exemple #11
0
        public AvailabilityRS GetAvailability <TReq, TRes>(AvailabilityRQ request)
        {
            //Logger.Instance.LogFunctionEntry(this.GetType().Name, "GetAvailability");
            List <Hotel>   hotels        = new List <Hotel>();
            HotelApiClient client        = new HotelApiClient();
            StatusRS       status        = client.status();
            AvailabilityRS responseAvail = null;

            try
            {
                //if (status?.error != null)
                if (status != null && status.error == null)
                {
                    responseAvail = client.doAvailability(request);
                }
            }
            catch (Exception)
            {
                throw;
            }

            //Logger.Instance.LogFunctionExit(this.GetType().Name, "GetAvailability");
            return(responseAvail);
        }
Exemple #12
0
        static void Main(string[] args)
        {
            try
            {
                HotelApiClient client = new HotelApiClient();
                StatusRS       status = client.status();

                if (status != null && status.error == null)
                {
                    Console.WriteLine("StatusRS: " + status.status);
                }
                else if (status != null && status.error != null)
                {
                    Console.WriteLine("StatusRS: " + status.status + " " + status.error.code + ": " + status.error.message);
                    return;
                }
                else if (status == null)
                {
                    Console.WriteLine("StatusRS: Is not available.");
                    return;
                }

                List <Tuple <string, string> > param;


                Availability avail = new Availability();
                avail.checkIn     = DateTime.Now.AddDays(10);
                avail.checkOut    = DateTime.Now.AddDays(13);
                avail.destination = "PMI";
                avail.zone        = 90;
                avail.language    = "CAS";
                avail.shiftDays   = 2;
                AvailRoom room = new AvailRoom();
                room.adults   = 1;
                room.children = 1;
                room.details  = new List <RoomDetail>();
                room.adultOf(30);
                room.childOf(4);
                room.numberOfRooms = 1;
                avail.rooms.Add(room);
                room          = new AvailRoom();
                room.adults   = 2;
                room.children = 0;
                room.details  = new List <RoomDetail>();
                room.adultOf(30);
                room.adultOf(30);
                room.numberOfRooms = 2;
                avail.rooms.Add(room);
                avail.payed = Availability.Pay.AT_WEB;
                //avail.ofTypes = new HashSet<hotel_api_model.auto.common.SimpleTypes.AccommodationType>();
                //avail.ofTypes.Add(hotel_api_model.auto.common.SimpleTypes.AccommodationType.HOTEL);
                //avail.ofTypes.Add(hotel_api_model.auto.common.SimpleTypes.AccommodationType.APARTMENT);

                //avail.minCategory = 4;
                //avail.limitHotelsTo = 10;
                //avail.numberOfTripAdvisorReviewsHigherThan = 2;
                //avail.tripAdvisorScoreHigherThan = 2

                //avail.matchingKeywords = new HashSet<int>();
                //avail.matchingKeywords.Add(34);
                //avail.matchingKeywords.Add(81);
                //avail.keywordsMatcher = Availability.Matcher.ALL;

                //avail.includeHotels = new List<int>();
                //avail.includeHotels.Add(111637);
                //avail.includeHotels.Add(2818);
                //avail.includeHotels.Add(138465);
                //avail.includeHotels.Add(164471);

                //avail.excludeHotels = new List<int>();
                //avail.excludeHotels.Add(187013);
                //avail.excludeHotels.Add(188330);

                //avail.useGiataCodes = false;
                //avail.limitHotelsTo = 250;
                //avail.limitRoomsPerHotelTo = 5;
                //avail.limitRatesPerRoomTo = 5;
                //avail.ratesHigherThan = 50;
                //avail.ratesLowerThan = 350;

                //avail.hbScoreHigherThan = 3;
                //avail.hbScoreLowerThan = 5;
                //avail.numberOfHBReviewsHigherThan = 50;

                //avail.tripAdvisorScoreHigherThan = 1;
                //avail.tripAdvisorScoreLowerThan = 4;
                //avail.numberOfHBReviewsHigherThan = 50;

                //avail.withinThis = new Availability.Circle() { latitude = 2.646633999999949, longitude = 39.57119, radiusInKilometers = 50 };
                //avail.withinThis = new Availability.Square() { northEastLatitude = 45.37680856570233, northEastLongitude = -2.021484375, southWestLatitude = 38.548165423046584, southWestLongitude = 8.658203125 };

                //avail.includeBoards = new List<string>();
                //avail.includeBoards.Add("R0-E10");
                //avail.includeBoards.Add("BB-E10");
                //avail.excludeBoards = new List<string>();
                //avail.excludeBoards.Add("RO");

                //avail.includeRoomCodes = new List<string>();
                //avail.includeRoomCodes.Add("DBL.ST");
                //avail.includeRoomCodes.Add("DBL.SU");
                ////avail.includeRoomCodes.AddRange(new string[]{ "DBL.ST", "DBL.SU" });
                //avail.excludeRoomCodes = new List<string>();
                //avail.excludeRoomCodes.Add("TPL.ST");

                AvailabilityRQ availabilityRQ = avail.toAvailabilityRQ();
                if (availabilityRQ == null)
                {
                    throw new Exception("Availability RQ can't be null", new ArgumentNullException());
                }

                Console.WriteLine("Availability Request:");
                Console.WriteLine(JsonConvert.SerializeObject(availabilityRQ, Formatting.Indented, new JsonSerializerSettings()
                {
                    DefaultValueHandling = DefaultValueHandling.Ignore
                }));

                AvailabilityRS responseAvail = client.doAvailability(availabilityRQ);

                if (responseAvail != null && responseAvail.hotels != null && responseAvail.hotels.hotels != null && responseAvail.hotels.hotels.Count > 0)
                {
                    Console.WriteLine(string.Format("Availability answered with {0} hotels!", responseAvail.hotels.hotels.Count));
                    Console.WriteLine(JsonConvert.SerializeObject(responseAvail, Formatting.Indented, new JsonSerializerSettings()
                    {
                        DefaultValueHandling = DefaultValueHandling.Ignore
                    }));

                    //  ***********************************
                    //  Try to check reservation with rate
                    //  ***********************************

                    Hotel  firstHotel = responseAvail.hotels.hotels.First();
                    string rateKey    = string.Empty;

                    for (int r = 0; r < firstHotel.rooms.Count && String.IsNullOrEmpty(rateKey); r++)
                    {
                        for (int rk = 0; firstHotel.rooms[r].rates != null && rk < firstHotel.rooms[r].rates.Count && String.IsNullOrEmpty(rateKey); rk++)
                        {
                            rateKey = firstHotel.rooms[r].rates[rk].rateKey;
                        }
                    }

                    if (String.IsNullOrEmpty(rateKey))
                    {
                        Console.WriteLine("No hotel available");
                        return;
                    }

                    Console.WriteLine("Checking reservation with rate " + rateKey);

                    ConfirmRoom confirmRoom = new ConfirmRoom();
                    confirmRoom.details = new List <RoomDetail>();
                    confirmRoom.detailed(RoomDetail.GuestType.ADULT, 30, "NombrePasajero1", "ApellidoPasajero1", 1);
                    confirmRoom.detailed(RoomDetail.GuestType.ADULT, 30, "NombrePasajero2", "ApellidoPasajero2", 1);

                    BookingCheck bookingCheck = new BookingCheck();
                    bookingCheck.addRoom(rateKey, confirmRoom);
                    CheckRateRQ checkRateRQ = bookingCheck.toCheckRateRQ();

                    if (checkRateRQ != null)
                    {
                        CheckRateRS responseRate = client.doCheck(checkRateRQ);
                        if (responseRate != null && responseRate.error == null)
                        {
                            Console.WriteLine("CheckRate Response:");
                            Console.WriteLine(JsonConvert.SerializeObject(responseRate, Formatting.Indented, new JsonSerializerSettings()
                            {
                                DefaultValueHandling = DefaultValueHandling.Ignore
                            }));

                            com.hotelbeds.distribution.hotel_api_sdk.helpers.Booking booking = new com.hotelbeds.distribution.hotel_api_sdk.helpers.Booking();
                            booking.createHolder("Rosetta", "Pruebas");
                            booking.clientReference = "SDK Test";
                            booking.remark          = "***SDK***TESTING";

                            //NOTE: ONLY LIBERATE (PAY AT HOTEL MODEL) USES PAYMENT DATA NODES. FOR OTHER PRICING MODELS THESE NODES MUST NOT BE USED.
                            booking.cardType       = "VI";
                            booking.cardNumber     = "4444333322221111";
                            booking.expiryDate     = "0620";
                            booking.cardCVC        = "0620";
                            booking.email          = "*****@*****.**";
                            booking.phoneNumber    = "654654654";
                            booking.cardHolderName = "AUTHORISED";

                            booking.addRoom(rateKey, confirmRoom);
                            BookingRQ bookingRQ = booking.toBookingRQ();
                            if (bookingRQ != null)
                            {
                                BookingRS responseBooking = client.confirm(bookingRQ);
                                Console.WriteLine("Booking Response:");
                                if (responseBooking != null)
                                {
                                    Console.WriteLine(JsonConvert.SerializeObject(responseBooking, Formatting.Indented, new JsonSerializerSettings()
                                    {
                                        DefaultValueHandling = DefaultValueHandling.Ignore
                                    }));
                                }
                                else
                                {
                                    Console.WriteLine("ResponseBooking Object Response is null");
                                }

                                if (responseBooking != null && responseBooking.error == null && responseBooking.booking != null)
                                {
                                    Console.WriteLine("Confirmation succedded. Canceling reservation with id " + responseBooking.booking.reference);
                                    param = new List <Tuple <string, string> >
                                    {
                                        new Tuple <string, string>("${bookingId}", responseBooking.booking.reference),
                                        //new Tuple<string, string>("${bookingId}", "1-3087550"),
                                        new Tuple <string, string>("${flag}", "C")
                                    };


                                    BookingCancellationRS bookingCancellationRS = client.Cancel(param);

                                    if (bookingCancellationRS != null)
                                    {
                                        Console.WriteLine("Id cancelled: " + responseBooking.booking.reference);
                                        Console.WriteLine(JsonConvert.SerializeObject(bookingCancellationRS, Formatting.Indented, new JsonSerializerSettings()
                                        {
                                            DefaultValueHandling = DefaultValueHandling.Ignore
                                        }));
                                        Console.ReadLine();

                                        Console.WriteLine("Getting detail after cancelation of id " + responseBooking.booking.reference);
                                        param = new List <Tuple <string, string> >
                                        {
                                            new Tuple <string, string>("${bookingId}", responseBooking.booking.reference)
                                        };
                                        BookingDetailRS bookingDetailRS = client.Detail(param);
                                        if (bookingDetailRS != null)
                                        {
                                            Console.WriteLine(JsonConvert.SerializeObject(bookingDetailRS, Formatting.Indented, new JsonSerializerSettings()
                                            {
                                                DefaultValueHandling = DefaultValueHandling.Ignore
                                            }));
                                        }
                                    }
                                }
                            }
                        }
                        else
                        {
                            Console.WriteLine("No hotel available");
                        }
                    }
                }
                else
                {
                    Console.WriteLine("No availability!");
                }

                Console.WriteLine("Requesting booking list...");

                param = new List <Tuple <string, string> >
                {
                    new Tuple <string, string>("${start}", DateTime.Now.AddDays(-30).ToString("yyyy-MM-dd")),
                    new Tuple <string, string>("${end}", DateTime.Now.ToString("yyyy-MM-dd")),
                    new Tuple <string, string>("${includeCancelled}", "true"),
                    new Tuple <string, string>("${filterType}", "CREATION"),
                    new Tuple <string, string>("${from}", "1"),
                    new Tuple <string, string>("${to}", "25"),
                };

                BookingListRS bookingListRS = client.List(param);
                if (bookingListRS != null)
                {
                    Console.WriteLine(JsonConvert.SerializeObject(bookingListRS, Formatting.Indented, new JsonSerializerSettings()
                    {
                        DefaultValueHandling = DefaultValueHandling.Ignore
                    }));
                    foreach (com.hotelbeds.distribution.hotel_api_model.auto.model.Booking booking in bookingListRS.bookings.bookings)
                    {
                        param = new List <Tuple <string, string> >
                        {
                            new Tuple <string, string>("${bookingId}", booking.reference)
                        };
                        BookingDetailRS bookingDetailRS = client.Detail(param);
                        if (bookingDetailRS != null)
                        {
                            Console.WriteLine(JsonConvert.SerializeObject(bookingDetailRS, Formatting.Indented, new JsonSerializerSettings()
                            {
                                DefaultValueHandling = DefaultValueHandling.Ignore
                            }));
                        }
                    }
                }
            }
            catch (Exception e)
            {
                Console.WriteLine("Error: " + e.Message + " " + e.StackTrace);
            }
            Console.ReadLine();
        }
Exemple #13
0
        public checkresult Get(string searchid, string hcode, string ratekey, string b2c_idn)
        {
            double admarkup     = 0.00;
            double adroommarkup = 0.00;

            double adpercmarkup  = 0.00;
            double clpercmarkup  = 0.00;
            double adperdiscount = 0.00;
            double clperdiscount = 0.00;
            double clmarkup      = 0.00;
            double finalmarkup   = 0.00;
            double finaldiscount = 0.00;
            double addiscount    = 0.00;
            double cldiscount    = 0.00;
            double baseamount    = 0.00;

            double roombaseamount       = 0.00;
            double roomamountwithouttax = 0.00;
            double roomamountwithtax    = 0.00;

            double           adroompercmarkup  = 0.00;
            double           clroompercmarkup  = 0.00;
            double           adroomperdiscount = 0.00;
            double           clroomperdiscount = 0.00;
            double           clroommarkup      = 0.00;
            double           finalroommarkup   = 0.00;
            double           finalroomdiscount = 0.00;
            double           adroomdiscount    = 0.00;
            double           clroomdiscount    = 0.00;
            double           rrate;
            double           roomtaxprice                  = 0.00;
            double           eachroomavgtaxprice           = 0.00;
            double           roomcancellationprice         = 0.00;
            double           troomspricepernightwithmarkup = 0.00;
            double           eachroomspernihgtpricewmrk    = 0.00;
            string           ratetable         = string.Empty;
            double           allroomsprice     = 0.00;
            string           filePathRQ        = string.Empty;
            ManageHDetAj     mhd               = new ManageHDetAj();
            string           Result            = string.Empty;
            AvailabilityRS   objAvailabilityRS = new AvailabilityRS();
            CheckRateRS      objCheckRateRS    = new CheckRateRS();
            List <upselling> lstupselling      = new List <upselling>();
            Rooms            objRooms          = new Rooms();
            Room             objupsellingRoom  = new Room();
            checkresult      objchkres         = new checkresult();

            DataTable dssearch = HotelDBLayer.GetSearch(searchid);
            int       rooms    = Convert.ToInt32(dssearch.Rows[0]["Rooms"]);

            checkrates(searchid, hcode, ratekey, b2c_idn);
            string[] ratekeys      = ratekey.Split(',');
            string   ratekey_split = ratekeys[0].Substring(ratekeys[0].Length - 4);

            try
            {
                ClsFevicons objfavicons;
                objfavicons = new ClsFevicons();
                CultureInfo cultureInfo = Thread.CurrentThread.CurrentCulture;
                // TextInfo = cultureInfo.TextInfo;
                //string filePathRQ = Path.Combine(HttpRuntime.AppDomainAppPath, "HotelXML/" + searchid + "_propertydesc_" + hotelcode + "_" + CurrencyCode + "-RS.xml");
                filePathRQ = Path.Combine(HttpRuntime.AppDomainAppPath, "Checkrates_tbluexml/" + searchid + "_" + ratekey_split + "_checkrate-RS.xml");

                if (File.Exists(filePathRQ))
                {
                    XmlDataDocument xmldoc = new XmlDataDocument();
                    FileStream      fs     = new FileStream(filePathRQ, FileMode.Open, FileAccess.Read);
                    xmldoc.Load(fs);
                    fs.Close();
                    XmlNode       xnod         = xmldoc.DocumentElement;
                    XmlSerializer deserializer = new XmlSerializer(typeof(CheckRateRS));
                    StreamReader  reader       = new StreamReader(filePathRQ);
                    objCheckRateRS = (CheckRateRS)deserializer.Deserialize(reader);

                    if (objCheckRateRS.Error == null)
                    {
                        double dc = 0.0;
                        try
                        { dc = (Convert.ToDateTime(objCheckRateRS.Hotel.CheckOut.ToString()) - Convert.ToDateTime(objCheckRateRS.Hotel.CheckIn.ToString())).TotalDays; }
                        catch { }
                        string cancleplFrom   = "";
                        string cancleplamount = "";
                        foreach (Room objrooms in objCheckRateRS.Hotel.Rooms.Room)
                        {
                            Rates objrates = new Rates();
                            objrates = objrooms.Rates;
                            List <Rate> lstRate = objrates.Rate;

                            if (lstRate != null && lstRate.Count > 0)
                            {
                                for (int r = 0; r < lstRate.Count; r++)
                                {
                                    // eachroomsprice = Convert.ToDouble(troomsprice / norooms);
                                    rrate = Convert.ToDouble(Convert.ToDouble(Convert.ToDouble(lstRate[r].Net) / dc).ToString("0.00"));

                                    string avgpnignt = Convert.ToDouble(rrate).ToString();

                                    //string avgroompernight = (Convert.ToDouble(avgpnignt) / dc).ToString("0.00");

                                    roombaseamount = Convert.ToDouble(avgpnignt);

                                    DataTable     dtwt     = new DataTable();
                                    SqlConnection sqlconwt = new SqlConnection(con);
                                    try
                                    {
                                        SqlCommand cmd = new SqlCommand();
                                        cmd.Connection  = sqlconwt;
                                        cmd.CommandType = CommandType.StoredProcedure;
                                        cmd.CommandText = "p_SreTS_HDR";
                                        cmd.Parameters.AddWithValue("@B2C_IDN", b2c_idn);
                                        cmd.Parameters.AddWithValue("@Hotelcode", hcode);
                                        cmd.Parameters.AddWithValue("@GDS", "HB");
                                        cmd.Parameters.AddWithValue("@IsLoginCust", "Y");
                                        SqlDataAdapter sa = new SqlDataAdapter(cmd);
                                        sa.Fill(dtwt);
                                    }
                                    catch
                                    {
                                    }

                                    if (dtwt.Rows.Count > 0)
                                    {
                                        string Ts_mode = string.Empty;
                                        Ts_mode = dtwt.Rows[0]["TS_Mode"].ToString();
                                        if (Ts_mode == "Fixed")
                                        {
                                            adroommarkup   = Convert.ToDouble(dtwt.Rows[0]["TS_Markup"].ToString());
                                            adroomdiscount = Convert.ToDouble(dtwt.Rows[0]["TS_Discount"].ToString());
                                        }
                                        else if (Ts_mode == "Percentage")
                                        {
                                            adroompercmarkup = Convert.ToDouble(dtwt.Rows[0]["TS_Markup"].ToString());
                                            adroommarkup     = ((roombaseamount / 100.00) * adroompercmarkup);

                                            adroomperdiscount = Convert.ToDouble(dtwt.Rows[0]["TS_Discount"].ToString());
                                            adroomdiscount    = (((roombaseamount) / 100.00) * adroomperdiscount);
                                        }
                                        else
                                        {
                                            adroommarkup   = 0.00;
                                            adroomdiscount = 0.00;
                                        }


                                        string Cl_Mode = string.Empty;
                                        Cl_Mode = dtwt.Rows[0]["Cl_Mode"].ToString();
                                        if (Cl_Mode == "Fixed")
                                        {
                                            clmarkup   = Convert.ToDouble(dtwt.Rows[0]["Cl_Markup"].ToString());
                                            cldiscount = Convert.ToDouble(dtwt.Rows[0]["Cl_Discount"].ToString());
                                        }
                                        else if (Cl_Mode == "Percentage")
                                        {
                                            clroompercmarkup = Convert.ToDouble(dtwt.Rows[0]["Cl_Markup"].ToString());
                                            clroommarkup     = (((roombaseamount) / (100)) * clroompercmarkup);

                                            clroomperdiscount = Convert.ToDouble(dtwt.Rows[0]["Cl_Discount"].ToString());
                                            clroomdiscount    = ((roombaseamount / 100.00) * clroomperdiscount);
                                        }
                                        else
                                        {
                                            clmarkup = 0.00;
                                        }

                                        finalroommarkup      = adroommarkup + clroommarkup;
                                        finalroomdiscount    = adroomdiscount + clroomdiscount;
                                        roombaseamount       = roombaseamount + (finalroommarkup - finalroomdiscount);
                                        roomamountwithouttax = (Convert.ToDouble(roombaseamount));
                                        // roombaseamount = (Convert.ToDouble(roomamountwithouttax) + Convert.ToDouble(tax));
                                        troomspricepernightwithmarkup = troomspricepernightwithmarkup + (Convert.ToDouble(roomamountwithouttax));
                                        allroomsprice = allroomsprice + Convert.ToDouble(lstRate[r].Net);
                                    }



                                    if (lstRate[r].Taxes != null && lstRate[r].Taxes.Tax.Amount != null)
                                    {
                                        roomtaxprice = roomtaxprice + Convert.ToDouble(lstRate[r].Taxes.Tax.Amount.ToString());
                                    }

                                    try
                                    {
                                        if (lstRate[r].CancellationPolicies != null && lstRate[r].CancellationPolicies.CancellationPolicy.Amount != null)
                                        {
                                            roomcancellationprice = roomcancellationprice + Convert.ToDouble(lstRate[r].CancellationPolicies.CancellationPolicy.Amount.ToString());
                                        }
                                    }
                                    catch
                                    {
                                        //cancleplamount = "NO Cancellation amount";
                                    }
                                }
                                eachroomspernihgtpricewmrk = (troomspricepernightwithmarkup / rooms);
                                eachroomavgtaxprice        = Convert.ToDouble(roomtaxprice / rooms);
                                //lstRate.Add(dr.Rates.Rate.Where(n => n.BoardCode == boardCode && (n.ChildrenAges.Contains(',') ? n.ChildrenAges.Split(',')[0].ToString() : n.ChildrenAges) == (childAges.Contains(',') ? childAges.Split(',')[0].ToString() : childAges)).FirstOrDefault());


                                //foreach (Rate drrt in lstRate)
                                //{
                                //var roomamt = rooms[i].Room[i].Rates.Rate[n].Net;

                                string ratetype = lstRate[0].RateType;


                                string ratecommentid = string.Empty;
                                try
                                {
                                    ratecommentid = lstRate[0].RateCommentsId;
                                }
                                catch
                                {
                                }


                                try
                                {
                                    cancleplFrom = lstRate[0].CancellationPolicies.CancellationPolicy.From.ToString();
                                }
                                catch
                                {
                                }
                                try
                                {
                                    cancleplamount = roomcancellationprice.ToString("0.00");//roomcancellationprice.ToString();
                                }
                                catch
                                {
                                    //cancleplamount = "NO Cancellation amount";
                                }
                                ratetable = GetRateTable(hcode, objCheckRateRS, lstRate, hcode, searchid, "USD", adroommarkup, clroommarkup, adroomdiscount, clroomdiscount, roomtaxprice, b2c_idn, rooms);//HttpUtility.HtmlEncode(
                            }
                        }

                        //objchkres.amount = Convert.ToDouble(Convert.ToDouble(objCheckRateRS.Hotel.Rooms.Room[0].Rates.Rate[0].Net) / dc).ToString("0.00");

                        objchkres.amount           = eachroomspernihgtpricewmrk.ToString("0.00");
                        objchkres.allroomstamount  = allroomsprice.ToString("0.00");
                        objchkres.cancellationamt  = cancleplamount;
                        objchkres.cancellationfrom = cancleplFrom;
                        objchkres.roomdetailstable = ratetable;


                        try
                        {
                            //List<Tax> lsttax = new List<Tax>();
                            //foreach (var lttax in objCheckRateRS.Hotel.Rooms.Room[0].Rates.Rate[0].Taxes.Tax)
                            //{
                            if (objCheckRateRS.Hotel.Rooms.Room[0].Rates.Rate[0].Taxes.Tax.Amount != null)
                            {
                                objchkres.Tax = eachroomavgtaxprice.ToString();//Convert.ToDouble(Convert.ToDouble(objCheckRateRS.Hotel.Rooms.Room[0].Rates.Rate[0].Taxes.Tax.Amount)).ToString("0.00");
                            }
                            else
                            {
                                objchkres.Tax = "0.00";
                            }
                            //}
                        }
                        catch
                        {
                            objchkres.Tax = "0.00";
                        }


                        //HotelListGenerate.CreateTables(dtBPIadd);
                        //HotelListGenerate.FillHStable(xnod, dtBPIadd);//yogi
                    }
                    else
                    {
                        objchkres.Message = "Fare Not Available";
                    }
                }
            }
            catch
            {
                objchkres.Message = "Fare Not Available";
            }
            return(objchkres);
        }
Exemple #14
0
        public static string GetRqcond(string SearchID, string hotelcode, string ratekey, string b2c_idn)
        {
            string         rq                = string.Empty;
            string         filePathRQ        = string.Empty;
            AvailabilityRS objAvailabilityRS = new AvailabilityRS();

            try
            {
                string searchid       = SearchID;
                int    adults         = 0;
                string adultsbyroom   = string.Empty;
                string ChildrenByRoom = string.Empty;
                int    childs         = 0;
                int    Roomsdb        = 0;
                string childages      = string.Empty;

                string    cmdtxtrkey = "select * from HotelSearch where Searchidn=" + searchid + "";
                DataTable dtsres     = manage_data.GetDataTable(cmdtxtrkey, manage_data.con);
                if (dtsres.Rows.Count > 0)
                {
                    Roomsdb        = Convert.ToInt32(dtsres.Rows[0]["Rooms"].ToString());
                    adults         = Convert.ToInt32(dtsres.Rows[0]["Adults"].ToString());
                    adultsbyroom   = dtsres.Rows[0]["HB_AdultsByRoom"].ToString();
                    childs         = Convert.ToInt32(dtsres.Rows[0]["Children"].ToString());
                    ChildrenByRoom = dtsres.Rows[0]["HB_ChildrenByRoom"].ToString();
                    childages      = dtsres.Rows[0]["HB_ChildAge"].ToString();
                    //room1-child1-childAge1_4,room1-child2-childAge2_6,room2-child1-childAge1_7

                    //ratekey = "20190322|20190323|W|235|425919|DBL.ST|FIT1|RO||1~1~2|4~6|N@440CE2A9A5234A11546798860704AAUK0000031001500020924da2";
                    //20190222|20190223|W|235|168947|DBL.2Q-NM|ID_B2B_26|RO|SF2|1~2~1|5~8|N@665957DF25404AE1546686230830AAUK000000100010001052601b6
                }

                ClsFevicons objfavicons;
                objfavicons = new ClsFevicons();
                CultureInfo cultureInfo = Thread.CurrentThread.CurrentCulture;
                //filePathRQ = Path.Combine(HttpRuntime.AppDomainAppPath, "checkratexml/" + searchid + "_" + CurrencyCode + "_hotelschkrate-RS.xml");

                rq += "<checkRateRQ xmlns='http://www.hotelbeds.com/schemas/messages' xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance' upselling='False' language='ENG'>";

                //int rc = 0;
                //int cco = 0;
                //int adco = 0;
                //string[] ratekey_split = ratekeys.Split('|');
                //string[] chags_split = childages.Split(',');
                //string[] childbyroom_split = ChildrenByRoom.Split('_');
                //string[] adtbyroom_split = adultsbyroom.Split('_');
                //int chagc = 0;


                rq += "<rooms>";
                //for (int i = 0; i < Roomsdb; i++)
                //{
                //int adts = Convert.ToInt32(adtbyroom_split[i+1].Split('-')[1]);
                //int chds = Convert.ToInt32(childbyroom_split[i + 1].Split('-')[1]);
                //if (i == 0)
                //{
                //    rq += "<room rateKey='" + ratekey + "'/>";
                //    chagc = chds;
                //}
                //else
                //{
                //    string ratekey_new = "";
                //    //string[] roominfo = null;

                //    //if (chds > 0)
                //    //{

                //    //    roominfo = chags_split[i].Split('_');
                //    //}

                //    string roomcont = "1~" + adts + "~" + chds;
                //    string agscont = "";
                //    for (int a = 0; a < chds; a++)
                //    {

                //        agscont += chags_split[chagc].Split('_')[1] + "~";
                //        chagc++;
                //    }
                //    if (chds > 0)
                //    {
                //        ratekey_split[10] = agscont.Remove(agscont.Length - 1);
                //        ratekey_split[9] = roomcont;
                //        for (int r = 0; r <= 11; r++)
                //        {
                //            ratekey_new += ratekey_split[r] + "|";
                //        }

                //        rq += "<room rateKey='" + ratekey_new.Remove(ratekey_new.Length - 1) + "'/>";
                //    }
                //    else
                //    {
                //        ratekey_split[10] = "";
                //        ratekey_split[9] = roomcont;
                //        for (int r = 0; r <= 11; r++)
                //        {
                //            ratekey_new += ratekey_split[r] + "|";
                //        }

                //        rq += "<room rateKey='" + ratekey_new.Remove(ratekey_new.Length - 1) + "'/>";
                //    }
                //}
                foreach (string ratek in ratekey.Split(','))
                {
                    if (ratek != null && ratek != "")
                    {
                        rq += "<room rateKey='" + ratek + "'/>";
                    }
                }

                // }
                rq += "</rooms>";
                rq += "</checkRateRQ>";
            }
            catch
            {
            }
            return(rq);
        }
Exemple #15
0
        public HotelRateMaxMin Get(string searchid, string curcode, string b2c_idn)
        {
            hrmm.Max = "0";
            hrmm.Min = "0";
            double minrate         = 0.00;
            double maxrate         = 0.00;
            string minratepernight = string.Empty;
            string maxratepernight = string.Empty;
            string checkin         = string.Empty;
            string checkout        = string.Empty;
            double dc = 0.0;



            double admarkup      = 0.00;
            double adpercmarkup  = 0.00;
            double clpercmarkup  = 0.00;
            double clmarkup      = 0.00;
            double finalmarkup   = 0.00;
            double finaldiscount = 0.00;
            double addiscount    = 0.00;
            double adperdiscount = 0.00;
            double cldiscount    = 0.00;
            double clperdiscount = 0.00;
            double minbaseamount = 0.00;
            double maxbaseamount = 0.00;


            double maxadmarkup      = 0.00;
            double maxadpercmarkup  = 0.00;
            double maxclpercmarkup  = 0.00;
            double maxclmarkup      = 0.00;
            double maxfinalmarkup   = 0.00;
            double maxfinaldiscount = 0.00;
            double maxaddiscount    = 0.00;
            double maxadperdiscount = 0.00;
            double maxcldiscount    = 0.00;
            double maxclperdiscount = 0.00;



            AvailabilityRS objAvailabilityRS = new AvailabilityRS();
            string         HLFPath           = Path.Combine(HttpRuntime.AppDomainAppPath, "HotelXML/" + searchid + "_" + curcode + "_hotelsAvail-RS.xml");

            if (File.Exists(HLFPath))
            {
                XmlDataDocument xmldoc = new XmlDataDocument();
                FileStream      fs     = new FileStream(HLFPath, FileMode.Open, FileAccess.Read);
                xmldoc.Load(fs);
                fs.Close();
                XmlNode       xnod         = xmldoc.DocumentElement;
                XmlSerializer deserializer = new XmlSerializer(typeof(AvailabilityRS));
                StreamReader  reader       = new StreamReader(HLFPath);
                objAvailabilityRS = (AvailabilityRS)deserializer.Deserialize(reader);
                checkin           = objAvailabilityRS.Hotels.CheckIn.ToString();
                checkout          = objAvailabilityRS.Hotels.CheckOut.ToString();
                dc = 0.0;
                try
                { dc = (Convert.ToDateTime(checkout) - Convert.ToDateTime(checkin)).TotalDays; }
                catch { }

                minrate = Convert.ToDouble(objAvailabilityRS.Hotels.Hotel.Min(k => Convert.ToDouble(k.MinRate)).ToString());
                maxrate = Convert.ToDouble(objAvailabilityRS.Hotels.Hotel.Max(k => Convert.ToDouble(k.MinRate)).ToString());
                //maxrate = Convert.ToDouble(objAvailabilityRS.Hotels.Hotel.Max(k => Convert.ToDouble(k.MaxRate)).ToString());
                maxratepernight = Convert.ToDouble((maxrate) / (dc)).ToString("0.00"); //objAvailabilityRS.Hotels.Hotel.Max(k => Convert.ToDouble(k.MaxRate)).ToString();
                minratepernight = Convert.ToDouble((minrate) / (dc)).ToString("0.00"); //objAvailabilityRS.Hotels.Hotel.Min(k => Convert.ToDouble(k.MinRate)).ToString();



                minbaseamount = (Convert.ToDouble(minratepernight));
                maxbaseamount = (Convert.ToDouble(maxratepernight));
                DataTable     dt     = new DataTable();
                SqlConnection sqlcon = new SqlConnection(con);
                try
                {
                    SqlCommand cmd = new SqlCommand();
                    cmd.Connection  = sqlcon;
                    cmd.CommandType = CommandType.StoredProcedure;
                    cmd.CommandText = "p_SreTS_HDR";
                    cmd.Parameters.AddWithValue("@B2C_IDN", b2c_idn);
                    cmd.Parameters.AddWithValue("@Hotelcode", 0);
                    cmd.Parameters.AddWithValue("@GDS", "HB");
                    cmd.Parameters.AddWithValue("@IsLoginCust", "Y");
                    SqlDataAdapter sa = new SqlDataAdapter(cmd);
                    sa.Fill(dt);
                }
                catch
                {
                }


                if (dt.Rows.Count > 0)
                {
                    string Ts_mode = string.Empty;
                    Ts_mode = dt.Rows[0]["TS_Mode"].ToString();
                    if (Ts_mode == "Fixed")
                    {
                        admarkup   = Convert.ToDouble(dt.Rows[0]["TS_Markup"].ToString());
                        addiscount = Convert.ToDouble(dt.Rows[0]["TS_Discount"].ToString());


                        maxadmarkup   = Convert.ToDouble(dt.Rows[0]["TS_Markup"].ToString());
                        maxaddiscount = Convert.ToDouble(dt.Rows[0]["TS_Discount"].ToString());
                    }
                    else if (Ts_mode == "Percentage")
                    {
                        adpercmarkup  = Convert.ToDouble(dt.Rows[0]["TS_Markup"].ToString());
                        adperdiscount = Convert.ToDouble(dt.Rows[0]["TS_Discount"].ToString());
                        admarkup      = (((minbaseamount) / 100.00) * adpercmarkup);
                        addiscount    = (((minbaseamount) / 100.00) * adperdiscount);



                        maxadpercmarkup  = Convert.ToDouble(dt.Rows[0]["TS_Markup"].ToString());
                        maxadperdiscount = Convert.ToDouble(dt.Rows[0]["TS_Discount"].ToString());
                        maxadmarkup      = (((maxbaseamount) / 100.00) * maxadpercmarkup);
                        maxaddiscount    = (((maxbaseamount) / 100.00) * maxadperdiscount);
                    }
                    else
                    {
                        maxadmarkup   = 0.00;
                        maxaddiscount = 0.00;
                    }


                    string Cl_Mode = string.Empty;
                    Cl_Mode = dt.Rows[0]["Cl_Mode"].ToString();
                    if (Cl_Mode == "Fixed")
                    {
                        clmarkup   = Convert.ToDouble(dt.Rows[0]["Cl_Markup"].ToString());
                        cldiscount = Convert.ToDouble(dt.Rows[0]["Cl_Discount"].ToString());


                        maxclmarkup   = Convert.ToDouble(dt.Rows[0]["Cl_Markup"].ToString());
                        maxcldiscount = Convert.ToDouble(dt.Rows[0]["Cl_Discount"].ToString());
                    }
                    else if (Cl_Mode == "Percentage")
                    {
                        clpercmarkup  = Convert.ToDouble(dt.Rows[0]["Cl_Markup"].ToString());
                        clperdiscount = Convert.ToDouble(dt.Rows[0]["Cl_Discount"].ToString());
                        clmarkup      = ((minbaseamount / 100.00) * clpercmarkup);
                        cldiscount    = ((minbaseamount / 100.00) * clperdiscount);



                        maxclpercmarkup  = Convert.ToDouble(dt.Rows[0]["Cl_Markup"].ToString());
                        maxclperdiscount = Convert.ToDouble(dt.Rows[0]["Cl_Discount"].ToString());
                        maxclmarkup      = ((maxbaseamount / 100.00) * maxclpercmarkup);
                        maxcldiscount    = ((maxbaseamount / 100.00) * maxclperdiscount);
                    }
                    else
                    {
                        maxclmarkup   = 0.00;
                        maxcldiscount = 0.00;
                    }

                    finalmarkup   = admarkup + clmarkup;
                    finaldiscount = addiscount + cldiscount;
                    minbaseamount = minbaseamount + (finalmarkup - finaldiscount);
                    //baseamount = baseamount - finaldiscount;


                    maxfinalmarkup   = maxadmarkup + maxclmarkup;
                    maxfinaldiscount = maxaddiscount + maxcldiscount;
                    maxbaseamount    = maxbaseamount + (maxfinalmarkup - maxfinaldiscount);


                    hrmm.Min = minbaseamount.ToString();
                    hrmm.Max = maxbaseamount.ToString();
                }



                //CreateTables();
                //FillHStable(xnod);
                //string pricerangecond = GetPricrangecondzero();
                //DataTable dtPricingzero = FilterTable(dtBPIadd, pricerangecond);
                //DataRow[] drmax = dtPricingzero.Select("RateRange_Maxrate = MAX(RateRange_Maxrate)");
                //if (drmax.Count() > 0)
                //{
                //    hrmm.Max = drmax[0]["RateRange_Maxrate"].ToString();
                //}
                //DataRow[] drmin = dtPricingzero.Select("RateRange_Maxrate = MIN(RateRange_Maxrate)");
                //if (drmin.Count() > 0)
                //{
                //    hrmm.Min = drmin[0]["RateRange_Maxrate"].ToString();
                //}

                hrmm.Cursymbol = Utilities.GetRatewithSymbol(curcode);
            }

            return(hrmm);
        }
Exemple #16
0
        private string GetHotellist(AvailabilityRS dtHList, string searchid, string checkind, string checkoutd, string guestcount, string selaudults, string selchilds, string currencycode, string b2c_idn)
        {
            double admarkup      = 0.00;
            double adpercmarkup  = 0.00;
            double clpercmarkup  = 0.00;
            double clmarkup      = 0.00;
            double finalmarkup   = 0.00;
            double finaldiscount = 0.00;
            double adperdiscount = 0.00;
            double clperdiscount = 0.00;
            double addiscount    = 0.00;
            double cldiscount    = 0.00;
            double baseamount    = 0.00;
            string reviewrate    = string.Empty;
            string rvalue        = "";
            string imagecode     = "GEN";
            int    order         = 2;
            string childage      = string.Empty;
            // foreach (DataRow drh in dtHList.Rows)
            //{


            string b2c_idnencript = Encrypt(b2c_idn);


            double dc = 0.0;

            try
            { dc = (Convert.ToDateTime(checkoutd.ToString()) - Convert.ToDateTime(checkind.ToString())).TotalDays; }
            catch { }
            DataTable dssearch = HotelDBLayer.GetSearch(searchid);

            if (dssearch.Rows.Count > 0)
            {
                childage = dssearch.Rows[0]["HB_ChildAge"].ToString();
            }
            HotelDevMTWebapi.Models.Hotel drh = new HotelDevMTWebapi.Models.Hotel();
            string    agency_name             = "";
            DataTable dtpccdet = manage_data.getpccdetails(b2c_idn);

            if (dtpccdet.Rows.Count > 0)
            {
                agency_name = dtpccdet.Rows[0]["agency_name"].ToString();
            }



            string cmdfacility = "";

            cmdfacility = "select HB_HotelCodes from hotelsearch where searchidn=" + searchid;
            DataTable dthbhotelcds = manage_data.GetDataTable(cmdfacility, manage_data.con);

            DataTable dtffbookingfb = null;

            DataRow[] drimgpath = null;
            if (System.Web.HttpContext.Current.Cache["dtffbookingfb" + searchid] == null)
            {
                string cmdflbkfb = "select HotelCode,Path,ImageTypeCode from HotelImage where HotelCode in (" + dthbhotelcds.Rows[0]["HB_HotelCodes"].ToString() + ") order by HotelCode,Path asc";
                dtffbookingfb = manage_data.GetDataTable(cmdflbkfb, manage_data.flip_conhb);
                System.Web.HttpContext.Current.Cache["dtffbookingfb" + searchid] = dtffbookingfb;
            }
            else
            {
                dtffbookingfb = (DataTable)System.Web.HttpContext.Current.Cache["dtffbookingfb" + searchid];
            }



            for (int i = (vpageno - 1) * 20; i < (vpageno * 20); i++)
            {
                if (i >= dtHList.Hotels.Hotel.Count || i >= 350)
                {
                    break;
                }
                drh = dtHList.Hotels.Hotel[i];
                HotelMaincintent     objhtl           = new HotelMaincintent();
                List <Hdbfacilities> lstHdbfacilities = new List <Hdbfacilities>();
                objhtl = HotelListGenerate.GetHotelContent(vpageno, drh.Code);
                if (objhtl.Name != null)
                {
                    lstHdbfacilities = HotelListGenerate.Gethotelfacilities(drh.Code);
                    //string lengt = objfacility.FacilityCode;
                    string facilitydescr = string.Empty;
                    facilitydescr = HotelListGenerate.GetFacilityList(lstHdbfacilities);
                    //foreach (Hdbfacilities obj in objfacility)
                    //{
                    //    string decrptnlist = "";
                    //    if (!string.IsNullOrEmpty(obj.FacilityCode))
                    //    {
                    //        decrptnlist = HotelListGenerate.getfacidisc(obj.FacilityCode.ToString(), obj.FacilityGroupCode.ToString());
                    //        facilitydescr += "<li>" + decrptnlist + "</li>";
                    //    }
                    //}
                    drimgpath = dtffbookingfb.Select("HotelCode='" + dtHList.Hotels.Hotel[i].Code + "' and ImageTypeCode='" + imagecode + "'");


                    rvalue += "<div class='col-md-12 hotel-details'><div class='row'>";
                    try
                    {
                        rvalue += " <div class='htl-img-blk col-md-4'> <img src='http://photos.hotelbeds.com/giata/" + drimgpath[0]["Path"].ToString() + "' onerror='this.src=&quot;../images/No%20Image%20found.png&quot;' class='img-responsive'  id='HotelImage_" + dtHList.Hotels.Hotel[i].Code + "' /></div>";
                    }
                    catch
                    {
                        rvalue += " <div class='htl-img-blk col-md-4'> <img src='../images/No Image found.png' onerror='this.src=&quot;../images/No%20Image%20found.png&quot;' class='img-responsive'  id='HotelImage_" + dtHList.Hotels.Hotel[i].Code + "' /></div>";
                    }
                    rvalue += "<div class='col-md-8 col-sm-8 col-xs-8 htl-content'> <div class='col-md-8 col-sm-8 col-xs-8 htl-cont-left'>";
                    rvalue += "<div class='htl-header'> <div class='htl-name'>";
                    double rating     = 0.0;
                    int    starRating = 0;
                    try
                    {
                        //rating = Convert.ToDouble("3.0");
                        string ratingv = drh.CategoryName.ToString();

                        string[] rativ_split = ratingv.Split(' ');
                        if (rativ_split[0].ToString() != "1" && rativ_split[0].ToString() != "2" && rativ_split[0].ToString() != "3" && rativ_split[0].ToString() != "4" && rativ_split[0].ToString() != "5")
                        {
                            //if (ratingv == "WITHOUT OFFICIAL CATEGORY")
                            //{
                            rating = 0.0;
                        }
                        else
                        {
                            //rativ_split = ratingv.Split(' ');
                            rating = Convert.ToDouble(rativ_split[0].ToString());
                        }

                        starRating = Convert.ToInt32(rating);
                        //if (drh.Reviews != null)
                        //{
                        //    rating = Convert.ToDouble(drh.Reviews.Review.Rate.ToString());
                        //    starRating = Convert.ToInt32(rating);
                        //}
                    }
                    catch
                    {
                        rating     = Convert.ToDouble("0.0");
                        starRating = Convert.ToInt32(rating);
                    }
                    rvalue += "<a target='_blank' href='HotelDetails_load.aspx?id=" + searchid + "&HotelCode=" + drh.Code + "&chkin=" + checkind + "&chkout=" + checkoutd + "&gc=" + selaudults + "&award=" + rating.ToString() + "&childAges=" + childage + "&Totalguest=" + guestcount + "&childrens=" + selchilds + "&clid=" + b2c_idnencript + "'>";
                    //if(drh["contractnegcode"].ToString()!="")
                    //{ rvalue += "<h4>" + drh["HotelName"] + "*<span class='star-blk'><img src='../images/" + drh["RatingValue"] + "stars.png' class='img-responsive' /> </span></h4></a>"; }
                    //else
                    //{

                    //}
                    try
                    {
                        if (starRating > 0)
                        {
                            rvalue += "<h4>" + drh.Name + "<span class='star-blk'><img src='../images/" + starRating + "stars.png' class='img-responsive' /> </span></h4>";
                        }
                        else
                        {
                            rvalue += "<h4>" + drh.Name + "</h4>";
                        }
                    }
                    catch
                    {
                    }
                    rvalue += "</a>";

                    rvalue += "</div></div>";
                    rvalue += "<div class='htl-adress'> <p><span class='addressrpblck'><i class='fa fa-map-marker' aria-hidden='true'></i>" + HotelListGenerate.Getaddress(drh.Code) + "</span> |<a href='#' id='btnShow1' data-toggle='modal' data-target='#DivMap' onclick=\"showmap(" + drh.Latitude + "," + drh.Longitude + ",'" + drh.Name + "')\"> Show Map </a></span></p> </div>";

                    rvalue += "<div class='facilities'><ul class='list-inline'>";
                    rvalue += facilitydescr;
                    rvalue += "</ul></div>";
                    //rvalue += " <div class='facilities'>" + facilitydescr + " </div> ";
                    try
                    {
                        if (drh.Reviews != null)
                        {
                            rvalue += " <div class='reviws-blk'> <ul class='list-inline'>";

                            rvalue += "<li class='review-rate'>" + drh.Reviews.Review.Rate + "</li> <li class='reviw-scre'><span>Excellent</span> (" + drh.Reviews.Review.ReviewCount + " reviews)</li> </ul></div>";
                        }
                        //else
                        //{
                        //    rvalue += " <div class='reviws-blk'> <ul class='list-inline'>";

                        //    rvalue += "<li class='review-rate'>3.0</li> <li class='reviw-scre'><span>Excellent</span> (15 reviews)</li> </ul></div>";
                        //}
                    }
                    catch
                    {
                    }
                    rvalue    += "</div>";
                    rvalue    += "<div class='col-md-4 col-sm-4 col-xs-4 htl-cont-right'>";
                    baseamount = (Convert.ToDouble(drh.MinRate) / Convert.ToDouble(dc));
                    if (drh.Code.ToString() != "")
                    {
                        DataTable     dt     = new DataTable();
                        SqlConnection sqlcon = new SqlConnection(con);
                        try
                        {
                            SqlCommand cmd = new SqlCommand();
                            cmd.Connection  = sqlcon;
                            cmd.CommandType = CommandType.StoredProcedure;
                            cmd.CommandText = "p_SreTS_HDR";
                            cmd.Parameters.AddWithValue("@B2C_IDN", b2c_idn);
                            cmd.Parameters.AddWithValue("@Hotelcode", drh.Code.ToString());
                            cmd.Parameters.AddWithValue("@GDS", "HB");
                            cmd.Parameters.AddWithValue("@IsLoginCust", "Y");
                            SqlDataAdapter sa = new SqlDataAdapter(cmd);
                            sa.Fill(dt);
                        }
                        catch
                        {
                        }


                        if (dt.Rows.Count > 0)
                        {
                            string Ts_mode = string.Empty;
                            Ts_mode = dt.Rows[0]["TS_Mode"].ToString();
                            if (Ts_mode == "Fixed")
                            {
                                admarkup   = Convert.ToDouble(dt.Rows[0]["TS_Markup"].ToString());
                                addiscount = Convert.ToDouble(dt.Rows[0]["TS_Discount"].ToString());
                            }
                            else if (Ts_mode == "Percentage")
                            {
                                adpercmarkup  = Convert.ToDouble(dt.Rows[0]["TS_Markup"].ToString());
                                adperdiscount = Convert.ToDouble(dt.Rows[0]["TS_Discount"].ToString());
                                admarkup      = (((baseamount) / 100.00) * adpercmarkup);
                                addiscount    = (((baseamount) / 100.00) * adperdiscount);
                            }
                            else
                            {
                                admarkup   = 0.00;
                                addiscount = 0.00;
                            }


                            string Cl_Mode = string.Empty;
                            Cl_Mode = dt.Rows[0]["Cl_Mode"].ToString();
                            if (Cl_Mode == "Fixed")
                            {
                                clmarkup   = Convert.ToDouble(dt.Rows[0]["Cl_Markup"].ToString());
                                cldiscount = Convert.ToDouble(dt.Rows[0]["Cl_Discount"].ToString());
                            }
                            else if (Cl_Mode == "Percentage")
                            {
                                clpercmarkup  = Convert.ToDouble(dt.Rows[0]["Cl_Markup"].ToString());
                                clperdiscount = Convert.ToDouble(dt.Rows[0]["Cl_Discount"].ToString());
                                clmarkup      = ((baseamount / 100.00) * clpercmarkup);
                                cldiscount    = ((baseamount / 100.00) * clperdiscount);
                            }
                            else
                            {
                                clmarkup   = 0.00;
                                cldiscount = 0.00;
                            }

                            finalmarkup   = admarkup + clmarkup;
                            finaldiscount = addiscount + cldiscount;
                            baseamount    = baseamount + (finalmarkup - finaldiscount);
                        }

                        rvalue += " <h2 class='price-cnt'>" + Utilities.GetRatewithSymbol(currencycode) + Convert.ToDouble(Convert.ToDouble(baseamount)).ToString("0.00") + "*</h2>";//drh.MinRate) / (dc)
                    }
                    else
                    {
                        rvalue += " <h2 class='price-cnt'>" + Utilities.GetRatewithSymbol(currencycode) + Convert.ToDouble(Convert.ToDouble(baseamount)).ToString("0.00") + "</h2>";//drh.MinRate) / (dc)
                    }
                    rvalue += " <p class='srch-pr-nyt'>Per Night</p>";
                    //if (drh.Reviews != null)
                    //{
                    //    rating = Convert.ToDouble(drh.Reviews.Review.Rate.ToString());
                    //}
                    rvalue += "<a target='_blank' href='HotelDetails_load.aspx?id=" + searchid + "&HotelCode=" + drh.Code + "&chkin=" + checkind + "&chkout=" + checkoutd + "&gc=" + guestcount + "&award=" + rating.ToString() + "&childAges=" + childage + "&Currency=" + currencycode + "&clid=" + b2c_idnencript + "' class='chocse-rm'>Choose Room</a>";
                    rvalue += " <p class='avail-rms'>";
                    rvalue += "<a class='lnkviewavrooms' style='cursor:pointer;'  onclick=\"RoomDetails('" + drh.Code + "',this,' " + rating.ToString() + "')\">View Available Rooms</a>";
                    rvalue += " </p></div>";
                    rvalue += " <div class='discount col-md-12 col-sm-12 col-xs-12 col-sm-12 col-xs-12'>";
                    rvalue += " <div class='benft'>  <p> <span class='hotl-logo'>";
                    rvalue += " <img src='http://photos.hotelbeds.com/giata/" + HotelListGenerate.getimpagePath(imagecode, drh.Code) + "' onerror='this.src=&quot;../images/No%20Image%20found.png&quot;' id='HotelLogo_" + drh.Code + "'/></span>*Special Discounted Rates  </p> </div>";
                    rvalue += "</div></div> </div>";
                    rvalue += " <div class='availble-rm-blk' id='divavailroom" + drh.Code + "'>";
                    rvalue += " <div class='loaing-bg_img' style='display:none ;width: 100%; margin-top: 20px; text-align: center;'><img src='../images/loader.gif' /><br /> please wait..</div>";
                    rvalue += "</div></div>";
                }
            }
            return(rvalue);
        }
        public string Get(string searchid, string city, string checkind, string checkoutd, string guestscount, string selroom, string selaudults, string selchilds, string sortby, string pageno, string amenities, string stars, string hotelname, string curcode, string b2c_idn)
        {
            AvailabilityRS objAvailabilityRS = new AvailabilityRS();

            vcity = city;

            vpageno = Convert.ToInt16(pageno);
            //  string HLFPath = Path.Combine(HttpRuntime.AppDomainAppPath, "HotelAvail/" + searchid + "_" + curcode + "_HotelList.xml");
            string HLFPath = Path.Combine(HttpRuntime.AppDomainAppPath, "HotelXML/" + searchid + "_" + curcode + "_hotelsAvail-RS.xml");

            if (File.Exists(HLFPath))
            {
                XmlDataDocument xmldoc = new XmlDataDocument();
                FileStream      fs     = new FileStream(HLFPath, FileMode.Open, FileAccess.Read);
                xmldoc.Load(fs);
                fs.Close();
                XmlNode       xnod         = xmldoc.DocumentElement;
                XmlSerializer deserializer = new XmlSerializer(typeof(AvailabilityRS));
                StreamReader  reader       = new StreamReader(HLFPath);
                objAvailabilityRS = (AvailabilityRS)deserializer.Deserialize(reader);

                //HotelListGenerate.CreateTables(dtBPIadd);
                //HotelListGenerate.FillHStable(xnod, dtBPIadd);//yogi
            }
            else
            {
                HACondition   Hac = GetSearchConditon(city, checkind, checkoutd, guestscount, Convert.ToInt32(selroom), Convert.ToInt32(selaudults), Convert.ToInt32(selchilds), curcode);
                HotelSearchAj hs  = new HotelSearchAj(Hac, searchid, b2c_idn);
                dtBPIadd = hs.dtBPIadd;
                DataSet ds = new DataSet();
                ds.Tables.Add(dtBPIadd);
                ds.WriteXml(HLFPath);
            }

            string         pricerangecond = HotelListGenerate.GetPricrangecondzero();
            AvailabilityRS dtPricingzero  = HotelListGenerate.FilterTable(objAvailabilityRS, pricerangecond);

            objAvailabilityRS.Hotels.Hotel = objAvailabilityRS.Hotels.Hotel.OrderBy(k => Convert.ToDouble(k.MinRate)).ToList();
            int totalhotels = 0;

            if (objAvailabilityRS.Hotels.Hotel.Count() >= 350)
            {
                totalhotels = 350;//objAvailabilityRS.Hotels.Hotel.Count();
            }
            else
            {
                totalhotels = objAvailabilityRS.Hotels.Hotel.Count();
            }
            //int totalhotels = dtPricingzero.Rows.Count;

            string rvalue = "";

            if (totalhotels <= 0)
            {
                rvalue = "N";
            }
            else
            {
                vtotpages = Convert.ToInt16(Math.Ceiling(Convert.ToDecimal(totalhotels) / 20));



                AvailabilityRS dtFilterHotels = HotelListGenerate.GetFilteredData(objAvailabilityRS, hotelname, "", sortby, stars, amenities);
                //AvailabilityRS dtSortedHotels = HotelListGenerate.GetSortedData(dtFilterHotels, sortby);
                rvalue = Generatehtml(dtFilterHotels, dtPricingzero, searchid, checkind, checkoutd, guestscount, hotelname, sortby, curcode, b2c_idn, selaudults, selchilds);
            }
            return(rvalue);
        }
        private string Generatehtml(AvailabilityRS objAvailabilityRS, AvailabilityRS MainTable, string searchid, string checkind, string checkoutd, string guestscount, string Hotelname, string sortby, string currencycode, string b2c_idn, string seladults, string selchilds)
        {
            hsAmentitiesCount = HotelListGenerate.GetPropinfocount(objAvailabilityRS);
            string lstHotelCodes = string.Join(",", MainTable.Hotels.Hotel.Select(k => k.Code));
            string genstring     = "";

            genstring  = "<div class='inner-col-left col-md-3' id='divleftfilters'>";
            genstring += "<div class='inner-col-left-inn'>";

            genstring += "<div class='filter-block' id='divfilterblk'>";
            genstring += "<div class='filter-title'><h3>filters</h3><a style='cursor: pointer;display:none' id='lnkclearfils' onclick='ClearFilters()'>clear all</a> </div>";
            genstring += "<div class='all-fltr-sec' id='divltselfils' style='display:none'   ><asp:Literal  ID='ltselfilters'></asp:Literal></div>";
            genstring += " <div class='shw-mre' id='divshowmorefils'><a style='cursor: pointer;display:none'  id='lnkshowmorefils' onclick='showmorefil()' style='display:none'>show more</a></div>";
            genstring += "</div>";

            genstring += "<div class='filter-block'>";
            genstring += "<div class='filter-title'><h4>Price range:</h4> </div>";
            genstring += "<div class='filter-label'><label class='pad-Rten'><span class='lbl padding-8'><input type='text' id='amount' class='inputtextbox' readonly onchange='pricerangechange()'></span>";


            genstring += "<div id='slider-range'></div></label></div> </div>";

            genstring += "<div class='filter-block'>";
            genstring += "<div class='filter-title' onclick=\"show_promos('divhotelfil')\">";
            genstring += "<h4>Hotel Filters</h4><p><i class='fa fa-angle-down' aria-hidden='true' id='adhotelfil'></i></p> </div>";
            genstring += "<div id='divhotelfil'> <div class='hotel-name-blk'>";
            if (!string.IsNullOrEmpty(Hotelname))
            {
                genstring += "<input name='txtHotelname' type='text' id='txthotelname' placeholder='Enter Hotel  Name' value='" + Hotelname + "' class='form-control' >";
            }
            else
            {
                genstring += "<input name='txtHotelname' type='text' id='txthotelname' placeholder='Enter Hotel  Name'  class='form-control' >";
            }

            genstring += "<a  id='srhotelname' style='cursor:pointer' onclick='srhotelnameClick()'>go</a></div>";
            genstring += "<div class='hotel-chain-blk'>";

            genstring += HotelListGenerate.FillHotelChains(objAvailabilityRS);
            genstring += "</div></div></div>";
            genstring += "<div style='display:none' class='filter-block'><div class='filter-title' onclick=\"show_promos('divstar')\"> <h4>Star rating</h4>";
            genstring += "<p><i class='fa fa-angle-down' aria-hidden='true'></i></p></div><div id='divstar'>";
            List <Reviews> lstreviews = new List <Reviews>();

            lstreviews = objAvailabilityRS.Hotels.Hotel.Select(k => k.Reviews).ToList();
            //yogi comented for review checking 07/01/19

            //for (int i = 0; i < lstreviews.Count; i++)
            //{
            //    if (lstreviews[i] != null)
            //    {
            //        genstring += HotelListGenerate.GetStarrating("chkrt5", 5, MainTable);
            //        genstring += HotelListGenerate.GetStarrating("chkrt4", 4, MainTable);
            //        genstring += HotelListGenerate.GetStarrating("chkrt3", 3, MainTable);
            //        genstring += HotelListGenerate.GetStarrating("chkrt2", 2, MainTable);
            //        genstring += HotelListGenerate.GetStarrating("chkrt1", 1, MainTable);
            //    }

            //}

            genstring += "</div> </div>";
            genstring += "<div class='filter-block'> <div class='filter-title' onclick=\"show_promos('divfc')\">  <h4>Amenities</h4> <p><i class='fa fa-angle-down' aria-hidden='true'></i></p> </div>";
            genstring += "<div id='divfc'>";

            genstring += HotelListGenerate.GetAmenities("chkfitnessfun", "Fitness", "Fitness Center", "Fitness", lstHotelCodes, MainTable.Hotels.Hotel);
            genstring += HotelListGenerate.GetAmenities("chkpoolfun", "Indpool", "Indoor Pool", "Indpool", lstHotelCodes, MainTable.Hotels.Hotel);
            genstring += HotelListGenerate.GetAmenities("chkinternet", "Internet", "Internet", "Internet", lstHotelCodes, MainTable.Hotels.Hotel);
            //genstring += HotelListGenerate.GetAmenities("chkwi-fi", "Wi-fi", "Wi-fi", "Wi-fi", lstHotelCodes, MainTable.Hotels.Hotel);
            genstring += HotelListGenerate.GetAmenities("chkbreakfast", "Breakfast", "Breakfast included", "Breakfast", lstHotelCodes, MainTable.Hotels.Hotel);
            genstring += HotelListGenerate.GetAmenities("chkfreepark", "Park", "Free Parking", "Park", lstHotelCodes, MainTable.Hotels.Hotel);
            genstring += HotelListGenerate.GetAmenities("chknsmk", "Non Smoking", "Non Smoking", "Non Smoking", lstHotelCodes, MainTable.Hotels.Hotel);
            genstring += HotelListGenerate.GetAmenities("chksmk", "Smoking Room", "Smoking Room", "Smoking Room", lstHotelCodes, MainTable.Hotels.Hotel);
            genstring += HotelListGenerate.GetAmenities("chkAccessible", "Accessible", "Accessible", "Accessible", lstHotelCodes, MainTable.Hotels.Hotel);
            genstring += HotelListGenerate.GetAmenities("chkpets", "Pets", "Pets Allowed", "Pets", lstHotelCodes, MainTable.Hotels.Hotel);
            genstring += HotelListGenerate.GetAmenities("chkairport", "Airport", "Airport Access", "Airport", lstHotelCodes, MainTable.Hotels.Hotel);
            genstring += HotelListGenerate.GetAmenities("chkbusineerec", "Business", "Business Travel", "Business", lstHotelCodes, MainTable.Hotels.Hotel);
            genstring += HotelListGenerate.GetAmenities("chkpoolrec", "Outdoor", "The Outdoor Pool", "Outdoor", lstHotelCodes, MainTable.Hotels.Hotel);
            genstring += HotelListGenerate.GetAmenities("chkkidsrec", "Kids", "Kid-friendly Travel", "Kids", lstHotelCodes, MainTable.Hotels.Hotel);
            genstring += "</div></div>";
            genstring += "<div class='clear-fltr-btn'><a href='#'  id='clfilter' name='clfilters' onclick='ClearFilters()'>Clear All Filters</a></div>";
            genstring += "<div class='close-filter'><a href='#' class='cf-apply' >Apply</a><a href='#' class='cf-close' onclick='CloseMobFilters()'>Close</a></div>";
            genstring += "</div></div>";

            string cityname = "";

            try
            {
                cityname = vcity.Substring(0, vcity.IndexOf(','));
            }
            catch
            {
                cityname = vcity;
            }

            int htcount = 0;

            if (objAvailabilityRS.Hotels.Hotel.Count() >= 350)
            {
                htcount = 350;
            }
            else
            {
                htcount = objAvailabilityRS.Hotels.Hotel.Count();
            }

            string hcount    = htcount.ToString(); //(objAvailabilityRS.Hotels.Hotel.Count()).ToString();
            string Maincount = htcount.ToString(); //MainTable.Hotels.Hotel.Count().ToString();

            genstring += "<div id='divhotellist'>";
            genstring += " <div class='inner-col-right col-md-9'> <div class='row'>";
            //genstring += "<div class='bk-selct-bx'><select id='ddlCurrency' onchange='CCchange()'> ";
            //if (currencycode == "USD")
            //{
            //    genstring += "<option value='USD' selected='selected'>(USD) US dollar</option>";
            //}
            //else
            //{
            //    genstring += "<option value='USD'>(USD) US dollar</option>";
            //}
            //if (currencycode == "CAD")
            //{
            //    genstring += "<option value='CAD' selected='selected'>(CAD) Canadian dollar</option>";
            //}
            //else
            //{
            //    genstring += "<option value='CAD'>(CAD) Canadian dollar</option>";
            //}
            //if (currencycode == "EUR")
            //{
            //    genstring += "<option value='EUR' selected='selected'>(EUR) Euro</option>";
            //}
            //else
            //{
            //    genstring += "<option value='EUR'>(EUR) Euro</option>";
            //}
            //if (currencycode == "GBP")
            //{
            //    genstring += "<option value='GBP' selected='selected'>(GBP) British pound</option>";
            //}
            //else
            //{
            //    genstring += "<option value='GBP'>(GBP) British pound</option>";
            //}
            //genstring += " </select></div>";


            genstring += "<div class='inn-rht-menu'><div   style='display:none' class='rht-menu-map'><i class='fa fa-map-marker' aria-hidden='true'></i>< a onclick='ShowAllinMap()'> Map</a> </div>";
            genstring += "<div class='rht-menu-selctbx'><select id='ddlCurrency' onchange='CCchange()' disabled='disabled'> ";

            if (currencycode == "USD")
            {
                genstring += "<option value='USD' selected='selected'>(USD) US dollar</option>";
            }
            else
            {
                genstring += "<option value='USD'>(USD) US dollar</option>";
            }
            //if (currencycode == "CAD")
            //{
            //    genstring += "<option value='CAD' selected='selected'>(CAD) Canadian dollar</option>";
            //}
            //else
            //{
            //    genstring += "<option value='CAD'>(CAD) Canadian dollar</option>";
            //}
            //if (currencycode == "EUR")
            //{
            //    genstring += "<option value='EUR' selected='selected'>(EUR) Euro</option>";
            //}
            //else
            //{
            //    genstring += "<option value='EUR'>(EUR) Euro</option>";
            //}
            //if (currencycode == "GBP")
            //{
            //    genstring += "<option value='GBP' selected='selected'>(GBP) British pound</option>";
            //}
            //else
            //{
            //    genstring += "<option value='GBP'>(GBP) British pound</option>";
            //}

            genstring += " </select></div></div>";

            genstring += "<div class='inn-right-header'> <h2>" + cityname + " - <sapn class='htlcount'>" + hcount + " Hotels Selected of " + Maincount + " Hotels Found </span>" + "</h2></div>";
            if (hcount == "0")
            {
                genstring += "<div class='resultsp-msg'><span>Please Clear the filters or change filters to get hotels list </span></div>";
            }
            genstring += " <div class='sortpagn'>";
            genstring += HotelListGenerate.GetSortBydd(sortby, hcount);
            genstring += HotelListGenerate.GetPagingHtmlTop(Convert.ToInt32(hcount), vpageno);
            genstring += HotelListGenerate.GetHotellist(objAvailabilityRS, searchid, checkind, checkoutd, guestscount, currencycode, vpageno, b2c_idn, seladults, selchilds);

            genstring += HotelListGenerate.GetPagingHtmlBottom(Convert.ToInt32(hcount), vpageno);

            genstring += "</div>";
            genstring += "<div><div>";
            genstring += "<div><div>";
            genstring += "<div>";
            return(genstring);
        }
Exemple #19
0
        private string GetHotellistPG(AvailabilityRS dtHList, string searchid, string checkind, string checkoutd, string guestcount, string selaudults, string selchilds, string sortby, int totalhotels, string currencycode, string b2c_idn)
        {
            string genstring = "";
            string cityname  = "";

            try
            {
                cityname = vcity.Substring(0, vcity.IndexOf(','));
            }
            catch
            {
                cityname = vcity;
            }


            int htcount = 0;

            if (dtHList.Hotels.Hotel.Count() >= 350)
            {
                htcount = 350;
            }
            else
            {
                htcount = dtHList.Hotels.Hotel.Count();
            }



            string hcount = htcount.ToString();

            genstring += "<div id='divhotellist'>";

            //genstring += "<div class='bk-selct-bx'><select id='ddlCurrency' onchange='CCchange()'> ";

            //if (currencycode == "USD")
            //{
            //    genstring += "<option value='USD' selected='selected'>(USD) US dollar</option>";
            //}
            //else
            //{
            //    genstring += "<option value='USD'>(USD) US dollar</option>";
            //}
            //if (currencycode == "CAD")
            //{
            //    genstring += "<option value='CAD' selected='selected'>(CAD) Canadian dollar</option>";
            //}
            //else
            //{
            //    genstring += "<option value='CAD'>(CAD) Canadian dollar</option>";
            //}
            //if (currencycode == "EUR")
            //{
            //    genstring += "<option value='EUR' selected='selected'>(EUR) Euro</option>";
            //}
            //else
            //{
            //    genstring += "<option value='EUR'>(EUR) Euro</option>";
            //}
            //if (currencycode == "GBP")
            //{
            //    genstring += "<option value='GBP' selected='selected'>(GBP) British pound</option>";
            //}
            //else
            //{
            //    genstring += "<option value='GBP'>(GBP) British pound</option>";
            //}

            //genstring += " </select></div>";
            genstring += " <div class='inner-col-right col-md-9'>";

            genstring += " <div class='row'>";
            genstring += "<div class='inn-rht-menu'><div style='display:none' class='rht-menu-map'><i class='fa fa-map-marker' aria-hidden='true'></i><a onclick='ShowAllinMap()'> Map</a> </div>";
            genstring += "<div class='rht-menu-selctbx'><select id='ddlCurrency' onchange='CCchange()' disabled='disabled'> ";

            if (currencycode == "USD")
            {
                genstring += "<option value='USD' selected='selected'>(USD) US dollar</option>";
            }
            else
            {
                genstring += "<option value='USD'>(USD) US dollar</option>";
            }
            //if (currencycode == "CAD")
            //{
            //    genstring += "<option value='CAD' selected='selected'>(CAD) Canadian dollar</option>";
            //}
            //else
            //{
            //    genstring += "<option value='CAD'>(CAD) Canadian dollar</option>";
            //}
            //if (currencycode == "EUR")
            //{
            //    genstring += "<option value='EUR' selected='selected'>(EUR) Euro</option>";
            //}
            //else
            //{
            //    genstring += "<option value='EUR'>(EUR) Euro</option>";
            //}
            //if (currencycode == "GBP")
            //{
            //    genstring += "<option value='GBP' selected='selected'>(GBP) British pound</option>";
            //}
            //else
            //{
            //    genstring += "<option value='GBP'>(GBP) British pound</option>";
            //}
            genstring += " </select></div></div>";
            genstring += "<div class='inn-right-header'> <h2>" + cityname + " - <sapn class='htlcount'>" + hcount + " Hotels Selected of " + totalhotels + " Hotels Found</span>" + "</h2></div>";
            if (hcount == "0")
            {
                genstring += "<div class='resultsp-msg'><span>Please Clear the filters or change filters to get hotels list </span></div>";
            }
            genstring += " <div class='sortpagn'>";
            genstring += HotelListGenerate.GetSortBydd(sortby, hcount);
            genstring += HotelListGenerate.GetPagingHtmlTop(Convert.ToInt32(hcount), vpageno);
            genstring += GetHotellist(dtHList, searchid, checkind, checkoutd, guestcount, selaudults, selchilds, currencycode, b2c_idn);
            genstring += HotelListGenerate.GetPagingHtmlBottom(Convert.ToInt32(hcount), vpageno);
            genstring += "</div>";
            genstring += "<div><div>";
            genstring += "<div><div>";
            genstring += "<div>";
            return(genstring);
        }