Exemplo n.º 1
0
        public long GDSRateSave(CLayer.GDSRates data)
        {
            List <DataPlug.Parameter> param = new List <DataPlug.Parameter>();
            Boolean isB2c = (data.RateFor == (int)CLayer.Role.Roles.Customer);

            param.Add(Connection.GetParameter("pRateId", DataPlug.DataType._BigInt, data.RateId));
            param.Add(Connection.GetParameter("pAccommodationId", DataPlug.DataType._BigInt, data.AccommodationId));
            param.Add(Connection.GetParameter("pRateFor", DataPlug.DataType._Int, data.RateFor));
            param.Add(Connection.GetParameter("pRate", DataPlug.DataType._Decimal, Math.Round(data.Rate)));
            param.Add(Connection.GetParameter("pStartDate", DataPlug.DataType._Date, data.StartDate));
            param.Add(Connection.GetParameter("pEndDate", DataPlug.DataType._Date, data.EndDate));
            param.Add(Connection.GetParameter("pStatus", DataPlug.DataType._Int, data.Status));
            param.Add(Connection.GetParameter("pUpdatedBy", DataPlug.DataType._BigInt, data.UpdatedBy));
            param.Add(Connection.GetParameter("pBookingCode", DataPlug.DataType._Varchar, data.BookingCode));

            object obj = Connection.ExecuteQueryScalar("gdsrates_Save", param);

            return(Connection.ToLong(obj));
        }
Exemplo n.º 2
0
        public bool UpdatePropertyRates()
        {
            bool   Output = false;
            long   id1    = 0;
            string start  = "";
            string End    = "";

            try
            {
                String hotelcode = string.Empty;

                List <CLayer.Property> objProperties = BLayer.Property.GetAllGDSPropertiesRecommended().ToList();

                CLayer.GDSBookingDetails.Envelope    ss    = new CLayer.GDSBookingDetails.Envelope();
                CLayer.GDSBookingDetailsAdv.Envelope ssAdv = new CLayer.GDSBookingDetailsAdv.Envelope();// ser.Deserialize<CLayer.GDSBookingDetailsAdv.Envelope>(hotel);
                long id = 0;
                foreach (var pitem in objProperties)
                {
                    try
                    {
                        StringBuilder Description = new StringBuilder();
                        Serializer    ser         = new Serializer();
                        id  = pitem.PropertyId;
                        id1 = id;
                        string HotelCode  = pitem.HotelID;
                        string GDSCountry = pitem.Countryname;

                        //    string hotel = GetGDS_Hotel_Details(HotelCode);


                        start = DateTime.Now.Date.AddDays(1).ToString("yyyy-MM-dd");
                        End   = DateTime.Now.Date.AddDays(2).ToString("yyyy-MM-dd");

                        #region Rate Calculation
                        string result = HotelMultiSingleAvailability(HotelCode, start, End);

                        Serializer ser1 = new Serializer();
                        CLayer.HotelAvailability.Envelope              HotelResult         = new CLayer.HotelAvailability.Envelope();
                        CLayer.HotelAvailabilityAdvanced.Envelope      HotelResultAdv      = new CLayer.HotelAvailabilityAdvanced.Envelope();
                        CLayer.HotelAvailabilityAdvancedFirst.Envelope HotelResultAdvFirst = new CLayer.HotelAvailabilityAdvancedFirst.Envelope();


                        try
                        {
                            HotelResult = ser1.Deserialize <CLayer.HotelAvailability.Envelope>(result);
                        }
                        catch (Exception ex)
                        {
                            try
                            {
                                HotelResultAdv = ser1.Deserialize <CLayer.HotelAvailabilityAdvanced.Envelope>(result);
                            }
                            catch (Exception ex1)
                            {
                                HotelResultAdvFirst = ser1.Deserialize <CLayer.HotelAvailabilityAdvancedFirst.Envelope>(result);
                            }
                        }
                        if (HotelResult.Body != null)
                        {
                            decimal GDSRateConversion = 0;
                            string  GDSCurrencyCode   = "INR";
                            if (HotelResult.Body.OTA_HotelAvailRS.CurrencyConversions != null)
                            {
                                var item = HotelResult.Body.OTA_HotelAvailRS.CurrencyConversions;
                                CLayer.GDSCurrencyConversions objCurrencyConversion = new CLayer.GDSCurrencyConversions();
                                objCurrencyConversion.RateConversion = item.CurrencyConversion.RateConversion;
                                GDSRateConversion = objCurrencyConversion.RateConversion;
                                objCurrencyConversion.DecimalPlaces         = item.CurrencyConversion.DecimalPlaces;
                                objCurrencyConversion.RequestedCurrencyCode = item.CurrencyConversion.RequestedCurrencyCode;
                                objCurrencyConversion.SourceCurrencyCode    = item.CurrencyConversion.SourceCurrencyCode;
                                GDSCurrencyCode = objCurrencyConversion.SourceCurrencyCode;
                                //  Session["GDSCurrencyConversion"] = objCurrencyConversion;
                            }
                            //if (GDSCountry == "")
                            //{
                            //     Session["GDSCurrencyConversion"] = null;
                            //}


                            if (HotelResult.Body.OTA_HotelAvailRS.HotelStays != null)
                            {
                                foreach (var item in HotelResult.Body.OTA_HotelAvailRS.HotelStays)
                                {
                                    //    InventoryAPIType = (int)CLayer.ObjectStatus.InventoryAPIType.Amadeus;
                                    string HotelId = item.BasicPropertyInfo.HotelCode;

                                    List <CLayer.Accommodation> objAcc = BLayer.Accommodation.GetAllAccByPropertyid(id);

                                    long   AccomodationId = 0;
                                    string RoomStayRPH    = item.RoomStayRPH;
                                    List <CLayer.RoomStaysResult> RoomStaysResultList = new List <CLayer.RoomStaysResult>();
                                    if (!string.IsNullOrEmpty(RoomStayRPH))
                                    {
                                        string[] RoomStayRPHList = RoomStayRPH.Split(' ');
                                        RoomStaysResultList = GetRoomStays(HotelResult.Body.OTA_HotelAvailRS.RoomStays, RoomStayRPHList, GDSCurrencyCode, GDSRateConversion);
                                    }
                                    CultureInfo culture = CultureInfo.CurrentCulture;

                                    CLayer.GDSRates Rdata       = new CLayer.GDSRates();
                                    string          BookingCode = RoomStaysResultList.OrderBy(x => x.AmountAfterTax).FirstOrDefault().BookingCode;
                                    Rdata.Rate    = RoomStaysResultList.OrderBy(x => x.AmountAfterTax).FirstOrDefault().AmountAfterTax;
                                    Rdata.RateFor = 2;
                                    long userId = 0;
                                    Rdata.UpdatedBy       = 1;
                                    Rdata.StartDate       = DateTime.Parse(start, CultureInfo.CurrentCulture);
                                    Rdata.EndDate         = DateTime.Parse(End, CultureInfo.CurrentCulture);
                                    Rdata.BookingCode     = BookingCode;
                                    Rdata.Status          = 1;
                                    Rdata.AccommodationId = objAcc.Where(X => X.BookingCode == BookingCode).FirstOrDefault().AccommodationId;
                                    long gdsRateId = BLayer.Rate.GDSRateSave(Rdata);
                                }
                            }
                            else
                            {
                                start = DateTime.Now.Date.AddDays(4).ToString("yyyy-MM-dd");
                                End   = DateTime.Now.Date.AddDays(5).ToString("yyyy-MM-dd");
                                UpdateGDSRate(id, HotelCode, start, End);
                            }
                        }

                        #endregion
                    }
                    catch (Exception ex)
                    {
                        LogHandler.AddLog("Error rate updation-Hotel ID" + id.ToString());
                    }
                }

                Output = true;
            }
            catch (Exception ex)
            {
                LogHandler.AddLog(ex.Message);
                string a = id1.ToString();
                Output = false;
                //#region Transaction Log
                //APIUtility.GenerateGDSTransactionLog("", "BulkImageandDescriptionFailure", 0, (int)CLayer.ObjectStatus.GDSType.BulkHotelImageDescriptionUpdation, 0);
                //#endregion Transaction Log end
                throw ex;
            }
            return(Output);
        }
Exemplo n.º 3
0
        public ActionResult Save(Models.RecommendedModel data)
        {
            string start = "";
            string End   = "";

            try
            {
                if (ModelState.IsValid)
                {
                    DateTime           tda = DateTime.Today;
                    CLayer.Recommended rec = new CLayer.Recommended();
                    if (data.PropertyId == 0)
                    {
                        RedirectToAction("Index");
                    }
                    int InventoryAPIType = BLayer.Property.GetInventoryAPITypeId(data.PropertyId);
                    if (InventoryAPIType == (int)CLayer.ObjectStatus.InventoryAPIType.Amadeus)
                    {
                        rec.PropertyId = data.PropertyId;
                        DataTable dtHoelCode = BLayer.Property.GetHotelIDFrompropertyid(rec.PropertyId);
                        var       hotelcode  = dtHoelCode.Rows[0]["Hotel_Id"].ToString();
                        start = DateTime.Now.Date.AddDays(1).ToString("yyyy-MM-dd");
                        End   = DateTime.Now.Date.AddDays(2).ToString("yyyy-MM-dd");

                        #region Rate Calculation
                        string result = HotelMultiSingleAvailability(hotelcode, start, End);

                        StayBazar.Common.Serializer                    ser1                = new StayBazar.Common.Serializer();
                        CLayer.HotelAvailability.Envelope              HotelResult         = new CLayer.HotelAvailability.Envelope();
                        CLayer.HotelAvailabilityAdvanced.Envelope      HotelResultAdv      = new CLayer.HotelAvailabilityAdvanced.Envelope();
                        CLayer.HotelAvailabilityAdvancedFirst.Envelope HotelResultAdvFirst = new CLayer.HotelAvailabilityAdvancedFirst.Envelope();


                        try
                        {
                            HotelResult = ser1.Deserialize <CLayer.HotelAvailability.Envelope>(result);
                        }
                        catch (Exception ex)
                        {
                            try
                            {
                                HotelResultAdv = ser1.Deserialize <CLayer.HotelAvailabilityAdvanced.Envelope>(result);
                            }
                            catch (Exception ex1)
                            {
                                HotelResultAdvFirst = ser1.Deserialize <CLayer.HotelAvailabilityAdvancedFirst.Envelope>(result);
                            }
                        }
                        if (HotelResult.Body != null)
                        {
                            if (HotelResult.Body.OTA_HotelAvailRS.CurrencyConversions != null)
                            {
                                var item = HotelResult.Body.OTA_HotelAvailRS.CurrencyConversions;
                                CLayer.GDSCurrencyConversions objCurrencyConversion = new CLayer.GDSCurrencyConversions();
                                objCurrencyConversion.RateConversion        = item.CurrencyConversion.RateConversion;
                                Session["GDSRateConversion"]                = objCurrencyConversion.RateConversion;
                                objCurrencyConversion.DecimalPlaces         = item.CurrencyConversion.DecimalPlaces;
                                objCurrencyConversion.RequestedCurrencyCode = item.CurrencyConversion.RequestedCurrencyCode;
                                objCurrencyConversion.SourceCurrencyCode    = item.CurrencyConversion.SourceCurrencyCode;
                                Session["GDSCurrencyConversion"]            = objCurrencyConversion;
                            }
                            if (Convert.ToString(Session["GDSCountry"]) == "")
                            {
                                Session["GDSCurrencyConversion"] = null;
                            }


                            if (HotelResult.Body.OTA_HotelAvailRS.HotelStays != null)
                            {
                                foreach (var item in HotelResult.Body.OTA_HotelAvailRS.HotelStays)
                                {
                                    InventoryAPIType = (int)CLayer.ObjectStatus.InventoryAPIType.Amadeus;
                                    string HotelId = item.BasicPropertyInfo.HotelCode;

                                    List <CLayer.Accommodation> objAcc = BLayer.Accommodation.GetAllAccByPropertyid(rec.PropertyId);

                                    long   AccomodationId = 0;
                                    string RoomStayRPH    = item.RoomStayRPH;
                                    List <CLayer.RoomStaysResult> RoomStaysResultList = new List <CLayer.RoomStaysResult>();
                                    if (!string.IsNullOrEmpty(RoomStayRPH))
                                    {
                                        string[] RoomStayRPHList = RoomStayRPH.Split(' ');
                                        RoomStaysResultList = StayBazar.Controllers.PropertyController.GetRoomStays(HotelResult.Body.OTA_HotelAvailRS.RoomStays, RoomStayRPHList, Convert.ToString(Session["GDSCurrencyCode"]), Convert.ToDecimal(Session["GDSRateConversion"]));
                                    }
                                    CultureInfo culture = CultureInfo.CurrentCulture;

                                    CLayer.GDSRates Rdata       = new CLayer.GDSRates();
                                    string          BookingCode = RoomStaysResultList.OrderBy(x => x.AmountAfterTax).FirstOrDefault().BookingCode;
                                    Rdata.Rate    = RoomStaysResultList.OrderBy(x => x.AmountAfterTax).FirstOrDefault().AmountAfterTax;
                                    Rdata.RateFor = data.ManageFor;
                                    long userId = 0;
                                    long.TryParse(User.Identity.GetUserId(), out userId);
                                    Rdata.UpdatedBy       = userId;
                                    Rdata.StartDate       = DateTime.Parse(start, CultureInfo.CurrentCulture);
                                    Rdata.EndDate         = DateTime.Parse(End, CultureInfo.CurrentCulture);
                                    Rdata.BookingCode     = BookingCode;
                                    Rdata.Status          = 1;
                                    Rdata.AccommodationId = objAcc.Where(X => X.BookingCode == BookingCode).FirstOrDefault().AccommodationId;
                                    long gdsRateId = BLayer.Rate.GDSRateSave(Rdata);
                                }
                            }
                        }
                        else if (HotelResultAdvFirst.Body != null)
                        {
                            if (HotelResultAdvFirst.Body.OTA_HotelAvailRS.CurrencyConversions != null)
                            {
                                var itemAdv = HotelResultAdvFirst.Body.OTA_HotelAvailRS.CurrencyConversions;
                                CLayer.GDSCurrencyConversions objCurrencyConversion = new CLayer.GDSCurrencyConversions();
                                objCurrencyConversion.RateConversion        = itemAdv.CurrencyConversion.RateConversion;
                                Session["GDSRateConversion"]                = objCurrencyConversion.RateConversion;
                                objCurrencyConversion.DecimalPlaces         = itemAdv.CurrencyConversion.DecimalPlaces;
                                objCurrencyConversion.RequestedCurrencyCode = itemAdv.CurrencyConversion.RequestedCurrencyCode;
                                objCurrencyConversion.SourceCurrencyCode    = itemAdv.CurrencyConversion.SourceCurrencyCode;
                                Session["GDSCurrencyConversion"]            = objCurrencyConversion;
                            }
                            if (Convert.ToString(Session["GDSCountry"]) == "")
                            {
                                Session["GDSCurrencyConversion"] = null;
                            }

                            if (HotelResultAdvFirst.Body.OTA_HotelAvailRS.HotelStays != null)
                            {
                                foreach (var item in HotelResult.Body.OTA_HotelAvailRS.HotelStays)
                                {
                                    InventoryAPIType = (int)CLayer.ObjectStatus.InventoryAPIType.Amadeus;
                                    string HotelId = item.BasicPropertyInfo.HotelCode;

                                    List <CLayer.Accommodation> objAcc = BLayer.Accommodation.GetAllAccByPropertyid(rec.PropertyId);

                                    long   AccomodationId = 0;
                                    string RoomStayRPH    = item.RoomStayRPH;
                                    List <CLayer.RoomStaysResult> RoomStaysResultList = new List <CLayer.RoomStaysResult>();
                                    if (!string.IsNullOrEmpty(RoomStayRPH))
                                    {
                                        string[] RoomStayRPHList = RoomStayRPH.Split(' ');
                                        RoomStaysResultList = StayBazar.Controllers.PropertyController.GetRoomStays(HotelResult.Body.OTA_HotelAvailRS.RoomStays, RoomStayRPHList, Convert.ToString(Session["GDSCurrencyCode"]), Convert.ToDecimal(Session["GDSRateConversion"]));
                                    }
                                    CultureInfo culture = CultureInfo.CurrentCulture;

                                    CLayer.GDSRates Rdata       = new CLayer.GDSRates();
                                    string          BookingCode = RoomStaysResultList.OrderBy(x => x.AmountAfterTax).FirstOrDefault().BookingCode;
                                    Rdata.Rate    = RoomStaysResultList.OrderBy(x => x.AmountAfterTax).FirstOrDefault().AmountAfterTax;
                                    Rdata.RateFor = data.ManageFor;
                                    long userId = 0;
                                    long.TryParse(User.Identity.GetUserId(), out userId);
                                    Rdata.UpdatedBy       = userId;
                                    Rdata.StartDate       = DateTime.Parse(start, CultureInfo.CurrentCulture);
                                    Rdata.EndDate         = DateTime.Parse(End, CultureInfo.CurrentCulture);
                                    Rdata.BookingCode     = BookingCode;
                                    Rdata.Status          = 1;
                                    Rdata.AccommodationId = objAcc.Where(X => X.BookingCode == BookingCode).FirstOrDefault().AccommodationId;
                                    long gdsRateId = BLayer.Rate.GDSRateSave(Rdata);
                                }
                            }
                        }
                        #endregion

                        DateTime.TryParse(data.StartDate, out tda);
                        rec.StartDate = tda;
                        tda           = DateTime.Today;
                        DateTime.TryParse(data.EndDate, out tda);
                        rec.EndDate   = tda;
                        rec.Order     = data.Order;
                        rec.Status    = data.Status;
                        rec.ManageFor = data.ManageFor;
                        long userid = 0;
                        long.TryParse(User.Identity.GetUserId(), out userid);
                        rec.UpdatedBy = userid;
                    }
                    else
                    {
                        rec.PropertyId = data.PropertyId;
                        DateTime.TryParse(data.StartDate, out tda);
                        rec.StartDate = tda;
                        tda           = DateTime.Today;
                        DateTime.TryParse(data.EndDate, out tda);
                        rec.EndDate   = tda;
                        rec.Order     = data.Order;
                        rec.Status    = data.Status;
                        rec.ManageFor = data.ManageFor;
                        long userid = 0;
                        long.TryParse(User.Identity.GetUserId(), out userid);
                        rec.UpdatedBy = userid;
                    }
                    //         BLayer.Recommended.Save(rec);
                    rec.StartDate = DateTime.Parse(start, CultureInfo.CurrentCulture);
                    rec.EndDate   = DateTime.Parse(End, CultureInfo.CurrentCulture);

                    BLayer.Recommended.SaveWithGDS(rec);
                }
            }
            catch (Exception ex)
            {
                Common.LogHandler.HandleError(ex);
                RedirectToAction("Index", "ErrorPage");
            }
            ////   RedirectToAction("Index", "Recommended", new { area = "Admin" });
            return(RedirectToAction("Index", "Recommended", new { area = "Admin" }));
        }
Exemplo n.º 4
0
        public void UpdateGDSRate(long PropertyID, string HotelCode, string Start, string End)
        {
            long id = PropertyID;


            try
            {
                #region Rate Calculation
                string result = HotelMultiSingleAvailability(HotelCode, Start, End);

                Serializer ser1 = new Serializer();
                CLayer.HotelAvailability.Envelope              HotelResult         = new CLayer.HotelAvailability.Envelope();
                CLayer.HotelAvailabilityAdvanced.Envelope      HotelResultAdv      = new CLayer.HotelAvailabilityAdvanced.Envelope();
                CLayer.HotelAvailabilityAdvancedFirst.Envelope HotelResultAdvFirst = new CLayer.HotelAvailabilityAdvancedFirst.Envelope();


                try
                {
                    HotelResult = ser1.Deserialize <CLayer.HotelAvailability.Envelope>(result);
                }
                catch (Exception ex)
                {
                    try
                    {
                        HotelResultAdv = ser1.Deserialize <CLayer.HotelAvailabilityAdvanced.Envelope>(result);
                    }
                    catch (Exception ex1)
                    {
                        HotelResultAdvFirst = ser1.Deserialize <CLayer.HotelAvailabilityAdvancedFirst.Envelope>(result);
                    }
                }
                if (HotelResult.Body != null)
                {
                    decimal GDSRateConversion = 0;
                    string  GDSCurrencyCode   = "INR";
                    if (HotelResult.Body.OTA_HotelAvailRS.CurrencyConversions != null)
                    {
                        var item = HotelResult.Body.OTA_HotelAvailRS.CurrencyConversions;
                        CLayer.GDSCurrencyConversions objCurrencyConversion = new CLayer.GDSCurrencyConversions();
                        objCurrencyConversion.RateConversion = item.CurrencyConversion.RateConversion;
                        GDSRateConversion = objCurrencyConversion.RateConversion;
                        objCurrencyConversion.DecimalPlaces         = item.CurrencyConversion.DecimalPlaces;
                        objCurrencyConversion.RequestedCurrencyCode = item.CurrencyConversion.RequestedCurrencyCode;
                        objCurrencyConversion.SourceCurrencyCode    = item.CurrencyConversion.SourceCurrencyCode;
                        GDSCurrencyCode = objCurrencyConversion.SourceCurrencyCode;
                        //  Session["GDSCurrencyConversion"] = objCurrencyConversion;
                    }
                    //if (GDSCountry == "")
                    //{
                    //     Session["GDSCurrencyConversion"] = null;
                    //}


                    if (HotelResult.Body.OTA_HotelAvailRS.HotelStays != null)
                    {
                        foreach (var item in HotelResult.Body.OTA_HotelAvailRS.HotelStays)
                        {
                            //    InventoryAPIType = (int)CLayer.ObjectStatus.InventoryAPIType.Amadeus;
                            string HotelId = item.BasicPropertyInfo.HotelCode;

                            List <CLayer.Accommodation> objAcc = BLayer.Accommodation.GetAllAccByPropertyid(id);

                            long   AccomodationId = 0;
                            string RoomStayRPH    = item.RoomStayRPH;
                            List <CLayer.RoomStaysResult> RoomStaysResultList = new List <CLayer.RoomStaysResult>();
                            if (!string.IsNullOrEmpty(RoomStayRPH))
                            {
                                string[] RoomStayRPHList = RoomStayRPH.Split(' ');
                                RoomStaysResultList = GetRoomStays(HotelResult.Body.OTA_HotelAvailRS.RoomStays, RoomStayRPHList, GDSCurrencyCode, GDSRateConversion);
                            }
                            CultureInfo culture = CultureInfo.CurrentCulture;

                            CLayer.GDSRates Rdata       = new CLayer.GDSRates();
                            string          BookingCode = RoomStaysResultList.OrderBy(x => x.AmountAfterTax).FirstOrDefault().BookingCode;
                            Rdata.Rate    = RoomStaysResultList.OrderBy(x => x.AmountAfterTax).FirstOrDefault().AmountAfterTax;
                            Rdata.RateFor = 2;
                            long userId = 0;
                            Rdata.UpdatedBy       = 1;
                            Rdata.StartDate       = DateTime.Parse(Start, CultureInfo.CurrentCulture);
                            Rdata.EndDate         = DateTime.Parse(End, CultureInfo.CurrentCulture);
                            Rdata.BookingCode     = BookingCode;
                            Rdata.Status          = 1;
                            Rdata.AccommodationId = objAcc.Where(X => X.BookingCode == BookingCode).FirstOrDefault().AccommodationId;
                            long gdsRateId = BLayer.Rate.GDSRateSave(Rdata);
                        }
                    }
                    else
                    {
                        //Start = DateTime.Now.Date.AddDays(9).ToString("yyyy-MM-dd");
                        //End = DateTime.Now.Date.AddDays(10).ToString("yyyy-MM-dd");
                        //UpdateGDSRates(PropertyID, HotelCode, Start, End);
                    }
                }

                #endregion
            }
            catch (Exception ex)
            {
                #region Rate Calculation
                string result = HotelMultiSingleAvailability(HotelCode, Start, End);

                Serializer ser1 = new Serializer();
                CLayer.HotelAvailability.Envelope              HotelResult         = new CLayer.HotelAvailability.Envelope();
                CLayer.HotelAvailabilityAdvanced.Envelope      HotelResultAdv      = new CLayer.HotelAvailabilityAdvanced.Envelope();
                CLayer.HotelAvailabilityAdvancedFirst.Envelope HotelResultAdvFirst = new CLayer.HotelAvailabilityAdvancedFirst.Envelope();


                try
                {
                    HotelResult = ser1.Deserialize <CLayer.HotelAvailability.Envelope>(result);
                }
                catch (Exception ex2)
                {
                    try
                    {
                        HotelResultAdv = ser1.Deserialize <CLayer.HotelAvailabilityAdvanced.Envelope>(result);
                    }
                    catch (Exception ex1)
                    {
                        HotelResultAdvFirst = ser1.Deserialize <CLayer.HotelAvailabilityAdvancedFirst.Envelope>(result);
                    }
                }
                if (HotelResult.Body != null)
                {
                    decimal GDSRateConversion = 0;
                    string  GDSCurrencyCode   = "INR";
                    if (HotelResult.Body.OTA_HotelAvailRS.CurrencyConversions != null)
                    {
                        var item = HotelResult.Body.OTA_HotelAvailRS.CurrencyConversions;
                        CLayer.GDSCurrencyConversions objCurrencyConversion = new CLayer.GDSCurrencyConversions();
                        objCurrencyConversion.RateConversion = item.CurrencyConversion.RateConversion;
                        GDSRateConversion = objCurrencyConversion.RateConversion;
                        objCurrencyConversion.DecimalPlaces         = item.CurrencyConversion.DecimalPlaces;
                        objCurrencyConversion.RequestedCurrencyCode = item.CurrencyConversion.RequestedCurrencyCode;
                        objCurrencyConversion.SourceCurrencyCode    = item.CurrencyConversion.SourceCurrencyCode;
                        GDSCurrencyCode = objCurrencyConversion.SourceCurrencyCode;
                        //  Session["GDSCurrencyConversion"] = objCurrencyConversion;
                    }
                    //if (GDSCountry == "")
                    //{
                    //     Session["GDSCurrencyConversion"] = null;
                    //}


                    if (HotelResult.Body.OTA_HotelAvailRS.HotelStays != null)
                    {
                        foreach (var item in HotelResult.Body.OTA_HotelAvailRS.HotelStays)
                        {
                            //    InventoryAPIType = (int)CLayer.ObjectStatus.InventoryAPIType.Amadeus;
                            string HotelId = item.BasicPropertyInfo.HotelCode;

                            List <CLayer.Accommodation> objAcc = BLayer.Accommodation.GetAllAccByPropertyid(id);

                            long   AccomodationId = 0;
                            string RoomStayRPH    = item.RoomStayRPH;
                            List <CLayer.RoomStaysResult> RoomStaysResultList = new List <CLayer.RoomStaysResult>();
                            if (!string.IsNullOrEmpty(RoomStayRPH))
                            {
                                string[] RoomStayRPHList = RoomStayRPH.Split(' ');
                                RoomStaysResultList = GetRoomStays(HotelResult.Body.OTA_HotelAvailRS.RoomStays, RoomStayRPHList, GDSCurrencyCode, GDSRateConversion);
                            }
                            CultureInfo culture = CultureInfo.CurrentCulture;

                            CLayer.GDSRates Rdata       = new CLayer.GDSRates();
                            string          BookingCode = RoomStaysResultList.OrderBy(x => x.AmountAfterTax).FirstOrDefault().BookingCode;
                            Rdata.Rate    = RoomStaysResultList.OrderBy(x => x.AmountAfterTax).FirstOrDefault().AmountAfterTax;
                            Rdata.RateFor = 2;
                            long userId = 0;
                            Rdata.UpdatedBy       = 1;
                            Rdata.StartDate       = DateTime.Parse(Start, CultureInfo.CurrentCulture);
                            Rdata.EndDate         = DateTime.Parse(End, CultureInfo.CurrentCulture);
                            Rdata.BookingCode     = BookingCode;
                            Rdata.Status          = 1;
                            Rdata.AccommodationId = objAcc.Where(X => X.BookingCode == BookingCode).FirstOrDefault().AccommodationId;
                            long gdsRateId = BLayer.Rate.GDSRateSave(Rdata);
                        }
                    }
                    else
                    {
                    }
                }

                #endregion
            }
        }
Exemplo n.º 5
0
        public static long GDSRateSave(CLayer.GDSRates data)
        {
            DataLayer.Rate dr = new DataLayer.Rate();

            return(dr.GDSRateSave(data));
        }