Example #1
0
        public ActionResult Index()
        {
            BasketViewModel model = MapOrder();

            model.BillingAddress  = MapOrderAddress(TransactionLibrary.GetBillingInformation());
            model.ShippingAddress = MapOrderAddress(TransactionLibrary.GetShippingInformation());

            return(View(model));
        }
Example #2
0
        public ActionResult Index()
        {
            PurchaseOrderViewModel model = MapOrder();

            model.BillingAddress  = MapOrderAddress(TransactionLibrary.GetBillingInformation());
            model.ShippingAddress = MapOrderAddress(TransactionLibrary.GetShippingInformation());

            return(View("/Views/mc/preview.cshtml", model));
        }
        public override ActionResult Index(RenderModel model)
        {
            var addressDetails = new AddressDetailsViewModel();

            var shippingInformation = TransactionLibrary.GetShippingInformation();
            var billingInformation  = TransactionLibrary.GetBillingInformation();

            addressDetails.BillingAddress.FirstName         = billingInformation.FirstName;
            addressDetails.BillingAddress.LastName          = billingInformation.LastName;
            addressDetails.BillingAddress.EmailAddress      = billingInformation.EmailAddress;
            addressDetails.BillingAddress.PhoneNumber       = billingInformation.PhoneNumber;
            addressDetails.BillingAddress.MobilePhoneNumber = billingInformation.MobilePhoneNumber;
            addressDetails.BillingAddress.Line1             = billingInformation.Line1;
            addressDetails.BillingAddress.Line2             = billingInformation.Line2;
            addressDetails.BillingAddress.PostalCode        = billingInformation.PostalCode;
            addressDetails.BillingAddress.City        = billingInformation.City;
            addressDetails.BillingAddress.State       = billingInformation.State;
            addressDetails.BillingAddress.Attention   = billingInformation.Attention;
            addressDetails.BillingAddress.CompanyName = billingInformation.CompanyName;
            addressDetails.BillingAddress.CountryId   = billingInformation.Country != null ? billingInformation.Country.CountryId : -1;

            addressDetails.ShippingAddress.FirstName         = shippingInformation.FirstName;
            addressDetails.ShippingAddress.LastName          = shippingInformation.LastName;
            addressDetails.ShippingAddress.EmailAddress      = shippingInformation.EmailAddress;
            addressDetails.ShippingAddress.PhoneNumber       = shippingInformation.PhoneNumber;
            addressDetails.ShippingAddress.MobilePhoneNumber = shippingInformation.MobilePhoneNumber;
            addressDetails.ShippingAddress.Line1             = shippingInformation.Line1;
            addressDetails.ShippingAddress.Line2             = shippingInformation.Line2;
            addressDetails.ShippingAddress.PostalCode        = shippingInformation.PostalCode;
            addressDetails.ShippingAddress.City        = shippingInformation.City;
            addressDetails.ShippingAddress.State       = shippingInformation.State;
            addressDetails.ShippingAddress.Attention   = shippingInformation.Attention;
            addressDetails.ShippingAddress.CompanyName = shippingInformation.CompanyName;
            addressDetails.ShippingAddress.CountryId   = shippingInformation.Country != null ? shippingInformation.Country.CountryId : -1;

            addressDetails.AvailableCountries = Country.All().ToList().Select(x => new SelectListItem()
            {
                Text = x.Name, Value = x.CountryId.ToString()
            }).ToList();

            return(base.View("/Views/BillingShippingAddress.cshtml", addressDetails));
        }
Example #4
0
        private void PopulateBillingAddress()
        {
            var billingAddress = TransactionLibrary.GetBillingInformation();

            litBillingName.Text       = billingAddress.FirstName + " " + billingAddress.LastName;
            litBillingStreet.Text     = billingAddress.Line1;
            litBillingPostalCode.Text = billingAddress.PostalCode;
            litBillingCity.Text       = billingAddress.City;
            litBillingCountry.Text    = billingAddress.Country.Name;

            if (!string.IsNullOrEmpty(billingAddress.Attention))
            {
                litBillingAttention.Text = $"att. {billingAddress.Attention}";
            }

            litBillingPhone.Text       = billingAddress.PhoneNumber;
            litBillingMobilePhone.Text = billingAddress.MobilePhoneNumber;
            lnkBillingMail.NavigateUrl = "mailto:" + billingAddress.EmailAddress;
            lnkBillingMail.Text        = billingAddress.EmailAddress;
        }
        private PurchaseOrderViewModel MapOrder()
        {
            PurchaseOrder basket = TransactionLibrary.GetBasket(false).PurchaseOrder;

            var basketModel = new PurchaseOrderViewModel();

            basketModel.BillingAddress  = TransactionLibrary.GetBillingInformation();
            basketModel.ShipmentAddress = TransactionLibrary.GetShippingInformation();

            foreach (var orderLine in basket.OrderLines)
            {
                var orderLineModel = new OrderlineViewModel();
                orderLineModel.ProductName = orderLine.ProductName;
                orderLineModel.Sku         = orderLine.Sku;
                orderLineModel.VariantSku  = orderLine.VariantSku;
                orderLineModel.Total       =
                    new Money(orderLine.Total.GetValueOrDefault(), orderLine.PurchaseOrder.BillingCurrency).ToString();
                orderLineModel.Tax =
                    new Money(orderLine.VAT, basket.BillingCurrency).ToString();
                orderLineModel.Price =
                    new Money(orderLine.Price, basket.BillingCurrency).ToString();
                orderLineModel.PriceWithDiscount =
                    new Money(orderLine.Price - orderLine.Discount, basket.BillingCurrency).ToString();
                orderLineModel.Quantity = orderLine.Quantity;
                orderLineModel.Discount = orderLine.Discount;

                basketModel.OrderLines.Add(orderLineModel);
            }

            basketModel.DiscountTotal  = new Money(basket.DiscountTotal.GetValueOrDefault(), basket.BillingCurrency).ToString();
            basketModel.DiscountAmount = basket.DiscountTotal.GetValueOrDefault();
            basketModel.SubTotal       = new Money(basket.SubTotal.GetValueOrDefault(), basket.BillingCurrency).ToString();
            basketModel.OrderTotal     = new Money(basket.OrderTotal.GetValueOrDefault(), basket.BillingCurrency).ToString();
            basketModel.TaxTotal       = new Money(basket.TaxTotal.GetValueOrDefault(), basket.BillingCurrency).ToString();
            basketModel.ShippingTotal  = new Money(basket.ShippingTotal.GetValueOrDefault(), basket.BillingCurrency).ToString();
            basketModel.PaymentTotal   = new Money(basket.PaymentTotal.GetValueOrDefault(), basket.BillingCurrency).ToString();


            var shipment = basket.Shipments.FirstOrDefault();

            if (shipment != null)
            {
                basketModel.ShipmentName   = shipment.ShipmentName;
                basketModel.ShipmentAmount = basket.ShippingTotal.GetValueOrDefault();
            }

            var payment = basket.Payments.FirstOrDefault();

            if (payment != null)
            {
                basketModel.PaymentName   = payment.PaymentMethodName;
                basketModel.PaymentAmount = basket.PaymentTotal.GetValueOrDefault();
            }

            ViewBag.RowSpan = 4;
            if (basket.DiscountTotal > 0)
            {
                ViewBag.RowSpan++;
            }
            if (basket.ShippingTotal > 0)
            {
                ViewBag.RowSpan++;
            }
            if (basket.PaymentTotal > 0)
            {
                ViewBag.RowSpan++;
            }

            return(basketModel);
        }