Exemplo n.º 1
0
        public async Task <Guid> PostCheckout(List <RVSSalesActorItem> cart)
        {
            ServiceEventSource.Current.Message("Now printing cart for POSTCHECKOUT...");
            foreach (RVSSalesActorItem item in cart)
            {
                ServiceEventSource.Current.Message("Guid {0}, quantity {1}", item.ItemId.ToString(), item.Quantity.ToString());
            }

            Guid orderId = Guid.NewGuid();
            ServiceUriBuilder builder = new ServiceUriBuilder(CustomerOrderServiceName);

            //We create a unique Guid that is associated with a customer order, as well as with the actor that represents that order's state.
            IRVSSalesActor customerOrder = ActorProxy.Create <IRVSSalesActor>(new ActorId(orderId), builder.ToUri());

            try
            {
                await customerOrder.SubmitOrderAsync(cart);

                ServiceEventSource.Current.Message("Customer order submitted successfully. ActorOrderID: {0} created", orderId);
            }
            catch (InvalidOperationException ex)
            {
                ServiceEventSource.Current.Message("Web Service: Actor rejected {0}: {1}", customerOrder, ex);
                throw;
            }
            catch (Exception ex)
            {
                ServiceEventSource.Current.Message("Web Service: Exception {0}: {1}", customerOrder, ex);
                throw;
            }

            return(orderId);
        }
Exemplo n.º 2
0
        public Task <string> GetOrderStatus(Guid customerOrderId)
        {
            ServiceUriBuilder builder       = new ServiceUriBuilder(CustomerOrderServiceName);
            IRVSSalesActor    customerOrder = ActorProxy.Create <IRVSSalesActor>(new ActorId(customerOrderId), builder.ToUri());

            try
            {
                return(customerOrder.GetOrderStatusAsStringAsync());
            }
            catch (Exception ex)
            {
                ServiceEventSource.Current.Message("Web Service: Exception {0}: {1}", customerOrder, ex);

                throw;
            }
        }