protected void btnNextStep_Click(object sender, EventArgs e)
        {
            if (Page.IsValid)
            {
                //reward points
                NopContext.Current.User.UseRewardPointsDuringCheckout = cbUseRewardPoints.Checked;

                //payment methods
                int paymentMethodId = this.SelectedPaymentMethodId;
                var paymentMethod   = PaymentMethodManager.GetPaymentMethodById(paymentMethodId);
                if (paymentMethod != null && paymentMethod.IsActive)
                {
                    NopContext.Current.User = CustomerManager.SetLastPaymentMethodId(NopContext.Current.User.CustomerId, paymentMethodId);
                    var args1 = new CheckoutStepEventArgs()
                    {
                        PaymentMethodSelected = true
                    };
                    OnCheckoutStepChanged(args1);
                    if (!this.OnePageCheckout)
                    {
                        Response.Redirect("~/checkoutpaymentinfo.aspx");
                    }
                }
            }
        }
示例#2
0
        private void CreateChildControlsTree()
        {
            PaymentMethod paymentMethod = PaymentMethodManager.GetPaymentMethodById(this.PaymentMethodId);

            if (paymentMethod != null)
            {
                Control child = null;
                try
                {
                    child = base.LoadControl(paymentMethod.ConfigureTemplatePath);
                    this.ConfigureMethodHolder.Controls.Add(child);
                }
                catch (Exception)
                {
                }
            }
        }
示例#3
0
        private void BindData()
        {
            PaymentMethod paymentMethod = PaymentMethodManager.GetPaymentMethodById(this.PaymentMethodId);

            if (paymentMethod != null)
            {
                this.txtName.Text                  = paymentMethod.Name;
                this.txtVisibleName.Text           = paymentMethod.VisibleName;
                this.txtDescription.Text           = paymentMethod.Description;
                this.txtConfigureTemplatePath.Text = paymentMethod.ConfigureTemplatePath;
                this.txtUserTemplatePath.Text      = paymentMethod.UserTemplatePath;
                this.txtClassName.Text             = paymentMethod.ClassName;
                this.txtSystemKeyword.Text         = paymentMethod.SystemKeyword;
                this.cbActive.Checked              = paymentMethod.IsActive;
                this.txtDisplayOrder.Value         = paymentMethod.DisplayOrder;
            }
            else
            {
                Response.Redirect("PaymentMethods.aspx");
            }
        }
示例#4
0
        protected void SaveButton_Click(object sender, EventArgs e)
        {
            if (Page.IsValid)
            {
                try
                {
                    var paymentMethod = PaymentMethodManager.GetPaymentMethodById(this.PaymentMethodId);

                    if (paymentMethod != null)
                    {
                        paymentMethod = PaymentMethodManager.UpdatePaymentMethod(paymentMethod.PaymentMethodId,
                                                                                 txtName.Text, txtVisibleName.Text, txtDescription.Text,
                                                                                 txtConfigureTemplatePath.Text, txtUserTemplatePath.Text, txtClassName.Text,
                                                                                 txtSystemKeyword.Text, cbHidePaymentInfoForZeroOrders.Checked,
                                                                                 cbActive.Checked, txtDisplayOrder.Value);

                        var configureModule = GetConfigureModule();
                        if (configureModule != null)
                        {
                            configureModule.Save();
                        }

                        CustomerActivityManager.InsertActivity(
                            "EditPaymentMethod",
                            GetLocaleResourceString("ActivityLog.EditPaymentMethod"),
                            paymentMethod.Name);

                        Response.Redirect(string.Format("PaymentMethodDetails.aspx?PaymentMethodID={0}&TabID={1}", paymentMethod.PaymentMethodId, this.GetActiveTabId(this.PaymentTabs)));
                    }
                    else
                    {
                        Response.Redirect("PaymentMethods.aspx");
                    }
                }
                catch (Exception exc)
                {
                    ProcessException(exc);
                }
            }
        }
示例#5
0
            private void ctrl_DataBinding(Object sender, EventArgs e)
            {
                WebControl  ctrl = sender as WebControl;
                GridViewRow row  = ctrl.NamingContainer as GridViewRow;

                switch (_dataType)
                {
                case "String":
                    object RawValue = DataBinder.Eval(row.DataItem, _columnName);
                    (ctrl as Label).Text = RawValue.ToString();
                    break;

                case "Checkbox":
                    PaymentMethodCountryMappingHelperClass map1 = row.DataItem as PaymentMethodCountryMappingHelperClass;
                    PaymentMethod pm = PaymentMethodManager.GetPaymentMethodById(_paymentMethodId);
                    if (pm != null)
                    {
                        switch (pm.PaymentMethodType)
                        {
                        case PaymentMethodTypeEnum.Unknown:
                        case PaymentMethodTypeEnum.Standard:
                        {
                            (ctrl as CheckBox).Checked = map1.Restrict[_paymentMethodId];
                        }
                        break;

                        case PaymentMethodTypeEnum.Button:
                        {
                            (ctrl as CheckBox).Enabled = false;
                            (ctrl as CheckBox).Text    = "n/a";
                        }
                        break;

                        default:
                            break;
                        }
                    }
                    break;
                }
            }
示例#6
0
        private void BindData()
        {
            PaymentMethod paymentMethod = PaymentMethodManager.GetPaymentMethodById(this.PaymentMethodId);

            if (paymentMethod != null)
            {
                this.txtName.Text                           = paymentMethod.Name;
                this.txtVisibleName.Text                    = paymentMethod.VisibleName;
                this.txtDescription.Text                    = paymentMethod.Description;
                this.txtConfigureTemplatePath.Text          = paymentMethod.ConfigureTemplatePath;
                this.txtUserTemplatePath.Text               = paymentMethod.UserTemplatePath;
                this.txtClassName.Text                      = paymentMethod.ClassName;
                this.txtSystemKeyword.Text                  = paymentMethod.SystemKeyword;
                this.cbHidePaymentInfoForZeroOrders.Checked = paymentMethod.HidePaymentInfoForZeroOrders;
                this.cbActive.Checked                       = paymentMethod.IsActive;
                this.txtDisplayOrder.Value                  = paymentMethod.DisplayOrder;
                try
                {
                    lblCanCapture.Text               = PaymentManager.CanCapture(this.PaymentMethodId) ? GetLocaleResourceString("Admin.Common.Yes") : GetLocaleResourceString("Admin.Common.No");
                    lblCanRefund.Text                = PaymentManager.CanRefund(this.PaymentMethodId) ? GetLocaleResourceString("Admin.Common.Yes") : GetLocaleResourceString("Admin.Common.No");
                    lblCanPartiallyRefund.Text       = PaymentManager.CanPartiallyRefund(this.PaymentMethodId) ? GetLocaleResourceString("Admin.Common.Yes") : GetLocaleResourceString("Admin.Common.No");
                    lblCanVoid.Text                  = PaymentManager.CanVoid(this.PaymentMethodId) ? GetLocaleResourceString("Admin.Common.Yes") : GetLocaleResourceString("Admin.Common.No");
                    lblSupportRecurringPayments.Text = CommonHelper.ConvertEnum(PaymentManager.SupportRecurringPayments(this.PaymentMethodId).ToString());
                }
                catch (Exception exc)
                {
                    Debug.WriteLine(exc.ToString());
                    lblCanCapture.Text               = "Unknown";
                    lblCanRefund.Text                = "Unknown";
                    lblCanPartiallyRefund.Text       = "Unknown";
                    lblCanVoid.Text                  = "Unknown";
                    lblSupportRecurringPayments.Text = "Unknown";
                }
            }
            else
            {
                Response.Redirect("PaymentMethods.aspx");
            }
        }
        protected void BindData()
        {
            this.lnkPrint.NavigateUrl = Page.ResolveUrl("~/PrintOrderDetails.aspx?OrderID=" + this.OrderId).ToLowerInvariant();
            this.lblOrderId.Text      = order.OrderId.ToString();
            this.lblCreatedOn.Text    = DateTimeHelper.ConvertToUserTime(order.CreatedOn).ToString("D");
            this.lblOrderStatus.Text  = OrderManager.GetOrderStatusName(order.OrderStatusId);
            btnReOrder.Visible        = OrderManager.IsReOrderAllowed;

            if (order.ShippingStatus != ShippingStatusEnum.ShippingNotRequired)
            {
                this.pnlShipping.Visible       = true;
                this.lShippingFirstName.Text   = Server.HtmlEncode(order.ShippingFirstName);
                this.lShippingLastName.Text    = Server.HtmlEncode(order.ShippingLastName);
                this.lShippingPhoneNumber.Text = Server.HtmlEncode(order.ShippingPhoneNumber);
                this.lShippingEmail.Text       = Server.HtmlEncode(order.ShippingEmail);
                this.lShippingFaxNumber.Text   = Server.HtmlEncode(order.ShippingFaxNumber);
                if (!String.IsNullOrEmpty(order.ShippingCompany))
                {
                    this.lShippingCompany.Text = Server.HtmlEncode(order.ShippingCompany);
                }
                else
                {
                    pnlShippingCompany.Visible = false;
                }
                this.lShippingAddress1.Text = Server.HtmlEncode(order.ShippingAddress1);
                if (!String.IsNullOrEmpty(order.ShippingAddress2))
                {
                    this.lShippingAddress2.Text = Server.HtmlEncode(order.ShippingAddress2);
                }
                else
                {
                    pnlShippingAddress2.Visible = false;
                }
                this.lShippingCity.Text          = Server.HtmlEncode(order.ShippingCity);
                this.lShippingStateProvince.Text = Server.HtmlEncode(order.ShippingStateProvince);
                this.lShippingZipPostalCode.Text = Server.HtmlEncode(order.ShippingZipPostalCode);
                if (!String.IsNullOrEmpty(order.ShippingCountry))
                {
                    this.lShippingCountry.Text = Server.HtmlEncode(order.ShippingCountry);
                }
                else
                {
                    pnlShippingCountry.Visible = false;
                }

                this.lblShippingMethod.Text = Server.HtmlEncode(order.ShippingMethod);
                this.lblOrderWeight.Text    = string.Format("{0} [{1}]", order.OrderWeight, MeasureManager.BaseWeightIn.Name);

                if (order.ShippedDate.HasValue)
                {
                    this.lblShippedDate.Text = DateTimeHelper.ConvertToUserTime(order.ShippedDate.Value).ToString("D");
                }
                else
                {
                    this.lblShippedDate.Text = GetLocaleResourceString("Order.NotYetShipped");
                }

                if (order.DeliveryDate.HasValue)
                {
                    this.lblDeliveredOn.Text = DateTimeHelper.ConvertToUserTime(order.DeliveryDate.Value).ToString("D");
                }
                else
                {
                    this.lblDeliveredOn.Text = GetLocaleResourceString("Order.Order.NotYetDelivered");
                }

                if (!string.IsNullOrEmpty(order.TrackingNumber))
                {
                    lblTrackingNumber.Text    = order.TrackingNumber;
                    pnlTrackingNumber.Visible = true;
                }
                else
                {
                    pnlTrackingNumber.Visible = false;
                }

                this.pnlShippingTotal.Visible = true;
            }
            else
            {
                this.pnlShipping.Visible      = false;
                this.pnlShippingTotal.Visible = false;
            }

            this.lBillingFirstName.Text   = Server.HtmlEncode(order.BillingFirstName);
            this.lBillingLastName.Text    = Server.HtmlEncode(order.BillingLastName);
            this.lBillingPhoneNumber.Text = Server.HtmlEncode(order.BillingPhoneNumber);
            this.lBillingEmail.Text       = Server.HtmlEncode(order.BillingEmail);
            this.lBillingFaxNumber.Text   = Server.HtmlEncode(order.BillingFaxNumber);
            if (!String.IsNullOrEmpty(order.BillingCompany))
            {
                this.lBillingCompany.Text = Server.HtmlEncode(order.BillingCompany);
            }
            else
            {
                pnlBillingCompany.Visible = false;
            }
            this.lBillingAddress1.Text = Server.HtmlEncode(order.BillingAddress1);
            if (!String.IsNullOrEmpty(order.BillingAddress2))
            {
                this.lBillingAddress2.Text = Server.HtmlEncode(order.BillingAddress2);
            }
            else
            {
                pnlBillingAddress2.Visible = false;
            }
            this.lBillingCity.Text          = Server.HtmlEncode(order.BillingCity);
            this.lBillingStateProvince.Text = Server.HtmlEncode(order.BillingStateProvince);
            this.lBillingZipPostalCode.Text = Server.HtmlEncode(order.BillingZipPostalCode);
            if (!String.IsNullOrEmpty(order.BillingCountry))
            {
                this.lBillingCountry.Text = Server.HtmlEncode(order.BillingCountry);
            }
            else
            {
                pnlBillingCountry.Visible = false;
            }


            var paymentMethod = PaymentMethodManager.GetPaymentMethodById(order.PaymentMethodId);

            if (paymentMethod != null)
            {
                this.lPaymentMethod.Text = paymentMethod.VisibleName;
            }
            else
            {
                this.lPaymentMethod.Text = order.PaymentMethodName;
            }

            switch (order.CustomerTaxDisplayType)
            {
            case TaxDisplayTypeEnum.ExcludingTax:
            {
                this.lblOrderSubtotal.Text = PriceHelper.FormatPrice(order.OrderSubtotalExclTaxInCustomerCurrency, true, order.CustomerCurrencyCode, NopContext.Current.WorkingLanguage, false);
                this.lblOrderShipping.Text = PriceHelper.FormatShippingPrice(order.OrderShippingExclTaxInCustomerCurrency, true, order.CustomerCurrencyCode, NopContext.Current.WorkingLanguage, false);
                this.lblPaymentMethodAdditionalFee.Text = PriceHelper.FormatPaymentMethodAdditionalFee(order.PaymentMethodAdditionalFeeExclTaxInCustomerCurrency, true, order.CustomerCurrencyCode, NopContext.Current.WorkingLanguage, false);
            }
            break;

            case TaxDisplayTypeEnum.IncludingTax:
            {
                this.lblOrderSubtotal.Text = PriceHelper.FormatPrice(order.OrderSubtotalInclTaxInCustomerCurrency, true, order.CustomerCurrencyCode, NopContext.Current.WorkingLanguage, true);
                this.lblOrderShipping.Text = PriceHelper.FormatShippingPrice(order.OrderShippingInclTaxInCustomerCurrency, true, order.CustomerCurrencyCode, NopContext.Current.WorkingLanguage, true);
                this.lblPaymentMethodAdditionalFee.Text = PriceHelper.FormatPaymentMethodAdditionalFee(order.PaymentMethodAdditionalFeeInclTaxInCustomerCurrency, true, order.CustomerCurrencyCode, NopContext.Current.WorkingLanguage, true);
            }
            break;
            }

            bool displayPaymentMethodFee = true;

            if (order.PaymentMethodAdditionalFeeExclTaxInCustomerCurrency == decimal.Zero)
            {
                displayPaymentMethodFee = false;
            }
            phPaymentMethodAdditionalFee.Visible = displayPaymentMethodFee;

            //discount
            if (order.OrderDiscountInCustomerCurrency > decimal.Zero)
            {
                phDiscount.Visible = true;
                string discountStr = PriceHelper.FormatPrice(-order.OrderDiscountInCustomerCurrency, true, order.CustomerCurrencyCode, false);
                this.lblDiscount.Text = discountStr;
            }
            else
            {
                phDiscount.Visible = false;
            }

            //tax
            bool displayTax = true;

            if (TaxManager.HideTaxInOrderSummary && order.CustomerTaxDisplayType == TaxDisplayTypeEnum.IncludingTax)
            {
                displayTax = false;
            }
            else
            {
                if (order.OrderTax == 0 && TaxManager.HideZeroTax)
                {
                    displayTax = false;
                }
                else
                {
                    string taxStr = PriceHelper.FormatPrice(order.OrderTaxInCustomerCurrency, true, order.CustomerCurrencyCode, false);
                    this.lblOrderTax.Text = taxStr;
                }
            }
            phTaxTotal.Visible = displayTax;

            //gift cards
            var gcuhC = OrderManager.GetAllGiftCardUsageHistoryEntries(null, null, order.OrderId);

            if (gcuhC.Count > 0)
            {
                rptrGiftCards.Visible    = true;
                rptrGiftCards.DataSource = gcuhC;
                rptrGiftCards.DataBind();
            }
            else
            {
                rptrGiftCards.Visible = false;
            }

            //reward points
            if (order.RedeemedRewardPoints != null)
            {
                phRewardPoints.Visible     = true;
                lRewardPointsTitle.Text    = string.Format(GetLocaleResourceString("Order.Totals.RewardPoints"), -order.RedeemedRewardPoints.Points);
                lblRewardPointsAmount.Text = PriceHelper.FormatPrice(-order.RedeemedRewardPoints.UsedAmountInCustomerCurrency, true, order.CustomerCurrencyCode, false);
            }
            else
            {
                phRewardPoints.Visible = false;
            }

            //total
            string orderTotalStr = PriceHelper.FormatPrice(order.OrderTotalInCustomerCurrency, true, order.CustomerCurrencyCode, false);

            this.lblOrderTotal.Text  = orderTotalStr;
            this.lblOrderTotal2.Text = orderTotalStr;

            //purchased products
            var  orderProductVariants = order.OrderProductVariants;
            bool hasDownloadableItems = false;

            foreach (var orderProductVariant in orderProductVariants)
            {
                var productVariant = orderProductVariant.ProductVariant;
                if (productVariant != null && productVariant.IsDownload)
                {
                    hasDownloadableItems = true;
                    break;
                }
            }
            gvOrderProductVariants.Columns[1].Visible = hasDownloadableItems && !this.IsInvoice;
            gvOrderProductVariants.DataSource         = orderProductVariants;
            gvOrderProductVariants.DataBind();

            //checkout attributes
            lCheckoutAttributes.Text = order.CheckoutAttributeDescription;

            var orderNoteCollection = order.OrderNotes;

            if (orderNoteCollection.Count > 0)
            {
                gvOrderNotes.DataSource = order.OrderNotes;
                gvOrderNotes.DataBind();
            }
            else
            {
                pnlOrderNotesTitle.Visible = false;
                pnlOrderNotes.Visible      = false;
            }
        }