protected void Page_Init(object sender, EventArgs e)
        {
            Session["Active"] = "SearchBookingsList";

            int customerId;

            int.TryParse(Request.Params["id"], out customerId);
            CurrentCustomerId = customerId;
            if (!IsPostBack)
            {
                Session["CurrentPage"] = 1;
                CustomerInfosDetails   = _customerInfoRepository.GetById(CurrentCustomerId);

                string json = JsonConvert.SerializeObject(CustomerInfosDetails, CustomSettings.SerializerSettings());
                Session["CustomerInfosDetails"] = json;

                _response = _helper.SearchDataByCustomerId(CurrentCustomerId);

                _currentData = _response.ListBookingsData.ToList();
                string jsonData = JsonConvert.SerializeObject(_currentData, CustomSettings.SerializerSettings());
                Session["SearchCustomerBookings"] = jsonData;
                BindRepeater(_currentData.Take(10));
            }
            else
            {
                string session = Session["CustomerInfosDetails"] != null ? Session["CustomerInfosDetails"].ToString() : string.Empty;
                CustomerInfosDetails = JsonConvert.DeserializeObject <CustomerInfos>(session);

                string sessionData = Session["SearchCustomerBookings"] != null ? Session["SearchCustomerBookings"].ToString() : string.Empty;
                _currentData = JsonConvert.DeserializeObject <List <SearchDataObject> >(sessionData);
            }

            if (CustomerInfosDetails == null)
            {
                Response.Redirect(Constant.SearchBookingsAdminpage);
            }

            // Get Membership Info
            PublicDiscounts = _customerInfoRepository.GetSubscriptionDiscount(CustomerInfosDetails.CustomerId);

            if (PublicDiscounts != null)
            {
                _subscriptionBookings = _subscriptionBookingRepository.GetByCustomerId(CustomerInfosDetails.CustomerId, PublicDiscounts.Id);
                if (_subscriptionBookings != null && _subscriptionBookings.Status == (byte)Enums.SubscriptionBookingStatus.Active)
                {
                    CancelMembershipLinkButton.Visible = true;
                }
            }

            BindCustomerData();
        }
        protected void Page_Init(object sender, EventArgs e)
        {
            Session["Active"] = "SearchBookingsList";
            string sessionUser = Session["CurrentUser"] != null ? Session["CurrentUser"].ToString() : string.Empty;

            PublicUser = JsonConvert.DeserializeObject <CustomerInfos>(sessionUser);
            if (PublicUser == null)
            {
                Response.Redirect(Constant.DefaultPage);
            }

            int customerId;

            int.TryParse(Request.Params["id"], out customerId);
            CurrentCustomerId = customerId;
            _currentData      = _customerCreditRepository.GetAllLogsByCustomerId(CurrentCustomerId).ToList();

            _customerCredits = _customerCreditRepository.GetById(CurrentCustomerId);

            if (!IsPostBack)
            {
                Session["CurrentPage"] = 1;
                CustomerInfosDetails   = _customerInfoRepository.GetById(CurrentCustomerId);

                string json = JsonConvert.SerializeObject(CustomerInfosDetails, CustomSettings.SerializerSettings());
                Session["CustomerInfosDetails"] = json;
                BindRepeater(_currentData.Take(10));
            }
            else
            {
                string session = Session["CustomerInfosDetails"] != null ? Session["CustomerInfosDetails"].ToString() : string.Empty;
                CustomerInfosDetails = JsonConvert.DeserializeObject <CustomerInfos>(session);
            }

            if (CustomerInfosDetails == null)
            {
                Response.Redirect(Constant.SearchBookingsAdminpage);
            }

            BindCustomerData();
        }
Ejemplo n.º 3
0
        /// <summary>
        /// 删除客户信息
        /// </summary>
        /// <param name="id"></param>
        /// <returns></returns>
        public bool Delete(Guid id)
        {
            var _session = HttpContext.Current.Session;

            if (int.Parse(_session["Authority"].ToString()) == 0)
            {
                var info = _customerInfoRepository.GetById(id);
                if (info != null)
                {
                    info.Deleted = true;
                    _customerInfoRepository.Update(info);
                    return(true);
                }
            }
            return(false);
        }
Ejemplo n.º 4
0
        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);
            }
        }
        protected void Page_Init(object sender, EventArgs e)
        {
            try
            {
                if (Page.RouteData.Values["SubscriptionBookingId"] != null)
                {
                    int subBookingId;
                    if (int.TryParse(Page.RouteData.Values["SubscriptionBookingId"].ToString(), out subBookingId))
                    {
                        PublicSubscriptionBooking = _subscriptionBookingRepository.GetById(subBookingId);
                        PublicSubscriptionCycles  = _subscriptionBookingRepository.SubscriptionCyclesList
                                                    .Where(sc => sc.SubscriptionBookingId == subBookingId)
                                                    .OrderByDescending(sc => sc.CycleNumber)
                                                    .FirstOrDefault();
                        PublicSubscriptions = _subscriptionRepository.GetById(PublicSubscriptionBooking.SubscriptionId);
                        PublicDiscountUsed  = _subscriptionRepository.GetDiscountsBySubscriptionBookingId(subBookingId);
                        ReBindConfirmInfo();

                        if (PublicDiscountUsed != null)
                        {
                            PromoAppliedRow.Visible         = true;
                            PromoAppliedSeperateRow.Visible = true;
                            DiscountCodeLit.Text            = string.Format("{0} OFF",
                                                                            PublicDiscountUsed.PromoType == (int)Enums.PromoType.Fixed
                                    ? Helper.FormatPrice(PublicDiscountUsed.PercentOff)
                                    : PublicDiscountUsed.PercentOff + "%");
                        }

                        var promoPrice = PublicSubscriptionCycles.MerchantPrice * PublicSubscriptionBooking.Quantity - PublicSubscriptionCycles.TotalPrice - PublicSubscriptionCycles.PayByCredit;

                        if (promoPrice.Equals(0))
                        {
                            promoRow.Visible = false;
                        }
                        PromoPrice.Text = Helper.FormatPrice(promoPrice);

                        if (PublicSubscriptionCycles.PayByCredit.Equals(0))
                        {
                            creditRow.Visible = false;
                        }
                        CreditPrice.Text   = Helper.FormatPrice(PublicSubscriptionCycles.PayByCredit * -1);
                        TotalPriceLit.Text = Helper.FormatPrice(PublicSubscriptionCycles.TotalPrice);
                    }
                }

                int bookingId;
                if (Page.RouteData.Values["BookingId"] != null &&
                    int.TryParse(Page.RouteData.Values["BookingId"].ToString(), out bookingId))
                {
                    var productRepository = new ProductRepository();
                    PublicProducts = productRepository.GetProductsByBookingId(bookingId);
                }

                if (PublicCustomerInfos == null ||
                    PublicSubscriptionBooking != null &&
                    PublicCustomerInfos.CustomerId != PublicSubscriptionBooking.CustomerId)
                {
                    Response.Redirect(Constant.InvalidTicketPage, false);
                    //Response.Redirect(string.Format(Constant.SignIpPage, WebUtility.UrlEncode(Request.Url.PathAndQuery)));
                }

                if (PublicDiscounts == null)
                {
                    Response.Redirect(string.Format(Constant.SignIpPage, HttpUtility.UrlEncode(Request.Url.PathAndQuery)));
                }

                if (PublicSubscriptionBooking == null)
                {
                    if (PublicCustomerInfos != null && !string.IsNullOrEmpty(PublicCustomerInfos.BrowsePassUrl))
                    {
                        Response.Redirect(PublicCustomerInfos.BrowsePassUrl, true);
                    }
                    Response.Redirect(!string.IsNullOrEmpty((string)Session["SearchPage"])
                        ? Session["SearchPage"].ToString()
                        : Constant.SearchPageDefault, true);
                }

                if (PublicCustomerInfos == null || string.IsNullOrEmpty(PublicCustomerInfos.EmailAddress))
                {
                    PublicCustomerInfos = _customerInfoRepository.GetById(PublicSubscriptionBooking.CustomerId);
                }
                if (!PublicCustomerInfos.IsConfirmed)
                {
                    PasswordErrorMessage.Visible = false;
                    CustomerMV.ActiveViewIndex   = 0;
                }

                if (PublicProducts != null)
                {
                    FirstPassReserveLit.Text = "and your first day pass has been reserved";
                    ViewReservation.Visible  = true;
                    AnchorButton.Text        = "Reserve Pass";
                }
            }
            catch (Exception ex)
            {
                var logs = new Logs
                {
                    LogKey         = "Subscription-Confirmation-Error",
                    UpdatedDate    = DateTime.UtcNow,
                    UpdatedContent = string.Format("Subscription Confirmation Error - {0} - {1} - {2}", ex.Message, ex.StackTrace, ex.Source),
                    UpdatedBy      = PublicCustomerInfos != null ? PublicCustomerInfos.CustomerId : 0
                };
                _subscriptionBookingRepository.AddLog(logs);
            }
        }
Ejemplo n.º 6
0
        protected void Page_Init(object sender, EventArgs e)
        {
            try
            {
                if (Page.RouteData.Values["GiftCardBookingId"] != null)
                {
                    int giftCardBookingId;
                    if (int.TryParse(Page.RouteData.Values["GiftCardBookingId"].ToString(), out giftCardBookingId))
                    {
                        PublicGiftCardBooking = _giftCardBookingRepository.GetById(giftCardBookingId);
                        PublicGiftCards       = _giftCardBookingRepository.GetGiftCard(PublicGiftCardBooking.GiftCardId);

                        if (PublicGiftCardBooking.PayByCredit.Equals(0))
                        {
                            creditRow.Visible = false;
                        }
                        CreditPrice.Text = Helper.FormatPrice(PublicGiftCardBooking.PayByCredit * -1);
                        var totalPrice = PublicGiftCardBooking.TotalPrice - PublicGiftCardBooking.PayByCredit;
                        TotalPriceLit.Text = Helper.FormatPrice(totalPrice);
                    }
                }

                if (PublicCustomerInfos == null ||
                    PublicGiftCardBooking != null &&
                    PublicCustomerInfos.CustomerId != PublicGiftCardBooking.CustomerId)
                {
                    Response.Redirect(Constant.InvalidTicketPage, false);
                }

                if (PublicGiftCardBooking == null)
                {
                    if (PublicCustomerInfos != null && !string.IsNullOrEmpty(PublicCustomerInfos.BrowsePassUrl))
                    {
                        Response.Redirect(PublicCustomerInfos.BrowsePassUrl, true);
                    }
                    Response.Redirect(!string.IsNullOrEmpty((string)Session["SearchPage"])
                        ? Session["SearchPage"].ToString()
                        : Constant.SearchPageDefault, true);
                }

                if (PublicCustomerInfos == null || string.IsNullOrEmpty(PublicCustomerInfos.EmailAddress))
                {
                    PublicCustomerInfos = _customerInfoRepository.GetById(PublicGiftCardBooking.CustomerId);
                }
                if (!PublicCustomerInfos.IsConfirmed)
                {
                    PasswordErrorMessage.Visible = false;
                    CustomerMV.ActiveViewIndex   = 0;
                }
            }
            catch (Exception ex)
            {
                var logs = new Logs
                {
                    LogKey         = "Subscription-Confirmation-Error",
                    UpdatedDate    = DateTime.UtcNow,
                    UpdatedContent = string.Format("Subscription Confirmation Error - {0} - {1} - {2}", ex.Message, ex.StackTrace, ex.Source),
                    UpdatedBy      = PublicCustomerInfos != null ? PublicCustomerInfos.CustomerId : 0
                };
                _giftCardBookingRepository.AddLog(logs);
            }
        }