Exemplo n.º 1
0
        public ActionResult Detail(int id)
        {
            var paymentWorker = new PaymentWorker();

            var model = m_catalogWorker.GetSiteProductDetail(id);

            model.PaymentTypes = paymentWorker.GetSitePaymentTypes();
            return(View(model));
        }
Exemplo n.º 2
0
        public ActionResult Checkout(FormCollection frm)
        {
            var shipmentWorker = new ShipmentWorker();
            var paymentWorker  = new PaymentWorker();
            var customerWorker = new CustomerWorker();
            var orderLayer     = new OrderLayer();

            if (frm["AddressId"] != null)
            {
                orderLayer.Order.ShipAddressId = int.Parse(frm["AddressId"]);
                if (frm["InvoiceSendPartial"] == "yes")
                {
                    orderLayer.Order.InvoiceAddressId = int.Parse(frm["InvoiceAddressId"]);
                }
                else
                {
                    orderLayer.Order.InvoiceAddressId = int.Parse(frm["AddressId"]);
                }
            }

            orderLayer.Order.ShipmentTypeId = int.Parse(frm["ShipmentType"]);
            orderLayer.Order.Note           = frm["Note"];

            if (orderLayer.Order.ShipCost == 0)
            {
                decimal shipCost = ShippingHelper.ShippingPrice(shipmentWorker.GetSiteShipmentType(orderLayer.Order.ShipmentTypeId));
                orderLayer.Order.TaxTotal   += shipCost * 18 / 118;
                orderLayer.Order.ShipCost    = shipCost * 100 / 118;
                orderLayer.Order.GrandTotal += shipCost;
            }

            orderLayer.Sync();
            orderLayer.Order.Payments = paymentWorker.GetSitePaymentTypes();

            ViewBag.ShipmentType = shipmentWorker.GetSiteShipmentType(orderLayer.Order.ShipmentTypeId);
            if (orderLayer.Order.ShipAddressId.HasValue)
            {
                ViewBag.ShipmentAddress = customerWorker.GetSiteCustomerAddress(orderLayer.Order.ShipAddressId.Value);
            }

            if (frm["InvoiceSendPartial"] == "yes")
            {
                ViewBag.InvoiceAddress = customerWorker.GetSiteCustomerAddress(orderLayer.Order.InvoiceAddressId.Value);
            }

            return(View(orderLayer.Order));
        }