Exemplo n.º 1
0
        private void PopulateFromOrder(Order o)
        {
            // Header
            this.OrderNumberField.Text = o.OrderNumber;
            this.TimeOfOrderField.Text = TimeZoneInfo.ConvertTimeFromUtc(o.TimeOfOrderUtc, MTApp.CurrentStore.Settings.TimeZone).ToString();

            // Fraud Score Display
            if (o.FraudScore < 0) this.lblFraudScore.Text = "No Fraud Score Data";
            if (o.FraudScore >= 0 && o.FraudScore < 3) this.lblFraudScore.Text = o.FraudScore.ToString() + "<span class=\"fraud-low\"><b>low risk</b></span>";
            if (o.FraudScore >= 3 && o.FraudScore <= 5) this.lblFraudScore.Text = "<span class=\"fraud-medium\"><b>medium risk</b></span>";
            if (o.FraudScore > 5) this.lblFraudScore.Text = "<span class=\"fraud-high\"><b>high risk</b></span>";

            // Billing
            this.BillingAddressField.Text = o.BillingAddress.ToHtmlString();

            //Email
            this.EmailAddressField.Text = MerchantTribe.Commerce.Utilities.MailServices.MailToLink(o.UserEmail, "Order " + o.OrderNumber, o.BillingAddress.FirstName + ",");

            // Shipping (hide if the same as billing address)
            this.pnlShipTo.Visible = true;
            this.ShippingAddressField.Text = o.ShippingAddress.ToHtmlString();

            // Payment
            OrderPaymentSummary paySummary = MTApp.OrderServices.PaymentSummary(o);
            this.lblPaymentSummary.Text = paySummary.PaymentsSummary;
            this.PaymentAuthorizedField.Text = string.Format("{0:C}", paySummary.AmountAuthorized);
            this.PaymentChargedField.Text = string.Format("{0:C}", paySummary.AmountCharged);
            this.PaymentDueField.Text = string.Format("{0:C}", paySummary.AmountDue);
            this.PaymentRefundedField.Text = string.Format("{0:C}", paySummary.AmountRefunded);

            //Items
            this.ItemsGridView.DataSource = o.Items;
            this.ItemsGridView.DataBind();

            // Instructions
            if (o.Instructions.Trim().Length > 0)
            {
                this.pnlInstructions.Visible = true;
                this.InstructionsField.Text = o.Instructions.Replace("\r\n", "<br />").Replace("\r", "<br />").Replace("\n", "<br />");
            }

            // Totals
            this.litTotals.Text = o.TotalsAsTable();

            // Coupons
            this.CouponField.Text = string.Empty;
            for (int i = 0; i <= o.Coupons.Count - 1; i++)
            {
                this.CouponField.Text += o.Coupons[i].CouponCode.Trim().ToUpper() + "<br />";
            }

            // Notes
            Collection<OrderNote> publicNotes = new Collection<OrderNote>();
            Collection<OrderNote> privateNotes = new Collection<OrderNote>();
            for (int i = 0; i <= o.Notes.Count - 1; i++)
            {
                if (o.Notes[i].IsPublic)
                {
                    publicNotes.Add(o.Notes[i]);
                }
                else
                {
                    privateNotes.Add(o.Notes[i]);
                }
            }
            this.PublicNotesField.DataSource = publicNotes;
            this.PublicNotesField.DataBind();
            this.PrivateNotesField.DataSource = privateNotes;
            this.PrivateNotesField.DataBind();
        }
Exemplo n.º 2
0
        private void PopulateFromOrder(Order o)
        {
            // Header
            this.OrderNumberField.Text = o.OrderNumber;
            this.TimeOfOrderField.Text = TimeZoneInfo.ConvertTimeFromUtc(o.TimeOfOrderUtc, MTApp.CurrentStore.Settings.TimeZone).ToString();

            // Billing
            this.BillingAddressEditor.LoadFromAddress(o.BillingAddress);

            //Email            
            this.UserPicker1.UserName = o.UserEmail;

            // Shipping (hide if the same as billing address)                        
            this.ShippingAddressEditor.LoadFromAddress(o.ShippingAddress);


            // Payment
            OrderPaymentSummary paySummary = MTApp.OrderServices.PaymentSummary(o);
            this.lblPaymentSummary.Text = paySummary.PaymentsSummary;
            this.PaymentAuthorizedField.Text = string.Format("{0:C}", paySummary.AmountAuthorized);
            this.PaymentChargedField.Text = string.Format("{0:C}", paySummary.AmountCharged);
            this.PaymentDueField.Text = string.Format("{0:C}", paySummary.AmountDue);
            this.PaymentRefundedField.Text = string.Format("{0:C}", paySummary.AmountRefunded);

            //Items
            this.ItemsGridView.DataSource = o.Items;
            this.ItemsGridView.DataBind();

            // Instructions
            this.pnlInstructions.Visible = true;
            this.InstructionsField.Text = o.Instructions.Replace("\r\n", "<br />").Replace("\r", "<br />").Replace("\n", "<br />");

            // Totals
            this.litTotals.Text = o.TotalsAsTable();

            if (o.TotalShippingBeforeDiscountsOverride >= 0)
            {
                this.ShippingOverride.Text = o.TotalShippingBeforeDiscountsOverride.ToString("C");
            }
            else
            {
                this.ShippingOverride.Text = string.Empty;
            }
            // Coupons            
            this.lstCoupons.DataSource = o.Coupons;
            this.lstCoupons.DataBind();

            LoadShippingMethods(o);
        }