public string Get(string city, string checkind, string checkoutd, string guestscount, string selroom, string seladults, string adultbyroom, string selchilds, string childrenbyroom, string childages, string curcode, string b2c_idn)
        {
            string ipaddress = "";
            string searchid  = "";
            string cust_idn  = string.Empty;

            if (Request.Properties.ContainsKey("MS_HttpContext"))
            {
                var ctx = Request.Properties["MS_HttpContext"] as HttpContextWrapper;
                if (ctx != null)
                {
                    var ip = ctx.Request.UserHostAddress;
                    //do stuff with IP
                }
            }
            searchid = HotelDBLayer.SaveSearch(city, checkind, checkoutd, Convert.ToInt16(selroom), Convert.ToInt16(seladults), adultbyroom, Convert.ToInt16(selchilds), childrenbyroom, childages, ipaddress, curcode, b2c_idn, cust_idn);
            HACondition   Hac     = Utilities.GetSearchConditon(city, checkind, checkoutd, guestscount.ToString(), Convert.ToInt32(selroom), Convert.ToInt32(seladults), adultbyroom, Convert.ToInt32(selchilds), childrenbyroom, childages, curcode);
            HotelSearchAj hs      = new HotelSearchAj(Hac, searchid, b2c_idn);
            DataTable     dtHList = hs.dtBPIadd;
            DataSet       ds      = new DataSet();

            ds.Tables.Add(dtHList);
            string HLFPath = Path.Combine(HttpRuntime.AppDomainAppPath, "HotelXML/" + searchid + "_" + curcode + "6140_USD_hotelsAvail-RS.xml");

            ds.WriteXml(HLFPath);
            string rvalue = searchid;

            return(rvalue);
        }
示例#2
0
        public string Get(string searchid, string curcode, string b2c_idn)
        {
            string rvalue = "N";

            try
            {
                string checkind          = "";
                string checkoutd         = "";
                string selroom           = "";
                string seladults         = "";
                string selchildren       = "";
                string seladultsbyroom   = "";
                string selchildrenbyroom = "";

                string city         = "";
                int    guestcount   = 1;
                string childrenages = "";

                DataTable dssearch = HotelDBLayer.GetSearch(searchid);
                city            = dssearch.Rows[0]["Destination"].ToString();
                checkind        = Convert.ToDateTime(dssearch.Rows[0]["CheckInDt"]).ToString("yyyy-MM-dd");
                checkoutd       = Convert.ToDateTime(dssearch.Rows[0]["CheckOutDt"]).ToString("yyyy-MM-dd");
                selroom         = dssearch.Rows[0]["Rooms"].ToString();
                seladults       = dssearch.Rows[0]["Adults"].ToString();
                seladultsbyroom = dssearch.Rows[0]["HB_AdultsByRoom"].ToString();

                selchildren       = dssearch.Rows[0]["Children"].ToString();
                selchildrenbyroom = dssearch.Rows[0]["HB_ChildrenByRoom"].ToString();
                guestcount        = Convert.ToInt16(dssearch.Rows[0]["Adults"].ToString()) + Convert.ToInt16(dssearch.Rows[0]["Children"].ToString());
                childrenages      = dssearch.Rows[0]["HB_ChildAge"].ToString();
                HACondition   Hac     = GetSearchConditon(city, checkind, checkoutd, guestcount.ToString(), Convert.ToInt32(selroom), Convert.ToInt32(seladults), seladultsbyroom, Convert.ToInt32(selchildren), selchildrenbyroom, childrenages, curcode.Trim());
                HotelSearchAj hs      = new HotelSearchAj(Hac, searchid, b2c_idn);
                DataTable     dtHList = hs.dtBPIadd;
                DataSet       ds      = new DataSet();
                ds.Tables.Add(dtHList);
                // string HLFPath = Path.Combine(HttpRuntime.AppDomainAppPath, "HotelAvail/" + searchid + "_" + curcode + "_HotelList.xml");//yogi
                //string HLFPath = Path.Combine(HttpRuntime.AppDomainAppPath, "HotelXML/" + searchid + "_" + curcode + "_hotelsAvail-RS");
                //ds.WriteXml(HLFPath);


                rvalue = "Y";
            }
            catch (Exception ex)
            {
                rvalue = "N";
            }
            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);
        }