Пример #1
0
        protected void btnLogin_Click(object sender, EventArgs e)
        {
            if (Page.IsValid)
            {
                AuthenticateResponse authResponse = DataProviderWrapper.Instance.AuthenticateUser(txtEmail.Text.Trim(), txtPassword.Text.Trim());
                if (authResponse != null)
                {
                    if (String.IsNullOrEmpty(authResponse.TokenId))
                    {
                        BLFunction.ShowAlert(this, authResponse.Error.ErrorMessage, ResponseType.DANGER);
                    }
                    else
                    {
                        string userData = authResponse.TokenId + "$" + authResponse.Member.AgencyId + "$" + authResponse.Member.MemberId + "$" + authResponse.Member.FirstName + " " + authResponse.Member.LastName;
                        string userName = authResponse.Member.FirstName + " " + authResponse.Member.LastName;
                        FormsAuthenticationTicket authTicket = new FormsAuthenticationTicket(authResponse.Status,
                                                                                             userData,
                                                                                             DateTime.Now,
                                                                                             DateTime.Now.AddMinutes(2880),
                                                                                             chkRememberMe.Checked,
                                                                                             userData,
                                                                                             FormsAuthentication.FormsCookiePath
                                                                                             );
                        string     hash   = FormsAuthentication.Encrypt(authTicket);
                        HttpCookie cookie = new HttpCookie(FormsAuthentication.FormsCookieName, hash);

                        if (authTicket.IsPersistent)
                        {
                            cookie.Expires = authTicket.Expiration;
                        }
                        Response.Cookies.Add(cookie);
                        Response.RedirectToRoute("Dashboard");
                    }
                }
                else
                {
                    BLFunction.ShowAlert(this, "Services currenlty unavailable", ResponseType.PRIMARY);
                }
            }
            else
            {
                BLFunction.ShowAlert(this, "Invalid page Access Mechanism", ResponseType.INFO);
            }
        }
Пример #2
0
        protected void btnSubmit_Click(object sender, EventArgs e)
        {
            try
            {
                if (Page.IsValid)
                {
                    if (drpCountry.SelectedValue != "0" && drpCity.SelectedValue != "0")
                    {
                        CountryCode = drpCountry.SelectedValue;
                        CityId      = drpCity.SelectedValue;
                    }
                    else if (drpTopCity.SelectedValue != "0")
                    {
                        CityId      = drpTopCity.SelectedValue.Split(',')[0];
                        CountryCode = drpTopCity.SelectedValue.Split(',')[1];
                    }
                    else
                    {
                        BLFunction.ShowAlert(this, "Please select Destination place", ResponseType.WARNING);
                        return;
                    }

                    if (String.IsNullOrEmpty(txtCheckIn.Text.Trim()))
                    {
                        BLFunction.ShowAlert(this, "Please select date", ResponseType.WARNING);
                        txtCheckIn.Focus();
                        return;
                    }
                    else if (drpGuestNationality.SelectedIndex == 0)
                    {
                        BLFunction.ShowAlert(this, "Please select guest Nationality", ResponseType.WARNING);
                        return;
                    }



                    String NoOfNights        = drpNight.SelectedValue;
                    String CheckInDate       = txtCheckIn.Text.Trim();
                    String PreferredCurrency = "";
                    String GuestNationality  = drpGuestNationality.SelectedValue;
                    Session["GuestNationality"] = GuestNationality;
                    String NoOfRooms  = drpRooms.SelectedValue;
                    int    NoOfAdults = Convert.ToInt32(drpAdults.SelectedValue);
                    int    NoOfChild  = Convert.ToInt32(drpChilds.SelectedValue);

                    String PreferredHotel        = "";
                    string ratings               = txtRatings.Text;
                    int    MaxRating             = Convert.ToInt32(ratings.Split(',')[1]);
                    int    MinRating             = Convert.ToInt32(ratings.Split(',')[0]);
                    bool   IsNearBySearchAllowed = chkNearBy.Checked;

                    HotelSearchRequest _Hotel = new HotelSearchRequest();
                    _Hotel.CheckInDate           = CheckInDate;
                    _Hotel.CityId                = CityId;
                    _Hotel.CountryCode           = CountryCode;
                    _Hotel.GuestNationality      = GuestNationality;
                    _Hotel.IsNearBySearchAllowed = IsNearBySearchAllowed;
                    _Hotel.MaxRating             = MaxRating;
                    _Hotel.MinRating             = MinRating;
                    _Hotel.NoOfNights            = NoOfNights;
                    _Hotel.NoOfRooms             = NoOfRooms;
                    Session["NoOfRooms"]         = NoOfRooms;
                    _Hotel.PreferredCurrency     = PreferredCurrency;
                    _Hotel.PreferredHotel        = PreferredHotel;
                    RoomGuest _guest = new RoomGuest();
                    _guest.NoOfAdults = NoOfAdults;
                    _guest.NoOfChild  = NoOfChild;
                    if (NoOfChild > 0)
                    {
                        while (NoOfChild > 0)
                        {
                            _guest.ChildAge.Add(15);
                            NoOfChild--;
                        }
                    }
                    _Hotel.RoomGuests.Add(_guest);
                    Session["RoomGuests"] = _Hotel.RoomGuests;
                    HotelSearchList _SearchResult = DataProviderWrapper.Instance.SearchHotel(_Hotel);
                    rptHotels.DataSource = null;

                    if (_SearchResult.HotelSearchResult.Error.ErrorCode > 0)
                    {
                        BLFunction.ShowAlert(this, _SearchResult.HotelSearchResult.Error.ErrorMessage, ResponseType.WARNING);
                        return;
                    }

                    if (_SearchResult?.HotelSearchResult?.HotelResults != null)
                    {
                        Session["TraceId"]   = _SearchResult.HotelSearchResult.TraceId;
                        rptHotels.DataSource = _SearchResult.HotelSearchResult.HotelResults;
                    }
                    rptHotels.DataBind();
                    pnlHotelList.Visible = true;
                    rptHotels.Focus();
                }
                else
                {
                    BLFunction.ShowAlert(this, "Invalid page request.Please Reload the page again", ResponseType.WARNING);
                    return;
                }
            }
            catch (Exception ex)
            {
                string message = ex.Message;
                BLFunction.ShowAlert(this, message, ResponseType.WARNING);
                return;
            }
        }
Пример #3
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");
            }
        }
Пример #4
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");
            }
        }