예제 #1
0
 private void UpdateBillingAddress(CommerceBuilder.Users.User user, CommerceBuilder.Users.Address acAddress)
 {
     if (user.Addresses.Count == 0)
     {
         user.Addresses.Add(acAddress);
     }
     else
     {
         user.PrimaryAddress.FirstName   = acAddress.FirstName;
         user.PrimaryAddress.LastName    = acAddress.LastName;
         user.PrimaryAddress.Address1    = acAddress.Address1;
         user.PrimaryAddress.City        = acAddress.City;
         user.PrimaryAddress.CountryCode = acAddress.CountryCode;
         user.PrimaryAddress.PostalCode  = acAddress.PostalCode;
         user.PrimaryAddress.Province    = acAddress.Province;
         user.PrimaryAddress.Residence   = acAddress.Residence;
     }
 }
예제 #2
0
        protected void Page_Load(object sender, EventArgs e)
        {
            _CategoryId = AbleCommerce.Code.PageHelper.GetCategoryId();
            _Category   = CategoryDataSource.Load(_CategoryId);
            CancelButton.NavigateUrl  = "Browse.aspx?CategoryId=" + _CategoryId.ToString();
            CancelButton2.NavigateUrl = "Browse.aspx?CategoryId=" + _CategoryId.ToString();
            if (_Category == null)
            {
                Response.Redirect(CancelButton.NavigateUrl);
                Response.Redirect(CancelButton2.NavigateUrl);
            }

            if (!Page.IsPostBack)
            {
                LayoutList.DataBind();
                BindThemes();
                CategoryTree1.SelectedCategories = new int[] { _CategoryId };
                CommerceBuilder.Users.User user = AbleContext.Current.User;
                PublishedBy.Text = user.PrimaryAddress.FirstName + " " + user.PrimaryAddress.LastName;
            }

            AbleCommerce.Code.PageHelper.SetPickImageButton(ThumbnailUrl, BrowseThumbnailUrl);
            AbleCommerce.Code.PageHelper.SetMaxLengthCountDown(MetaKeywordsValue, MetaKeywordsCharCount);
            AbleCommerce.Code.PageHelper.SetMaxLengthCountDown(MetaDescriptionValue, MetaDescriptionCharCount);

            if (!AbleContext.Current.Store.Settings.EnableWysiwygEditor)
            {
                AbleCommerce.Code.PageHelper.SetHtmlEditor(WebpageContent, ContentHtmlButton);
            }
            else
            {
                ContentHtmlButton.Visible = false;
            }

            if (!AbleContext.Current.Store.Settings.EnableWysiwygEditor)
            {
                AbleCommerce.Code.PageHelper.SetHtmlEditor(Summary, SummaryHtmlButton);
            }
            else
            {
                SummaryHtmlButton.Visible = false;
            }
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!Page.IsPostBack)
            {
                LayoutList.DataBind();
                BindThemes();
                CommerceBuilder.Users.User user = AbleContext.Current.User;
                PublishedBy.Text = user.PrimaryAddress.FirstName + " " + user.PrimaryAddress.LastName;
            }

            AbleCommerce.Code.PageHelper.SetPickImageButton(ThumbnailUrl, BrowseThumbnailUrl);
            AbleCommerce.Code.PageHelper.SetMaxLengthCountDown(MetaKeywordsValue, MetaKeywordsCharCount);
            AbleCommerce.Code.PageHelper.SetMaxLengthCountDown(MetaDescriptionValue, MetaDescriptionCharCount);

            if (!AbleContext.Current.Store.Settings.EnableWysiwygEditor)
            {
                AbleCommerce.Code.PageHelper.SetHtmlEditor(WebpageContent, HtmlButton);
            }
            else
            {
                HtmlButton.Visible = false;
            }
        }
예제 #4
0
        protected void Page_Load(object sender, EventArgs e)
        {
            CommerceBuilder.Users.User user = AbleContext.Current.User;
            if (user.IsAnonymous)
            {
                Response.Redirect("~/Checkout/Default.aspx");
                return;
            }

            if (CheckQuoteBasketItems())
            {
                Response.Redirect(AbleCommerce.Code.NavigationHelper.GetQuotePageUrl());
            }

            // VALIDATE BILLING ADDRESS
            if (!AbleContext.Current.User.PrimaryAddress.IsValid)
            {
                if (Request.UrlReferrer != null)
                {
                    Response.Redirect(Request.UrlReferrer.AbsoluteUri);
                }
                else
                {
                    Response.Redirect("EditBillAddress.aspx");
                }
            }

            Basket basket = AbleContext.Current.User.Basket;

            // VERIFY ANY SHIPPABLE ITEMS ARE IN PROPERLY CONFIGURED SHIPMENTS
            int unpackagedItems = basket.Items.Count(i => i.Shippable != CommerceBuilder.Shipping.Shippable.No && i.Shipment == null);

            if (unpackagedItems > 0)
            {
                Response.Redirect("ShipAddress.aspx");
            }
            int missingShippingAddress = basket.Shipments.Count(s => s.Address == null || !s.Address.IsValid);

            if (missingShippingAddress > 0)
            {
                Response.Redirect("ShipAddress.aspx");
            }

            IBasketService preCheckoutService = AbleContext.Resolve <IBasketService>();

            preCheckoutService.Recalculate(basket);
            if (basket.Items.Count == 0)
            {
                Response.Redirect(AbleCommerce.Code.NavigationHelper.GetBasketUrl());
            }
            if (!basket.Items.HasShippableProducts())
            {
                Response.Redirect("Payment.aspx");
            }
            weightFormat = "{0:0.##} " + AbleContext.Current.Store.WeightUnit;
            if (!Page.IsPostBack)
            {
                ShipmentRepeater.DataSource = AbleContext.Current.User.Basket.Shipments;
                ShipmentRepeater.DataBind();
            }
            else
            {
                UpdateShipments();
                preCheckoutService.Recalculate(basket);
                BasketTotalsAjax.Update();
            }
            foreach (var rec in basket.Items)
            {
                rec.Price = Math.Abs(rec.Price);
            }
            foreach (RepeaterItem item in ShipmentRepeater.Items)
            {
                if (item.ItemType == ListItemType.AlternatingItem || item.ItemType == ListItemType.Item)
                {
                    Control msgBox    = item.FindControl("ShipMessage");
                    Control msgBoxLbl = item.FindControl("ShipMessageCount");
                    if (msgBox != null && msgBoxLbl != null)
                    {
                        AbleCommerce.Code.PageHelper.SetMaxLengthCountDown(msgBox as TextBox, msgBoxLbl as Label);
                    }
                }
            }
        }
예제 #5
0
 public GetExpressCheckoutResult(CommerceBuilder.Users.User paypalUser, com.paypal.soap.api.ErrorType[] errors) : base(errors)
 {
     _PayPalUser = paypalUser;
 }
        protected void Page_Init(object sender, EventArgs e)
        {
            _user = AbleContext.Current.User;
            UpdateValidationOptions();

            // SET THE DEFAULT NAME
            CardName.Text = AbleContext.Current.User.PrimaryAddress.FullName;

            // POPULATE EXPIRATON DATE DROPDOWN
            int thisYear = LocaleHelper.LocalNow.Year;

            for (int i = 0; (i <= 10); i++)
            {
                ExpirationYear.Items.Add(new ListItem((thisYear + i).ToString()));
            }

            // POPULATE START DATE DROPDOWN
            for (int i = 1997; (i <= thisYear); i++)
            {
                StartDateYear.Items.Add(new ListItem(i.ToString()));
            }

            // LOAD AVAILABLE PAYMENT METHODS
            _methods = AbleCommerce.Code.StoreDataHelper.GetPaymentMethods(AbleContext.Current.UserId);
            List <string> creditCards    = new List <string>();
            List <string> intlDebitCards = new List <string>();

            foreach (PaymentMethod method in _methods)
            {
                if (method.IsCreditOrDebitCard())
                {
                    CardType.Items.Add(new ListItem(method.Name, method.Id.ToString()));
                    if (method.IsIntlDebitCard())
                    {
                        intlDebitCards.Add(method.Name);
                    }
                    else
                    {
                        creditCards.Add(method.Name);
                    }
                }
            }

            // SHOW OR HIDE INTL DEBIT FIELDS
            if (intlDebitCards.Count > 0)
            {
                trIntlCVV.Visible = true;
                if (creditCards.Count > 0)
                {
                    IntlCVVCredit.Visible = true;
                    IntlCVVCredit.Text    = string.Format(IntlCVVCredit.Text, FormatCardNames(creditCards));
                }
                else
                {
                    IntlCVVCredit.Visible = false;
                }
                IntlCVVDebit.Text             = string.Format(IntlCVVDebit.Text, FormatCardNames(intlDebitCards));
                SecurityCodeValidator.Enabled = false;
                trIntlInstructions.Visible    = true;
                IntlInstructions.Text         = string.Format(IntlInstructions.Text, FormatCardNames(intlDebitCards));
                trIssueNumber.Visible         = true;
                trStartDate.Visible           = true;
            }
            else
            {
                trIntlCVV.Visible          = false;
                trIntlInstructions.Visible = false;
                trIssueNumber.Visible      = false;
                trStartDate.Visible        = false;
            }

            // prevent double submit
            CreditCardButton.OnClientClick = "if (Page_ClientValidate('" + this.ValidationGroup + "')) { this.value='Processing...';this.onclick=function(){return false;}; }";
            CompleteButton.OnClientClick   = "if (Page_ClientValidate('" + this.ValidationGroup + "')) { this.value='Processing...';this.onclick=function(){return false;}; }";
            BootstrapPopover.Visible       = PageHelper.IsResponsiveTheme(this.Page);
        }
예제 #7
0
        protected void Page_Init(object sender, EventArgs e)
        {
            _user = AbleContext.Current.User;
            UpdateValidationOptions();

            // SET THE DEFAULT NAME
            CardName.Text = AbleContext.Current.User.PrimaryAddress.FullName;

            // POPULATE EXPIRATON DATE DROPDOWN
            int thisYear = LocaleHelper.LocalNow.Year;

            for (int i = 0; (i <= 10); i++)
            {
                ExpirationYear.Items.Add(new ListItem((thisYear + i).ToString()));
            }

            // POPULATE START DATE DROPDOWN
            for (int i = 1997; (i <= thisYear); i++)
            {
                StartDateYear.Items.Add(new ListItem(i.ToString()));
            }

            // LOAD AVAILABLE PAYMENT METHODS
            _methods = AbleCommerce.Code.StoreDataHelper.GetPaymentMethods(AbleContext.Current.UserId);
            List <string> creditCards    = new List <string>();
            List <string> intlDebitCards = new List <string>();

            foreach (PaymentMethod method in _methods)
            {
                if (method.IsCreditOrDebitCard())
                {
                    CardType.Items.Add(new ListItem(method.Name, method.Id.ToString()));
                    if (method.IsIntlDebitCard())
                    {
                        intlDebitCards.Add(method.Name);
                    }
                    else
                    {
                        creditCards.Add(method.Name);
                    }
                }
            }

            // SHOW AMEX HELP PANEL
            AmexPanel.Visible = _methods.Where(method => method.PaymentInstrumentType == PaymentInstrumentType.AmericanExpress).Count() > 0;

            // SHOW OR HIDE INTL DEBIT FIELDS
            if (intlDebitCards.Count > 0)
            {
                trIntlCVV.Visible = true;
                if (creditCards.Count > 0)
                {
                    IntlCVVCredit.Visible = true;
                    IntlCVVCredit.Text    = string.Format(IntlCVVCredit.Text, FormatCardNames(creditCards));
                }
                else
                {
                    IntlCVVCredit.Visible = false;
                }
                IntlCVVDebit.Text             = string.Format(IntlCVVDebit.Text, FormatCardNames(intlDebitCards));
                SecurityCodeValidator.Enabled = false;
                trIntlInstructions.Visible    = true;
                IntlInstructions.Text         = string.Format(IntlInstructions.Text, FormatCardNames(intlDebitCards));
                trIssueNumber.Visible         = true;
                trStartDate.Visible           = true;
            }
            else
            {
                trIntlCVV.Visible          = false;
                trIntlInstructions.Visible = false;
                trIssueNumber.Visible      = false;
                trStartDate.Visible        = false;
            }

            // prevent double submit
            CreditCardButton.OnClientClick = "if (Page_ClientValidate('" + this.ValidationGroup + "')) { this.value='Processing...';this.onclick=function(){return false;}; }";

            // javascript to close the help popup when clicked on background
            string jsClosePopup = "window.onload = function() { var popup = $find('PnlHelpPopup'); if(popup) popup._backgroundElement.onclick = function() { $find('PnlHelpPopup').hide(); }};";

            ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "jsClosePopup", jsClosePopup, true);
        }
예제 #8
0
        protected void Page_Load(object sender, EventArgs e)
        {
            string action = Request.QueryString["action"];

            if (!string.IsNullOrEmpty(action))
            {
                //DETERMINE THE ACTION
                action = action.ToLowerInvariant();
                if (action == "remove")
                {
                    //delete user from the list
                    int    emailListId = AlwaysConvert.ToInt(Request.QueryString["list"]);
                    string email       = Request.QueryString["email"];
                    string key         = Request.QueryString["key"];
                    AbleContext.Current.Database.BeginTransaction();
                    EmailList list = EmailListDataSource.Load(emailListId);
                    if ((list != null) && (email != null))
                    {
                        string        eluKey = string.Empty;
                        EmailListUser elu    = EmailListUserDataSource.Load(emailListId, email);
                        if (elu != null)
                        {
                            eluKey = elu.SignupDate.ToString("MMddyyhhmmss");
                        }
                        if (key == eluKey)
                        {
                            list.RemoveMember(email);
                            phMessage.Controls.Add(new LiteralControl(string.Format(this.DeletedMessage, list.Name)));
                        }
                    }
                    AbleContext.Current.Database.CommitTransaction();
                }
                else if (action == "confirm")
                {
                    //ADD USER TO LIST
                    int    emailListId = AlwaysConvert.ToInt(Request.QueryString["list"]);
                    string email       = Request.QueryString["email"];
                    string key         = Request.QueryString["key"];
                    AbleContext.Current.Database.BeginTransaction();
                    EmailList list = EmailListDataSource.Load(emailListId);
                    if ((list == null) || !ValidationHelper.IsValidEmail(email))
                    {
                        Response.Redirect(AbleCommerce.Code.NavigationHelper.GetHomeUrl());
                    }
                    EmailListSignup signup = EmailListSignupDataSource.Load(emailListId, email);
                    if (signup != null)
                    {
                        if (key == signup.SignupKey)
                        {
                            signup.Activate();

                            //confirm user subscription
                            phMessage.Controls.Add(new LiteralControl(string.Format(this.SubscribedMessage, list.Name)));
                        }
                    }
                    else if (EmailListUserDataSource.Load(emailListId, email) != null)
                    {
                        //CHECK IF USER HAS ALREADY ACTIVATED
                        //confirm user subscription
                        phMessage.Controls.Add(new LiteralControl(string.Format(this.SubscribedMessage, list.Name)));
                    }
                    AbleContext.Current.Database.CommitTransaction();
                }
                else if (action == "unsubrr")
                {
                    int    userId = AlwaysConvert.ToInt(Request.QueryString["uid"]);
                    string email  = Request.QueryString["email"];
                    if (string.IsNullOrEmpty(email))
                    {
                        return;
                    }

                    CommerceBuilder.Users.User user = CommerceBuilder.Users.UserDataSource.Load(userId);
                    if (user != null && email.ToLowerInvariant() == user.Email.ToLowerInvariant())
                    {
                        user.Settings.OptOutReviewReminders = true;
                        user.Save();
                        string message = "You have successfully unsubscribed from all future product review invitations. If you are a registered user, you may join again by logging into your account and updating your profile.";
                        phMessage.Controls.Add(new LiteralControl(message));
                    }
                }
            }

            //IF RESPONSE IS EMPTY, REQUEST IS INVALID
            if (phMessage.Controls.Count == 0)
            {
                phMessage.Controls.Add(new LiteralControl(this.InvalidMessage));
            }
        }