Ejemplo n.º 1
0
        private void RenderHtml()
        {
            StringBuilder writer = new StringBuilder();

            if (authorized)
            {
                //If there is a DeleteID remove it from the cart
                int    DeleteRecurringOrderNumber = CommonLogic.QueryStringUSInt("DeleteID");
                String DeleteRecurringOrderResult = String.Empty;
                if (DeleteRecurringOrderNumber != 0)
                {
                    Order             originalOrder = new Order(DeleteRecurringOrderNumber);
                    RecurringOrderMgr rmgr          = new RecurringOrderMgr();

                    ExpressAPIType expressApiType = PayPalController.GetAppropriateExpressType();

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

                //If there is a FullRefundID refund it
                int    FullRefundID     = CommonLogic.QueryStringUSInt("FullRefundID");
                String FullRefundResult = String.Empty;
                if (FullRefundID != 0)
                {
                    RecurringOrderMgr rmgr = new RecurringOrderMgr();
                    FullRefundResult = rmgr.ProcessAutoBillFullRefund(FullRefundID);
                }

                //If there is a PartialRefundID refund it
                int    PartialRefundID     = CommonLogic.QueryStringUSInt("PartialRefundID");
                String PartialRefundResult = String.Empty;
                if (PartialRefundID != 0)
                {
                    RecurringOrderMgr rmgr = new RecurringOrderMgr();
                    PartialRefundResult = rmgr.ProcessAutoBillPartialRefund(PartialRefundID);
                }

                //If there is a retrypaymentid, retry it
                int    RetryPaymentID     = CommonLogic.QueryStringUSInt("retrypaymentid");
                String RetryPaymentResult = String.Empty;
                if (RetryPaymentID != 0)
                {
                    RecurringOrderMgr rmgr = new RecurringOrderMgr();
                    RetryPaymentResult = rmgr.ProcessAutoBillRetryPayment(RetryPaymentID);
                }

                //If there is a restartid, restart it
                int    RestartPaymentID     = CommonLogic.QueryStringUSInt("restartid");
                String RestartPaymentResult = String.Empty;
                if (RestartPaymentID != 0)
                {
                    RecurringOrderMgr rmgr = new RecurringOrderMgr();
                    RestartPaymentResult = rmgr.ProcessAutoBillRestartPayment(RestartPaymentID);
                }

                if (AppLogic.AppConfigBool("AuditLog.Enabled"))
                {
                    writer.Append("<p><a href=\"" + AppLogic.AdminLinkUrl("auditlog.aspx") + "?CustomerID=" + TargetCustomer.CustomerID.ToString() + "\">View Customer Activity Log</a></p>\n");
                }

                if (ShoppingCart.NumItems(TargetCustomer.CustomerID, CartTypeEnum.RecurringCart) != 0)
                {
                    writer.Append("<p align=\"left\"><b>" + AppLogic.GetString("admin.common.CstMsg9", SkinID, LocaleSetting) + "</b></p>\n");

                    // build JS code to show/hide address update block:
                    StringBuilder tmpS = new StringBuilder(4096);
                    tmpS.Append("<script type=\"text/javascript\">\n");
                    tmpS.Append("function toggleLayer(DivID)\n");
                    tmpS.Append("{\n");
                    tmpS.Append("	var elem;\n");
                    tmpS.Append("	var vis;\n");
                    tmpS.Append("	if(document.getElementById)\n");
                    tmpS.Append("	{\n");
                    tmpS.Append("		// standards\n");
                    tmpS.Append("		elem = document.getElementById(DivID);\n");
                    tmpS.Append("	}\n");
                    tmpS.Append("	else if(document.all)\n");
                    tmpS.Append("	{\n");
                    tmpS.Append("		// old msie versions\n");
                    tmpS.Append("		elem = document.all[DivID];\n");
                    tmpS.Append("	}\n");
                    tmpS.Append("	else if(document.layers)\n");
                    tmpS.Append("	{\n");
                    tmpS.Append("		// nn4\n");
                    tmpS.Append("		elem = document.layers[DivID];\n");
                    tmpS.Append("	}\n");
                    tmpS.Append("	vis = elem.style;\n");
                    tmpS.Append("	if(vis.display == '' && elem.offsetWidth != undefined && elem.offsetHeight != undefined)\n");
                    tmpS.Append("	{\n");
                    tmpS.Append("		vis.display = (elem.offsetWidth != 0 && elem.offsetHeight != 0) ? 'block' : 'none';\n");
                    tmpS.Append("	}\n");
                    tmpS.Append("	vis.display = (vis.display == '' || vis.display == 'block') ? 'none' : 'block' ;\n");
                    tmpS.Append("}\n");
                    tmpS.Append("</script>\n");
                    tmpS.Append("\n");
                    tmpS.Append("<style type=\"text/css\">\n");
                    tmpS.Append("	.addressBlockDiv { margin: 0px 20px 0px 20px;  display: none;}\n");
                    tmpS.Append("</style>\n");
                    writer.Append(tmpS.ToString());

                    var parser = new Parser();

                    using (var dbconn = DB.dbConn())
                    {
                        dbconn.Open();
                        using (var rsr = DB.GetRS("Select distinct OriginalRecurringOrderNumber from ShoppingCart   with (NOLOCK)  where CartType=" + ((int)CartTypeEnum.RecurringCart).ToString() + " and CustomerID=" + TargetCustomer.CustomerID.ToString() + " order by OriginalRecurringOrderNumber desc", dbconn))
                        {
                            while (rsr.Read())
                            {
                                bool   ShowCancelButton  = true;
                                bool   ShowRetryButton   = false;
                                bool   ShowRestartButton = false;
                                String GatewayStatus     = String.Empty;

                                RecurringOrderMgr rmgr1 = new RecurringOrderMgr();
                                rmgr1.ProcessAutoBillGetAdminButtons(DB.RSFieldInt(rsr, "OriginalRecurringOrderNumber"), out ShowCancelButton, out ShowRetryButton, out ShowRestartButton, out GatewayStatus);

                                if (DeleteRecurringOrderNumber == DB.RSFieldInt(rsr, "OriginalRecurringOrderNumber"))
                                {
                                    writer.Append("<table class=\"table\">\n");
                                    writer.Append("<tr><td>\n");
                                    writer.Append("<span class=\"h4\">" + AppLogic.GetString("admin.cst_history.StopBillingResult", SkinID, LocaleSetting) + " " + DeleteRecurringOrderResult + "</span>\n");
                                    writer.Append("</td></tr>\n");
                                    writer.Append("</table>\n");
                                }

                                if (FullRefundID == DB.RSFieldInt(rsr, "OriginalRecurringOrderNumber"))
                                {
                                    writer.Append("<table class=\"table\">\n");
                                    writer.Append("<tr><td>\n");
                                    writer.Append("<span class=\"h4\">" + AppLogic.GetString("admin.cst_history.FullRefundResult", SkinID, LocaleSetting) + " " + FullRefundResult + "</span>\n");
                                    writer.Append("</td></tr>\n");
                                    writer.Append("</table>\n");
                                }

                                if (PartialRefundID == DB.RSFieldInt(rsr, "OriginalRecurringOrderNumber"))
                                {
                                    writer.Append("<table class=\"table\">\n");
                                    writer.Append("<tr><td>\n");
                                    writer.Append("<span class=\"h4\">" + AppLogic.GetString("admin.cst_history.PartialRefundResult", SkinID, LocaleSetting) + " " + PartialRefundResult + "</span>\n");
                                    writer.Append("</td></tr>\n");
                                    writer.Append("</table>\n");
                                }

                                if (RetryPaymentID == DB.RSFieldInt(rsr, "OriginalRecurringOrderNumber"))
                                {
                                    writer.Append("<table class=\"table\">\n");
                                    writer.Append("<tr><td>\n");
                                    writer.Append("<span class=\"h4\">" + AppLogic.GetString("admin.cst_history.RetryPaymentResult", SkinID, LocaleSetting) + " " + RetryPaymentResult + "</span>\n");
                                    writer.Append("</td></tr>\n");
                                    writer.Append("</table>\n");
                                }

                                if (RestartPaymentID == DB.RSFieldInt(rsr, "OriginalRecurringOrderNumber"))
                                {
                                    writer.Append("<table class=\"table\">\n");
                                    writer.Append("<tr><td>\n");
                                    writer.Append("<span class=\"h4\">" + AppLogic.GetString("admin.cst_history.RestartPaymentResult", SkinID, LocaleSetting) + " " + RestartPaymentResult + "</span>\n");
                                    writer.Append("</td></tr>\n");
                                    writer.Append("</table>\n");
                                }

                                writer.Append(AppLogic.GetRecurringCart(parser, TargetCustomer, DB.RSFieldInt(rsr, "OriginalRecurringOrderNumber"), SkinID, false, ShowCancelButton, ShowRetryButton, ShowRestartButton, GatewayStatus));
                            }
                        }
                    }
                }

                writer.Append("<div class=\"admin-module\">\n");
                writer.Append("<h3>" + AppLogic.GetString("admin.orderframe.OrderHistory", SkinID, LocaleSetting) + "</h3>\n");

                int N = 0;

                writer.Append("<table class=\"table\">\n");
                writer.Append("<tr>\n");
                writer.Append("<td><b>" + AppLogic.GetString("admin.common.OrderNumber", SkinID, LocaleSetting) + "</b></td>\n");
                writer.Append("<td><b>" + AppLogic.GetString("admin.common.OrderDate", SkinID, LocaleSetting) + "</b></td>\n");
                writer.Append("<td><b>" + AppLogic.GetString("admin.cst_history.PaymentStatus", SkinID, LocaleSetting) + "</b></td>\n");
                writer.Append("<td><b>" + AppLogic.GetString("admin.common.ShippingStatus", SkinID, LocaleSetting) + "</b></td>\n");
                writer.Append("<td><b>" + AppLogic.GetString("admin.common.OrderTotal", SkinID, LocaleSetting) + "</b></td>\n");
                if (AppLogic.AppConfigBool("ShowCustomerServiceNotesInReceipts"))
                {
                    writer.Append("<td><b>" + AppLogic.GetString("admin.cst_history.CustomerServiceNotes", SkinID, LocaleSetting) + "</b></td>\n");
                }
                writer.Append("</tr>\n");

                using (var dbconn = DB.dbConn())
                {
                    dbconn.Open();
                    using (var rs = DB.GetRS("Select '' Failed, PaymentGateway, PaymentMethod, ShippedOn, ShippedVIA, ShippingTrackingNumber, OrderNumber, OrderDate, OrderTotal, cast(CustomerServiceNotes as nvarchar(4000)) CustomerServiceNotes, TransactionState, DownloadEMailSentOn, CustomerID, RecurringSubscriptionID from orders  with (NOLOCK)  where CustomerID=" + TargetCustomer.CustomerID.ToString()
                                             + " union select 'Failed' Failed, PaymentGateway, PaymentMethod, null ShippedOn, null ShippedVIA, null ShippingTrackingNumber, OrderNumber, OrderDate, null OrderTotal, cast(TransactionResult as nvarchar(4000)) CustomerServiceNotes, null TransactionState, null DownloadEMailSentOn, CustomerID, RecurringSubscriptionID  from FailedTransaction  with (NOLOCK)  where CustomerID=" + TargetCustomer.CustomerID.ToString()
                                             + " order by OrderDate desc", dbconn))
                    {
                        while (rs.Read())
                        {
                            String PaymentStatus = String.Empty;
                            if (DB.RSField(rs, "PaymentMethod").Length != 0)
                            {
                                PaymentStatus = AppLogic.GetString("admin.order.PaymentMethod", SkinID, LocaleSetting) + " " + DB.RSField(rs, "PaymentMethod") + "<br/>";
                            }
                            else
                            {
                                PaymentStatus = AppLogic.GetString("admin.order.PaymentMethod", SkinID, LocaleSetting) + " " + CommonLogic.IIF(DB.RSField(rs, "CardNumber").StartsWith(AppLogic.ro_PMPayPal, StringComparison.InvariantCultureIgnoreCase), AppLogic.ro_PMPayPal, "Credit Card") + "<br/>";
                            }

                            if (DB.RSField(rs, "RecurringSubscriptionID").Length > 0 && DB.RSField(rs, "PaymentGateway") == AspDotNetStorefrontGateways.Gateway.ro_GWPAYFLOWPRO)
                            {                             // include link to recurringgatewaydetails.aspx for live gateway status
                                PaymentStatus += "Subscription ID: <a href=\"" + AppLogic.AdminLinkUrl("recurringgatewaydetails.aspx") + "?RecurringSubscriptionID=" + DB.RSField(rs, "RecurringSubscriptionID") + "\">" + DB.RSField(rs, "RecurringSubscriptionID") + "</a><br/>";
                            }

                            String ShippingStatus = String.Empty;
                            if (AppLogic.OrderHasShippableComponents(DB.RSFieldInt(rs, "OrderNumber")))
                            {
                                if (DB.RSFieldDateTime(rs, "ShippedOn") != System.DateTime.MinValue)
                                {
                                    ShippingStatus = "Shipped";
                                    if (DB.RSField(rs, "ShippedVIA").Length != 0)
                                    {
                                        ShippingStatus += " via " + DB.RSField(rs, "ShippedVIA");
                                    }
                                    ShippingStatus += " on " + Localization.ToThreadCultureShortDateString(DB.RSFieldDateTime(rs, "ShippedOn")) + ".";
                                    if (DB.RSField(rs, "ShippingTrackingNumber").Length != 0)
                                    {
                                        ShippingStatus += " " + AppLogic.GetString("admin.orderframe.TrackingNumber", SkinID, LocaleSetting) + " ";

                                        String TrackURL = Shipping.GetTrackingURL(DB.RSField(rs, "ShippingTrackingNumber"));
                                        if (TrackURL.Length != 0)
                                        {
                                            ShippingStatus += "<a href=\"" + TrackURL + "\" target=\"_blank\">" + DB.RSField(rs, "ShippingTrackingNumber") + "</a>";
                                        }
                                        else
                                        {
                                            ShippingStatus += DB.RSField(rs, "ShippingTrackingNumber");
                                        }
                                    }
                                }
                                else
                                {
                                    ShippingStatus = AppLogic.GetString("admin.cst_history.NotYetShipped", SkinID, LocaleSetting);
                                }
                            }
                            if (AppLogic.OrderHasDownloadComponents(DB.RSFieldInt(rs, "OrderNumber"), true))
                            {
                                if (DB.RSField(rs, "TransactionState") == AppLogic.ro_TXStateCaptured && DB.RSFieldDateTime(rs, "DownloadEMailSentOn") != System.DateTime.MinValue)
                                {
                                    if (ShippingStatus.Length != 0)
                                    {
                                        ShippingStatus += "<hr size=\"1\"/>";
                                    }
                                }
                                else
                                {
                                    if (ShippingStatus.Length == 0)
                                    {
                                        ShippingStatus += AppLogic.GetString("admin.cst_history.DownloadListPendingPayment", SkinID, LocaleSetting);
                                    }
                                }
                            }
                            writer.Append("<tr>\n");
                            writer.Append("<td>");
                            writer.Append("<a href=\"" + AppLogic.AdminLinkUrl("order.aspx") + "?ordernumber=" + DB.RSFieldInt(rs, "OrderNumber").ToString() + "\">" + DB.RSFieldInt(rs, "OrderNumber").ToString() + "</a>");
                            writer.Append("<br/><br/>");
                            if (string.IsNullOrEmpty(DB.RSField(rs, "Failed")))
                            {
                                var urlHelper = DependencyResolver.Current.GetService <UrlHelper>();
                                writer.AppendFormat(@"<a href=""{0}"" target=""_blank"">{1}</a>",
                                                    urlHelper.Action(
                                                        actionName: ActionNames.Index,
                                                        controllerName: ControllerNames.Receipt,
                                                        routeValues: new
                                {
                                    OrderNumber = DB.RSFieldInt(rs, "OrderNumber")
                                }),
                                                    AppLogic.GetString("admin.cst_history.PrintableReceipt", SkinID, LocaleSetting));
                            }
                            else
                            {
                                writer.Append("<font color=\"red\">" + DB.RSField(rs, "Failed") + "</font>");
                            }
                            writer.Append("</td>");
                            writer.Append("<td>" + Localization.ToNativeDateTimeString(DB.RSFieldDateTime(rs, "OrderDate")));
                            writer.Append("</td>");
                            writer.Append("<td>" + PaymentStatus + "&nbsp;" + "</td>");
                            writer.Append("<td>" + ShippingStatus + "&nbsp;" + "</td>");
                            writer.Append("<td>" + ThisCustomer.CurrencyString(DB.RSFieldDecimal(rs, "OrderTotal")) + "</td>");
                            if (AppLogic.AppConfigBool("ShowCustomerServiceNotesInReceipts"))
                            {
                                if (DB.RSField(rs, "CustomerServiceNotes").Length > 110)
                                {
                                    writer.Append("<td><textarea READONLY rows=\"10\" cols=\"50\">" + DB.RSField(rs, "CustomerServiceNotes") + "</textarea></td>");
                                }
                                else
                                {
                                    writer.Append("<td>" + CommonLogic.IIF(DB.RSField(rs, "CustomerServiceNotes").Length == 0, "None", DB.RSField(rs, "CustomerServiceNotes")) + "</td>");
                                }
                            }
                            else
                            {
                                writer.Append("&nbsp;");
                            }
                            writer.Append("</tr>\n");
                            N++;
                        }
                    }
                }
                writer.Append("</table>\n");
                if (N == 0)
                {
                    writer.Append("<p align=\"left\">" + AppLogic.GetString("admin.common.NoOrdersFound", SkinID, LocaleSetting) + "</p>\n");
                }
            }
            ltContent.Text = writer.ToString();
        }
Ejemplo n.º 2
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.º 3
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.º 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();
            }
        }