protected void Page_Init(object sender, EventArgs e) { try { string sessionUser = Session["CurrentUser"] != null ? Session["CurrentUser"].ToString() : string.Empty; PublicUser = JsonConvert.DeserializeObject <CustomerInfos>(sessionUser); Session["Active"] = "Booking"; if (PublicUser == null) { Response.Redirect(Constant.DefaultPage); } string sessionHotel = Session["Hotel"] != null ? Session["Hotel"].ToString() : string.Empty; _hotels = _hotelRepository.GetById(int.Parse(sessionHotel)); if (!IsPostBack) { InitSearch(); } } catch (Exception ex) { var logs = new Logs { LogKey = "Admin_BookingPage_Error", UpdatedBy = PublicUser != null ? PublicUser.CustomerId : 1, UpdatedDate = DateTime.UtcNow, UpdatedContent = string.Format("{0} - {1} - {2}", ex.Message, ex.StackTrace, ex.Source) }; _bookingRepository.AddLog(logs); } }
protected void Page_Init(object sender, EventArgs e) { try { Session["Active"] = "CustomerInsight"; var searchAllParam = new SearchAllBookingsParams { HotelId = PublicHotel.HotelId, IsForRevenue = true }; var result = _bookingRepository.GetAllBookingsOfHotel(searchAllParam); if (result.Count >= AppConfiguration.MininumItemToCalculateRevenue) { MVEngagement.ActiveViewIndex = 1; } else { MVEngagement.ActiveViewIndex = 0; } if (!IsPostBack) { SelectedFilterBy.Text = SelectedFilterDdl.SelectedItem.Text; ProductTypeLabel.Text = ProductTypeDdl.Text; DateTime endDate = DateTime.UtcNow.ToLosAngerlesTimeWithTimeZone(PublicHotel.TimeZoneId); var startDate = new DateTime(DateTime.UtcNow.ToLosAngerlesTimeWithTimeZone(PublicHotel.TimeZoneId).Year, DateTime.UtcNow.ToLosAngerlesTimeWithTimeZone(PublicHotel.TimeZoneId).Month, 1); var searchBookingsParams = new SearchBookingsParams { HotelId = PublicHotel.HotelId, StartDate = startDate, EndDate = endDate, IsBookingForRevenue = false }; var bookings = _bookingRepository.GetAllbookingsByRange(searchBookingsParams); ListDates = Helper.GetDateRanges(startDate, endDate); BindEngagement(bookings); } } catch (Exception ex) { var logs = new Logs { LogKey = "Admin_EngagementPage_Error", UpdatedBy = 1, UpdatedDate = DateTime.UtcNow, UpdatedContent = string.Format("{0} - {1} - {2}", ex.Message, ex.StackTrace, ex.Source) }; _bookingRepository.AddLog(logs); } }
protected void Page_Init(object sender, EventArgs e) { try { Session["Active"] = "Revenue"; if (Request.Params["id"] != null) { int hotelId; int.TryParse(Request.Params["id"], out hotelId); _hotels = _hotelRepository.GetHotel(hotelId, PublicCustomerInfos != null ? PublicCustomerInfos.EmailAddress : string.Empty); Session["Hotel"] = _hotels.HotelId; } else { string sessionHotel = Session["Hotel"] != null ? Session["Hotel"].ToString() : string.Empty; _hotels = _hotelRepository.GetById(int.Parse(sessionHotel)); } if (_hotels == null) { Response.Redirect(Constant.HotelList); } DateFrom.Visible = false; DateTo.Visible = false; Search.Visible = false; CustomForm.Visible = false; if (!IsPostBack) { SelectedFilterBy.Text = SelectedFilterDdl.Text; ProductTypeLabel.Text = ProductTypeDdl.Text; var searchAllParam = new SearchAllBookingsParams { HotelId = _hotels.HotelId, IsForRevenue = true }; var bookings = _bookingRepository.GetAllBookingsOfHotel(searchAllParam); FilterBookingByProductType(ref bookings); BindRevenue(bookings); } } catch (Exception ex) { var logs = new Logs { LogKey = "Admin_RevenuesPage_Error", UpdatedBy = PublicCustomerInfos != null ? PublicCustomerInfos.CustomerId : 1, UpdatedDate = DateTime.UtcNow, UpdatedContent = string.Format("{0} - {1} - {2}", ex.Message, ex.StackTrace, ex.Source) }; _bookingRepository.AddLog(logs); } }
protected void SaveButtonOnClick(object sender, EventArgs e) { if (ImageFileUpload.HasFile) { var file = ImageFileUpload.PostedFile; if (Request.Params["id"] != "0") { string pathString = Server.MapPath("~/cloudinary/"); string localImageFile = string.Format("/cloudinary/{0}", file.FileName); if (!Directory.Exists(pathString)) { Directory.CreateDirectory(pathString); } try { file.SaveAs(Server.MapPath(localImageFile)); } catch (Exception ex) { throw new Exception(ex.Message); } var uploadParams = new ImageUploadParams() { File = new FileDescription(string.Format("{0}{1}", pathString, file.FileName)), PublicId = "Hotel_" + Guid.NewGuid() }; var uploadResult = Cloudinary.Upload(uploadParams); imageId = string.Format("{0}.{1}", uploadResult.PublicId, uploadResult.Format); Session["PublicId"] = imageId; ImageCloudinary.ImageUrl = ImageCloudinary.ImageUrl = Cloudinary.Api.UrlImgUp.Secure() .Transform(new Transformation().Width(960).Height(486).Crop("fill")) .BuildUrl(imageId); ImageCloudinary.Visible = true; var log = new Logs { LogKey = "cloudinary", UpdatedContent = uploadResult.JsonObj.ToString(), UpdatedBy = 0, UpdatedDate = DateTime.UtcNow }; _bookingRepository.AddLog(log); } } }
protected void Page_Load(object sender, EventArgs e) { string newUrl; var currentUrl = Request.Url.AbsoluteUri; //s/{market}/search.aspx var isSearch = currentUrl.Contains("search.aspx") && Page.RouteData.Values["market"] != null; if (isSearch) { newUrl = currentUrl.Replace("search.aspx", "day-passes"); Response.Redirect(newUrl, true); } //{market}/{bookingId}/confirm.aspx var isConfirm = currentUrl.Contains("confirm.aspx") && Page.RouteData.Values["market"] != null && Page.RouteData.Values["bookingId"] != null; if (isConfirm) { // {market}/{city}/{hotelName}/{productName}-confirm-{bookingId} var booking = _bookingRepository.GetById(int.Parse(Page.RouteData.Values["bookingId"].ToString())); if (booking == null) { _bookingRepository.AddLog(new Logs { LogKey = "Error Redirect Booking", UpdatedContent = currentUrl, UpdatedBy = 1, UpdatedDate = DateTime.UtcNow }); throw new HttpException(404, string.Format("Url Error - {0}", currentUrl)); } var products = _bookingRepository.ProductList.First(p => p.ProductId == booking.ProductId); var hotels = _bookingRepository.HotelList.First(h => h.HotelId == products.HotelId); newUrl = string.Format(Constant.ConfirmProductPage, Page.RouteData.Values["market"], hotels.City.Trim().Replace(" ", "-"), hotels.HotelName.Trim().Replace(" ", "-"), products.ProductName.Trim().Replace(" ", "-"), Page.RouteData.Values["bookingId"]).ToLower(); Response.Redirect(newUrl, true); } //{market}/{city}/{hotelName}-day-pass/{id} var isSurvey = currentUrl.Contains("-day-pass") && Page.RouteData.Values["market"] != null && Page.RouteData.Values["city"] != null && Page.RouteData.Values["hotelName"] != null && Page.RouteData.Values["id"] != null; if (isSurvey) { var product = _productRepository.GetProductBySurveyId(Page.RouteData.Values["id"].ToString()); if (product == null) { _bookingRepository.AddLog(new Logs { LogKey = "Error Redirect Change Password", UpdatedContent = currentUrl, UpdatedBy = 1, UpdatedDate = DateTime.UtcNow }); throw new HttpException(404, string.Format("Url Error - {0}", currentUrl)); } newUrl = string.Format("/{0}/{1}/{2}/{3}/{4}", Page.RouteData.Values["market"] ?? "socal", Helper.ReplaceSpecialCharacter(product.Hotels.City), Helper.ReplaceSpecialCharacter(product.Hotels.HotelName), Helper.ReplaceSpecialCharacter(product.ProductName), Page.RouteData.Values["id"]); Response.Redirect(newUrl); } //{market}/{city}/{hotelName}-day-pass var isHotel = currentUrl.Contains("-day-pass") && Page.RouteData.Values["market"] != null && Page.RouteData.Values["city"] != null && Page.RouteData.Values["hotelName"] != null; if (isHotel) { var product = _productRepository.GetProductByHotelName(Page.RouteData.Values["hotelName"].ToString()); if (product == null) { _bookingRepository.AddLog(new Logs { LogKey = "Error Redirect Product", UpdatedContent = currentUrl, UpdatedBy = 1, UpdatedDate = DateTime.UtcNow }); throw new HttpException(404, string.Format("Url Error - {0}", currentUrl)); } newUrl = string.Format("/{0}/{1}/{2}/{3}", Page.RouteData.Values["market"] ?? "socal", Helper.ReplaceSpecialCharacter(product.Hotels.City), Helper.ReplaceSpecialCharacter(product.Hotels.HotelName), Helper.ReplaceSpecialCharacter(product.ProductName)); Response.Redirect(newUrl); } //{market}/{city}/{hotelName}/reviews var isReviews = currentUrl.Contains("reviews") && Page.RouteData.Values["market"] != null && Page.RouteData.Values["city"] != null && Page.RouteData.Values["hotelName"] != null; if (isReviews) { var product = _productRepository.GetProductByHotelName(Page.RouteData.Values["hotelName"].ToString()); if (product == null) { _bookingRepository.AddLog(new Logs { LogKey = "Error Redirect Reviews Products", UpdatedContent = currentUrl, UpdatedBy = 1, UpdatedDate = DateTime.UtcNow }); throw new HttpException(404, string.Format("Url Error - {0}", currentUrl)); } newUrl = string.Format("/{0}/{1}/{2}/{3}/reviews", Page.RouteData.Values["market"] ?? "socal", Helper.ReplaceSpecialCharacter(product.Hotels.City), Helper.ReplaceSpecialCharacter(product.Hotels.HotelName), Helper.ReplaceSpecialCharacter(product.ProductName)); Response.Redirect(newUrl); } //{market}/{hotelId}/book.aspx var isBook = currentUrl.Contains("book.aspx") && Page.RouteData.Values["market"] != null && Page.RouteData.Values["hotelId"] != null; if (isBook) { var product = _productRepository.GetById(int.Parse(Page.RouteData.Values["hotelId"].ToString())); if (product == null) { _bookingRepository.AddLog(new Logs { LogKey = "Error Redirect Book Hotels", UpdatedContent = currentUrl, UpdatedBy = 1, UpdatedDate = DateTime.UtcNow }); throw new HttpException(404, string.Format("Url Error - {0}", currentUrl)); } newUrl = string.Format("/{0}/{1}/{2}/{3}-book", Page.RouteData.Values["market"] ?? "socal", Helper.ReplaceSpecialCharacter(product.Hotels.City), Helper.ReplaceSpecialCharacter(product.Hotels.HotelName), Helper.ReplaceSpecialCharacter(product.ProductName)); Response.Redirect(newUrl); } }
protected void Page_Init(object sender, EventArgs e) { try { if (Page.RouteData.Values["bookingId"] != null) { int bookingId; if (int.TryParse(Page.RouteData.Values["bookingId"].ToString(), out bookingId)) { PublicBooking = _bookingRepository.GetById(bookingId); PublicHotels = _bookingRepository.GetHotelsByBookingId(bookingId); if (PublicBooking != null && PublicHotels != null) { PublicMarkets = _productRepository.GetMarketsByHotelId(PublicHotels.HotelId); PublicDiscountUsed = _bookingRepository.GetDiscountsByBookingId(bookingId); if (PublicDiscountUsed != null) { PromoAppliedRow.Visible = true; PromoAppliedSeperateRow.Visible = true; DiscountCodeLit.Text = string.Format("{0} OFF", PublicDiscountUsed.PromoType == (int)Enums.PromoType.Fixed ? Helper.FormatPriceWithFixed(PublicDiscountUsed.PercentOff) : PublicDiscountUsed.PercentOff + "%"); } var checkInDate = DateTime.UtcNow.ToLosAngerlesTimeWithTimeZone(PublicHotels.TimeZoneId).Date; if (PublicBooking.CheckinDate.HasValue) { checkInDate = PublicBooking.CheckinDate.Value.ToLosAngerlesTimeWithTimeZone(PublicHotels.TimeZoneId).Date; } PublicProduct = _productRepository.GetById(PublicBooking.ProductId, checkInDate); if (PublicProduct != null) { ReBindConfirmInfo(); } var promoPrice = PublicBooking.MerchantPrice * PublicBooking.Quantity + PublicBooking.TaxPrice - PublicBooking.TotalPrice; TicketFirstLabel.Text = PublicBooking.Quantity.ToString(); TicketLabel.Text = PublicBooking.Quantity.ToString(); if (promoPrice.Equals(0)) { promoRow.Visible = false; } PromoPrice.Text = string.Format("-{0}", Helper.FormatPriceWithFixed(promoPrice)); if (PublicBooking.PayByCredit.Equals(0)) { creditRow.Visible = false; } CreditPrice.Text = Helper.FormatPriceWithFixed(PublicBooking.PayByCredit * -1); PerPriceLabel.Text = Helper.FormatPriceWithFixed(PublicBooking.MerchantPrice); var totalPrice = PublicBooking.TotalPrice - PublicBooking.PayByCredit; TotalPriceLit.Text = Helper.FormatPriceWithFixed(totalPrice); var quantity = PublicBooking.IsActiveSubscription ? PublicBooking.Quantity - 1 : PublicBooking.Quantity; TicketNumberLit.Text = string.Format("{0} x {1}", Helper.FormatPriceWithFixed(PublicBooking.MerchantPrice), quantity == 1 ? "1 ticket" : quantity + " tickets"); TicketPriceLit.Text = Helper.FormatPriceWithFixed(PublicBooking.MerchantPrice * quantity); if (!PublicBooking.TaxPrice.Equals(0)) { taxRow.Visible = true; TaxLit.Text = Helper.FormatPriceWithFixed(PublicBooking.TaxPrice); } var goldPassDiscount = _bookingRepository.GetGoldPassDiscountByBookingId(bookingId); if (goldPassDiscount != null) { reminderRow.Visible = true; } } } } if (PublicCustomerInfos == null || PublicBooking != null && PublicCustomerInfos.CustomerId != PublicBooking.CustomerId) { Response.Redirect(string.Format(Constant.SignIpPage, HttpUtility.UrlEncode(Request.Url.PathAndQuery))); } if (PublicBooking == null) { if (PublicCustomerInfos != null && !string.IsNullOrEmpty(PublicCustomerInfos.BrowsePassUrl)) { Response.Redirect(PublicCustomerInfos.BrowsePassUrl); } Response.Redirect(!string.IsNullOrEmpty((string)Session["SearchPage"]) ? Session["SearchPage"].ToString() : Constant.SearchPageDefault); } if (PublicCustomerInfos == null || string.IsNullOrEmpty(PublicCustomerInfos.EmailAddress)) { PublicCustomerInfos = _customerInfoRepository.GetById(PublicBooking.CustomerId); } if (!PublicCustomerInfos.IsConfirmed) { PasswordErrorMessage.Visible = false; CustomerMV.ActiveViewIndex = 0; } var maxGuest = PublicProduct.MaxGuest <= 0 ? Constant.DefaultMaxGuest : PublicProduct.MaxGuest; MaxGuestLabel.Text = string.Format(Constant.MaxGuestText, maxGuest, maxGuest > 1 ? "s" : string.Empty, PublicProduct.ProductTypeString, PublicProduct.KidAllowedString ); if (PublicProduct.IsCheckedInRequired) { FinePrintRow.Visible = false; FinePrintSeperateRow.Visible = false; } if (PublicBooking.CheckinDate.HasValue) { CheckInDateLabel.Text = PublicBooking.CheckinDate.Value.ToString(Constant.DateFormat); CheckInDateButtonLabel.Text = "Change"; Session["CheckInDateSearch"] = PublicBooking.CheckinDate.Value.ToLosAngerlesTimeWithTimeZone(PublicHotels.TimeZoneId).Date .ToString("MM/dd/yyyy"); } else { CheckInDateLabel.CssClass += " not-selected"; } if (PublicProduct.AddOnsproduct.Any()) { AddOnPanel.Visible = true; AddOnsListView.DataSource = PublicProduct.AddOnsproduct; AddOnsListView.DataBind(); const string mixpanelscript = "MixpanelScript"; string strScript = string.Empty; PublicProduct.AddOnsproduct.ToList().ForEach(item => { strScript += Helper.GetMixpanelScriptRedirect(item.ProductId, string.Format("/{0}/{1}/{2}/{3}/{4}", Page.RouteData.Values["market"] ?? "socal", Helper.ReplaceSpecialCharacter(item.Hotels.City), Helper.ReplaceSpecialCharacter(item.Hotels.HotelName), Helper.ReplaceSpecialCharacter(item.ProductName), item.ProductId)); }); if (!string.IsNullOrEmpty(strScript)) { ClientScript.RegisterClientScriptBlock(GetType(), mixpanelscript, strScript, true); } } ProductInfoLit.Text = GetProductInfo(); AssignPassString(); bool showGoldPassConfirmation; if (Session["ShowGoldPassConfirmation"] != null && bool.TryParse(Session["ShowGoldPassConfirmation"].ToString(), out showGoldPassConfirmation) && showGoldPassConfirmation) { btnViewSubscriptionTop.Visible = true; btnViewSubscriptionBottom.Visible = true; } } catch (Exception ex) { var logs = new Logs { LogKey = "Confirm-Error-On-Init", UpdatedDate = DateTime.UtcNow, UpdatedContent = string.Format("Confirm Error - {0} - {1} - {2} - {3}", ex.Message, ex.StackTrace, ex.Source, ex.InnerException), UpdatedBy = PublicCustomerInfos != null ? PublicCustomerInfos.CustomerId : 0 }; _bookingRepository.AddLog(logs); } }