Beispiel #1
0
        public ActionResult UpdateBookingOnUpgrade(BiddingHotelsUpgrade obj)
        {
            try
            {
                // TempData.Peek("BIdUpgradeHotels");
                //TempData.Peek("BidSearchHotels");
                //  TempData.Peek("BidSearchData");
                int bookingId, PropId;
                PropId    = obj.iPropId;
                bookingId = obj.iBookingId;

                eBidBookingResult Robj = BL_Bidding.UpdateBidBooking(bookingId, PropId);
                if (Robj.Status == "Success")
                {
                    //var bookingModel = BL_Booking.GetBooking(bookingId);

                    //string Status = "Thanks " + bookingModel.sFirstNameOFR + "! We have recieved your final payment.";
                    //Task.Run(() => MailComponent.SendEmailAsync(bookingModel.sEmailOFR, "", "", "Hotel Selected", Status, null, null, false));
                    //Task.Run(() => clsUtils.sendSMS(bookingModel.sMobileOFR, Status));
                    return(RedirectToRoute("GuestInformation", new { bookingId = OneFineRateAppUtil.clsUtils.Encode(Convert.ToString(Robj.ID)) }));
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
            return(View());
        }
Beispiel #2
0
        public ActionResult GetBidRange(string Localities, int RatingId, string Type, string bidData)
        {
            PropSearchRequestModel obj = new PropSearchRequestModel();
            string sRoomData           = string.Empty;

            if (Session[bidData] != null)
            {
                // TempData.Keep();
                obj       = Session[bidData] as PropSearchRequestModel;
                sRoomData = obj.sRoomData;
            }

            string[] ids = Localities.TrimEnd(',').Split(',');

            DataTable dtIds = new DataTable();

            dtIds.Columns.AddRange(new DataColumn[1] {
                new DataColumn("Id", typeof(int))
            });

            foreach (var item in ids)
            {
                DataRow dtLocality = dtIds.NewRow();
                dtLocality["Id"] = item;
                dtIds.Rows.Add(dtLocality);
            }

            GetRoomDataAndDates(sRoomData, obj.sCheckIn, obj.sCheckOut);

            string Currency = Session["CurrencyCode"] != null ? Session["CurrencyCode"].ToString() : "INR";

            var list = BL_Bidding.GetBidRangeValues(CheckIn, CheckOut, Currency, RatingId, dtTblRoomOccupancySearch, dtTblChildrenAgeSearch, Type, dtIds);

            return(Json(new { list }, JsonRequestBehavior.AllowGet));
        }
Beispiel #3
0
        public ActionResult GetLeftPayment(BiddingHotelsUpgrade objUpgrade)
        {
            try
            {
                var obj = new BiddingHotelsUpgrade();
                if (TempData["BIdUpgradeHotels"] != null)
                {
                    TempData.Keep(); obj = TempData["BIdUpgradeHotels"] as BiddingHotelsUpgrade;
                }

                var prop = obj.lstRoomsData.Where(u => u.iRoomId == objUpgrade.iRoomId).SingleOrDefault();

                var obj1 = new eBiddingHotelsUpgradeRoomsList();
                obj1 = prop as eBiddingHotelsUpgradeRoomsList;
                var result = BL_Bidding.UpdateUpgradeBidBookingUnfinished(Convert.ToInt64(objUpgrade.iBookingId), obj.iPropId, objUpgrade.iRoomId, obj1.TotalDifference, obj1.TaxDifference, objUpgrade.sAuthCode);
                if (result.Status == "Success")
                {
                    var bookingModel = BL_Booking.GetBooking(Convert.ToInt64(objUpgrade.iBookingId));

                    string Status = "Thank you " + bookingModel.sTitleOFR + " " + bookingModel.sFirstNameOFR + "! We have recieved your final payment.";
                    Task.Run(() => MailComponent.SendEmail(bookingModel.sEmailOFR, "", "", "Hotel Selected", Status, null, null, false, null, null));
                    Task.Run(() => clsUtils.sendSMS(bookingModel.sMobileOFR, Status));
                    Session["Result"] = "Hotel selected successfully!";
                    return(RedirectToAction("Index"));
                }
            }
            catch (Exception E)
            {
                Session["Result"] = "There was an error selecting the hotel. Please try again.";
            }
            return(RedirectToAction("Index"));
        }
Beispiel #4
0
        public ActionResult UpdateBookingOnUpgrade(BiddingHotelsUpgrade obj)
        {
            try
            {
                TempData.Peek("BIdUpgradeHotels");
                TempData.Peek("BidSearchHotels");
                TempData.Peek("BidSearchData");
                int bookingId, PropId;
                PropId    = obj.iPropId;
                bookingId = obj.iBookingId;

                eBidBookingResult Robj = BL_Bidding.UpdateBidBooking(bookingId, PropId);
                if (Robj.Status == "Success")
                {
                    var bookingModel = BL_Booking.GetBooking(bookingId);

                    string Status = "Thank you " + bookingModel.sTitleOFR + " " + bookingModel.sFirstNameOFR + "! We have recieved your final payment.";
                    Task.Run(() => MailComponent.SendEmail(bookingModel.sEmailOFR, "", "", "Hotel Selected", Status, null, null, false, null, null));
                    Task.Run(() => clsUtils.sendSMS(bookingModel.sMobileOFR, Status));
                    Session["Result"] = "Hotel selected successfully!";
                    return(RedirectToAction("Index"));
                }
            }
            catch (Exception E)
            {
                Session["Result"] = "There was an error selecting the hotel. Please try again.";
            }
            return(RedirectToAction("Index"));
        }
Beispiel #5
0
        public ActionResult UnfinishedHotelNotSelected(long bookingId)
        {
            eBidding objdata = new eBidding();

            objdata                     = BL_Bidding.GetSearchedBidHotelsListForUnfinished(bookingId);
            objdata.iBookingId          = (int)bookingId;
            TempData["BidSearchHotels"] = objdata;
            return(View(objdata));
        }
Beispiel #6
0
        public ActionResult GetLocalities(string Type, int Id)
        {
            //TO DO
            //Take care later
            List <etblIndianLocalityCordinate> polygonData;
            var list = BL_Bidding.GetAreaLocalityForBid(Type, Id, out polygonData);

            return(Json(new
            {
                list,
                polygonData = polygonData
            }, JsonRequestBehavior.AllowGet));
        }
Beispiel #7
0
        public ActionResult Index(PropSearchRequestModel model)
        {
            string type = "";

            if (HttpContext.Request.Params["type"] != null && HttpContext.Request.Params["type"] != "")
            {
                type = HttpContext.Request.Params["type"];
            }
            ViewBag.type = type == "" ? null : type;

            eBiddingSearch obj = new eBiddingSearch();

            if (User.Identity.IsAuthenticated)
            {
                var user = BL_WebsiteUser.GetSingleRecordById(User.Identity.GetUserId <long>());
                obj.sUserTitle     = user.Title;
                obj.sUserFirstName = user.FirstName;
                obj.sUserLastName  = user.LastName;
                obj.sUserEmail     = user.Email;
                obj.sUserMobileNo  = user.PhoneNumber;
                obj.iStateId       = user.StateId.HasValue? user.StateId.Value:0;
            }

            obj.sSearchId            = Convert.ToInt32(model.cid);
            obj.sSearchName          = model.cname;
            obj.sSearchType          = model.ctype == "City" ? "C" : model.ctype == "Locality" ? "L" : "A";
            obj.ctype                = model.ctype;
            obj.sJsonRoomData        = model.sRoomData;
            obj.sCheckIn             = model.sCheckIn;
            obj.sCheckOut            = model.sCheckOut;
            obj.cname                = model.cname;
            obj.type                 = ViewBag.type;
            obj.CountryCodePhoneList = BL_Country.GetAllCountryPhoneCodes();
            List <etblIndianLocalityCordinate> cordinatesList;

            var list = BL_Bidding.GetAreaLocalityForBid(obj.sSearchType, obj.sSearchId, out cordinatesList);

            obj.lstPolygonData = cordinatesList;

            obj.sJsonLocality          = OneFineRateAppUtil.clsUtils.ConvertToJson(list);
            obj.BidSearchData          = "BidSearchData" + Guid.NewGuid().ToString();
            obj.BidData                = "BidData" + Guid.NewGuid().ToString();
            Session[obj.BidSearchData] = obj;
            Session[obj.BidData]       = model;
            //TempData.Keep();
            return(View(obj));
        }
Beispiel #8
0
        public ActionResult BiddingInfo(string bidSearchData)
        {
            Decimal?ExchangeRate = 1;
            var     obj          = new eBiddingSearch();

            ViewBag.HeaderBarData = "Congratulations! We have found hotels matching your bid";

            if (Session[bidSearchData] != null)
            {
                //    TempData.Keep();
                obj = Session[bidSearchData] as eBiddingSearch;
            }

            obj.lstLocalities = BL_Bidding.GetAllLocalitiesName(obj.sLocalityData, obj.sLocalityType);

            DateTime checkin  = DateTime.Parse(obj.sCheckIn);
            DateTime checkOut = DateTime.Parse(obj.sCheckOut);

            obj.sCheckInDay  = String.Format("{0:dddd MMM d yyyy}", checkin);
            obj.sCheckOutDay = String.Format("{0:dddd MMM d yyyy}", checkOut);

            obj.iNights = Convert.ToInt32((checkOut - checkin).TotalDays);
            var data = GetRoomsCount(obj.sJsonRoomData);

            obj.iRooms     = data.room;
            obj.iChildrens = data.child;
            obj.iAdults    = data.adult;

            string CurrencyCode = Session["CurrencyCode"] != null ? Session["CurrencyCode"].ToString() : "INR";

            if (CurrencyCode != "INR")
            {
                etblExchangeRatesM objExchange = BL_ExchangeRate.GetSingleRecordById("INR", CurrencyCode);
                if (objExchange.dRate != 0)
                {
                    ExchangeRate = objExchange.dRate;
                }
            }

            obj.dTaxes      = obj.Tax; //taxes provided are full n final.
            obj.dTotalPrice = obj.dBidPrice * obj.iRooms * obj.iNights;
            obj.dGrandTotal = obj.dTotalPrice + obj.dTaxes;

            return(View(obj));
        }
Beispiel #9
0
        /// <summary>
        /// After Final Selection of the bid property after making payment
        /// </summary>
        /// <param name="bookingid"></param>
        /// <param name="propid"></param>
        /// <param name="bidSearchHotels"></param>
        /// <returns></returns>
        public ActionResult GetUpgradeHotelDetails(int bookingid, int propid, string bidSearchHotels)
        {
            var obj = new eBidding();

            if (Session[bidSearchHotels] != null)   //TempData.Keep();
            {
                obj = Session[bidSearchHotels] as eBidding;
            }


            var prop = obj.lstBidRoomsData.Where(u => u.iPropId == propid).SingleOrDefault();


            BiddingHotelsUpgrade objUpgrade = BL_Bidding.GetHotelUpgradeResult(propid, bookingid);

            objUpgrade.objBidRoomsData           = prop;
            objUpgrade.iBookingId                = bookingid;
            objUpgrade.iPropId                   = propid;
            objUpgrade.BIdUpgradeHotels          = "BIdUpgradeHotels" + Guid.NewGuid().ToString();
            Session[objUpgrade.BIdUpgradeHotels] = objUpgrade;
            return(PartialView("BidInfo", objUpgrade));
        }
Beispiel #10
0
        public ActionResult GetUpgradeHotelDetails(int bookingid, int propid)
        {
            var obj = new eBidding();

            if (TempData["BidSearchHotels"] != null)
            {
                TempData.Keep(); obj = TempData["BidSearchHotels"] as eBidding;
            }


            var prop = obj.lstBidRoomsData.Where(u => u.iPropId == propid).SingleOrDefault();


            BiddingHotelsUpgrade objUpgrade = BL_Bidding.GetHotelUpgradeResult(propid, bookingid);

            objUpgrade.objBidRoomsData = prop;
            objUpgrade.iBookingId      = bookingid;
            objUpgrade.iPropId         = propid;

            TempData["BIdUpgradeHotels"] = objUpgrade;
            return(PartialView("BidInfo", objUpgrade));
        }
Beispiel #11
0
        public ActionResult GetBidSearchedHotels(string bookingId)
        {
            int bookId = Convert.ToInt32(clsUtils.Decode(bookingId));


            //fetch the data of booking
            var booking = BL_Booking.GetBooking(bookId);

            if (booking.iPropId != null)
            {
                return(RedirectToAction("Index", "Home"));
            }
            eBidding objdata = new eBidding();

            objdata = BL_Bidding.GetSearchedBidHotelsListForUnfinished(bookId);

            if (objdata.lstBidRoomsData.Count > 0)
            {
                DataTable dtPropIds = new DataTable();
                dtPropIds.Columns.AddRange(new DataColumn[1]
                {
                    new DataColumn("Id", typeof(int))
                });

                foreach (var item in objdata.lstBidRoomsData)
                {
                    DataRow drpropid = dtPropIds.NewRow();
                    drpropid["Id"] = item.iPropId;
                    dtPropIds.Rows.Add(drpropid);
                }

                BL_PropDetails.UpdateViewForConversion("B", dtPropIds, bookId);
            }
            objdata.iBookingId               = bookId;
            objdata.BidSearchHotels          = "BidSearchHotels" + Guid.NewGuid().ToString();
            Session[objdata.BidSearchHotels] = objdata;
            return(View(objdata));
        }
Beispiel #12
0
        public ActionResult PayNow(eBiddingSearch obj)
        {
            try
            {
                Decimal?      ExchangeRate = 1;
                etblBookingTx bookobj      = new etblBookingTx();

                if (User.Identity.IsAuthenticated)
                {
                    var user = BL_WebsiteUser.GetSingleRecordById(User.Identity.GetUserId <long>());
                    bookobj.iCustomerId = user.Id;
                    bookobj.iGuestId    = 0;
                }
                else
                {
                    var stronglObject          = Session[obj.BidSearchData] as eBiddingSearch;
                    GuestUserDetails objDetail = new GuestUserDetails();
                    objDetail.Title       = obj.sUserTitle == "1" ? "Mr." : obj.sUserTitle == "2" ? "Ms." : "";
                    objDetail.FirstName   = obj.sUserFirstName;
                    objDetail.LastName    = obj.sUserLastName;
                    objDetail.Email       = obj.sUserEmail;
                    objDetail.PhoneNumber = obj.sUserMobileNo;
                    objDetail.iStateId    = stronglObject.iStateId;
                    int i = BL_Bidding.AddGuestDetailsRecord(objDetail);
                    if (i > 0)
                    {
                        bookobj.iGuestId = i;
                    }
                    else
                    {
                        return(View("BiddingInfo", obj));
                    }
                }

                string CurrencyCode = Session["CurrencyCode"] != null ? Session["CurrencyCode"].ToString() : "INR";

                if (CurrencyCode != "INR")
                {
                    etblExchangeRatesM objExchange = BL_ExchangeRate.GetSingleRecordById("INR", CurrencyCode);
                    if (objExchange.dRate != 0)
                    {
                        ExchangeRate = 1 / objExchange.dRate;
                    }
                }

                bookobj.dtCheckIn         = Convert.ToDateTime(obj.sCheckIn);;
                bookobj.dtChekOut         = Convert.ToDateTime(obj.sCheckOut);
                bookobj.dtReservationDate = DateTime.Now;
                bookobj.cBookingType      = "B";
                bookobj.sTitleOFR         = obj.sUserTitle;
                bookobj.sFirstNameOFR     = obj.sUserFirstName;
                bookobj.sLastNameOFR      = obj.sUserLastName;
                bookobj.sEmailOFR         = obj.sUserEmail;
                bookobj.sMobileOFR        = obj.sUserMobileNo;
                bookobj.dtActionDate      = DateTime.Now;
                bookobj.BookingStatus     = "PP";
                bookobj.PaymentStatus     = "P";
                bookobj.dBidAmount        = obj.dBidPrice * ExchangeRate;
                bookobj.dTotalAmount      = obj.dTotalPrice * ExchangeRate;
                bookobj.dTaxes            = obj.dTaxes * ExchangeRate;
                bookobj.dTaxesForHotel    = obj.dTaxes * ExchangeRate;
                bookobj.sCurrencyCode     = Session["CurrencyCode"] != null ? Session["CurrencyCode"].ToString() : "INR";
                bookobj.iBidStarCategory  = Convert.ToInt16(obj.sStarRating);
                bookobj.sBidType          = obj.sLocalityType;
                bookobj.sIDs                = obj.sLocalityData.TrimEnd(',');
                bookobj.dServiceCharge      = Convert.ToDecimal(obj.sOFRServiceCharge);
                bookobj.dGSTOnServiceCharge = Convert.ToDecimal(obj.sTaxOnServiceCharge_Val);
                bookobj.dGSTServiceType     = obj.cGstValueType;
                bookobj.dGSTValue           = Convert.ToString(obj.dGSTValue);
                string  TimeZone = Session["TimeZone"] != null ? Session["TimeZone"].ToString() : "+5:30";
                decimal zone     = Convert.ToDecimal(TimeZone.Replace(":", ".").Replace("+", ""));
                bookobj.iCountryOffset = zone;

                #region FetchRoomData and bind in datatables

                var roomDataResult = new List <RoomData>();
                if (obj.sJsonRoomData != null)
                {
                    roomDataResult = new JavaScriptSerializer().Deserialize <List <RoomData> >(obj.sJsonRoomData);
                }

                List <etblBIDRoomAdultsTx> lstBid = new List <etblBIDRoomAdultsTx>();

                foreach (var room in roomDataResult)
                {
                    etblBIDRoomAdultsTx RoomObj = new etblBIDRoomAdultsTx();
                    RoomObj.iRoomNo   = Convert.ToInt16(room.room);
                    RoomObj.iAdults   = Convert.ToInt16(room.adult);
                    RoomObj.iChildren = Convert.ToInt16(room.child);

                    System.Text.StringBuilder str = new System.Text.StringBuilder();
                    foreach (var child in room.ChildAge)
                    {
                        str.Append(child.Age);
                        str.Append(",");
                    }

                    string ChildAges = str.ToString().TrimEnd(',');
                    RoomObj.sChildAge = ChildAges;
                    lstBid.Add(RoomObj);
                }

                #endregion

                etblBookingTrakerTx trkobj = new etblBookingTrakerTx();
                trkobj.BookingStatus = "PP";
                trkobj.dtActionDate  = DateTime.Now;

                int j = BL_Booking.AddBookingForBid(bookobj, trkobj, lstBid);
                if (j > 0)
                {
                    obj.iBookingId             = j;
                    Session[obj.BidSearchData] = obj;
                    //  TempData.Keep();
                    return(RedirectToAction("PayNow", "Payment", new { bookingId = j }));
                }
                else
                {
                }
            }
            catch (Exception)
            {
            }

            Session[obj.BidSearchData] = obj;
            //  TempData.Keep();
            return(View("BiddingInfo", obj));
        }
Beispiel #13
0
        public ActionResult ValidateUserData(string Title, string FirstName, string LastName, string EmailID, string Mobile, string VC, string OTPCode, decimal BidAmount, string RoomData, string Localities, int RatingId, string Type, decimal Taxes, decimal MinRange, decimal MaxRange, string Symbol, string SelectedAreaId, string URL, int iStateId, string bidSearchData)
        {
            var stronglObject = new eBiddingSearch();

            try
            {
                TempData["URL"] = URL.ToString().Replace("wish-to-bid", "Search").Replace("bid", "negotiate");
                if (Session[bidSearchData] != null)
                {
                    //TempData.Keep();
                    stronglObject = Session[bidSearchData] as eBiddingSearch;
                }
                stronglObject.dBidPrice       = Convert.ToDecimal(BidAmount);
                stronglObject.sJsonRoomData   = stronglObject.sJsonRoomData;
                stronglObject.sLocalityType   = Type;
                stronglObject.sLocalityData   = Localities;
                stronglObject.sStarRating     = RatingId;
                stronglObject.dMaxRange       = MaxRange;
                stronglObject.dMinRange       = MinRange;
                stronglObject.dTaxes          = Taxes;
                stronglObject.Symbol          = Symbol;
                stronglObject.sSelectedAreaId = SelectedAreaId;
                RoomData = stronglObject.sJsonRoomData;

                stronglObject.iBiddingCount = BL_Bidding.GetBiddingCount(Mobile);

                if (stronglObject.iBiddingCount < int.Parse(ConfigurationManager.AppSettings["bidLimit"]))
                {
                    if (User.Identity.IsAuthenticated)
                    {
                        var user = BL_WebsiteUser.GetSingleRecordById(User.Identity.GetUserId <long>());
                        stronglObject.sUserTitle     = user.Title;
                        stronglObject.sUserFirstName = FirstName;
                        stronglObject.sUserLastName  = LastName;
                        stronglObject.sUserEmail     = EmailID;
                        stronglObject.iUserId        = user.Id;
                        stronglObject.iStateId       = user.StateId.HasValue ? user.StateId.Value : iStateId;

                        if (user.PhoneNumber == Mobile)
                        {
                            GetRoomDataAndDates(RoomData, stronglObject.sCheckIn, stronglObject.sCheckOut);
                            string[] ids = stronglObject.sLocalityData.TrimEnd(',').Split(',');

                            DataTable dtIds = new DataTable();
                            dtIds.Columns.AddRange(new DataColumn[1] {
                                new DataColumn("Id", typeof(int))
                            });

                            foreach (var item in ids)
                            {
                                DataRow dtLocality = dtIds.NewRow();
                                dtLocality["Id"] = item;
                                dtIds.Rows.Add(dtLocality);
                            }

                            string Currency = Session["CurrencyCode"] != null ? Session["CurrencyCode"].ToString() : "INR";
                            var    list     = BL_Bidding.SearchHotelsByBidAmount(CheckIn, CheckOut, Currency, RatingId, dtTblRoomOccupancySearch, dtTblChildrenAgeSearch, Type, dtIds, stronglObject.dBidPrice, iStateId);

                            if (list.Status == 1)
                            {
                                stronglObject.lstHotelData      = list.lstHotelData;
                                stronglObject.Amount            = list.Amount;
                                stronglObject.Tax               = list.Tax;
                                stronglObject.sCheckIn_Display  = list.sCheckIn_Display;
                                stronglObject.sCheckOut_Display = list.sCheckOut_Display;
                                stronglObject.TopMessage        = list.TopMessage;
                                stronglObject.MinTaxPer         = list.MinTaxPer;

                                stronglObject.SGST_Per                      = list.SGST_Per;
                                stronglObject.SGST_Val                      = list.SGST_Val;
                                stronglObject.sHotelTax                     = list.sHotelTax;
                                stronglObject.sOFRServiceCharge             = list.sOFRServiceCharge;
                                stronglObject.sOFRServiceChargeIncludingTax = list.sOFRServiceChargeIncludingTax;
                                stronglObject.sTaxOnServiceCharge_Per       = list.sTaxOnServiceCharge_Per;
                                stronglObject.sTaxOnServiceCharge_Val       = list.sTaxOnServiceCharge_Val;
                                stronglObject.bShowIGST                     = list.bShowIGST;
                                stronglObject.cGstValueType                 = list.cGstValueType;
                                stronglObject.dGSTValue                     = list.dGSTValue;
                            }
                            else
                            {
                                stronglObject.iBiddingCount = stronglObject.iBiddingCount + 1;
                            }
                            var maxBiddingCount = Convert.ToInt32(ConfigurationManager.AppSettings["bidLimit"]);
                            stronglObject.Message = stronglObject.iBiddingCount == (maxBiddingCount - 1)?string.Concat(list.Message, " You have only one more chance remaining."): stronglObject.iBiddingCount == maxBiddingCount? "We're sorry, but you have utilized all you three chances now." : list.Message;
                            stronglObject.Status  = list.Status;

                            //Increment bidding count for a mobile
                            bidObj.sMobile = Mobile;
                            BL_Bidding.AddRecordToBiddingCount(bidObj);

                            return(Json(new { Status = list.Status, msg = stronglObject.Message, count = stronglObject.iBiddingCount }, JsonRequestBehavior.AllowGet));
                        }
                        else
                        {
                            if (OTPCode != "" && OTPCode != null)
                            {
                                if (DecodeVC(VC) == OTPCode)
                                {
                                    GetRoomDataAndDates(RoomData, stronglObject.sCheckIn, stronglObject.sCheckOut);

                                    string[] ids = stronglObject.sLocalityData.TrimEnd(',').Split(',');

                                    DataTable dtIds = new DataTable();
                                    dtIds.Columns.AddRange(new DataColumn[1] {
                                        new DataColumn("Id", typeof(int))
                                    });

                                    foreach (var item in ids)
                                    {
                                        DataRow dtLocality = dtIds.NewRow();
                                        dtLocality["Id"] = item;
                                        dtIds.Rows.Add(dtLocality);
                                    }

                                    string Currency = Session["CurrencyCode"] != null ? Session["CurrencyCode"].ToString() : "INR";
                                    var    list     = BL_Bidding.SearchHotelsByBidAmount(CheckIn, CheckOut, Currency, RatingId, dtTblRoomOccupancySearch, dtTblChildrenAgeSearch, Type, dtIds, stronglObject.dBidPrice, iStateId);

                                    if (list.Status == 1)
                                    {
                                        stronglObject.lstHotelData      = list.lstHotelData;
                                        stronglObject.Amount            = list.Amount;
                                        stronglObject.Tax               = list.Tax;
                                        stronglObject.sCheckIn_Display  = list.sCheckIn_Display;
                                        stronglObject.sCheckOut_Display = list.sCheckOut_Display;
                                        stronglObject.TopMessage        = list.TopMessage;
                                        stronglObject.MinTaxPer         = list.MinTaxPer;

                                        stronglObject.SGST_Per                      = list.SGST_Per;
                                        stronglObject.SGST_Val                      = list.SGST_Val;
                                        stronglObject.sHotelTax                     = list.sHotelTax;
                                        stronglObject.sOFRServiceCharge             = list.sOFRServiceCharge;
                                        stronglObject.sOFRServiceChargeIncludingTax = list.sOFRServiceChargeIncludingTax;
                                        stronglObject.sTaxOnServiceCharge_Per       = list.sTaxOnServiceCharge_Per;
                                        stronglObject.sTaxOnServiceCharge_Val       = list.sTaxOnServiceCharge_Val;
                                        stronglObject.bShowIGST                     = list.bShowIGST;
                                    }
                                    else
                                    {
                                        stronglObject.iBiddingCount = stronglObject.iBiddingCount + 1;
                                    }
                                    var maxBiddingCount = Convert.ToInt32(ConfigurationManager.AppSettings["bidLimit"]);
                                    stronglObject.Message = stronglObject.iBiddingCount == (maxBiddingCount - 1) ? string.Concat(list.Message, " You have only one more chance remaining.") : stronglObject.iBiddingCount == maxBiddingCount ? "We're sorry, but you have utilized all you three chances now." : list.Message;
                                    stronglObject.Status  = list.Status;

                                    //Increment bidding count for a mobile
                                    bidObj.sMobile = Mobile;
                                    BL_Bidding.AddRecordToBiddingCount(bidObj);

                                    return(Json(new { st = 2, Status = list.Status, msg = list.Message, count = stronglObject.iBiddingCount }, JsonRequestBehavior.AllowGet));
                                }
                                else
                                {
                                    return(Json(new { st = 0, msg = "OTP is incorrect." }, JsonRequestBehavior.AllowGet));
                                }
                            }
                            else
                            {
                                string VerificationCode = ResendVerification(Mobile);
                                stronglObject.sVerificationCode = VerificationCode;
                            }
                        }
                    }
                    else
                    {
                        stronglObject.sUserTitle     = Title;
                        stronglObject.sUserFirstName = FirstName;
                        stronglObject.sUserLastName  = LastName;
                        stronglObject.sUserEmail     = EmailID;
                        stronglObject.sUserMobileNo  = Mobile;
                        stronglObject.iStateId       = iStateId;

                        if (OTPCode != "" && OTPCode != null)
                        {
                            if (DecodeVC(VC) == OTPCode)
                            {
                                GetRoomDataAndDates(RoomData, stronglObject.sCheckIn, stronglObject.sCheckOut);

                                string[] ids = stronglObject.sLocalityData.TrimEnd(',').Split(',');

                                DataTable dtIds = new DataTable();
                                dtIds.Columns.AddRange(new DataColumn[1] {
                                    new DataColumn("Id", typeof(int))
                                });

                                foreach (var item in ids)
                                {
                                    DataRow dtLocality = dtIds.NewRow();
                                    dtLocality["Id"] = item;
                                    dtIds.Rows.Add(dtLocality);
                                }

                                string Currency = Session["CurrencyCode"] != null ? Session["CurrencyCode"].ToString() : "INR";
                                var    list     = BL_Bidding.SearchHotelsByBidAmount(CheckIn, CheckOut, Currency, RatingId, dtTblRoomOccupancySearch, dtTblChildrenAgeSearch, Type, dtIds, stronglObject.dBidPrice, iStateId);

                                if (list.Status == 1)
                                {
                                    stronglObject.lstHotelData                  = list.lstHotelData;
                                    stronglObject.Amount                        = list.Amount;
                                    stronglObject.Tax                           = list.Tax;
                                    stronglObject.sCheckIn_Display              = list.sCheckIn_Display;
                                    stronglObject.sCheckOut_Display             = list.sCheckOut_Display;
                                    stronglObject.TopMessage                    = list.TopMessage;
                                    stronglObject.MinTaxPer                     = list.MinTaxPer;
                                    stronglObject.SGST_Per                      = list.SGST_Per;
                                    stronglObject.SGST_Val                      = list.SGST_Val;
                                    stronglObject.sHotelTax                     = list.sHotelTax;
                                    stronglObject.sOFRServiceCharge             = list.sOFRServiceCharge;
                                    stronglObject.sOFRServiceChargeIncludingTax = list.sOFRServiceChargeIncludingTax;
                                    stronglObject.sTaxOnServiceCharge_Per       = list.sTaxOnServiceCharge_Per;
                                    stronglObject.sTaxOnServiceCharge_Val       = list.sTaxOnServiceCharge_Val;
                                    stronglObject.bShowIGST                     = list.bShowIGST;
                                }
                                else
                                {
                                    stronglObject.iBiddingCount = stronglObject.iBiddingCount + 1;
                                }

                                var maxBiddingCount = Convert.ToInt32(ConfigurationManager.AppSettings["bidLimit"]);
                                stronglObject.Message = stronglObject.iBiddingCount == (maxBiddingCount - 1) ? string.Concat(list.Message, " You have only one more chance remaining.") : stronglObject.iBiddingCount == maxBiddingCount ? "We're sorry, but you have utilized all you three chances now." : list.Message;
                                stronglObject.Status  = list.Status;

                                //Increment bidding count for a mobile
                                bidObj.sMobile = Mobile;
                                BL_Bidding.AddRecordToBiddingCount(bidObj);

                                return(Json(new { st = 2, Status = list.Status, msg = stronglObject.Message, count = stronglObject.iBiddingCount }, JsonRequestBehavior.AllowGet));
                            }
                            else
                            {
                                return(Json(new { st = 0, msg = "OTP is incorrect." }, JsonRequestBehavior.AllowGet));
                            }
                        }
                        else
                        {
                            string VerificationCode = ResendVerification(stronglObject.sUserMobileNo);

                            if (VerificationCode == "error")
                            {
                                return(Json(new { st = 0, msg = "Kindly try after some time." }, JsonRequestBehavior.AllowGet));
                            }
                            else
                            {
                                stronglObject.sVerificationCode = VerificationCode;
                            }
                        }
                    }
                }
                else
                {
                    return(Json(new { st = 0, msg = "Sorry, you have exceeded maximum number of bid attempts for the day. Please click Bargain button to search hotels of your choice." }, JsonRequestBehavior.AllowGet));
                }
            }
            catch (Exception ex)
            {
                return(Json(new { st = 0, msg = "Kindly try after some time." }, JsonRequestBehavior.AllowGet));
            }

            Session[stronglObject.BidSearchData] = stronglObject;
            //TempData.Keep();

            return(Json(new { st = 1, status = true, VC = stronglObject.sVerificationCode }, JsonRequestBehavior.AllowGet));
        }
Beispiel #14
0
        public ActionResult GetRoomData(string sVendorId, string dCheckIn, string dCheckOut, string sRoomData)
        {
            try
            {
                DateTime checkIn  = DateTime.ParseExact(dCheckIn, "dd/MM/yyyy", CultureInfo.InvariantCulture);
                DateTime checkOut = DateTime.ParseExact(dCheckOut, "dd/MM/yyyy", CultureInfo.InvariantCulture);

                var propDetail = new PropDetailsM();

                propDetail.dtCheckIn  = checkIn;
                propDetail.dtCheckOut = checkOut;
                propDetail.sRoomData  = sRoomData;
                propDetail.iVendorId  = sVendorId;
                propDetail.scheckIn   = dCheckIn;
                propDetail.scheckOut  = dCheckOut;

                #region RoomOccupancySearch

                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))
                });

                var roomDataResult = new List <RoomData>();

                if (!string.IsNullOrEmpty(sRoomData))
                {
                    roomDataResult = new JavaScriptSerializer().Deserialize <List <RoomData> >(sRoomData);

                    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;
                            if (child.Age == "<1")
                            {
                                dtChildrenAge["Age"] = "0";
                                child.Age            = "0";
                            }
                            else
                            {
                                dtChildrenAge["Age"] = child.Age;
                            }
                            dtChildrenAge["Age"] = child.Age == "<1" ? "0" : child.Age;

                            dtTblChildrenAgeSearch.Rows.Add(dtChildrenAge);
                        }
                    }
                }

                #endregion

                #region Hotel Detais

                var ofrCommision = BL_Bidding.GetBidMaster(CurrencyCode);

                var TG_Hotel_With_Rooms = clsSearchHotel.FetchHotelsDetailsByVendorId(
                    true,
                    sVendorId, checkIn.ToString("yyyy-MM-dd"),
                    checkOut.ToString("yyyy-MM-dd"),
                    dtTblRoomOccupancySearch,
                    dtTblChildrenAgeSearch,
                    roomDataResult
                    );

                propDetail.dOFRServiceCharge = ofrCommision.dOFRServiceCharge;

                string        roomIds    = string.Empty;
                List <string> roomIdsArr = new List <string>();

                if (TG_Hotel_With_Rooms != null)
                {
                    roomIdsArr = TG_Hotel_With_Rooms.RoomDetails.Select(x => x.RoomId).ToList();
                    roomIds    = string.Join(",", roomIdsArr);
                }
                var db_roomAmenities = BL_PropDetailsTG.GetRoomAmenities(sVendorId, roomIds);

                if (db_roomAmenities.Count > 0)
                {
                    foreach (var roomId in roomIdsArr)
                    {
                        var tgRoom = TG_Hotel_With_Rooms.RoomDetails.Where(x => x.RoomId == roomId).FirstOrDefault();
                        tgRoom.RoomAmenities = db_roomAmenities.Distinct().ToList();
                    }
                }

                propDetail.TG_Hotel = TG_Hotel_With_Rooms;

                ViewBag.dExchangeRate = 1;

                if (CurrencyCode != "INR")
                {
                    etblExchangeRatesM objExchange = BL_ExchangeRate.GetSingleRecordById("INR", CurrencyCode);
                    if (objExchange.dRate.HasValue)
                    {
                        ViewBag.dExchangeRate = objExchange.dRate.Value;
                    }
                }
                propDetail.Symbol = BL_ExchangeRate.GetSymbolByCurrencyCode(CurrencyCode);


                #endregion

                return(PartialView("pvHotelRooms", propDetail));
            }
            catch (Exception)
            {
                return(Content("An Error Occured !"));
            }
        }