Exemplo n.º 1
0
        /// <summary>
        /// This method returns a JSON representing the Resort based on supplied project number and unit type
        /// Sample Call: http://sc.bluegreenowner.com/api/sitecore/resort/GetResortInfo?pn=87&ut=2
        /// </summary>
        /// <returns></returns>
        ///
        public string GetResortInfo()
        {
            DebugUtils.StartLogEvent("ResortController.GetResortInfo");

            StringBuilder result = new StringBuilder();
            string        pn     = Request.QueryString["pn"];
            string        ut     = Request.QueryString["ut"];

            result.Append("{");
            var resort = ResortManager.GetResortByProject(pn);

            if (resort != null)
            {
                string image = (resort.MainResortImage != null) ? resort.MainResortImage.ImageFullUrl() : "";
                result.AppendFormat("\"resortId\":\"{0}\"", resort.ResortId);
                result.AppendFormat(",\"resortName\":\"{0}\"", StringUtils.ClearDoubleQuotes(resort.ResortName));
                result.AppendFormat(",\"resortDetails\":\"{0}\"", StringUtils.ClearDoubleQuotes(resort.ResortSummary));
                result.AppendFormat(",\"address\":\"{0} {1}\"", resort.AddressLine1, (!string.IsNullOrEmpty(resort.AddressLine2)) ? "," + resort.AddressLine2 : "");
                result.AppendFormat(",\"city\":\"{0}\"", resort.City);
                result.AppendFormat(",\"state\":\"{0}\"", resort.State.DisplayName);
                result.AppendFormat(",\"zip\":\"{0}\"", resort.ZipCode);
                result.AppendFormat(",\"phone\":\"{0}\"", resort.PhoneNumber);
                result.AppendFormat(",\"imagePath\":\"{0}\"", image);
                result.AppendFormat(",\"resortDetailsUrl\":\"http://{0}{1}\"", Request.Url.Host, resort.Url);
                result.AppendFormat(",\"taxRate\":\"{0}\"", resort.TaxRate);

                if (resort.ImportantNoteList != null && resort.ImportantNoteList.Count() > 0)
                {
                    foreach (ImportantNote item in resort.ImportantNoteList)
                    {
                        result.AppendFormat(",\"{0}\":\"{1}\"", StringUtils.JsonAttribute(item.InnerItem.Name), StringUtils.JsonContent(item.NotesContent));
                    }
                }
            }

            var room = ResortManager.GetRoom(pn, ut);

            if (room != null)
            {
                result.AppendFormat(",\"vilaSize\":\"{0}\"", StringUtils.ClearDoubleQuotes(room.RoomDescription));
                result.AppendFormat(",\"ROOM_TYPE\":\"{0}\"", room.ViewTitle);
                //result.AppendFormat(",\"cancelPolicy\":\"{0}\",", room.C);
                //result.AppendFormat(",\"checkInTime\":\"{0}\",", resort.C);
                //result.AppendFormat(",\"checkOutTime\":\"{0}\",", resort.C);
                //result.AppendFormat(",\"officeHours\":\"{0}\",", resort.C);
                //result.AppendFormat(",\"lateCheckInProcedure\":\"{0}\",", resort.C);
                //result.AppendFormat(",\"feeDetails\":\"{0}\",", resort.C);
                //result.AppendFormat(",\"constructionInfo\":\"{0}\",", resort.C);
                //result.AppendFormat(",\"creditCard\":\"{0}\",", resort.C);
            }

            result.Append("}");
            DebugUtils.EndLogEvent("ResortController.GetResortInfo");

            return(result.ToString());
        }
Exemplo n.º 2
0
        public ActionResult Explore()
        {
            DebugUtils.StartLogEvent("ResortController.Explore");

            var model = GetLayoutItem <ExploreBluegreen>();

            model.AllResorts    = ResortManager.GetAllResorts();
            model.AllExperience = ResortManager.GetAllExperience();
            DebugUtils.EndLogEvent("ResortController.Explore");

            return(View(model));
        }
Exemplo n.º 3
0
        // GET: ResortLocator
        public ActionResult Find()
        {
            DebugUtils.StartLogEvent("ResortLocatorController.Find");
            var context = new SitecoreContext();
            var model   = context.GetCurrentItem <ResortLocator>(false, true);

            model.AllResorts      = ResortManager.GetAllResorts();
            model.AllExperience   = ResortManager.GetAllExperience();
            model.ClubAffiliation = ResortManager.GetAllClubAffiliation();

            DebugUtils.EndLogEvent("ResortLocatorController.Find");
            return(View(model));
        }
Exemplo n.º 4
0
        public ActionResult ResortPreviewDetails()
        {
            DebugUtils.StartLogEvent("ReservationController.ResortPreviewDetails");

            var model = GetLayoutItem <ResortPreviewDetails>();

            ResortDetails resortDetail = null;


            if (Session["ActiveReservation"] != null)
            {
                Reservation activeReservation = (Reservation)Session["ActiveReservation"];
                resortDetail             = ResortManager.GetResortByProject(activeReservation.ProjectStay);
                model.ActiveReservation  = activeReservation;
                model.HandicapAccessible = false;

                ResortService resortService = new ResortService();
                var           UnitInfo      = resortService.GetUnitInfo(model.ActiveReservation.ProjectStay, model.ActiveReservation.AS400UnitType, model.ActiveReservation.UnitNumber);
                if (UnitInfo != null)
                {
                    model.HandicapAccessible = (UnitInfo.HandicapAccessible == "1");
                }

                Session["ActiveReservation"] = null;
            }
            else
            {
                ReservationParameters reservationContext = ReservationUtils.GetContextReservation();

                if (reservationContext != null)
                {
                    resortDetail            = ResortManager.FindResort(reservationContext.ResortId);
                    model.ActiveReservation = new BGSitecore.Models.ResortService.ReservationsList.Reservation();
                    model.ActiveReservation.AS400UnitType    = reservationContext.UnitType;
                    model.ActiveReservation.ProjectStay      = reservationContext.ProjectNumber.ToString();
                    model.ActiveReservation.CheckInDate      = reservationContext.CheckInDate.ToString("yyyyMMdd");
                    model.ActiveReservation.CheckOutDate     = reservationContext.CheckOutDate.ToString("yyyyMMdd");
                    model.ActiveReservation.ReservationType  = reservationContext.ReservationType;
                    model.ActiveReservation.Points           = reservationContext.PointsRequired.ToString();
                    model.ActiveReservation.MaximumOccupancy = reservationContext.MaxOccupancy.ToString();

                    model.ActiveReservation.Amount = reservationContext.BT_TotalCost;
                    model.HandicapAccessible       = (!string.IsNullOrEmpty(reservationContext.wheelchairaccessible) && (reservationContext.wheelchairaccessible == "1"));
                }
            }
            model.ResortDetail = resortDetail;
            DebugUtils.EndLogEvent("ReservationController.ResortPreviewDetails");

            return(View(model));
        }
Exemplo n.º 5
0
 public ActionResult ShowFlexResort()
 {
     DebugUtils.StartLogEvent("HomeController.ShowFlexResort");
     if (Session["OwnerHomeResort"] != null)
     {
         string resortId = Session["OwnerHomeResort"].ToString();
         var    resort   = ResortManager.FindResort(FormatUtils.ConvertStringToInt(resortId));
         if (resort != null)
         {
             Server.TransferRequest(SitecoreUtils.GetPageUrl(resort.InnerItem));
         }
         DebugUtils.EndLogEvent("HomeController.ShowFlexResort");
     }
     return(null);
 }
Exemplo n.º 6
0
        public ActionResult NearbyResort()
        {
            DebugUtils.StartLogEvent("ResortController.NearbyResort");
            var soureceResort = GetContextItem <ResortDetails>();

            var allREsorts = ResortManager.GetAllResorts();

            var coord = soureceResort.resortGeoCoordinate;

            var nearest = allREsorts.OrderBy(x => x.resortGeoCoordinate.GetDistanceTo(coord));

            var model = GetLayoutItem <NearbyResortList>();

            if (model == null)
            {
                model = new NearbyResortList();
            }
            model.Resort = new List <ResortDetails>();


            foreach (var item in nearest)
            {
                if (item.ResortId != soureceResort.ResortId)
                {
                    item.Distance = Convert.ToInt32(coord.GetDistanceTo(item.resortGeoCoordinate) / 1000);  //convert meter to KM
                    ((List <ResortDetails>)model.Resort).Add(item);

                    if (model.Resort.Count() >= model.NumberToDisplay)
                    {
                        break;
                    }
                }
            }
            DebugUtils.EndLogEvent("ResortController.NearbyResort");

            return(View(model));
        }
Exemplo n.º 7
0
        public ActionResult ReservationConfirmation()
        {
            var model = GetLayoutItem <ReservationConfirmation>();
            BlueGreenContext bgcontext = new BlueGreenContext();
            var reservationNo          = Request.QueryString["reservationNo"];

            if (!string.IsNullOrEmpty(reservationNo))
            {
                var reservationType = Request.QueryString["type"];
                model.ActiveReservation = bgcontext.GetActiveReservation(reservationNo, reservationType);

                model.BxgOwner = bgcontext.bxgOwner;
                if (model.ActiveReservation != null)
                {
                    model.taxTotal = ReservationUtils.CalculateReservationTax(model.ActiveReservation);
                    model.ActiveReservation.Amount = model.taxTotal + model.ActiveReservation.AmountDue;
                    model.Guest_NumberOfGuest      = model.ActiveReservation.NumberOfAdults;

                    string specialCharacter = Sitecore.Configuration.Settings.GetSetting("IdentifierForSpecialRequestFromBGO");
                    model.ActiveReservation.Comments = StringUtils.Between(model.ActiveReservation.Comments, specialCharacter, specialCharacter);

                    Session["ActiveReservation"] = model.ActiveReservation;

                    Session["instanceResort"] = ResortUtils.GetResortInfoDetails(FormatUtils.ConvertStringToInt(model.ActiveReservation.ProjectStay), model.ActiveReservation.MaximumOccupancy);

                    //setup session object requied by the Cancel page
                    ReservationHistoryItem tmp = new ReservationHistoryItem();  //This is the object cancel expect in the session
                    DateTime DateConfirmed     = DateTime.Parse(FormatUtils.GetDate(model.ActiveReservation.DateConfirmed));
                    tmp._DateConfirmed = DateConfirmed.ToString("yyyyMMdd");


                    tmp._Points = model.ActiveReservation.Points;
                    DateTime checkinDate = DateTime.Parse(FormatUtils.GetDate(model.ActiveReservation.CheckInDate));
                    tmp._CheckInDate       = checkinDate.ToString("yyyyMMdd");
                    tmp._ReservationType   = model.ActiveReservation.ReservationType;
                    tmp._NumberOfNights    = model.ActiveReservation.NumberOfNights.ToString();
                    tmp._Amount            = model.ActiveReservation.Amount.ToString();
                    tmp._AmountDue         = model.ActiveReservation.AmountDue.ToString();
                    tmp._ReservationNumber = model.ActiveReservation.ReservationNumber;
                    tmp._ReservationStatus = model.ActiveReservation.ReservationStatus;
                    tmp._GuestFullName     = model.ActiveReservation.Guests[0].FullName;
                    tmp._NumberOfAdults    = model.ActiveReservation.NumberOfAdults;
                    tmp._MaximumOccupancy  = model.ActiveReservation.MaximumOccupancy;
                    tmp._Handicap          = model.ActiveReservation.Handicap;

                    var Room = ResortManager.GetRoom(Convert.ToInt16(model.ActiveReservation.ProjectStay), model.ActiveReservation.AS400UnitType);
                    if (Room != null)
                    {
                        tmp._VillaDescription = Room.ViewTitle;
                    }
                    tmp._PolicyStatus = FormatUtils.PolicyStatus(model.ActiveReservation.PolicyStatus, model.ActiveReservation.EligibleDate, reservationType, model.ActiveReservation.ReservationNumber, model.ActiveReservation.ExchangeCode, model.ActiveReservation.ReservationType);
                    Session["ReservationSelected4Details"] = tmp;


                    Session["PPPStatus"]  = tmp._PolicyStatus;
                    Session["PPPFee"]     = model.ActiveReservation.PolicyPrice;
                    Session["resConfNum"] = model.ActiveReservation.ReservationNumber;

                    //Only get the Guests when reservation is Points
                    if (model.ActiveReservation.ReservationType == "P")
                    {
                        BGSitecore.Services.ResortService resortService = new BGSitecore.Services.ResortService();
                        var allGuest = resortService.OwnerGuestList(bgcontext.OwnerId);
                        if (allGuest != null && allGuest.Guests != null && allGuest.Guests.Count() > 0)
                        {
                            if (model.allGuest == null)
                            {
                                model.allGuest = new List <BGSitecore.Models.ResortService.ScreeningBookReservationResponse.Guest>();
                            }
                            foreach (BGSitecore.Models.ResortService.OwnerGuestList.Guest guest in allGuest.Guests)
                            {
                                if (model.ActiveReservation.Guests != null && model.ActiveReservation.Guests.Count > 0)
                                {
                                    if (guest.GuestID == model.ActiveReservation.Guests[0].GuestID)
                                    {
                                        //Email and phone number are not return with the reservation.  We need to get those values from the list or guests
                                        if (guest.Emails != null && guest.Emails.Count > 0)
                                        {
                                            model.ActiveReservation.Guests[0].Emails = new List <Models.ResortService.ReservationsList.Email>();
                                            Models.ResortService.ReservationsList.Email email = new Models.ResortService.ReservationsList.Email();
                                            email.EmailAddress = guest.Emails[0].EmailAddress;
                                            model.ActiveReservation.Guests[0].Emails.Add(email);
                                        }
                                        if (guest.Phones != null && guest.Phones.Count > 0)
                                        {
                                            model.ActiveReservation.Guests[0].Phones = new List <Models.ResortService.ReservationsList.Phone>();
                                            Models.ResortService.ReservationsList.Phone phone = new Models.ResortService.ReservationsList.Phone();
                                            phone.PhoneNumber = guest.Phones[0].PhoneNumber;
                                            model.ActiveReservation.Guests[0].Phones.Add(phone);
                                        }
                                    }
                                }
                                var findExistingGuest = from existingGuest in model.ActiveReservation.Guests
                                                        where existingGuest.FullName == guest.LastName + " ," + guest.FirstName &&
                                                        existingGuest.GuestID == "0"
                                                        select existingGuest;

                                if (findExistingGuest != null && findExistingGuest.Count() > 0)
                                {
                                    findExistingGuest.First().GuestID = guest.GuestID;
                                }
                                else
                                {
                                    model.allGuest.Add(ReservationUtils.MapOwnerGuestToReservationGuest(guest));
                                }
                            }
                        }
                    }
                }
                return(View(model));
            }
            else
            {
                return(null);
            }
        }