protected string GetRemainingAmountInfo(GiftCard gc)
        {
            decimal remainingAmount = GiftCardHelper.GetGiftCardRemainingAmount(gc);
            string  result          = PriceHelper.FormatPrice(remainingAmount, true, false);

            return(result);
        }
Ejemplo n.º 2
0
        private void BindData()
        {
            GiftCard gc = OrderManager.GetGiftCardById(this.GiftCardId);

            if (gc != null)
            {
                this.lblOrder.Text    = string.Format("<a href=\"OrderDetails.aspx?OrderID={0}\">{1}</a>", gc.PurchasedOrderProductVariant.OrderId, GetLocaleResourceString("Admin.GiftCardInfo.Order.View"));
                this.lblCustomer.Text = string.Format("<a href=\"CustomerDetails.aspx?CustomerID={0}\">{1}</a>", gc.PurchasedOrderProductVariant.Order.CustomerId, GetLocaleResourceString("Admin.GiftCardInfo.Customer.View"));

                this.txtInitialValue.Value = GiftCardHelper.GetGiftCardInitialValue(gc);
                decimal remainingAmount = GiftCardHelper.GetGiftCardRemainingAmount(gc);
                this.lblRemainingAmount.Text       = PriceHelper.FormatPrice(remainingAmount, true, false);
                this.cbIsGiftCardActivated.Checked = gc.IsGiftCardActivated;
                this.txtCouponCode.Text            = gc.GiftCardCouponCode;
                this.txtRecipientName.Text         = gc.RecipientName;
                this.txtRecipientEmail.Text        = gc.RecipientEmail;
                this.txtSenderName.Text            = gc.SenderName;
                this.txtSenderEmail.Text           = gc.SenderEmail;
                this.txtMessage.Text = gc.Message;
                if (gc.IsRecipientNotified)
                {
                    lblIsRecipientNotified.Text = GetLocaleResourceString("Admin.Common.Yes");
                }
                else
                {
                    lblIsRecipientNotified.Text = GetLocaleResourceString("Admin.Common.No");
                }
                this.lblPurchasedOn.Text = DateTimeHelper.ConvertToUserTime(gc.CreatedOn).ToString();
            }
            else
            {
                Response.Redirect("PurchasedGiftCards.aspx");
            }
        }
Ejemplo n.º 3
0
        protected void rptrGiftCards_ItemDataBound(object sender, RepeaterItemEventArgs e)
        {
            if (e.Item.ItemType == ListItemType.AlternatingItem || e.Item.ItemType == ListItemType.Item)
            {
                var appliedGiftCard = e.Item.DataItem as AppliedGiftCard;

                var lGiftCard = e.Item.FindControl("lGiftCard") as Literal;
                lGiftCard.Text = String.Format(GetLocaleResourceString("ShoppingCart.Totals.GiftCardInfo"), Server.HtmlEncode(appliedGiftCard.GiftCard.GiftCardCouponCode));

                var     lblGiftCardAmount = e.Item.FindControl("lblGiftCardAmount") as Label;
                decimal amountCanBeUsed   = CurrencyManager.ConvertCurrency(appliedGiftCard.AmountCanBeUsed, CurrencyManager.PrimaryStoreCurrency, NopContext.Current.WorkingCurrency);
                lblGiftCardAmount.Text = PriceHelper.FormatPrice(-amountCanBeUsed, true, false);

                var     lGiftCardRemaining  = e.Item.FindControl("lGiftCardRemaining") as Literal;
                decimal remainingAmountBase = GiftCardHelper.GetGiftCardRemainingAmount(appliedGiftCard.GiftCard) - appliedGiftCard.AmountCanBeUsed;
                decimal remainingAmount     = CurrencyManager.ConvertCurrency(remainingAmountBase, CurrencyManager.PrimaryStoreCurrency, NopContext.Current.WorkingCurrency);
                lGiftCardRemaining.Text = string.Format(GetLocaleResourceString("ShoppingCart.Totals.GiftCardInfo.Remaining"), PriceHelper.FormatPrice(remainingAmount, true, false));

                var btnRemoveGC = e.Item.FindControl("btnRemoveGC") as LinkButton;
                btnRemoveGC.Visible = this.IsShoppingCart;
            }
        }