public string Get(string searchid, string hcode, string checkin, string checkout, string gc, string CurrencyCode, string b2c_idn, string Totelguest, string childs)
        {
            ManageHDetAj mhd = new ManageHDetAj();
            string       hpr = GetDataroom(searchid, hcode, CurrencyCode, b2c_idn);

            return(hpr);
        }
Пример #2
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);
        }
        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);
        }
Пример #5
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);
        }