Ejemplo n.º 1
0
        protected void Page_Load(object sender, System.EventArgs e)
        {
            if (ThisCustomer.IsAdminUser || AppLogic.AppConfigBool("UseStrongPwd"))
            {
                ctrlAccount.PasswordNote = AppLogic.GetString("account.strongPassword", ThisCustomer.SkinID, ThisCustomer.LocaleSetting);
            }
            RequireSecurePage();
            Checkout = CommonLogic.QueryStringBool("checkout");
            RequiresLogin(CommonLogic.GetThisPageName(false) + "?" + CommonLogic.ServerVariables("QUERY_STRING"));
            SectionTitle = AppLogic.GetString("account.aspx.56", SkinID, ThisCustomer.LocaleSetting);
            ctrlAccount.Attributes.Add("Disabled", "");
            if (Checkout)
            {
                GatewayCheckoutByAmazon.CheckoutByAmazon checkoutByAmazon = new GatewayCheckoutByAmazon.CheckoutByAmazon();
                if (checkoutByAmazon.IsCheckingOut)
                {
                    pnlCBAAddressWidget.Visible         = true;
                    litCBAAddressWidget.Text            = checkoutByAmazon.RenderAddressWidgetWithRedirect("CBAAddressWidgetContainer", Server.UrlEncode("account.aspx?checkout=true"), new Guid(ThisCustomer.CustomerGUID), 300, 200);
                    litCBAAddressWidgetInstruction.Text = "gw.checkoutbyamazon.display.4".StringResource();

                    pnlAddress.Visible = false;
                }

                ThisCustomer.RequireCustomerRecord();
                CheckoutSteps.Visible = true;
            }
            else
            {
                CheckoutSteps.Visible = false;
            }

            lblErrorMessage.Text  = String.Empty;
            pnlErrorMsg.Visible   = false;
            lblAcctUpdateMsg.Text = String.Empty;

            var status = new StringBuilder();

            bool newAccount = CommonLogic.QueryStringBool("newaccount");

            if (newAccount)
            {
                lblErrorMessage.Text = AppLogic.GetString("createaccount.aspx.86", SkinID, ThisCustomer.LocaleSetting);
                pnlErrorMsg.Visible  = true;
            }

            ThisCustomer.ValidatePrimaryAddresses();

            bool AllowShipToDifferentThanBillTo = AppLogic.AppConfigBool("AllowShipToDifferentThanBillTo") && !AppLogic.AppConfigBool("SkipShippingOnCheckout");

            if (!AllowShipToDifferentThanBillTo)
            {
                pnlShipping.Visible = false;
            }

            //If there is a DeleteID remove it from the cart
            int DeleteID = CommonLogic.QueryStringUSInt("DeleteID");

            if (DeleteID != 0 && Customer.OwnsThisOrder(ThisCustomer.CustomerID, DeleteID))
            {
                Order             originalOrder = new Order(DeleteID);
                RecurringOrderMgr rmgr          = new RecurringOrderMgr(base.EntityHelpers, base.GetParser);

                ExpressAPIType expressApiType = PayPalController.GetAppropriateExpressType();

                if (originalOrder.PaymentMethod == AppLogic.ro_PMPayPalExpress && expressApiType == ExpressAPIType.PayPalExpress)
                {
                    status.Append(rmgr.CancelPPECRecurringOrder(DeleteID, false));
                }
                else
                {
                    status.Append(rmgr.CancelRecurringOrder(DeleteID));
                }
            }

            //If there is a FullRefundID refund it
            int FullRefundID = CommonLogic.QueryStringUSInt("FullRefundID");

            if (FullRefundID != 0 && Customer.OwnsThisOrder(ThisCustomer.CustomerID, FullRefundID))
            {
                RecurringOrderMgr rmgr = new RecurringOrderMgr(base.EntityHelpers, base.GetParser);
                status.Append(rmgr.ProcessAutoBillFullRefund(FullRefundID));
            }

            //If there is a PartialRefundID refund it
            int PartialRefundID = CommonLogic.QueryStringUSInt("PartialRefundID");

            if (PartialRefundID != 0 && Customer.OwnsThisOrder(ThisCustomer.CustomerID, PartialRefundID))
            {
                RecurringOrderMgr rmgr = new RecurringOrderMgr(base.EntityHelpers, base.GetParser);
                status.Append(rmgr.ProcessAutoBillPartialRefund(PartialRefundID));
            }

            //do not display an error message saying OK
            lblErrorMessage.Text = status.ToString() != AppLogic.ro_OK ? status.ToString() : String.Empty;
            pnlErrorMsg.Visible  = lblErrorMessage.Text.Length > 0;

            if (!this.IsPostBack)
            {
                RefreshPage();
                SetAccountFields();
                if (ThisCustomer.IsRegistered)
                {
                    this.hdnCustomerLevel1.Text = ThisCustomer.CustomerLevelID.ToString();
                }
                else
                {
                    hdnCustomerLevel1.Text = "-1";
                }
            }
        }
Ejemplo n.º 2
0
        private void PerformPageAccessLogic()
        {
            RequireSecurePage();
            RequiresLogin(CommonLogic.GetThisPageName(false) + "?" + CommonLogic.ServerVariables("QUERY_STRING"));

            //If current user came from IS, chances are it has no Primary Billing Info!
            if (ThisCustomer.PrimaryBillingAddressID == String.Empty)
            {
                // IS Facade implementation
                string[][] commandSet;
                string[][] parameters;

                var customerGateway = new CustomerDetailDatasetGateway();
                var iseCustomer     = new CustomerDetailFacade(customerGateway);

                // Specific view and stored procedure
                commandSet = new string[][] { new string[] { "CustomerView", "ReadCustomer" } };
                parameters = new string[][] { new string[] { "@CustomerCode", null } };

                // Load it at defined Dataset
                iseCustomer.LoadDataSet(commandSet, parameters, Interprise.Framework.Base.Shared.Enum.ClearType.Specific, Interprise.Framework.Base.Shared.Enum.ConnectionStringType.Online);

                // Retrieve data information, store it at DataRow array
                // Filter the data information based on the Customer Code
                DataRow[] rowsCustomer = customerGateway.Tables["CustomerView"].Select(string.Concat("CustomerCode = '", ThisCustomer.CustomerCode, "'"));

                // It should return 1 record from filtered dataset.
                if (rowsCustomer.Length > 0)
                {
                    // By Default
                    string ResidenceType = "Residential";

                    // Address Class to store address information
                    // retrieve via DataRow array
                    var thisAddress = new Address
                    {
                        CustomerCode = ThisCustomer.CustomerCode,
                        Name         = rowsCustomer[0]["CustomerName"].ToString(),
                        Address1     = rowsCustomer[0]["Address"].ToString(),
                        City         = rowsCustomer[0]["City"].ToString(),
                        State        = rowsCustomer[0]["State"].ToString(),
                        PostalCode   = rowsCustomer[0]["PostalCode"].ToString(),
                        Country      = rowsCustomer[0]["Country"].ToString(),
                        Phone        = rowsCustomer[0]["Telephone"].ToString(),
                        County       = rowsCustomer[0]["County"].ToString()
                    };

                    // set default if null
                    if (!string.IsNullOrEmpty(rowsCustomer[0]["ResidenceType"].ToString()))
                    {
                        ResidenceType = rowsCustomer[0]["ResidenceType"].ToString();
                    }

                    thisAddress.ResidenceType = (ResidenceTypes)Enum.Parse(typeof(ResidenceTypes), ResidenceType);

                    // Adding of Customer Billing Address Information
                    InterpriseHelper.AddCustomerBillToInfo(ThisCustomer.CustomerCode, thisAddress, true);
                }
                else
                {
                    // If no Record is found
                    // Redirects to address information entry
                    Response.Redirect("selectaddress.aspx?add=true&setPrimary=true&checkout=False&addressType=Billing&returnURL=account.aspx");
                }
            }

            ThisCustomer.ValidatePrimaryAddresses();
            SkinImagePath = "skins/skin_" + SkinID.ToString() + "/images/";
        }
Ejemplo n.º 3
0
        protected void Page_Load(object sender, System.EventArgs e)
        {
            if (AppLogic.AppConfigBool("UseStringPwd"))
            {
                ctrlAccount.PasswordNote = AppLogic.GetString("account.stringPassword", ThisCustomer.SkinID, ThisCustomer.LocaleSetting);
            }
            RequireSecurePage();
            RequiresLogin(CommonLogic.GetThisPageName(false) + "?" + CommonLogic.ServerVariables("QUERY_STRING"));
            SectionTitle = AppLogic.GetString("account.aspx.56", SkinID, ThisCustomer.LocaleSetting);
            Checkout     = CommonLogic.QueryStringBool("checkout");
            if (Checkout)
            {
                GatewayCheckoutByAmazon.CheckoutByAmazon checkoutByAmazon = new GatewayCheckoutByAmazon.CheckoutByAmazon();
                if (checkoutByAmazon.IsCheckingOut)
                {
                    pnlCBAAddressWidget.Visible         = true;
                    litCBAAddressWidget.Text            = checkoutByAmazon.RenderAddressWidgetWithRedirect("CBAAddressWidgetContainer", Server.UrlEncode("account.aspx?checkout=true"), new Guid(ThisCustomer.CustomerGUID), 300, 200);
                    litCBAAddressWidgetInstruction.Text = "gw.checkoutbyamazon.display.4".StringResource();

                    tblAccount.Visible = false;
                }

                ThisCustomer.RequireCustomerRecord();
            }

            ErrorMsgLabel.Text    = "";
            lblAcctUpdateMsg.Text = "";

            bool newAccount = CommonLogic.QueryStringBool("newaccount");

            if (newAccount)
            {
                ErrorMsgLabel.Text = "<b><center>" + AppLogic.GetString("createaccount.aspx.86", SkinID, ThisCustomer.LocaleSetting) + "</center></b>";
            }

            ThisCustomer.ValidatePrimaryAddresses();

            bool AllowShipToDifferentThanBillTo = AppLogic.AppConfigBool("AllowShipToDifferentThanBillTo") && !AppLogic.AppConfigBool("SkipShippingOnCheckout");

            if (!AllowShipToDifferentThanBillTo)
            {
                pnlShipping.Visible = pnlShipping2.Visible = false;
            }

            //If there is a DeleteID remove it from the cart
            int DeleteID = CommonLogic.QueryStringUSInt("DeleteID");

            if (DeleteID != 0 && Customer.OwnsThisOrder(ThisCustomer.CustomerID, DeleteID))
            {
                RecurringOrderMgr rmgr = new RecurringOrderMgr(base.EntityHelpers, base.GetParser);
                rmgr.CancelRecurringOrder(DeleteID);
            }

            //If there is a FullRefundID refund it
            int FullRefundID = CommonLogic.QueryStringUSInt("FullRefundID");

            if (FullRefundID != 0 && Customer.OwnsThisOrder(ThisCustomer.CustomerID, FullRefundID))
            {
                RecurringOrderMgr rmgr = new RecurringOrderMgr(base.EntityHelpers, base.GetParser);
                rmgr.ProcessAutoBillFullRefund(FullRefundID);
            }

            //If there is a PartialRefundID refund it
            int PartialRefundID = CommonLogic.QueryStringUSInt("PartialRefundID");

            if (PartialRefundID != 0 && Customer.OwnsThisOrder(ThisCustomer.CustomerID, PartialRefundID))
            {
                RecurringOrderMgr rmgr = new RecurringOrderMgr(base.EntityHelpers, base.GetParser);
                rmgr.ProcessAutoBillPartialRefund(PartialRefundID);
            }

            //SkinImagePath = "~/App_Themes/skin_" + SkinID.ToString() + "/images/";

            if (!this.IsPostBack)
            {
                ctrlAccount.FirstName         = ThisCustomer.FirstName;
                ctrlAccount.LastName          = ThisCustomer.LastName;
                ctrlAccount.Email             = ThisCustomer.EMail.ToLowerInvariant().Trim();
                ctrlAccount.Password          = String.Empty;
                ctrlAccount.PasswordConfirm   = String.Empty;
                ctrlAccount.Phone             = ThisCustomer.Phone;
                ctrlAccount.SaveCC            = ThisCustomer.MasterShouldWeStoreCreditCardInfo || ThisCustomer.SecureNetVaultMasterShouldWeStoreCreditCardInfo;
                ctrlAccount.Over13            = ThisCustomer.IsOver13;
                ctrlAccount.VATRegistrationID = ThisCustomer.VATRegistrationID;
                if (ThisCustomer.OKToEMail)
                {
                    ctrlAccount.OKToEmailYes = true;
                }
                else
                {
                    ctrlAccount.OKToEmailNo = true;
                }

                RefreshPage();
            }
        }
Ejemplo n.º 4
0
        protected void Page_Load(object sender, System.EventArgs e)
        {
            MobileHelper.RedirectPageWhenMobileIsDisabled("~/account.aspx", ThisCustomer);

            if (ThisCustomer.IsAdminUser || AppLogic.AppConfigBool("UseStrongPwd"))
            {
                ctrlAccount.PasswordNote = AppLogic.GetString("account.strongPassword", ThisCustomer.SkinID, ThisCustomer.LocaleSetting);
            }
            RequireSecurePage();
            RequiresLogin(CommonLogic.GetThisPageName(false) + "?" + CommonLogic.ServerVariables("QUERY_STRING"));
            SectionTitle = AppLogic.GetString("account.aspx.56", SkinID, ThisCustomer.LocaleSetting);
            Checkout     = CommonLogic.QueryStringBool("checkout");
            if (Checkout)
            {
                ThisCustomer.RequireCustomerRecord();
                pnlAccountInfoMP.Visible  = false;
                pnlOrderHistoryMP.Visible = false;
            }

            ErrorMsgLabel.Text    = "";
            lblAcctUpdateMsg.Text = "";

            bool newAccount = CommonLogic.QueryStringBool("newaccount");

            if (newAccount)
            {
                ErrorMsgLabel.Text = "<b><center>" + AppLogic.GetString("createaccount.aspx.86", SkinID, ThisCustomer.LocaleSetting) + "</center></b>";
            }

            ThisCustomer.ValidatePrimaryAddresses();

            //If there is a DeleteID remove it from the cart
            int DeleteID = CommonLogic.QueryStringUSInt("DeleteID");

            if (DeleteID != 0 && Customer.OwnsThisOrder(ThisCustomer.CustomerID, DeleteID))
            {
                RecurringOrderMgr rmgr = new RecurringOrderMgr(base.EntityHelpers, base.GetParser);
                rmgr.CancelRecurringOrder(DeleteID);
            }

            //If there is a FullRefundID refund it
            int FullRefundID = CommonLogic.QueryStringUSInt("FullRefundID");

            if (FullRefundID != 0 && Customer.OwnsThisOrder(ThisCustomer.CustomerID, FullRefundID))
            {
                RecurringOrderMgr rmgr = new RecurringOrderMgr(base.EntityHelpers, base.GetParser);
                rmgr.ProcessAutoBillFullRefund(FullRefundID);
            }

            //If there is a PartialRefundID refund it
            int PartialRefundID = CommonLogic.QueryStringUSInt("PartialRefundID");

            if (PartialRefundID != 0 && Customer.OwnsThisOrder(ThisCustomer.CustomerID, PartialRefundID))
            {
                RecurringOrderMgr rmgr = new RecurringOrderMgr(base.EntityHelpers, base.GetParser);
                rmgr.ProcessAutoBillPartialRefund(PartialRefundID);
            }

            if (!this.IsPostBack)
            {
                ctrlAccount.FirstName         = ThisCustomer.FirstName;
                ctrlAccount.LastName          = ThisCustomer.LastName;
                ctrlAccount.Email             = ThisCustomer.EMail.ToLowerInvariant().Trim();
                ctrlAccount.Password          = String.Empty;
                ctrlAccount.PasswordConfirm   = String.Empty;
                ctrlAccount.Phone             = ThisCustomer.Phone;
                ctrlAccount.SaveCC            = ThisCustomer.MasterShouldWeStoreCreditCardInfo || ThisCustomer.SecureNetVaultMasterShouldWeStoreCreditCardInfo;
                ctrlAccount.Over13            = ThisCustomer.IsOver13;
                ctrlAccount.VATRegistrationID = ThisCustomer.VATRegistrationID;
                if (ThisCustomer.OKToEMail)
                {
                    ctrlAccount.OKToEmailYes = true;
                }
                else
                {
                    ctrlAccount.OKToEmailNo = true;
                }

                RefreshPage();
            }

            //If email address confirmation is on, prefill the box so they don't have to populate it to change other things
            TextBox txtReEnterEmail = (TextBox)ctrlAccount.FindControl("txtReEnterEmail");

            if (txtReEnterEmail != null)
            {
                txtReEnterEmail.Text = ThisCustomer.EMail.ToLowerInvariant().Trim();
            }
        }