Exemple #1
0
    public HPDCondition GetCondition(string searchid, string hotelcode, string CurrencyCode)
    {
        HPDCondition Hapc       = new HPDCondition();
        DataTable    dssearch   = HotelDBLayer.GetSearch(searchid);
        int          guestcount = Convert.ToInt16(dssearch.Rows[0]["Adults"].ToString()) + Convert.ToInt16(dssearch.Rows[0]["Children"].ToString());

        try { Hapc.HotelCode = hotelcode; }
        catch { Hapc.HotelCode = ""; }
        try { Hapc.rooms = Convert.ToInt32(dssearch.Rows[0]["Rooms"]).ToString(); }
        catch { Hapc.checkin = ""; }
        try { Hapc.checkin = Convert.ToDateTime(dssearch.Rows[0]["CheckInDt"]).ToString("yyyy-MM-dd"); }
        catch { Hapc.checkin = ""; }
        try { Hapc.checkout = Convert.ToDateTime(dssearch.Rows[0]["CheckOutDt"]).ToString("yyyy-MM-dd"); }
        catch { Hapc.checkout = ""; }
        try { Hapc.guestcount = guestcount.ToString(); }
        catch { Hapc.guestcount = ""; }
        try { Hapc.Adult = dssearch.Rows[0]["Adults"].ToString(); }
        catch { }
        try { Hapc.children = Convert.ToInt32(dssearch.Rows[0]["Children"].ToString()); }
        catch { }
        try { Hapc.childrenage = dssearch.Rows[0]["HB_ChildAge"].ToString(); }
        catch { }
        if (CurrencyCode == "")
        {
            Hapc.CurrencyCode = "USD";
        }
        else
        {
            Hapc.CurrencyCode = CurrencyCode;
        }
        return(Hapc);
    }
Exemple #2
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);
    }
        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 #4
0
    private string GetHCRQ(HPDCondition hpc)
    {
        string rqvalue = "";

        try
        {
            rqvalue += "<availabilityRQ xmlns='http://www.hotelbeds.com/schemas/messages' xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance'>";
            rqvalue += "<stay checkIn='" + hpc.checkin + "' checkOut='" + hpc.checkout + "'/>";
            rqvalue += "<occupancies><occupancy rooms='" + hpc.rooms + "' adults='" + hpc.Adult + "' children='" + hpc.children + "'>";
            if (hpc.children > 0)
            {
                string childages = string.Empty;

                foreach (string item in hpc.childrenage.Split(','))
                {
                    rqvalue += "	<paxes>	<pax type='CH' age='"+ item + "'/>";
                    rqvalue += "	</paxes>";
                }
            }

            rqvalue += "</occupancy>";
            rqvalue += "  </occupancies>";

            rqvalue += "<reviews>	<review type='HOTELBEDS' maxRate='5' minRate= '1' minReviewCount='3' /></reviews>";

            rqvalue += " <hotels>";

            //rq += "<hotel>454281</hotel>";



            if (hpc.HotelCode != null && hpc.HotelCode != string.Empty)
            {
                rqvalue += "<hotel>" + hpc.HotelCode + "</hotel>";
            }


            rqvalue += "</hotels>";

            rqvalue += "</availabilityRQ>";
        }
        catch (Exception ex)
        {
        }



        return(rqvalue);
    }
    private HPDCondition GetCondition(string hotelcode)
    {
        HPDCondition Hapc       = new HPDCondition();
        DataTable    dssearch   = HotelDBLayer.GetSearch(searchid);
        int          guestcount = Convert.ToInt16(dssearch.Rows[0]["Adults"].ToString()) + Convert.ToInt16(dssearch.Rows[0]["Children"].ToString());

        try { Hapc.HotelCode = hotelcode; }
        catch { Hapc.HotelCode = ""; }
        try { Hapc.checkin = Convert.ToDateTime(dssearch.Rows[0]["CheckInDt"]).ToString("MM-dd"); }
        catch { Hapc.checkin = ""; }
        try { Hapc.checkout = Convert.ToDateTime(dssearch.Rows[0]["CheckOutDt"]).ToString("MM-dd"); }
        catch { Hapc.checkout = ""; }
        try { Hapc.guestcount = guestcount.ToString(); }
        catch { Hapc.guestcount = ""; }
        return(Hapc);
    }
Exemple #6
0
    public string gethdata(HPDCondition Hapc, string ContextResult, string searchid, string curcode, string b2c_idn)
    {
        string result = "";

        try
        {
            string Rqbody = GetHCRQ(Hapc);


            result = GetHotel(Rqbody, searchid, Hapc.HotelCode, curcode, b2c_idn);
        }
        catch (Exception ex)
        {
            throw ex;
        }
        return(result);
    }
    private string GetPropDescBodyRQ(HPDCondition hpc)
    {
        string rq = "";

        rq += "<SOAP-ENV:Body>";
        rq += "<HotelPropertyDescriptionRQ ReturnHostCommand='true' Version='2.1.0' xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance' xmlns='http://webservices.sabre.com/sabreXML/2011/10'>";
        rq += "<AvailRequestSegment>";
        rq += " <GuestCounts Count='" + hpc.guestcount + "'/>";
        rq += " <HotelSearchCriteria>";
        rq += " <Criterion>";
        rq += " <HotelRef HotelCode='" + hpc.HotelCode + "'/>";
        rq += " </Criterion>";
        rq += "</HotelSearchCriteria>";
        //rq += " <TimeSpan Start='" + Convert.ToDateTime(Hapc.checkin).ToString("yyyy-MM-dd") + "' End='" + Convert.ToDateTime(Hapc.checkout).ToString("yyyy-MM-dd") + "'/>";
        rq += "  </AvailRequestSegment>";
        rq += "</HotelPropertyDescriptionRQ>";
        rq += "</SOAP-ENV:Body>";
        return(rq);
    }
    private string GetRQ(HPDCondition hpc)
    {
        string rqvalue = "";

        rqvalue += "<SOAP-ENV:Body>";
        rqvalue += "<HotelPropertyDescriptionRQ xmlns='http://webservices.sabre.com/sabreXML/2011/10' xmlns:xs='http://www.w3.org/2001/XMLSchema' xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance'  Version='2.3.0'>";
        rqvalue += "<AvailRequestSegment>";
        rqvalue += " <GuestCounts Count='" + hpc.guestcount + "' />";
        rqvalue += " <HotelSearchCriteria>";
        rqvalue += " <Criterion>";
        rqvalue += " <HotelRef HotelCode='" + hpc.HotelCode + "'/>";
        rqvalue += " </Criterion>";
        rqvalue += "</HotelSearchCriteria>";
        rqvalue += "<RatePlanCandidates><RateRange CurrencyCode='" + hpc.CurrencyCode + "'/></RatePlanCandidates>";
        rqvalue += " <TimeSpan End='" + hpc.checkout + "' Start='" + hpc.checkin + "' />";
        rqvalue += "  </AvailRequestSegment>";
        rqvalue += "</HotelPropertyDescriptionRQ>";
        rqvalue += "</SOAP-ENV:Body>";
        return(rqvalue);
    }
    //public  HotelProperty  GetData(string SearchID,string contextresult,string hotelcode )
    public HotelProperty GetData(string SearchID, string hotelcode)
    {
        HotelProperty hpr             = null;
        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, "HotelProperty/" + searchid + "_" + hotelcode + "_PropertyData.xml");
            string filePathRQ = Path.Combine(HttpRuntime.AppDomainAppPath, "HotelXML/" + searchid + "_propertydesc_" + hotelcode + "-RS.xml");
            if (File.Exists(filePathRQ))
            {
                string result = File.ReadAllText(filePathRQ);
                hpr = new HotelProperty(result, hotelcode, searchid);
            }
            else
            {
                DataTable    dssearch = HotelDBLayer.GetSearch(searchid);
                HPDCondition Hapc     = GetCondition(hotelcode);
                hpr = new HotelProperty(Hapc, ContextResult, searchid);
                if (!File.Exists(filePathRQ))
                {
                    File.WriteAllText(filePathRQ, hpr.PropertyXmlResult);
                }
            }
        }
        catch { }
        return(hpr);
    }
    private HPDCondition GetCondition(string hotelcode, string CurrencyCode, string BookinID)
    {
        HPDCondition Hapc       = new HPDCondition();
        DataTable    dssearch   = HotelDBLayer.GetSearchFromBookingID(BookinID);
        int          guestcount = Convert.ToInt16(dssearch.Rows[0]["Adults"].ToString()) + Convert.ToInt16(dssearch.Rows[0]["Children"].ToString());

        try { Hapc.HotelCode = hotelcode; }
        catch { Hapc.HotelCode = ""; }
        try { Hapc.checkin = Convert.ToDateTime(dssearch.Rows[0]["CheckInDt"]).ToString("MM-dd"); }
        catch { Hapc.checkin = ""; }
        try { Hapc.checkout = Convert.ToDateTime(dssearch.Rows[0]["CheckOutDt"]).ToString("MM-dd"); }
        catch { Hapc.checkout = ""; }
        try { Hapc.guestcount = guestcount.ToString(); }
        catch { Hapc.guestcount = ""; }
        if (CurrencyCode == "")
        {
            Hapc.CurrencyCode = "USD";
        }
        else
        {
            Hapc.CurrencyCode = CurrencyCode;
        }
        return(Hapc);
    }