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();
        }
示例#2
0
        protected void btnViewSubscription_Click(object sender, EventArgs e)
        {
            int subscriptionId      = AppConfiguration.SubscriptionUpgradeId;
            var upgradeSubscription = _bookingRepository.SubscriptionsList.FirstOrDefault(s => s.Id == subscriptionId && s.IsActive);

            SubscriptionBookings subscriptionBookings = _subscriptionBookingRepository.GetByCustomerId(PublicCustomerInfos.CustomerId, PublicDiscounts.Id);

            if (subscriptionBookings != null)
            {
                var subscriptionDetailUrl = string.Format(Constant.SubscriptionConfirmPage,
                                                          upgradeSubscription.StripePlanId,
                                                          subscriptionBookings.Id,
                                                          "/" + Page.RouteData.Values["bookingId"]);
                Response.Redirect(subscriptionDetailUrl, false);
            }
        }
示例#3
0
        protected void Page_Init(object sender, EventArgs e)
        {
            if (PublicCustomerInfos == null)
            {
                var loginLinkButton = (HtmlAnchor)ControlExtensions.FindControlRecursive(Master, "LoginLinkButton");
                loginLinkButton.Visible = false;
                Response.Redirect(string.Format(Constant.SignIpPage, HttpUtility.UrlEncode(Request.Url.PathAndQuery)));
            }

            MemberShipDetailView.ActiveViewIndex = 0;
            YourPlanLabel.Text             = ErrorMessage.MembershipNotActive;
            reactiveMembershipLink.Visible = true;
            cancelMembershipLink.Visible   = false;


            _subscriptionBookings = _subscriptionBookingRepository.GetSuspendedByCustomerId(PublicCustomerInfos.CustomerId);

            if (_subscriptionBookings != null)
            {
                PublicDiscounts            = _customerInfoRepository.GetSubscriptionDiscountSuspended(PublicCustomerInfos.CustomerId);
                ErrorMessageLabel.Text     = "Your subscription is suspended. Please contact our customer support at <a href=\"mailto:[email protected]\">[email protected]</a> to resolve this issue.";
                ErrorMessageLabel.Visible  = true;
                ErrorMessageLabel.CssClass = "error-message";
            }

            if (PublicDiscounts != null)
            {
                MemberShipDetailView.ActiveViewIndex = 1;

                _subscriptions = _customerInfoRepository.GetSubscriptionByCustomerId(PublicCustomerInfos.CustomerId, PublicDiscounts.Id);
                if (_subscriptions != null)
                {
                    YourPlanLabel.Text = string.Format("{0} - {1} <br/> {2} / month",
                                                       _subscriptions.Name.ToUpper(),
                                                       _subscriptions.ProductHighlight,
                                                       Helper.FormatPrice(_subscriptions.Price));
                    WhatYouGetLit.Text = _subscriptions.WhatYouGet;
                }

                // Avoid get again by Suspended case
                if (_subscriptionBookings == null)
                {
                    _subscriptionBookings = _subscriptionBookingRepository.GetByCustomerId(PublicCustomerInfos.CustomerId, PublicDiscounts.Id);
                }

                if (_subscriptionBookings != null)
                {
                    switch (_subscriptionBookings.Status)
                    {
                    case (int)Enums.SubscriptionBookingStatus.Active:
                        NextCycleLit.Text = string.Format("Next cycle begins {0:MMMM dd}",
                                                          PublicDiscounts.EndDate.HasValue ?
                                                          PublicDiscounts.EndDate.Value.ToLosAngerlesTime().AddDays(1) : DateTime.UtcNow);
                        reactiveMembershipLink.Visible = false;
                        cancelMembershipLink.Visible   = true;
                        break;

                    case (int)Enums.SubscriptionBookingStatus.End:
                        NextCycleLit.Visible = false;
                        break;

                    case (int)Enums.SubscriptionBookingStatus.Suspended:
                        reactiveMembershipLink.Visible = false;
                        cancelMembershipLink.Visible   = false;
                        break;
                    }
                }

                ValidLit.Text = string.Format("Valid through {0:MMMM dd, yyyy}",
                                              PublicDiscounts.EndDate.HasValue ?
                                              PublicDiscounts.EndDate.Value.ToLosAngerlesTime() : DateTime.UtcNow);
                MembershipIdLabel.Text = PublicDiscounts.Code;
            }
        }