Esempio n. 1
0
        public void SubmitOrderAndClearCart(UserCache pUserCache)
        {
            Order lOrder = new Order();
            lOrder.OrderDate = DateTime.Now;
            lOrder.Customer = pUserCache.Model;
            // NEWLY ADDED 
            lOrder.UserId = pUserCache.Model.Id;

            lOrder.Status = 0;

            foreach(OrderItem lItem in mOrderItems)
            {
                // NEWLY ADDED
                lItem.order_Id = lOrder.ExternalOrderId;
                lItem.MediaId = lItem.Media.Id;
                lItem.Media.Stocks.setMediaId(lItem.Media.Id);

                lOrder.OrderItems.Add(lItem);
            }

            OrderService.OrderServiceClient lOrderService = new OrderService.OrderServiceClient();

            lOrderService.SubmitOrder(lOrder);
            pUserCache.UpdateUserCache();
            Clear();
        }
Esempio n. 2
0
File: Cart.cs Progetto: agaw/aurora
        public void SubmitOrderAndClearCart(UserCache pUserCache)
        {
            Order lOrder = new Order();
            lOrder.OrderDate = DateTime.Now;
            lOrder.Customer = pUserCache.Model;
            foreach(OrderItem lItem in mOrderItems)
            {
                lOrder.OrderItems.Add(lItem);
            }
            lOrder.Total = Convert.ToDouble(ComputeTotalValue());

            OrderService.OrderServiceClient lOrderService = new OrderService.OrderServiceClient();

            lOrderService.SubmitOrder(lOrder);
            pUserCache.UpdateUserCache();
            Clear();
        }
Esempio n. 3
0
        public void SubmitOrderAndClearCart(UserCache pUserCache)
        {
            Order lOrder = new Order();
            lOrder.OrderDate = DateTime.Now;
            lOrder.Customer = pUserCache.Model;
            lOrder.Status = 0;
            foreach(OrderItem lItem in mOrderItems)
            {
                lOrder.OrderItems.Add(lItem);
            }

            OrderService.OrderServiceClient lOrderService = new OrderService.OrderServiceClient();

            lOrderService.SubmitOrder(lOrder);
            pUserCache.UpdateUserCache();
            Clear();
        }
Esempio n. 4
0
 public SubmitOrderCommand(Order pOrder)
 {
     Order = pOrder;
 }
Esempio n. 5
0
 public Command GetSubmitOrderCommand(Order pOrder)
 {
     return new SubmitOrderCommand(pOrder);
 }
Esempio n. 6
0
        internal void FixupVideoStoreEntityModel_OrderOrderItem_OrderKeys(Order value, bool forceRemove)
        {
            const string IdKeyName = "Navigate(VideoStoreEntityModel.OrderOrderItem.Order).Id";

            if (ChangeTracker.ChangeTrackingEnabled &&
                ChangeTracker.ExtendedProperties.ContainsKey(IdKeyName))
            {
                if (forceRemove ||
                    !Equals(ChangeTracker.ExtendedProperties[IdKeyName], value == null ? null : (object)value.Id))
                {
                    ChangeTracker.RecordOriginalValue(IdKeyName, ChangeTracker.ExtendedProperties[IdKeyName]);
                    if (value == null)
                    {
                        ChangeTracker.ExtendedProperties.Remove(IdKeyName);
                    }
                    else
                    {
                        ChangeTracker.ExtendedProperties[IdKeyName] = value.Id;
                    }
                }
            }
        }
Esempio n. 7
0
        private void PlaceDeliveryForOrder(Order pOrder)
        {
            Delivery lDelivery = new Delivery() { DeliveryStatus = DeliveryStatus.Submitted, SourceAddress = "Video Store Address", DestinationAddress = pOrder.Customer.Address, Order = pOrder };
            DeliveryServiceClient lClient = new DeliveryServiceClient();
            /**
            Guid lDeliveryIdentifier = lClient.SubmitDelivery(new DeliveryInfo()
            {
                OrderNumber = lDelivery.Order.OrderNumber.ToString(),
                SourceAddress = lDelivery.SourceAddress,
                DestinationAddress = lDelivery.DestinationAddress,
                DeliveryNotificationAddress = "net.tcp://localhost:9010/DeliveryNotificationService"
            });
            **/
            Guid lDeliveryIdentifier = Guid.NewGuid();
            lClient.SubmitDelivery(new DeliveryInfo()
            {
                DeliveryIdentifier = lDeliveryIdentifier,
                OrderNumber = lDelivery.Order.OrderNumber.ToString(),
                SourceAddress = lDelivery.SourceAddress,
                DestinationAddress = lDelivery.DestinationAddress,
                DeliveryNotificationAddress = "net.tcp://localhost:9010/DeliveryNotificationService/mex"
            });

            lDelivery.ExternalDeliveryIdentifier = lDeliveryIdentifier;
            pOrder.Delivery = lDelivery;
        }
Esempio n. 8
0
 private void SendOrderPlacedConfirmation(Order pOrder)
 {
     EmailProvider.SendMessage(new EmailMessage()
     {
         ToAddress = pOrder.Customer.Email,
         Message = "Your order " + pOrder.OrderNumber + " has been placed"
     });
 }
Esempio n. 9
0
 private void SendOrderErrorMessage(Order pOrder, Exception pException)
 {
     EmailProvider.SendMessage(new EmailMessage()
     {
         ToAddress = pOrder.Customer.Email,
         Message = "There was an error in processsing your order " + pOrder.OrderNumber + ": "+ pException.Message +". Please contact Video Store"
     });
 }
Esempio n. 10
0
 private void SendOrderDeclinedEmail(Order pOrder)
 {
     EmailProvider.SendMessage(new EmailMessage()
     {
         ToAddress = pOrder.Customer.Email,
         Message = "There was an error in processsing your order " + pOrder.OrderNumber + ": The bank transfer was declined."
     });
 }
Esempio n. 11
0
        private void FixupOrder(Order previousValue)
        {
            if (IsDeserializing)
            {
                return;
            }

            if (previousValue != null && ReferenceEquals(previousValue.Delivery, this))
            {
                previousValue.Delivery = null;
            }

            if (Order != null)
            {
                Order.Delivery = this;
            }

            if (ChangeTracker.ChangeTrackingEnabled)
            {
                if (ChangeTracker.OriginalValues.ContainsKey("Order")
                    && (ChangeTracker.OriginalValues["Order"] == Order))
                {
                    ChangeTracker.OriginalValues.Remove("Order");
                }
                else
                {
                    ChangeTracker.RecordOriginalValue("Order", previousValue);
                }
                if (Order != null && !Order.ChangeTracker.ChangeTrackingEnabled)
                {
                    Order.StartTracking();
                }
                FixupOrderKeys();
            }
        }