private static void UpdateResort(Resort resort, ScrapeResort scrape, ResortService resortService) { resort.ResortStats.BaseLevel = scrape.BaseLevel; resort.ResortStats.TopLevel = scrape.TopLevel; resort.ResortStats.VerticalDrop = scrape.VerticalDrop; resort.ResortStats.LiftTotal = scrape.LiftTotal; resort.ResortStats.QuadPlusCount = scrape.QuadPlusCount; resort.ResortStats.QuadCount = scrape.QuadCount; resort.ResortStats.TripleCount = scrape.TripleCount; resort.ResortStats.DoubleCount = scrape.DoubleCount; resort.ResortStats.SingleCount = scrape.SingleCount; resort.ResortStats.SurfaceCount = scrape.SurfaceCount; resort.ResortStats.GondolaCount = scrape.GondolaCount; resort.ResortStats.FunicularCount = scrape.FunicularCount; resort.ResortStats.SurfaceTrainCount = scrape.SurfaceTrainCount; resort.ResortStats.RunTotal = scrape.RunTotal; resort.ResortStats.RedRuns = scrape.RedRuns; resort.ResortStats.BlueRuns = scrape.BlueRuns; resort.ResortStats.GreenRuns = scrape.GreenRuns; resort.ResortStats.BlackRuns = scrape.BlackRuns; resort.ResortStats.LongestRunDistance = scrape.LongestRunDistance; resort.ResortStats.AverageSnowfall = scrape.AverageSnowfall; resort.ResortStats.SnowmakingCoverage = scrape.SnowmakingCoverage; resort.ResortStats.SkiableTerrianSize = scrape.SkiableTerrianSize; resort.Display = true; resortService.Update(resort); }
private void button3_Click(object sender, EventArgs e) { //copy scrape resortService = new ResortService(resortRepository); IList <Resort> resorts = resortService.GetAll(); ScrapeResort scrape = new ScrapeResort(); foreach (Resort resort in resorts) { scrape = LocationDataManager.GetScrapeResort(resort.Name, resort.CountryName); if (!string.IsNullOrEmpty(scrape.Name)) { UpdateResort(resort, scrape, resortService); } else { //try without accents scrape = LocationDataManager.GetScrapeResort(RemoveAccents(resort.Name), resort.CountryName); if (!string.IsNullOrEmpty(scrape.Name)) { UpdateResort(resort, scrape, resortService); } } } label10.Text = "Finished"; }
private void button1_Click(object sender, EventArgs e) { resortService = new ResortService(resortRepository); IList <Resort> resorts = resortService.GetEmptyPrettyUrls(); foreach (Resort resort in resorts) { string encodedName = EncodeURL(CheckEncodedName(resort.Name)); var resortCheck = resortService.Get(encodedName); if (resortCheck != null) { ListViewItem item = new ListViewItem(); item.Text = resort.Name + " NOT ADDED!!!!!!!!!!"; listBox1.Items.Add(item); } else { resort.PrettyUrl = encodedName; resortService.Update(resort); ListViewItem item = new ListViewItem(); item.Text = resort.Name + " => " + encodedName; listBox1.Items.Add(item); } } }
public ActionResult PageAlerts() { DebugUtils.StartLogEvent("AlertController.PageAlerts"); var model = GetLayoutItem <AllAlerts>(); if (model.AllAlert != null && model.AllAlert.Count() > 0) { List <Alert> allAllerts = (List <Alert>)model.AllAlert; foreach (var alert in allAllerts.Reverse <Alert>()) { if (!SitecoreUtils.EvaluateRules(alert.AlertRules, ContextItem)) { allAllerts.Remove(alert); } else { BlueGreenContext bgContext = new BlueGreenContext(); if (alert.AlertText.Contains("{TPNoLongerAvailableDate}")) { if (bgContext.OwnerExpiration != null) { string valueToUpdate = bgContext.OwnerExpiration.Value.AddYears(1).ToString("MM/dd/yyyy"); alert.AlertText = alert.AlertText.Replace("{TPNoLongerAvailableDate}", valueToUpdate); } } if (alert.AlertText.Contains("{WaiverCount}")) { ResortService service = new ResortService(); var waiverCount = service.OwnerWaivers(FormatUtils.ConvertStringToInt(bgContext.OwnerId)); if (waiverCount != null && waiverCount.OwnerWaivers != null) { alert.AlertText = alert.AlertText.Replace("{WaiverCount}", waiverCount.OwnerWaivers.WaiversAvailable); } else { allAllerts.Remove(alert); } } if (alert.AlertText.Contains("{PointsExpirationDate}")) { DateTime?pointsExpirationDate = bgContext?.GetPointsExpireDate(); if (pointsExpirationDate != null) { string valueToUpdate = pointsExpirationDate.Value.ToString("MM/dd/yyyy"); alert.AlertText = alert.AlertText.Replace("{PointsExpirationDate}", valueToUpdate); } } } } model.AllAlert = allAllerts; DebugUtils.EndLogEvent("AlertController.PageAlerts"); } return(View(model)); }
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)); }
private void button4_Click(object sender, EventArgs e) { resortService = new ResortService(resortRepository); IList <Resort> resorts = resortService.GetAll(); foreach (Resort resort in resorts) { resort.NameFriendlyFormat = RemoveAccents(resort.Name); resort.PrettyUrlFriendlyFormat = RemoveAccents(resort.PrettyUrl); resortService.Update(resort); } label11.Text = "Finished"; }
private void Main_Load(object sender, EventArgs e) { _resortService = new ResortService(_resortRepository); _countryService = new CountryService(_countryRepository); var countries = _countryService.GetAllWithResorts(); foreach (var country in countries) { coCountries.Items.Add(country.CountryName); } int index = coCountries.FindString("France"); coCountries.SelectedIndex = index; PopResortsCombo(coCountries.SelectedItem.ToString()); lblStatus.Text = string.Empty; }
private void GetResort() { dgvLinks.Rows.Clear(); NewLinkName.Text = string.Empty; NewUrl.Text = string.Empty; lblStatus.Text = string.Empty; _resortService = new ResortService(_resortRepository); _resort = _resortService.GetByName(coResorts.SelectedItem.ToString()); ResortName.Text = _resort.Name; PrettyUrl.Text = _resort.PrettyUrl; Longitude.Text = _resort.Longitude.ToString(); Latitude.Text = _resort.Latitude.ToString(); if (!_resort.IsSkiArea) { BaseLevel.Text = _resort.ResortStats.BaseLevel; TopLevel.Text = _resort.ResortStats.TopLevel; VerticalDrop.Text = _resort.ResortStats.VerticalDrop; Height.Text = _resort.ResortStats.Height; AverageSnowfall.Text = _resort.ResortStats.AverageSnowfall; HasSnowmaking.Checked = (_resort.ResortStats.HasSnowmaking == "True") ? true : false; SnowmakingCoverage.Text = _resort.ResortStats.SnowmakingCoverage; PreSeasonStartMonth.Text = _resort.ResortStats.PreSeasonStartMonth; SeasonStartMonth.Text = _resort.ResortStats.SeasonStartMonth; SeasonEndMonth.Text = _resort.ResortStats.SeasonEndMonth; Population.Text = _resort.ResortStats.Population; MountainRestaurants.Text = _resort.ResortStats.MountainRestaurants; HasNightskiing.Checked = (_resort.ResortStats.HasNightskiing == "True") ? true : false; NightskiingDescription.Text = _resort.ResortStats.NightskiingDescription; HasSummerskiing.Checked = (_resort.ResortStats.HasSummerskiing == "True") ? true : false; SummerskiingDescription.Text = _resort.ResortStats.SummerskiingDescription; SummerStartMonth.Text = _resort.ResortStats.SummerStartMonth; SummerEndMonth.Text = _resort.ResortStats.SummerEndMonth; BlackRuns.Text = _resort.ResortStats.BlackRuns; RedRuns.Text = _resort.ResortStats.RedRuns; BlueRuns.Text = _resort.ResortStats.BlueRuns; GreenRuns.Text = _resort.ResortStats.GreenRuns; LongestRunDistance.Text = _resort.ResortStats.LongestRunDistance; RunTotalDistance.Text = _resort.ResortStats.RunTotalDistance; RunTotal.Text = _resort.ResortStats.RunTotal; SkiableTerrianSize.Text = _resort.ResortStats.SkiableTerrianSize; HasSnowpark.Checked = (_resort.ResortStats.HasSnowpark == "True") ? true : false; SnowparkTotal.Text = _resort.ResortStats.SnowparkTotal; SnowparkDescription.Text = _resort.ResortStats.SnowparkDescription; HasHalfpipe.Checked = (_resort.ResortStats.HasHalfpipe == "True") ? true : false; HalfpipeTotal.Text = _resort.ResortStats.HalfpipeTotal; HalfpipeDescription.Text = _resort.ResortStats.HalfpipeDescription; HasQuarterpipe.Checked = (_resort.ResortStats.HasQuarterpipe == "True") ? true : false; QuarterpipeTotal.Text = _resort.ResortStats.QuarterpipeTotal; QuarterpipeDescription.Text = _resort.ResortStats.QuarterpipeDescription; AverageSnowfall.Text = _resort.ResortStats.AverageSnowfall; SnowmakingCoverage.Text = _resort.ResortStats.SnowmakingCoverage; Snowfall1Jan.Text = _resort.ResortStats.Snowfall1Jan; Snowfall2Feb.Text = _resort.ResortStats.Snowfall2Feb; Snowfall3Mar.Text = _resort.ResortStats.Snowfall3Mar; Snowfall4Apr.Text = _resort.ResortStats.Snowfall4Apr; Snowfall5May.Text = _resort.ResortStats.Snowfall5May; Snowfall6Jun.Text = _resort.ResortStats.Snowfall6Jun; Snowfall7Jul.Text = _resort.ResortStats.Snowfall7Jul; Snowfall8Aug.Text = _resort.ResortStats.Snowfall8Aug; Snowfall9Sep.Text = _resort.ResortStats.Snowfall9Sep; Snowfall10Oct.Text = _resort.ResortStats.Snowfall10Oct; Snowfall11Nov.Text = _resort.ResortStats.Snowfall11Nov; Snowfall12Dec.Text = _resort.ResortStats.Snowfall12Dec; LiftDescription.Text = _resort.ResortStats.LiftDescription; LiftTotal.Text = _resort.ResortStats.LiftTotal; LiftCapacityHour.Text = _resort.ResortStats.LiftTotal; QuadPlusCount.Text = _resort.ResortStats.QuadPlusCount; QuadCount.Text = _resort.ResortStats.QuadCount; TripleCount.Text = _resort.ResortStats.TripleCount; DoubleCount.Text = _resort.ResortStats.DoubleCount; SurfaceCount.Text = _resort.ResortStats.SurfaceCount; GondolaCount.Text = _resort.ResortStats.GondolaCount; FunicularCount.Text = _resort.ResortStats.FunicularCount; SurfaceTrainCount.Text = _resort.ResortStats.SurfaceTrainCount; } IsSkiArea.Checked = _resort.IsSkiArea; var resorts = _resortService.GetAllByContinentID(_resort.ContinentID); var i = 0; for (var index = 0; index < resorts.Count; index++) { var resort = resorts[index]; checkedListBoxResortsForSkiArea.Items.Add(resort.Name); var cnt = _resort.SkiAreas.Where(r => resort.ID == r.Resort.ID).Count(); if (cnt > 0) { checkedListBoxResortsForSkiArea.SetItemChecked(index, true); } i++; } PopulateLinks(); }
private void btnSave_Click(object sender, EventArgs e) { _resortService = new ResortService(_resortRepository); _resort.Name = ResortName.Text; _resort.PrettyUrl = PrettyUrl.Text; _resort.Longitude = double.Parse(Longitude.Text); _resort.Latitude = double.Parse(Latitude.Text); _resort.IsSkiArea = IsSkiArea.Checked; _resort.ResortStats.BaseLevel = BaseLevel.Text; _resort.ResortStats.TopLevel = TopLevel.Text; _resort.ResortStats.VerticalDrop = VerticalDrop.Text; _resort.ResortStats.BlackRuns = BlackRuns.Text; _resort.ResortStats.RedRuns = RedRuns.Text; _resort.ResortStats.BlueRuns = BlueRuns.Text; _resort.ResortStats.GreenRuns = GreenRuns.Text; _resort.ResortStats.LongestRunDistance = LongestRunDistance.Text; _resort.ResortStats.RunTotalDistance = RunTotalDistance.Text; _resort.ResortStats.RunTotal = RunTotal.Text; _resort.ResortStats.SkiableTerrianSize = SkiableTerrianSize.Text; _resort.ResortStats.HasSnowpark = (HasSnowpark.Checked) ? "True" : "False"; _resort.ResortStats.SnowparkTotal = SnowparkTotal.Text; _resort.ResortStats.SnowparkDescription = SnowparkDescription.Text; _resort.ResortStats.HasHalfpipe = (HasHalfpipe.Checked) ? "True" : "False"; _resort.ResortStats.HalfpipeTotal = HalfpipeTotal.Text; _resort.ResortStats.HalfpipeDescription = HalfpipeDescription.Text; _resort.ResortStats.HasQuarterpipe = (HasQuarterpipe.Checked) ? "True" : "False"; _resort.ResortStats.QuarterpipeTotal = QuarterpipeTotal.Text; _resort.ResortStats.QuarterpipeDescription = QuarterpipeDescription.Text; _resort.ResortStats.LiftDescription = LiftDescription.Text; _resort.ResortStats.LiftTotal = LiftTotal.Text; _resort.ResortStats.LiftCapacityHour = LiftTotal.Text; _resort.ResortStats.QuadPlusCount = QuadPlusCount.Text; _resort.ResortStats.QuadCount = QuadCount.Text; _resort.ResortStats.TripleCount = TripleCount.Text; _resort.ResortStats.DoubleCount = DoubleCount.Text; _resort.ResortStats.SurfaceCount = SurfaceCount.Text; _resort.ResortStats.GondolaCount = GondolaCount.Text; _resort.ResortStats.FunicularCount = FunicularCount.Text; _resort.ResortStats.SurfaceTrainCount = SurfaceTrainCount.Text; _resort.ResortStats.AverageSnowfall = AverageSnowfall.Text; _resort.ResortStats.HasSnowmaking = (HasSnowmaking.Checked) ? "True" : "False"; _resort.ResortStats.SnowmakingCoverage = SnowmakingCoverage.Text; _resort.ResortStats.Snowfall1Jan = Snowfall1Jan.Text; _resort.ResortStats.Snowfall2Feb = Snowfall2Feb.Text; _resort.ResortStats.Snowfall3Mar = Snowfall3Mar.Text; _resort.ResortStats.Snowfall4Apr = Snowfall4Apr.Text; _resort.ResortStats.Snowfall5May = Snowfall5May.Text; _resort.ResortStats.Snowfall6Jun = Snowfall6Jun.Text; _resort.ResortStats.Snowfall7Jul = Snowfall7Jul.Text; _resort.ResortStats.Snowfall8Aug = Snowfall8Aug.Text; _resort.ResortStats.Snowfall9Sep = Snowfall9Sep.Text; _resort.ResortStats.Snowfall10Oct = Snowfall10Oct.Text; _resort.ResortStats.Snowfall11Nov = Snowfall11Nov.Text; _resort.ResortStats.Snowfall12Dec = Snowfall12Dec.Text; _resort.ResortStats.HasNightskiing = (HasNightskiing.Checked) ? "True" : "False"; _resort.ResortStats.NightskiingDescription = NightskiingDescription.Text; _resort.ResortStats.SeasonStartMonth = SeasonStartMonth.Text; _resort.ResortStats.SeasonEndMonth = SeasonEndMonth.Text; _resort.ResortStats.HasSummerskiing = (HasSummerskiing.Checked) ? "True" : "False"; _resort.ResortStats.SummerskiingDescription = SummerskiingDescription.Text; _resort.ResortStats.SummerStartMonth = SummerStartMonth.Text; _resort.ResortStats.SummerEndMonth = SummerEndMonth.Text; if (IsSkiArea.Checked) { _resort.SkiAreas = new List <LinkResortSkiArea>(); if (checkedListBoxResortsForSkiArea.CheckedItems.Count != 0) { string s = ""; for (int x = 0; x <= checkedListBoxResortsForSkiArea.CheckedItems.Count - 1; x++) { var tempResort = _resortService.GetByName(checkedListBoxResortsForSkiArea.CheckedItems[x].ToString()); var lrsa = new LinkResortSkiArea { SkiAreaID = _resort.ID, ResortID = tempResort.ID, Resort = tempResort }; _resort.SkiAreas.Add(lrsa); } MessageBox.Show(s); } } _resortService.Update(_resort); lblStatus.Text = "Resort Saved OK"; }
private void btnSave_Click(object sender, EventArgs e) { _resortService = new ResortService(_resortRepository); _resort.Name = ResortName.Text; _resort.PrettyUrl = PrettyUrl.Text; _resort.Longitude = double.Parse(Longitude.Text); _resort.Latitude = double.Parse(Latitude.Text); _resort.IsSkiArea = IsSkiArea.Checked; _resort.ResortStats.BaseLevel = BaseLevel.Text; _resort.ResortStats.TopLevel = TopLevel.Text; _resort.ResortStats.VerticalDrop = VerticalDrop.Text; _resort.ResortStats.BlackRuns = BlackRuns.Text; _resort.ResortStats.RedRuns = RedRuns.Text; _resort.ResortStats.BlueRuns = BlueRuns.Text; _resort.ResortStats.GreenRuns = GreenRuns.Text; _resort.ResortStats.LongestRunDistance = LongestRunDistance.Text; _resort.ResortStats.RunTotalDistance = RunTotalDistance.Text; _resort.ResortStats.RunTotal = RunTotal.Text; _resort.ResortStats.SkiableTerrianSize = SkiableTerrianSize.Text; _resort.ResortStats.HasSnowpark = (HasSnowpark.Checked) ? "True" : "False"; _resort.ResortStats.SnowparkTotal = SnowparkTotal.Text; _resort.ResortStats.SnowparkDescription = SnowparkDescription.Text; _resort.ResortStats.HasHalfpipe = (HasHalfpipe.Checked) ? "True" : "False"; _resort.ResortStats.HalfpipeTotal = HalfpipeTotal.Text; _resort.ResortStats.HalfpipeDescription = HalfpipeDescription.Text; _resort.ResortStats.HasQuarterpipe = (HasQuarterpipe.Checked) ? "True" : "False"; _resort.ResortStats.QuarterpipeTotal = QuarterpipeTotal.Text; _resort.ResortStats.QuarterpipeDescription = QuarterpipeDescription.Text; _resort.ResortStats.LiftDescription = LiftDescription.Text; _resort.ResortStats.LiftTotal = LiftTotal.Text; _resort.ResortStats.LiftCapacityHour = LiftTotal.Text; _resort.ResortStats.QuadPlusCount = QuadPlusCount.Text; _resort.ResortStats.QuadCount = QuadCount.Text; _resort.ResortStats.TripleCount = TripleCount.Text; _resort.ResortStats.DoubleCount = DoubleCount.Text; _resort.ResortStats.SurfaceCount = SurfaceCount.Text; _resort.ResortStats.GondolaCount = GondolaCount.Text; _resort.ResortStats.FunicularCount = FunicularCount.Text; _resort.ResortStats.SurfaceTrainCount = SurfaceTrainCount.Text; _resort.ResortStats.AverageSnowfall = AverageSnowfall.Text; _resort.ResortStats.HasSnowmaking = (HasSnowmaking.Checked) ? "True" : "False"; _resort.ResortStats.SnowmakingCoverage = SnowmakingCoverage.Text; _resort.ResortStats.Snowfall1Jan = Snowfall1Jan.Text; _resort.ResortStats.Snowfall2Feb = Snowfall2Feb.Text; _resort.ResortStats.Snowfall3Mar = Snowfall3Mar.Text; _resort.ResortStats.Snowfall4Apr = Snowfall4Apr.Text; _resort.ResortStats.Snowfall5May = Snowfall5May.Text; _resort.ResortStats.Snowfall6Jun = Snowfall6Jun.Text; _resort.ResortStats.Snowfall7Jul = Snowfall7Jul.Text; _resort.ResortStats.Snowfall8Aug = Snowfall8Aug.Text; _resort.ResortStats.Snowfall9Sep = Snowfall9Sep.Text; _resort.ResortStats.Snowfall10Oct = Snowfall10Oct.Text; _resort.ResortStats.Snowfall11Nov = Snowfall11Nov.Text; _resort.ResortStats.Snowfall12Dec = Snowfall12Dec.Text; _resort.ResortStats.HasNightskiing = (HasNightskiing.Checked) ? "True" : "False"; _resort.ResortStats.NightskiingDescription = NightskiingDescription.Text; _resort.ResortStats.SeasonStartMonth = SeasonStartMonth.Text; _resort.ResortStats.SeasonEndMonth = SeasonEndMonth.Text; _resort.ResortStats.HasSummerskiing = (HasSummerskiing.Checked) ? "True" : "False"; _resort.ResortStats.SummerskiingDescription = SummerskiingDescription.Text; _resort.ResortStats.SummerStartMonth = SummerStartMonth.Text; _resort.ResortStats.SummerEndMonth = SummerEndMonth.Text; if (IsSkiArea.Checked) { _resort.SkiAreas = new List<LinkResortSkiArea>(); if (checkedListBoxResortsForSkiArea.CheckedItems.Count != 0) { string s = ""; for (int x = 0; x <= checkedListBoxResortsForSkiArea.CheckedItems.Count - 1; x++) { var tempResort = _resortService.GetByName(checkedListBoxResortsForSkiArea.CheckedItems[x].ToString()); var lrsa = new LinkResortSkiArea { SkiAreaID = _resort.ID, ResortID = tempResort.ID, Resort = tempResort }; _resort.SkiAreas.Add(lrsa); } MessageBox.Show(s); } } _resortService.Update(_resort); lblStatus.Text = "Resort Saved OK"; }
private void button3_Click(object sender, EventArgs e) { //copy scrape resortService = new ResortService(resortRepository); IList<Resort> resorts = resortService.GetAll(); ScrapeResort scrape = new ScrapeResort(); foreach (Resort resort in resorts) { scrape = LocationDataManager.GetScrapeResort(resort.Name, resort.CountryName); if (!string.IsNullOrEmpty(scrape.Name)) { UpdateResort(resort, scrape, resortService); } else { //try without accents scrape = LocationDataManager.GetScrapeResort(RemoveAccents(resort.Name), resort.CountryName); if (!string.IsNullOrEmpty(scrape.Name)) { UpdateResort(resort, scrape, resortService); } } } label10.Text = "Finished"; }
private BookReservationResponse ExecuteBook(ReservationParameters reservationContext) { // bool statusExecuteBook = false; BlueGreenContext bgContext = new BlueGreenContext(); BookReservationRequest request = new BookReservationRequest(); request.ReservationProjectNumber = reservationContext.ProjectNumber.ToString(); request.OwnerID = reservationContext.OwnerId; request.UnitTypeCode = reservationContext.UnitType; request.CheckInDate = reservationContext.CheckInDate.ToString("MM/dd/yyyy"); request.LengthOfStay = Convert.ToInt16((reservationContext.CheckOutDate - reservationContext.CheckInDate).TotalDays); request.NumberOfAdults = int.Parse(reservationContext.Guest_NumberOfGuest); //TODO get value from context request.AccountNumber = bgContext.GetPrimaryAccountNumber(); request.OwnerProjectNumber = bgContext.GetOwnerAccountProject().ToString(); //Changed to Enclose Special Requests with Special Request for BGO only string specialCharacter = Sitecore.Configuration.Settings.GetSetting("IdentifierForSpecialRequestFromBGO"); request.Comments = (reservationContext.text_SpecialRequests == null) ? "" : specialCharacter + reservationContext.text_SpecialRequests + specialCharacter; if (!string.IsNullOrEmpty(reservationContext.wheelchairaccessible) && reservationContext.wheelchairaccessible == "1") { request.HandicapAccessible = "Y"; request.Comments = "REQHANDICAP " + request.Comments; } if (reservationContext.ReservationType == SearchParameters.RESERVATION_TYPE_BONUSTIME) { request.ReservationType = "B"; request.SiteName = "BonusTime"; } else { request.ReservationType = "P"; request.SiteName = "onlinepoints"; request.Points = reservationContext.PointsRequired; } if (reservationContext.hasCreditcard) { request.Payment = new Models.ResortService.BookReservationRequest.Payment(); request.Payment.CreditCardAuthorization = reservationContext.CreditCard_VerificationNumber; request.Payment.CreditCardName = reservationContext.CreditCard_Name; request.Payment.CreditCardNumber = reservationContext.CreditCard_Number; request.Payment.CreditCardType = FormatUtils.ConvertCreditCard(reservationContext.CreditCard_Type); request.Payment.CreditCardExpirationDate = ReservationUtils.GetExpDate(reservationContext.CreditCard_ExpDateMonth, reservationContext.CreditCard_ExpDateYear); request.Payment.CreditCardTotal = Convert.ToDouble(reservationContext.BT_TotalCost); request.Payment.NonTaxTotal = Convert.ToDouble(Convert.ToDecimal(reservationContext.DailyPrice) * reservationContext.NumberOfNightChanged); } if (reservationContext.hasGuest) { request.Guests = new List <Models.ResortService.BookReservationRequest.Guest>(); var guestOld = new Models.ResortService.BookReservationRequest.Guest(); guestOld.GuestType = "Primary"; guestOld.GuestID = ""; guestOld.FirstName = reservationContext.Guest_FirstName; guestOld.LastName = reservationContext.Guest_LastName; guestOld.Relationship = reservationContext.Guest_Relationship; request.Guests.Add(guestOld); if (!string.IsNullOrEmpty(reservationContext.Guest_Email)) { guestOld.EmailAddresses = new List <Models.ResortService.BookReservationRequest.EmailAddress>(); var email = new Models.ResortService.BookReservationRequest.EmailAddress(); email.AddressType = "Home"; email.Email = reservationContext.Guest_Email; guestOld.EmailAddresses.Add(email); } else { guestOld.EmailAddresses = new List <Models.ResortService.BookReservationRequest.EmailAddress>(); var email = new Models.ResortService.BookReservationRequest.EmailAddress(); email.AddressType = "Home"; email.Email = bgContext.bxgOwner.Email; guestOld.EmailAddresses.Add(email); } if (reservationContext.Guest_AddNew != "AddNew") { if (!string.IsNullOrEmpty(reservationContext.Guest_PhoneNumber)) { guestOld.Phones = new List <Models.ResortService.BookReservationRequest.Phone>(); var phone = new Models.ResortService.BookReservationRequest.Phone(); phone.PhoneNumberType = "Home"; phone.PhoneNumber = reservationContext.Guest_PhoneNumber; guestOld.Phones.Add(phone); } if (!string.IsNullOrEmpty(reservationContext.Guest_City)) { guestOld.Addresses = new List <Models.ResortService.BookReservationRequest.Address>(); var address = new Models.ResortService.BookReservationRequest.Address(); address.AddressLine1 = " "; address.AddressLine2 = " "; address.CountryCode = " "; address.PostalCode = " "; address.AddressType = "Home"; address.City = reservationContext.Guest_City; // Here I'm assuming that no one will select state without city (they are both required fields anyway) if (!string.IsNullOrEmpty(reservationContext.Guest_State)) { address.ProvinceCode = reservationContext.Guest_State; } guestOld.Addresses.Add(address); } } else { var guest = new Models.ResortService.BookReservationRequest.Guest(); guest.GuestType = "GuestOnPrimary"; guest.FirstName = reservationContext.Guest_FirstName; guest.LastName = reservationContext.Guest_LastName; guest.Relationship = reservationContext.Guest_Relationship; guest.GuestID = ""; if (!string.IsNullOrEmpty(reservationContext.Guest_Email)) { guest.EmailAddresses = new List <Models.ResortService.BookReservationRequest.EmailAddress>(); var email = new Models.ResortService.BookReservationRequest.EmailAddress(); email.AddressType = "Home"; email.Email = reservationContext.Guest_Email; guest.EmailAddresses.Add(email); } if (!string.IsNullOrEmpty(reservationContext.Guest_City)) { guest.Addresses = new List <Models.ResortService.BookReservationRequest.Address>(); var address = new Models.ResortService.BookReservationRequest.Address(); address.AddressLine1 = " "; address.AddressLine2 = " "; address.CountryCode = " "; address.PostalCode = " "; address.AddressType = "Home"; address.City = reservationContext.Guest_City; // Here I'm assuming that no one will select state without city (they are both required fields anyway) if (!string.IsNullOrEmpty(reservationContext.Guest_State)) { address.ProvinceCode = reservationContext.Guest_State; } guest.Addresses.Add(address); } if (!string.IsNullOrEmpty(reservationContext.Guest_PhoneNumber)) { guest.Phones = new List <Models.ResortService.BookReservationRequest.Phone>(); var phone = new Models.ResortService.BookReservationRequest.Phone(); phone.PhoneNumberType = "Home"; phone.PhoneNumber = reservationContext.Guest_PhoneNumber; guest.Phones.Add(phone); } request.Guests.Add(guest); } } if (reservationContext.hasAddress) { } if (Session["AgentLoginID"] == null) { request.Agent = "OWNER"; } else { request.Agent = (string)Session["AgentLoginID"]; } ResortService resortService = new ResortService(); var reservationResponse = resortService.BookReservation(request); OwnerWebStats(request, reservationResponse); return(reservationResponse); }
public ActionResult SubmitPPP(BGSitecore.Models.ReservationParameters model) { DebugUtils.StartLogEvent("ReservationController.SubmitPPP"); ReservationParameters reservationContext = ReservationUtils.GetContextReservation(); model.CreditCard_Type = FormatUtils.ConvertCreditCard(reservationContext.CreditCard_Type); if (model.btnSubmit == "action:nocreditcard") { DeclinePointsProtectionRequest request = new DeclinePointsProtectionRequest(); request.SiteName = ""; request.ReservationNumber = Session["ReservationNumber"].ToString(); ResortService service = new ResortService(); var response = service.DeclinePointsProtection(request); var reservationNUmber = Session["ReservationNumber"].ToString(); PPPOwnerWebStats(reservationContext, false); ReservationUtils.DeleteContextReservation(); Response.Redirect("/owner/reservation-confirmation?bv=true&type=Future&reservationNo=" + reservationNUmber, false); return(null); } else { var listOfError = ValidationUtils.GetCreditCardViolations(model); if (listOfError.Count() <= 0) { AcceptPointsProtectionRequest request = new AcceptPointsProtectionRequest(); request.SiteName = "OnlinePoints"; request.ReservationNumber = Session["ReservationNumber"].ToString(); request.Payment = new Models.ResortService.AcceptPointsProtection.Payment(); request.Payment.CreditCardNumber = model.CreditCard_Number; request.Payment.CreditCardExpirationDate = ReservationUtils.GetExpDate(model.CreditCard_ExpDateMonth, model.CreditCard_ExpDateYear); request.Payment.CreditCardType = "V"; // model.CreditCard_Type; request.Payment.CreditCardName = model.CreditCard_Name; request.Payment.CreditCardAuthorization = model.CreditCard_VerificationNumber; request.Payment.CreditCardTotal = Convert.ToString(reservationContext.PPPCost); request.Payment.NonTaxTotal = ""; ResortService service = new ResortService(); var pppResponse = service.AcceptPointsProtection(request); if (pppResponse == null || pppResponse.Errors != null) { //TODO move this message in sitecore listOfError.Add(new RuleViolation("", "", "Unfortunately, we have encountered a technical error while processing Points Protection Plan.Please call 800.456.CLUB(2582) to report the problem and receive assistance.Thank you.")); Session["PPPUiError"] = listOfError; } else { var reservationNUmber = Session["ReservationNumber"].ToString(); PPPOwnerWebStats(reservationContext, true); ReservationUtils.DeleteContextReservation(); DebugUtils.StartLogEvent("ReservationController.SubmitPPP"); Response.Redirect("/owner/reservation-confirmation?bv=true&reservationNo=" + reservationNUmber, false); return(null); } } else { Session["PPPUiError"] = listOfError; } } DebugUtils.StartLogEvent("ReservationController.SubmitPPP"); return(base.Index()); }
private void btnGeoscrape_Click(object sender, EventArgs e) { if ((!string.IsNullOrEmpty(tbCountryID.Text)) || (!string.IsNullOrEmpty(tbContinentID.Text)) || (!string.IsNullOrEmpty(tbCountryName.Text)) || (!string.IsNullOrEmpty(tbCountryName.Text))) { resortService = new ResortService(resortRepository); List <string> list = new List <string>(); using (StreamReader reader = new StreamReader("scrape_in.txt")) { char tab = '\u0009'; string line; while ((line = reader.ReadLine()) != null) { line = line.Replace(" = ", "="); line = line.Replace(tab, '¬'); line = line.Replace("¬", ""); //line = line.Replace("è", "è"); //line = line.Replace("é", "é"); //line = line.Replace("ë", "ë"); list.Add(line); } } string store_id = string.Empty; string lat = string.Empty; string lng = string.Empty; string name = string.Empty; string encoded_name = string.Empty; foreach (string line in list) { string id = getId(line); if ((store_id != id) && (!string.IsNullOrEmpty(store_id))) { //write to DB Resort resort = new Resort(); try { resort.Name = name; resort.CountryID = int.Parse(tbCountryID.Text); resort.CountryName = tbCountryName.Text; resort.ContinentID = int.Parse(tbContinentID.Text); resort.ContinentName = tbContinentName.Text; resort.Latitude = double.Parse(lat); resort.Longitude = double.Parse(lng); resort.PrettyUrl = encoded_name; resort.CanPublish = true; resort.CreatedDate = DateTime.Now; resort.UpdatedDate = DateTime.Now; int resortID = resortService.Add(resort); if (!string.IsNullOrEmpty(tbMountainRange.Text)) { int lrmrID = LocationDataManager.AddResortToMountainRangeLink(resortID, int.Parse(tbMountainRange.Text)); } } catch (Exception ex) { ListViewItem item = new ListViewItem(); item.Text = string.Format("{0} = {1}", name, ex.Message); listBox1.Items.Add(item); } } store_id = id; string type = line.Substring(0, 4); switch (type) { case "lats": lat = getLatLng(line); break; case "long": lng = getLatLng(line); break; case "type": //skip break; case "info": name = getName(line); name = name.Replace(" - ", "-"); name = name.Replace(" / ", "/"); encoded_name = EncodeURL(CheckEncodedName(name)); name = CheckEncodedName(name); break; default: break; } } ListViewItem item2 = new ListViewItem(); item2.Text = "========== END =========="; listBox1.Items.Add(item2); } else { ListViewItem item2 = new ListViewItem(); item2.Text = "Textboxes empty"; listBox1.Items.Add(item2); } }
private void btnGeoscrape_Click(object sender, EventArgs e) { if ((!string.IsNullOrEmpty(tbCountryID.Text)) || (!string.IsNullOrEmpty(tbContinentID.Text)) || (!string.IsNullOrEmpty(tbCountryName.Text)) || (!string.IsNullOrEmpty(tbCountryName.Text))) { resortService = new ResortService(resortRepository); List<string> list = new List<string>(); using (StreamReader reader = new StreamReader("scrape_in.txt")) { char tab = '\u0009'; string line; while ((line = reader.ReadLine()) != null) { line = line.Replace(" = ", "="); line = line.Replace(tab, '¬'); line = line.Replace("¬", ""); //line = line.Replace("è", "è"); //line = line.Replace("é", "é"); //line = line.Replace("ë", "ë"); list.Add(line); } } string store_id = string.Empty; string lat = string.Empty; string lng = string.Empty; string name = string.Empty; string encoded_name = string.Empty; foreach (string line in list) { string id = getId(line); if ((store_id != id) && (!string.IsNullOrEmpty(store_id))) { //write to DB Resort resort = new Resort(); try { resort.Name = name; resort.CountryID = int.Parse(tbCountryID.Text); resort.CountryName = tbCountryName.Text; resort.ContinentID = int.Parse(tbContinentID.Text); resort.ContinentName = tbContinentName.Text; resort.Latitude = double.Parse(lat); resort.Longitude = double.Parse(lng); resort.PrettyUrl = encoded_name; resort.CanPublish = true; resort.CreatedDate = DateTime.Now; resort.UpdatedDate = DateTime.Now; int resortID = resortService.Add(resort); if (!string.IsNullOrEmpty(tbMountainRange.Text)) { int lrmrID = LocationDataManager.AddResortToMountainRangeLink(resortID, int.Parse(tbMountainRange.Text)); } } catch (Exception ex) { ListViewItem item = new ListViewItem(); item.Text = string.Format("{0} = {1}", name, ex.Message); listBox1.Items.Add(item); } } store_id = id; string type = line.Substring(0, 4); switch (type) { case "lats": lat = getLatLng(line); break; case "long": lng = getLatLng(line); break; case "type": //skip break; case "info": name = getName(line); name = name.Replace(" - ", "-"); name = name.Replace(" / ", "/"); encoded_name = EncodeURL(CheckEncodedName(name)); name = CheckEncodedName(name); break; default: break; } } ListViewItem item2 = new ListViewItem(); item2.Text = "========== END =========="; listBox1.Items.Add(item2); } else { ListViewItem item2 = new ListViewItem(); item2.Text = "Textboxes empty"; listBox1.Items.Add(item2); } }
private void button1_Click(object sender, EventArgs e) { resortService = new ResortService(resortRepository); IList<Resort> resorts = resortService.GetEmptyPrettyUrls(); foreach (Resort resort in resorts) { string encodedName = EncodeURL(CheckEncodedName(resort.Name)); var resortCheck = resortService.Get(encodedName); if (resortCheck != null) { ListViewItem item = new ListViewItem(); item.Text = resort.Name + " NOT ADDED!!!!!!!!!!"; listBox1.Items.Add(item); } else { resort.PrettyUrl = encodedName; resortService.Update(resort); ListViewItem item = new ListViewItem(); item.Text = resort.Name + " => " + encodedName; listBox1.Items.Add(item); } } }
private void GetResort() { dgvLinks.Rows.Clear(); NewLinkName.Text = string.Empty; NewUrl.Text = string.Empty; lblStatus.Text = string.Empty; _resortService = new ResortService(_resortRepository); _resort = _resortService.GetByName(coResorts.SelectedItem.ToString()); ResortName.Text = _resort.Name; PrettyUrl.Text = _resort.PrettyUrl; Longitude.Text = _resort.Longitude.ToString(); Latitude.Text = _resort.Latitude.ToString(); if (!_resort.IsSkiArea) { BaseLevel.Text = _resort.ResortStats.BaseLevel; TopLevel.Text = _resort.ResortStats.TopLevel; VerticalDrop.Text = _resort.ResortStats.VerticalDrop; Height.Text = _resort.ResortStats.Height; AverageSnowfall.Text = _resort.ResortStats.AverageSnowfall; HasSnowmaking.Checked = (_resort.ResortStats.HasSnowmaking == "True") ? true : false; SnowmakingCoverage.Text = _resort.ResortStats.SnowmakingCoverage; PreSeasonStartMonth.Text = _resort.ResortStats.PreSeasonStartMonth; SeasonStartMonth.Text = _resort.ResortStats.SeasonStartMonth; SeasonEndMonth.Text = _resort.ResortStats.SeasonEndMonth; Population.Text = _resort.ResortStats.Population; MountainRestaurants.Text = _resort.ResortStats.MountainRestaurants; HasNightskiing.Checked = (_resort.ResortStats.HasNightskiing == "True") ? true : false; NightskiingDescription.Text = _resort.ResortStats.NightskiingDescription; HasSummerskiing.Checked = (_resort.ResortStats.HasSummerskiing == "True") ? true : false; SummerskiingDescription.Text = _resort.ResortStats.SummerskiingDescription; SummerStartMonth.Text = _resort.ResortStats.SummerStartMonth; SummerEndMonth.Text = _resort.ResortStats.SummerEndMonth; BlackRuns.Text = _resort.ResortStats.BlackRuns; RedRuns.Text = _resort.ResortStats.RedRuns; BlueRuns.Text = _resort.ResortStats.BlueRuns; GreenRuns.Text = _resort.ResortStats.GreenRuns; LongestRunDistance.Text = _resort.ResortStats.LongestRunDistance; RunTotalDistance.Text = _resort.ResortStats.RunTotalDistance; RunTotal.Text = _resort.ResortStats.RunTotal; SkiableTerrianSize.Text = _resort.ResortStats.SkiableTerrianSize; HasSnowpark.Checked = (_resort.ResortStats.HasSnowpark == "True") ? true : false; SnowparkTotal.Text = _resort.ResortStats.SnowparkTotal; SnowparkDescription.Text = _resort.ResortStats.SnowparkDescription; HasHalfpipe.Checked = (_resort.ResortStats.HasHalfpipe == "True") ? true : false; HalfpipeTotal.Text = _resort.ResortStats.HalfpipeTotal; HalfpipeDescription.Text = _resort.ResortStats.HalfpipeDescription; HasQuarterpipe.Checked = (_resort.ResortStats.HasQuarterpipe == "True") ? true : false; QuarterpipeTotal.Text = _resort.ResortStats.QuarterpipeTotal; QuarterpipeDescription.Text = _resort.ResortStats.QuarterpipeDescription; AverageSnowfall.Text = _resort.ResortStats.AverageSnowfall; SnowmakingCoverage.Text = _resort.ResortStats.SnowmakingCoverage; Snowfall1Jan.Text = _resort.ResortStats.Snowfall1Jan; Snowfall2Feb.Text = _resort.ResortStats.Snowfall2Feb; Snowfall3Mar.Text = _resort.ResortStats.Snowfall3Mar; Snowfall4Apr.Text = _resort.ResortStats.Snowfall4Apr; Snowfall5May.Text = _resort.ResortStats.Snowfall5May; Snowfall6Jun.Text = _resort.ResortStats.Snowfall6Jun; Snowfall7Jul.Text = _resort.ResortStats.Snowfall7Jul; Snowfall8Aug.Text = _resort.ResortStats.Snowfall8Aug; Snowfall9Sep.Text = _resort.ResortStats.Snowfall9Sep; Snowfall10Oct.Text = _resort.ResortStats.Snowfall10Oct; Snowfall11Nov.Text = _resort.ResortStats.Snowfall11Nov; Snowfall12Dec.Text = _resort.ResortStats.Snowfall12Dec; LiftDescription.Text = _resort.ResortStats.LiftDescription; LiftTotal.Text = _resort.ResortStats.LiftTotal; LiftCapacityHour.Text = _resort.ResortStats.LiftTotal; QuadPlusCount.Text = _resort.ResortStats.QuadPlusCount; QuadCount.Text = _resort.ResortStats.QuadCount; TripleCount.Text = _resort.ResortStats.TripleCount; DoubleCount.Text = _resort.ResortStats.DoubleCount; SurfaceCount.Text = _resort.ResortStats.SurfaceCount; GondolaCount.Text = _resort.ResortStats.GondolaCount; FunicularCount.Text = _resort.ResortStats.FunicularCount; SurfaceTrainCount.Text = _resort.ResortStats.SurfaceTrainCount; } IsSkiArea.Checked = _resort.IsSkiArea; var resorts = _resortService.GetAllByContinentID(_resort.ContinentID); var i = 0; for (var index = 0; index < resorts.Count; index++) { var resort = resorts[index]; checkedListBoxResortsForSkiArea.Items.Add(resort.Name); var cnt = _resort.SkiAreas.Where(r => resort.ID == r.Resort.ID).Count(); if (cnt > 0) checkedListBoxResortsForSkiArea.SetItemChecked(index, true); i++; } PopulateLinks(); }
private void button4_Click(object sender, EventArgs e) { resortService = new ResortService(resortRepository); IList<Resort> resorts = resortService.GetAll(); foreach (Resort resort in resorts) { resort.NameFriendlyFormat = RemoveAccents(resort.Name); resort.PrettyUrlFriendlyFormat = RemoveAccents(resort.PrettyUrl); resortService.Update(resort); } label11.Text = "Finished"; }
private void Main_Load(object sender, EventArgs e) { _resortService = new ResortService(_resortRepository); _countryService = new CountryService(_countryRepository); var countries = _countryService.GetAllWithResorts(); foreach (var country in countries) coCountries.Items.Add(country.CountryName); int index = coCountries.FindString("France"); coCountries.SelectedIndex = index; PopResortsCombo(coCountries.SelectedItem.ToString()); lblStatus.Text = string.Empty; }