Ejemplo n.º 1
0
        public HotelRoomResult RoomDetails(GetHotelRoomRequest requestInfo)
        {
            HotelRoomResult _RoomDetailResult = new HotelRoomResult();

            try
            {
                GetHotelRoomRequest _requestInfo = new GetHotelRoomRequest();
                _requestInfo.EndUserIp   = IPAddress;
                _requestInfo.TokenId     = BLFunction.GetTokenID();
                _requestInfo.TraceId     = BLFunction.GetTraceID();
                _requestInfo.HotelCode   = requestInfo.HotelCode;
                _requestInfo.ResultIndex = requestInfo.ResultIndex;
                var jsonObject   = JsonConvert.SerializeObject(_requestInfo);
                var qualifiedUrl = Baseurl + "/BookingEngineService_Hotel/hotelservice.svc/rest/GetHotelRoom";
                var result       = APIHotel.Instance().GetResponse(qualifiedUrl, Verbs.POST, jsonObject);
                if (result != null)
                {
                    _RoomDetailResult = JsonConvert.DeserializeObject <HotelRoomResult>(result);
                }
            }
            catch (Exception ex)
            {
                string msg = ex.Message;
                _RoomDetailResult.GetHotelRoomResult.Error.ErrorCode    = 4;
                _RoomDetailResult.GetHotelRoomResult.Error.ErrorMessage = msg;
            }
            return(_RoomDetailResult);
        }
Ejemplo n.º 2
0
        public void CheckValues()
        {
            if (this.Page.RouteData.Values.Count > 0)
            {
                if (HotelCode == "0" || ResultIndex == "0")
                {
                    Response.RedirectToRoute("Home");
                }
                else
                {
                    var objHotelInfoRequest = new HotelInfoRequest
                    {
                        HotelCode   = HotelCode,
                        ResultIndex = ResultIndex
                    };

                    var hotelResult = DataProviderWrapper.Instance.HotelInfo(objHotelInfoRequest);
                    if (hotelResult != null)
                    {
                        if (hotelResult.HotelInfoResult.Error.ErrorCode > 1)
                        {
                            BLFunction.ShowAlert(this, hotelResult.HotelInfoResult.Error.ErrorMessage,
                                                 ResponseType.WARNING);
                            return;
                        }
                        else
                        {
                            var hotelDetails = hotelResult.HotelInfoResult.HotelDetails;
                            //Do your process
                            if (hotelDetails != null)
                            {
                                ltrHotelName.Text   = hotelDetails.HotelName;
                                LtrAddress.Text     = hotelDetails.Address;
                                LtrContact.Text     = hotelDetails.HotelContactNo;
                                LtrDescription.Text = hotelDetails.Description.Split(';')[1];
                                string hotelUrl = hotelDetails.HotelURL?.ToString();
                                LtrHotelPolicy.Text = hotelDetails.HotelPolicy?.ToString();
                                LtrHotelUrl.Text    = "<a href=" + (string.IsNullOrEmpty(hotelUrl) ? "javascript:;" : "http://" + hotelUrl) + " target='_blank'>Visit Hotel Site</a>";
                                foreach (var item in hotelDetails.Attractions)
                                {
                                    LtrAttractions.Text += "<span><b>" + item.Key + "</b>" + item.Value + "</span>&nbsp;";
                                }
                                var images = hotelDetails.Images.Take(5).ToList();
                                if (images.Count > 0)
                                {
                                    rptSlider.DataSource = images;
                                    rptSlider.DataBind();
                                }

                                //Get Room Details
                                var objRoomDetails = new GetHotelRoomRequest
                                {
                                    HotelCode   = HotelCode,
                                    ResultIndex = ResultIndex
                                };

                                var RoomDetailsList = DataProviderWrapper.Instance.RoomDetails(objRoomDetails);
                                if (RoomDetailsList != null)
                                {
                                    var HotelRoomResult = RoomDetailsList.GetHotelRoomResult;
                                    if (HotelRoomResult != null)
                                    {
                                        String CancellationText = "Room Cancellation Allowed : ";
                                        if (HotelRoomResult.IsUnderCancellationAllowed)
                                        {
                                            ltrCancellationPolicy.Text = CancellationText + "<span class='glyphicon glyphicon-ok'></span>";
                                        }
                                        else
                                        {
                                            ltrCancellationPolicy.Text = CancellationText + "<span class='glyphicon glyphicon-remove'></span>";
                                        }

                                        var HotelRoomsCL = HotelRoomResult.HotelRoomsDetails;
                                        if (HotelRoomsCL.Count > 0)
                                        {
                                            rptRooms.DataSource = HotelRoomsCL;
                                            rptRooms.DataBind();
                                        }
                                    }
                                }
                            }
                        }
                    }
                    else
                    {
                        BLFunction.ShowAlert(this, "Invalid Request", ResponseType.WARNING);
                        return;
                    }
                }
            }
            else
            {
                Response.RedirectToRoute("Home");
            }
        }
Ejemplo n.º 3
0
        public void RunBlockRoomOperation()
        {
            if (this.Page.RouteData.Values.Count > 0)
            {
                if (HotelCode == "0" || ResultIndex == "0" || RoomIndex == "0")
                {
                    Response.RedirectToRoute("Home");
                }
                else
                {
                    var objHotelInfoRequest = new HotelInfoRequest
                    {
                        HotelCode   = HotelCode,
                        ResultIndex = ResultIndex
                    };

                    var hotelResult = DataProviderWrapper.Instance.HotelInfo(objHotelInfoRequest);
                    if (hotelResult != null)
                    {
                        if (hotelResult.HotelInfoResult.Error.ErrorCode > 1)
                        {
                            BLFunction.ShowAlert(this, hotelResult.HotelInfoResult.Error.ErrorMessage, ResponseType.WARNING);
                            return;
                        }
                        else
                        {
                            var hotelDetails = hotelResult.HotelInfoResult.HotelDetails;
                            //Get Room Details
                            var objRoomDetails = new GetHotelRoomRequest
                            {
                                HotelCode   = HotelCode,
                                ResultIndex = ResultIndex
                            };

                            var RoomDetailsList  = DataProviderWrapper.Instance.RoomDetails(objRoomDetails);
                            var _HotelRoomResult = RoomDetailsList.GetHotelRoomResult;

                            //Block Room Testing
                            var HotelRoomsCL = _HotelRoomResult.HotelRoomsDetails;
                            var objBlockRoom = new BlockRoomRequest
                            {
                                HotelCode         = HotelCode,
                                HotelName         = hotelDetails.HotelName,
                                ResultIndex       = ResultIndex,
                                HotelRoomsDetails = new List <HotelRoomsDetail1>(HotelRoomsCL.Where(p => p.RoomIndex.ToString() == RoomIndex).Select(s => new HotelRoomsDetail1()
                                {
                                    RoomIndex         = s.RoomIndex.ToString(),
                                    BedTypes          = s.BedTypes,
                                    Price             = s.Price,
                                    RatePlanCode      = s.RatePlanCode,
                                    SmokingPreference = 0,
                                    Supplements       = s.HotelSupplements,
                                    RoomTypeCode      = s.RoomTypeCode,
                                    RoomTypeName      = s.RoomTypeName,
                                    BedTypeCode       = null,
                                    HotelPassenger    = null
                                }))
                            };
                            objBlockRoom.IsVoucherBooking = "0";
                            if (_HotelRoomResult.IsUnderCancellationAllowed)
                            {
                                objBlockRoom.IsVoucherBooking = "1";
                            }

                            objBlockRoom.GuestNationality = Session["GuestNationality"].ToString();
                            objBlockRoom.NoOfRooms        = Session["NoOfRooms"].ToString();
                            var BlockRoomDetails = DataProviderWrapper.Instance.BlockRoom(objBlockRoom);

                            var _HotelRoomDetailsCL = BlockRoomDetails?.BlockRoomResult?.HotelRoomsDetails;

                            txtHotelPolicy.Text  = BlockRoomDetails?.BlockRoomResult?.HotelNorms;
                            txtAvailability.Text = BlockRoomDetails?.BlockRoomResult?.AvailabilityType;
                            String StartTag = "<li><a>";
                            String EndTag   = "</a></li>";

                            if (_HotelRoomDetailsCL.Count > 0)
                            {
                                foreach (var item in _HotelRoomDetailsCL)
                                {
                                    txtDiscount.Text         = item.Price?.Discount.ToString();
                                    txtExtraGuestCharge.Text = item.Price?.ExtraGuestCharge.ToString();
                                    txtRoomPrice.Text        = item.Price?.RoomPrice.ToString();
                                    txtRoomTypeName.Text     = item.RoomTypeName.ToString();
                                    txtServiceTax.Text       = item.Price?.ServiceTax.ToString();
                                    txtSmokingPrefs.Text     = item.SmokingPreference.ToString();
                                    txtTAX.Text = item.Price?.Tax.ToString();
                                    txtTDS.Text = item.Price?.TDS.ToString();
                                    txtLastCancellationDate.Text = item.LastCancellationDate.Replace('T', ' ');
                                    string amenities = null;
                                    foreach (var element in item.Amenities)
                                    {
                                        amenities += StartTag + element + EndTag;
                                    }
                                    ltrAmenties.Text = amenities?.ToString();

                                    string bedtypes = null;
                                    foreach (var btypes in item.BedTypes)
                                    {
                                        bedtypes += StartTag + btypes?.ToString() + EndTag;
                                    }
                                    ltrBedTypes.Text = bedtypes?.ToString();

                                    string CancellationPolicies = null;
                                    foreach (var policy in item.CancellationPolicies)
                                    {
                                        string Charge = null;
                                        if ((int)policy.ChargeType == 2)
                                        {
                                            Charge = policy.Charge.ToString() + "%";
                                        }
                                        else //policy.ChargeType == 1
                                        {
                                            Charge = policy.Currency + " " + policy.Charge.ToString();
                                        }
                                        CancellationPolicies += StartTag + "Charge " + Charge + " ,If Cancelled between " + policy.FromDate.Replace('T', ' ') + " and " + policy.ToDate.Replace('T', ' ') + EndTag;
                                    }
                                    ltrCancellationPolicy.Text = CancellationPolicies?.ToString();
                                }
                            }
                        }
                    }
                    else
                    {
                        BLFunction.ShowAlert(this, "Invalid Request", ResponseType.WARNING);
                        return;
                    }
                }
            }
            else
            {
                Response.RedirectToRoute("Home");
            }
        }