Esempio n. 1
0
        //[OutputCache(Duration = 100, VaryByParam = "*")]
        public JsonResult GetLocalityNames(string txt, string PlaceId, string Type, string sRequestType)
        {
            int itype    = 0;
            int iReqType = 0;

            switch (Type)
            {
            case "City":
                itype = 3;
                break;

            case "Area":
                itype = 4;
                break;

            case "Locality":
                itype = 5;
                break;
            }

            switch (sRequestType)
            {
            case "buy":
                iReqType = 0;
                break;

            case "negotiate":
                iReqType = 1;
                break;
            }
            List <eDropDown> data = BL_WebSiteSearchPage.GetAllHotelsLocality(txt, Convert.ToInt32(PlaceId), itype, iReqType);

            return(Json(data, JsonRequestBehavior.AllowGet));
        }
Esempio n. 2
0
        // [OutputCache(Duration = 10, VaryByParam = "*")] // Cached for 10 second
        public ActionResult Index(PropSearchRequestModel model)
        {
            try
            {
                eWebSiteSearchPage obj = new eWebSiteSearchPage();
                obj.HotelFacilityItems = BL_WebSiteSearchPage.GetAllHotelFacilities("");
                obj.RoomFacilityItems  = BL_WebSiteSearchPage.GetAllRoomFacilities("");
                model.sRequestType     = model.sRequestType ?? "buy";
                obj.sRequestType       = model.sRequestType;
                string currencySymbol = string.Empty;

                var hotelList = GetHotelSearchData(model, out currencySymbol);
                obj.PropertySearchedList = hotelList;
                obj.TotalPropertySearchedList.AddRange(obj.PropertySearchedList);
                obj.sCurrencySymbol       = currencySymbol;
                obj.dExchangeRate         = 1;
                Session["PropSearchList"] = obj;

                if (CurrencyCode != "INR")
                {
                    etblExchangeRatesM objExchange = BL_ExchangeRate.GetSingleRecordById("INR", CurrencyCode);
                    if (objExchange.dRate.HasValue)
                    {
                        obj.dExchangeRate = objExchange.dRate.Value;
                    }
                }
                TempData.Keep();
                return(View(obj));
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Esempio n. 3
0
        public JsonResult ToggleFavorite(string iPropId)
        {
            int retrn = BL_WebSiteSearchPage.ToggleFavs(iPropId, User.Identity.GetUserId <long>().ToString());

            if (retrn == 1)
            {
                return(Json(new { status = true }, JsonRequestBehavior.AllowGet));
            }
            else
            {
                return(Json(new { status = false }, JsonRequestBehavior.AllowGet));
            }
        }
Esempio n. 4
0
        //[OutputCache(Duration = 60, VaryByParam = "*")]
        public JsonResult GetHotelNames(string txt, string placeId, string type, string sRequestType)
        {
            int itype    = 0;
            int iReqType = 0;

            switch (type)
            {
            case "City":
                itype = 3;
                break;

            case "Area":
                itype = 4;
                break;

            case "Locality":
                itype = 5;
                break;
            }

            switch (sRequestType)
            {
            case "buy":
                iReqType = 0;
                break;

            case "negotiate":
                iReqType = 1;
                break;
            }

            //List<eDropDown> data = new List<eDropDown>();

            List <eDropDown> data = BL_WebSiteSearchPage.GetAllHotels(txt, Convert.ToInt32(placeId), itype, iReqType);

            //var propertySearchedList = Session["PropNameSearchList"] as List<eDropDown>;

            //if (propertySearchedList != null && propertySearchedList.Count > 0)
            //{
            //    data = propertySearchedList.Where(x => x.Name.ToLower().Contains(txt.ToLower())).ToList();
            //}

            return(Json(data, JsonRequestBehavior.AllowGet));
        }
Esempio n. 5
0
        private List <PropSearchResponseModel> Get_TG_HotelSearchData(PropSearchRequestModel model, out decimal dExchangeRate)
        {
            var     hotelSearchDataTG = new List <PropSearchResponseModel>();
            decimal sExchangeRate     = 1;

            try
            {
                if (model != null)
                {
                    var roomDataResult = new List <RoomData>();
                    if (model.sRoomData != null)
                    {
                        roomDataResult = new JavaScriptSerializer().Deserialize <List <RoomData> >(model.sRoomData);
                    }

                    DataTable dtTblRoomOccupancySearch = new DataTable();
                    dtTblRoomOccupancySearch.Columns.AddRange(new DataColumn[3]
                    {
                        new DataColumn("ID", typeof(int)),
                        new DataColumn("iAdults", typeof(short)),
                        new DataColumn("children", typeof(short))
                    });

                    DataTable dtTblChildrenAgeSearch = new DataTable();
                    dtTblChildrenAgeSearch.Columns.AddRange(new DataColumn[2]
                    {
                        new DataColumn("ID", typeof(int)),
                        new DataColumn("Age", typeof(short))
                    });


                    foreach (var room in roomDataResult)
                    {
                        DataRow roomOccupancy = dtTblRoomOccupancySearch.NewRow();
                        roomOccupancy["ID"]       = room.room;
                        roomOccupancy["iAdults"]  = room.adult;
                        roomOccupancy["children"] = room.child;
                        dtTblRoomOccupancySearch.Rows.Add(roomOccupancy);

                        foreach (var child in room.ChildAge)
                        {
                            DataRow dtChildrenAge = dtTblChildrenAgeSearch.NewRow();
                            dtChildrenAge["ID"]  = room.room;
                            dtChildrenAge["Age"] = child.Age;
                            dtTblChildrenAgeSearch.Rows.Add(dtChildrenAge);
                        }
                    }

                    var dbRequestParamModel = model.GetThisWithRoomAndHotelFailities();

                    dbRequestParamModel.dtCheckIn  = DateTime.Parse(model.sCheckIn ?? DateTime.Now.ToShortDateString());
                    dbRequestParamModel.dtCheckOut = DateTime.Parse(model.sCheckOut ?? DateTime.Now.ToShortDateString());
                    if (!string.IsNullOrEmpty(model.sHotelSearch))
                    {
                        model.iAreaType = 0;
                    }
                    else if (model.ctype == "City")
                    {
                        model.iAreaType = 3;
                    }
                    else if (model.ctype == "Area")
                    {
                        model.iAreaType = 4;
                    }
                    else if (model.ctype == "Locality")
                    {
                        model.iAreaType = 5;
                    }

                    model.bLogin  = User.Identity.IsAuthenticated;
                    model.iUserId = User.Identity.GetUserId <long>();

                    if (model.sRequestType.ToLower() == "buy" && model.isSpecialDeal == false)
                    {
                        var responseDB_DataTG = BL_WebSiteSearchPage.GetHotelsForTG(dbRequestParamModel, dtTblRoomOccupancySearch, dtTblChildrenAgeSearch, CurrencyCode, out sExchangeRate);
                        if (responseDB_DataTG.Count > 0)
                        {
                            //To get the real time data from the travel guru
                            var api_responseTG_Data = clsSearchHotel.FetchMultiVendorOfDB(responseDB_DataTG, dtTblRoomOccupancySearch, dtTblChildrenAgeSearch, dbRequestParamModel.dtCheckIn.ToString("yyyy-MM-dd"), dbRequestParamModel.dtCheckOut.ToString("yyyy-MM-dd"), sExchangeRate, model.dMinPrice, model.dMaxPrice);
                            if (api_responseTG_Data.Count > 0)
                            {
                                hotelSearchDataTG.AddRange(api_responseTG_Data);
                            }
                        }
                    }
                }
            }
            catch (Exception)
            {
                throw;
            }

            dExchangeRate = sExchangeRate;

            return(hotelSearchDataTG);
        }